TMP / added SIM_ID

This commit is contained in:
OLEGSHA 2022-11-20 14:17:08 +03:00
parent c518a69b75
commit 689b66b2be

View File

@ -51,33 +51,43 @@ target_include_directories(progressia PRIVATE ${generated}/embedded_resources)
# Compilation settings # Compilation settings
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR # Determine command line style
CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (DEFINED compiler_cl_dialect)
set(gcc_like_compiler TRUE) # Do nothing
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(compiler_cl_dialect "GCC")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(compiler_cl_dialect "MSVC")
elseif (CMAKE_CXX_SIMULATE_ID STREQUAL "GCC")
set(compiler_cl_dialect "GCC")
elseif (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
set(compiler_cl_dialect "MSVC")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# On Linux, clang does not have SIMULATE_ID
set(compiler_cl_dialect "GCC")
elseif(WIN32)
message(WARNING "Could not determine compiler command line dialect, guessing MSVC")
set(compiler_cl_dialect "MSVC")
else() else()
set(gcc_like_compiler FALSE) message(WARNING "Could not determine compiler command line dialect, guessing GCC")
set(compiler_cl_dialect "GCC")
endif() endif()
set_property(TARGET progressia PROPERTY CXX_STANDARD 17) set_property(TARGET progressia PROPERTY CXX_STANDARD 17)
set_property(TARGET progressia PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET progressia PROPERTY CXX_STANDARD_REQUIRED ON)
# Do Windows-specific tweaks for release builds # Do Windows-specific tweaks for release builds
if (WIN32 AND DEFINED BUILD_ID) if (WIN32 AND NOT BUILD_ID STREQUAL "dev")
set_target_properties(progressia PROPERTIES WIN32_EXECUTABLE true) set_target_properties(progressia PROPERTIES WIN32_EXECUTABLE true)
if (gcc_like_compiler) if (compiler_cl_dialect STREQUAL "GCC")
target_link_options(progressia PRIVATE -static-libstdc++ -static-libgcc) target_link_options(progressia PRIVATE -static-libstdc++ -static-libgcc)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif (compiler_cl_dialect STREQUAL "MSVC")
target_link_options(progressia PRIVATE /entry:mainCRTStartup) target_link_options(progressia PRIVATE /entry:mainCRTStartup)
message(WARNING "Release builds with MSVC are not supported") message(WARNING "Release builds with MSVC are not supported")
endif() endif()
endif() endif()
# Extra options for gcc -- we're using this for extra static analisys for now
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(progressia PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
# Pass configuration options # Pass configuration options
file(MAKE_DIRECTORY "${generated}/config") file(MAKE_DIRECTORY "${generated}/config")
configure_file(${PROJECT_SOURCE_DIR}/main/config.h.in configure_file(${PROJECT_SOURCE_DIR}/main/config.h.in