From: Timo Kreuzer Date: Tue, 13 Feb 2018 19:36:08 +0000 (+0100) Subject: [CMAKE] Zap builddir.h.cmake and instead define macros globally X-Git-Tag: 0.4.11-dev~342 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=79ad68ddc3a47f55e348af5b9d47242b5ca72877;hp=73aa420f0e98aa52adfffbb4e7f923541858ecd0 [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. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 489bdbb209b..3b6235d9cb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/sdk/include/reactos/builddir.h.cmake b/sdk/include/reactos/builddir.h.cmake deleted file mode 100644 index 1e94f39f240..00000000000 --- a/sdk/include/reactos/builddir.h.cmake +++ /dev/null @@ -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 */ diff --git a/sdk/include/reactos/debug.h b/sdk/include/reactos/debug.h index adecac6f467..ab332fda181 100644 --- a/sdk/include/reactos/debug.h +++ b/sdk/include/reactos/debug.h @@ -14,7 +14,9 @@ #pragma once -#include +#ifndef __RELFILE__ +#define __RELFILE__ __FILE__ +#endif /* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */ #if !defined(_RTLFUNCS_H) && !defined(_NTDDK_) diff --git a/sdk/include/reactos/version.cmake b/sdk/include/reactos/version.cmake index e0eae0a0641..5bc25238186 100644 --- a/sdk/include/reactos/version.cmake +++ b/sdk/include/reactos/version.cmake @@ -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) diff --git a/sdk/include/reactos/wine/debug.h b/sdk/include/reactos/wine/debug.h index 62f7da5f2c9..cd366ab3756 100644 --- a/sdk/include/reactos/wine/debug.h +++ b/sdk/include/reactos/wine/debug.h @@ -27,7 +27,9 @@ #include #endif -#include +#ifndef __RELFILE__ +#define __RELFILE__ __FILE__ +#endif #ifdef __WINE_WINE_TEST_H #error This file should not be used in Wine tests diff --git a/win32ss/user/ntuser/win32kdebug.h b/win32ss/user/ntuser/win32kdebug.h index dd58b75b853..1211994a00d 100644 --- a/win32ss/user/ntuser/win32kdebug.h +++ b/win32ss/user/ntuser/win32kdebug.h @@ -29,8 +29,6 @@ #if DBG - #include - #if !defined(__RELFILE__) #define __RELFILE__ __FILE__ #endif