diff --git a/CMakeLists.txt b/CMakeLists.txt index d61d0e5f7..f968081f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,16 +4,6 @@ project(godot-cpp LANGUAGES CXX) # Get Python find_package(Python3 3.4 REQUIRED) # pathlib should be present -# Configure CMake -# https://discourse.cmake.org/t/how-do-i-remove-compile-options-from-target/5965 -# https://stackoverflow.com/questions/74426638/how-to-remove-rtc1-from-specific-target-or-file-in-cmake -if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) - if(NOT CMAKE_BUILD_TYPE MATCHES Debug) - STRING(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) - endif () -endif () - if( CMAKE_C_COMPILER) #Silence warning from unused CMAKE_C_COMPILER from toolchain endif () diff --git a/cmake/common_compiler_flags.cmake b/cmake/common_compiler_flags.cmake index 39c5616bf..9e14d8ccd 100644 --- a/cmake/common_compiler_flags.cmake +++ b/cmake/common_compiler_flags.cmake @@ -10,7 +10,12 @@ set( GNU_LT_V11 "$,11>" ) set( GNU_GE_V12 "$,12>" ) set( WARNING_AS_ERROR "$") -set( HOT_RELOAD "$") + +set( NOT_RELEASE "$>") + +set( HOT_RELOAD-UNSET "$") +set( HOT_RELOAD "$>" ) + set( DISABLE_EXCEPTIONS "$") target_compile_features(${PROJECT_NAME} @@ -101,8 +106,9 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC GDEXTENSION + $<$:WINDOWS_ENABLED> + $<${IS_MSVC}: - WINDOWS_ENABLED TYPED_METHOD_BIND NOMINMAX $<${DISABLE_EXCEPTIONS}:_HAS_EXCEPTIONS=0> diff --git a/cmake/godotcpp.cmake b/cmake/godotcpp.cmake index f68edfef0..047da926b 100644 --- a/cmake/godotcpp.cmake +++ b/cmake/godotcpp.cmake @@ -66,16 +66,6 @@ function( godotcpp_generate ) set( GODOT_SYMBOL_VISIBILITY "default" ) endif () - # Default build type is Debug in the SConstruct - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Debug) - endif() - - # Hot reload is enabled by default in Debug-builds - if( GODOT_USE_HOT_RELOAD STREQUAL "" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - set(GODOT_USE_HOT_RELOAD ON) - endif() - ### Generate Bindings if(NOT DEFINED BITS) set(BITS 32) @@ -145,10 +135,9 @@ function( godotcpp_generate ) include(${PROJECT_SOURCE_DIR}/cmake/common_compiler_flags.cmake) - ### Create the correct name (godot.os.build_type.system_bits) - string(TOLOWER "${CMAKE_SYSTEM_NAME}" SYSTEM_NAME) - string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE) + set( SYSTEM_NAME "$" ) + set( BUILD_TYPE "$>" ) if(ANDROID) # Added the android abi after system name