Skip to content

Commit a10c05b

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

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

cmake/godotcpp.cmake

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,28 @@ 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(
192+
FATAL_ERROR
193+
"No targets were chosen to be build.See GODOTCPP_ADD_TARGET_* variables: at least one of the should be ON"
194+
)
195+
endif()
196+
# parent scoping GODOTCPP_TARGETS
197+
set(GODOTCPP_TARGETS ${GODOTCPP_TARGETS} PARENT_SCOPE)
176198

177199
#[[ Target Platform Options ]]
178200
android_options()
@@ -310,7 +332,7 @@ function(godotcpp_generate)
310332
set(IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD}>")
311333

312334
### Define our godot-cpp library targets
313-
foreach(TARGET_ALIAS template_debug template_release editor)
335+
foreach(TARGET_ALIAS ${GODOTCPP_TARGETS})
314336
set(TARGET_NAME "godot-cpp.${TARGET_ALIAS}")
315337

316338
# 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)