[CMAKE] Zap builddir.h.cmake and instead define macros globally
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 13 Feb 2018 19:36:08 +0000 (20:36 +0100)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 30 Jun 2018 11:26:56 +0000 (13:26 +0200)
This changes __RELFILE__ to always be relative and not rely on a GCC extension, since __FILE__ is *always* relative to the root.

CMakeLists.txt
sdk/include/reactos/builddir.h.cmake [deleted file]
sdk/include/reactos/debug.h
sdk/include/reactos/version.cmake
sdk/include/reactos/wine/debug.h
win32ss/user/ntuser/win32kdebug.h

index 489bdbb..3b6235d 100644 (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")
diff --git a/sdk/include/reactos/builddir.h.cmake b/sdk/include/reactos/builddir.h.cmake
deleted file mode 100644 (file)
index 1e94f39..0000000
+++ /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 */
index adecac6..ab332fd 100644 (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_)
index e0eae0a..5bc2523 100644 (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)
index 62f7da5..cd366ab 100644 (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
index dd58b75..1211994 100644 (file)
@@ -29,8 +29,6 @@
 
 #if DBG
 
-    #include <builddir.h>
-
     #if !defined(__RELFILE__)
         #define __RELFILE__ __FILE__
     #endif