Skip to content

Commit 6710fda

Browse files
author
torets
committed
adding options to hide some of targets from building
1 parent 05f5d73 commit 6710fda

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

cmake/godotcpp.cmake

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ function(godotcpp_options)
173173

174174
# Enable Testing
175175
option(GODOTCPP_ENABLE_TESTING "Enable the godot-cpp.test.<target> integration testing targets" OFF)
176+
# Define which targets create for build. By default all targets are included
177+
# Not presented in SCons
178+
option(GODOTCPP_ADD_TARGET_TEMPLATE_RELEASE "Add template_release target to build" ON)
179+
option(GODOTCPP_ADD_TARGET_TEMPLATE_DEBUG "Add template_debug target to build" ON)
180+
option(GODOTCPP_ADD_TARGET_EDITOR "Add editor target to build" ON)
181+
if(GODOTCPP_ADD_TARGET_TEMPLATE_DEBUG)
182+
list(APPEND GODOTCPP_TARGETS "template_debug")
183+
endif()
184+
if(GODOTCPP_ADD_TARGET_TEMPLATE_RELEASE)
185+
list(APPEND GODOTCPP_TARGETS "template_release")
186+
endif()
187+
if(GODOTCPP_ADD_TARGET_EDITOR)
188+
list(APPEND GODOTCPP_TARGETS "editor")
189+
endif()
190+
if(NOT GODOTCPP_TARGETS)
191+
message(FATAL_ERROR "No targets were chosen to be build.See GODOTCPP_ADD_TARGET_* variables: at least one of the should be ON")
192+
endif()
193+
# parent scoping GODOTCPP_TARGETS
194+
set(GODOTCPP_TARGETS ${GODOTCPP_TARGETS} PARENT_SCOPE)
176195

177196
#[[ Target Platform Options ]]
178197
android_options()
@@ -310,7 +329,7 @@ function(godotcpp_generate)
310329
set(IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD}>")
311330

312331
### Define our godot-cpp library targets
313-
foreach(TARGET_ALIAS template_debug template_release editor)
332+
foreach (TARGET_ALIAS ${GODOTCPP_TARGETS})
314333
set(TARGET_NAME "godot-cpp.${TARGET_ALIAS}")
315334

316335
# Generator Expressions that rely on the target

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ message(STATUS "Testing Integration targets are enabled.")
1010
# Generate Doc Data
1111
file(GLOB_RECURSE DOC_XML LIST_DIRECTORIES NO CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/doc_classes/*.xml")
1212

13-
foreach(TARGET_ALIAS template_debug template_release editor)
13+
foreach(TARGET_ALIAS ${GODOTCPP_TARGETS})
1414
set(TARGET_NAME "godot-cpp.test.${TARGET_ALIAS}")
1515

1616
add_library(${TARGET_NAME} SHARED EXCLUDE_FROM_ALL)

0 commit comments

Comments
 (0)