-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added to .gitignore CMakeUserPresets.json Configuration: - Silenced warning for unused CMAKE_C_COMPILER when specified in toolchain - Moved find package for python to root CMakeLists.txt - Changed python command to use single quotes to make build output log more legible. - Added GODOT_DEV_BUILD to allow differentiation of debug or Release builds. == targets == Changed godot-cpp-test to be a target Split godot-cpp into template_release, template_debug, editor Target Compile Options: - Changed the MSVC warning flags to PUBLIC to propagate to consumers - Audit MSVC compile options and verified either defaults, or match scons - fixed msvc runtime target to be MT[d] like the scons build separated msvc properties visually. Target Link Options: - prevent use of -static-libgcc on APPLE platform - removed manual rpath origin from link options Target Definitions: - Turn on WINDOWS_ENABLED based on WIN32 Target properties: - Added CXX_STANDARD 17 - Added CXX_VISIBILITY_PRESET - Added LINK_SEARCH_START_STATIC - Added LINK_SEARCH_END_STATIC - New cmake/sources.cmake to collect all the pre-existing source files, because globing is evil. - Made sources PRIVATE - Exposed headers as INTERFACE using target_include_directories for consumers ### Generator Expressions Renamed generator expression helper variables to ease readability Moved all flags to generator expressions Moved generator expression helpers to common_compiler_flags.cmake Refactor SYSTEM_NAME and BUILD_TYPE to use generator expressions Refactor HOT_RELOAD to use generator expressions CMAKE_BUILD_TYPE is no longer depended upon, eliminating config errors for multi-config builds like Visual Studio, and Ninja-MultiConfig Now that we are specifying the config at build time, the hack to re-write CMAKE_CXX_FLAGS(_DEBUG) flags is no longer needed. Remove CMAKE_BUILD_TYPE from msvc CI target as it is a Multi-Config generator and ignores it == godot-cpp-test == Add EXCLUDE_FROM_ALL to godot-cpp-test so that it isn't built as part of the 'all' target Updated ci to build the godot-cpp-test target from the root directory using cmake Adding the LANGUAGES CXX to the test project maintains the existing behavior of not checking for C compiler during configure. Removed majority of the cmake code as it was duplicating things that propagate as transient dependency from godot-cpp ### Documentation Updated with new information Added Emscripten example Added Android example
- Loading branch information
Showing
8 changed files
with
578 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,3 +199,6 @@ venv | |
# Clion Configuration | ||
.idea/ | ||
cmake-build-* | ||
|
||
# CMake related | ||
CMakeUserPresets.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(godot-cpp LANGUAGES CXX) | ||
|
||
# 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 () | ||
|
||
include( ${PROJECT_SOURCE_DIR}/cmake/godotcpp.cmake ) | ||
|
||
# I know this doesn't look like a typical CMakeLists.txt, but as we are | ||
# attempting mostly feature parity with SCons, and easy maintenance, the closer | ||
# the two build systems look the easier they will be to keep in lockstep. | ||
# As we are attempting to maintain feature parity, and ease of maintenance, | ||
# these CMake scripts are built to resemble the structure of the SCons build system. | ||
# The closer the two build systems look the easier they will be to maintain. | ||
|
||
# The typical target definitions are in ${PROJECT_SOURCE_DIR}/cmake/godotcpp.cmake | ||
# include pulls in the code from godotcpp.cmake | ||
# the equivalent in scons: | ||
# cpp_tool = Tool("godotcpp", toolpath=["tools"]) | ||
include( ${CMAKE_SOURCE_DIR}/cmake/godotcpp.cmake ) | ||
|
||
godotcpp_options() | ||
|
||
# godot-cpp targets three main configurations, editor, template_release and template_debug. | ||
# These are all built in "Release" mode unless GODOT_DEV_BUILD is enabled, then the build type is "Debug". | ||
# If using MSBuild the build type is 'Debug' unless specified on the command line like so: | ||
# cmake --build . --config Release | ||
get_property( IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG ) | ||
if( NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE ) | ||
if( GODOT_DEV_BUILD ) | ||
set( CMAKE_BUILD_TYPE Debug ) | ||
else () | ||
set( CMAKE_BUILD_TYPE Release ) | ||
endif () | ||
endif () | ||
|
||
# Get Python | ||
find_package(Python3 3.4 REQUIRED) # pathlib should be present | ||
|
||
# Define our project. | ||
project(godot-cpp | ||
VERSION 4.4 | ||
DESCRIPTION "" | ||
HOMEPAGE_URL "https://github.com/godotengine/godot-cpp" | ||
LANGUAGES CXX) | ||
|
||
godotcpp_generate() | ||
|
||
# Test Example | ||
add_subdirectory( test ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.