https://git.reactos.org/?p=reactos.git;a=commitdiff;h=79ad68ddc3a47f55e348af5b9d47242b5ca72877

commit 79ad68ddc3a47f55e348af5b9d47242b5ca72877
Author:     Timo Kreuzer <timo.kreu...@reactos.org>
AuthorDate: Tue Feb 13 20:36:08 2018 +0100
Commit:     Timo Kreuzer <timo.kreu...@reactos.org>
CommitDate: Sat Jun 30 13:26:56 2018 +0200

    [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.
---
 CMakeLists.txt                       |  3 +++
 sdk/include/reactos/builddir.h.cmake | 16 ----------------
 sdk/include/reactos/debug.h          |  4 +++-
 sdk/include/reactos/version.cmake    |  1 -
 sdk/include/reactos/wine/debug.h     |  4 +++-
 win32ss/user/ntuser/win32kdebug.h    |  2 --
 6 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 489bdbb209..3b6235d9cb 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 1e94f39f24..0000000000
--- 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 adecac6f46..ab332fda18 100644
--- a/sdk/include/reactos/debug.h
+++ b/sdk/include/reactos/debug.h
@@ -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_)
diff --git a/sdk/include/reactos/version.cmake 
b/sdk/include/reactos/version.cmake
index e0eae0a064..5bc2523818 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 62f7da5f2c..cd366ab375 100644
--- a/sdk/include/reactos/wine/debug.h
+++ b/sdk/include/reactos/wine/debug.h
@@ -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
diff --git a/win32ss/user/ntuser/win32kdebug.h 
b/win32ss/user/ntuser/win32kdebug.h
index dd58b75b85..1211994a00 100644
--- a/win32ss/user/ntuser/win32kdebug.h
+++ b/win32ss/user/ntuser/win32kdebug.h
@@ -29,8 +29,6 @@
 
 #if DBG
 
-    #include <builddir.h>
-
     #if !defined(__RELFILE__)
         #define __RELFILE__ __FILE__
     #endif

Reply via email to