[CMAKE] Zap builddir.h.cmake and instead define macros globally

This changes __RELFILE__ to always be relative and not rely on a GCC extension, since __FILE__ is *always* relative to the root.
This commit is contained in:
Timo Kreuzer 2018-02-13 20:36:08 +01:00
parent 73aa420f0e
commit 79ad68ddc3
6 changed files with 9 additions and 21 deletions

View file

@ -56,6 +56,9 @@ endif()
include(sdk/cmake/compilerflags.cmake)
add_definitions(-D__REACTOS__)
add_definitions(-DREACTOS_SOURCE_DIR="\\"${REACTOS_SOURCE_DIR}\\"")
add_definitions(-DREACTOS_BINARY_DIR="\\"${REACTOS_BINARY_DIR}\\"")
add_compile_flags(-D__RELFILE__="&__FILE__[sizeof REACTOS_SOURCE_DIR]")
if(MSVC_IDE)
add_compile_flags("/MP")

View file

@ -1,16 +0,0 @@
/* Do not edit - Machine generated */
#pragma once
#define REACTOS_SOURCE_DIR "@REACTOS_SOURCE_DIR@"
#define REACTOS_BINARY_DIR "@REACTOS_BINARY_DIR@"
#if defined(__GNUC__)
#define __RELFILE__ \
(!__builtin_strncmp(__FILE__, REACTOS_SOURCE_DIR, sizeof(REACTOS_SOURCE_DIR) - 1) \
? __FILE__ + sizeof(REACTOS_SOURCE_DIR) : __FILE__)
#else
#define __RELFILE__ __FILE__
#endif
/* EOF */

View file

@ -14,7 +14,9 @@
#pragma once
#include <builddir.h>
#ifndef __RELFILE__
#define __RELFILE__ __FILE__
#endif
/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)

View file

@ -53,4 +53,3 @@ endif()
configure_file(sdk/include/reactos/version.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/version.h)
configure_file(sdk/include/reactos/buildno.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/buildno.h)
configure_file(sdk/include/reactos/builddir.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/builddir.h)

View file

@ -27,7 +27,9 @@
#include <guiddef.h>
#endif
#include <builddir.h>
#ifndef __RELFILE__
#define __RELFILE__ __FILE__
#endif
#ifdef __WINE_WINE_TEST_H
#error This file should not be used in Wine tests

View file

@ -29,8 +29,6 @@
#if DBG
#include <builddir.h>
#if !defined(__RELFILE__)
#define __RELFILE__ __FILE__
#endif