[Linux] Switch to Ninja build system. Use compiler feature detection to accomodate the new PCH module.

This commit is contained in:
Router Gray
2019-10-19 22:12:19 -05:00
parent 76e9d912d6
commit 2ba3ff852c
3 changed files with 21 additions and 17 deletions

View File

@@ -2925,10 +2925,10 @@
<key>build</key>
<map>
<key>command</key>
<string>make</string>
<string>ninja</string>
<key>options</key>
<array>
<string>-j 7</string>
<string>-v</string>
</array>
</map>
<key>configure</key>
@@ -2936,7 +2936,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>Unix Makefiles</string>
<string>Ninja</string>
</array>
</map>
<key>default</key>
@@ -2949,10 +2949,10 @@
<key>build</key>
<map>
<key>command</key>
<string>make</string>
<string>ninja</string>
<key>options</key>
<array>
<string>-j 7</string>
<string>-v</string>
</array>
</map>
<key>configure</key>
@@ -2960,7 +2960,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>Unix Makefiles</string>
<string>Ninja</string>
</array>
</map>
<key>name</key>
@@ -2981,10 +2981,10 @@
<key>build</key>
<map>
<key>command</key>
<string>make</string>
<string>ninja</string>
<key>options</key>
<array>
<string>-j 7</string>
<string>-v</string>
</array>
</map>
<key>configure</key>
@@ -2992,7 +2992,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>Unix Makefiles</string>
<string>Ninja</string>
<string>-DWORD_SIZE:STRING=64</string>
</array>
</map>
@@ -3006,10 +3006,10 @@
<key>build</key>
<map>
<key>command</key>
<string>make</string>
<string>ninja</string>
<key>options</key>
<array>
<string>-j 7</string>
<string>--v</string>
</array>
</map>
<key>configure</key>
@@ -3017,7 +3017,7 @@
<key>options</key>
<array>
<string>-G</string>
<string>Unix Makefiles</string>
<string>Ninja</string>
<string>-DWORD_SIZE:STRING=64</string>
</array>
</map>

View File

@@ -5,6 +5,7 @@
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
include(CheckCCompilerFlag)
include(Variables)
# Portable compilation flags.
@@ -199,10 +200,13 @@ if (LINUX)
# End of hacks.
if (NOT STANDALONE)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
endif (NOT STANDALONE)
CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STRONG_STACK_PROTECTOR)
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
if(HAS_STRONG_STACK_PROTECTOR)
add_compile_options(-fstack-protector-strong)
endif(HAS_STRONG_STACK_PROTECTOR)
endif (${CMAKE_BUILD_TYPE} STREQUAL "Release")
if (${ARCH} STREQUAL "x86_64")
add_definitions(-pipe)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math")

View File

@@ -94,7 +94,7 @@ macro(target_precompiled_header TARGET_NAME PRECOMPILED_HEADER PRECOMPILED_SOURC
# Add a custom target for building the precompiled header.
add_custom_command(
OUTPUT ${OUTPUT_NAME}
COMMAND ${CMAKE_CXX_COMPILER} @${PCH_FLAGS_FILE} ${COMPILER_FLAGS} -x c++-header -std=${CXX_STD} -o ${OUTPUT_NAME} ${PRECOMPILED_HEADER}
COMMAND ${CMAKE_CXX_COMPILER} @${PCH_FLAGS_FILE} ${COMPILER_FLAGS} -x c++-header -o ${OUTPUT_NAME} ${PRECOMPILED_HEADER}
DEPENDS ${PRECOMPILED_HEADER})
add_custom_target(${TARGET_NAME}_gch DEPENDS ${OUTPUT_NAME})
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_gch)