test project config types, verbose test configfile

Vano 2024-01-13 14:21:13 +02:00
parent 18aa34d9f2
commit a37226e106
3 changed files with 21 additions and 12 deletions

View File

@ -1,10 +1,12 @@
# Configuration for building godot-cpp only
# See `tests/CMakeLists.txt` for example configuration
#
# Main cmake arguments
#
# CMAKE_BUILD_TYPE Compilation target (Debug, Release, RelWithDebInfo, MinSizeRel)
#
# CMAKE_CONFIGURATION_TYPES Set to "Debug;Release;RelWithDebInfo;MinSizeRel"
# if not all needed configurations are created in multi-config generator
# (Setting it in script causes crash on Ninja Multi-Config)
# in top project config or via cmdline (see `test/CMakeLists.txt`)
#
# TARGET Godot build target (EDITOR, TEMPLATE_DEBUG, TEMPLATE_RELEASE)
#
@ -31,9 +33,11 @@
# cmake -DTARGET=TEMPLATE_RELEASE -Bbuild
# cmake --build build
#
# Creates multi-config setup and builds Release version (example for Linux)
# Creates multi-config setup and builds Release version
#
# cmake -G "Ninja Multi-Config" -Bbuild
# cmake -G "Ninja Multi-Config" -Bbuild # For Linux/non-MSVC
# OR
# cmake -G "Visual Studio 16 2019" -A x64 -Bbuild # For Windows/MSVC
# cmake --build build --config Release
#
# Builds web version, using Emscripten toolchain

View File

@ -94,7 +94,6 @@ set(DEFAULT_OPTIMIZATION "$<NOT:${DEFAULT_OPTIMIZATION_DEBUG_FEATURES}>")
set(DEBUG_SYMBOLS_ENABLED "$<OR:$<BOOL:${DEBUG_SYMBOLS}>,$<IN_LIST:${CONFIG},${CONFIGS_WITH_DEBUG}>>")
# Clean default options
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")

View File

@ -1,14 +1,18 @@
# Configuration can be used as a template for custom project, read comments
cmake_minimum_required(VERSION 3.6)
project(gdexample)
project(gdexample LANGUAGES CXX)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel")
set(GODOT_CPP_PATH ../) # path to godot-cpp repository
add_subdirectory(
../ # path to godot-cpp
${GODOT_CPP_PATH}
${CMAKE_CURRENT_BINARY_DIR}/godot-cpp # needed because godot-cpp is top directory
)
# Get Sources
file(GLOB_RECURSE SOURCES src/*.c**)
file(GLOB_RECURSE HEADERS include/*.h**)
file(GLOB_RECURSE HEADERS src/*.h**)
# Define our godot-cpp library
if(${PLATFORM} STREQUAL "WEB")
@ -18,6 +22,7 @@ if(${PLATFORM} STREQUAL "WEB")
PROPERTIES
PREFIX "lib"
SUFFIX ".wasm"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
@ -41,20 +46,21 @@ endif()
target_link_libraries(${PROJECT_NAME} PUBLIC godot-cpp)
get_directory_property(GODOT_CC_FLAGS DIRECTORY ../ DEFINITION GODOT_CC_FLAGS)
get_directory_property(GODOT_CXX_FLAGS DIRECTORY ../ DEFINITION GODOT_CXX_FLAGS)
get_directory_property(GODOT_CC_FLAGS DIRECTORY ${GODOT_CPP_PATH} DEFINITION GODOT_CC_FLAGS)
get_directory_property(GODOT_CXX_FLAGS DIRECTORY ${GODOT_CPP_PATH} DEFINITION GODOT_CXX_FLAGS)
target_compile_options(${PROJECT_NAME} PRIVATE
${GODOT_CC_FLAGS}
${GODOT_CXX_FLAGS}
)
get_directory_property(GODOT_LINK_FLAGS DIRECTORY ../ DEFINITION GODOT_LINK_FLAGS)
get_directory_property(GODOT_LINK_FLAGS DIRECTORY ${GODOT_CPP_PATH} DEFINITION GODOT_LINK_FLAGS)
target_link_options(${PROJECT_NAME} PRIVATE ${GODOT_LINK_FLAGS})
get_directory_property(LIBRARY_SUFFIX DIRECTORY ../ DEFINITION LIBRARY_SUFFIX)
get_directory_property(LIBRARY_SUFFIX DIRECTORY ${GODOT_CPP_PATH} DEFINITION LIBRARY_SUFFIX)
set_target_properties(${PROJECT_NAME}
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"