From c3edfdd946de0db3054add7d323bb4c44dde2aa5 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 22 Aug 2019 10:44:30 +0300 Subject: [PATCH] - temporary solution to fix build of non-MSVC targets Precompilation of prefix header for GCC and Clang requires some efforts thanks to CMake which doesn't support this feature out of the box Existing thirparty solutions must be tuned to our needs, and our configuration should be adjusted to a chosen module --- src/CMakeLists.txt | 7 ++++++- src/g_pch.h | 2 ++ src/maploader/glnodes.cpp | 2 +- src/utility/files.h | 1 + src/utility/palette.cpp | 5 ----- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 84d65ea23b..b8531384bb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1328,7 +1328,12 @@ else() set( NOT_COMPILED_SOURCE_FILES ${NOT_COMPILED_SOURCE_FILES} ${VM_JIT_SOURCES} ) endif() -enable_precompiled_headers( g_pch.h PCH_SOURCES ) +if( MSVC ) + enable_precompiled_headers( g_pch.h PCH_SOURCES ) +else() + # Temporary solution for compilers other than MSVC + set_source_files_properties( ${PCH_SOURCES} PROPERTIES COMPILE_FLAGS "-include g_pch.h" ) +endif() add_executable( zdoom WIN32 MACOSX_BUNDLE ${HEADER_FILES} diff --git a/src/g_pch.h b/src/g_pch.h index bf2833cf81..bad3eda563 100644 --- a/src/g_pch.h +++ b/src/g_pch.h @@ -16,8 +16,10 @@ #include #include #include +#ifdef _MSC_VER #include #include +#endif // _MSC_VER #include #include #include diff --git a/src/maploader/glnodes.cpp b/src/maploader/glnodes.cpp index 185de68cf8..7d606696d4 100644 --- a/src/maploader/glnodes.cpp +++ b/src/maploader/glnodes.cpp @@ -1153,7 +1153,7 @@ UNSAFE_CCMD(clearnodecache) if (!ScanDirectory(list, path)) { - Printf("Unable to scan node cache directory %s\n", path); + Printf("Unable to scan node cache directory %s\n", path.GetChars()); return; } diff --git a/src/utility/files.h b/src/utility/files.h index f3d768e37c..854af172b4 100644 --- a/src/utility/files.h +++ b/src/utility/files.h @@ -36,6 +36,7 @@ #ifndef FILES_H #define FILES_H +#include #include #include #include diff --git a/src/utility/palette.cpp b/src/utility/palette.cpp index 84debab9fe..e79e68a545 100644 --- a/src/utility/palette.cpp +++ b/src/utility/palette.cpp @@ -35,11 +35,6 @@ #include "palette.h" #include "palentry.h" -#include -#include -#include -#include - /****************************/ /* Palette management stuff */ /****************************/