Skip to content

Commit 13120e7

Browse files
author
torets
committed
adding options to hide some of targets from building
1 parent 714c9e2 commit 13120e7

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
@@ -161,6 +161,25 @@ function( godotcpp_options )
161161

162162
# Enable Testing
163163
option( GODOTCPP_ENABLE_TESTING "Enable the godot-cpp.test.<target> integration testing targets" OFF )
164+
# Define which targets create for build. By default all targets are included
165+
# Not presented in SCons
166+
option(GODOTCPP_ADD_TARGET_TEMPLATE_RELEASE "Add template_release target to build" ON)
167+
option(GODOTCPP_ADD_TARGET_TEMPLATE_DEBUG "Add template_debug target to build" ON)
168+
option(GODOTCPP_ADD_TARGET_EDITOR "Add editor target to build" ON)
169+
if(GODOTCPP_ADD_TARGET_TEMPLATE_DEBUG)
170+
list(APPEND GODOTCPP_TARGETS "template_debug")
171+
endif()
172+
if(GODOTCPP_ADD_TARGET_TEMPLATE_RELEASE)
173+
list(APPEND GODOTCPP_TARGETS "template_release")
174+
endif()
175+
if(GODOTCPP_ADD_TARGET_EDITOR)
176+
list(APPEND GODOTCPP_TARGETS "editor")
177+
endif()
178+
if(NOT GODOTCPP_TARGETS)
179+
message(FATAL_ERROR "No targets were chosen to be build.See GODOTCPP_ADD_TARGET_* variables: at least one of the should be ON")
180+
endif()
181+
# parent scoping GODOTCPP_TARGETS
182+
set(GODOTCPP_TARGETS ${GODOTCPP_TARGETS} PARENT_SCOPE)
164183

165184
#[[ Target Platform Options ]]
166185
android_options()
@@ -288,7 +307,7 @@ function( godotcpp_generate )
288307
set( IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD}>")
289308

290309
### Define our godot-cpp library targets
291-
foreach ( TARGET_ALIAS template_debug template_release editor )
310+
foreach ( TARGET_ALIAS ${GODOTCPP_TARGETS} )
292311
set( TARGET_NAME "godot-cpp.${TARGET_ALIAS}" )
293312

294313
# Generator Expressions that rely on the target

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ file( GLOB_RECURSE DOC_XML
1313
CONFIGURE_DEPENDS
1414
"${CMAKE_CURRENT_SOURCE_DIR}/doc_classes/*.xml" )
1515

16-
foreach( TARGET_ALIAS template_debug template_release editor )
16+
foreach( TARGET_ALIAS ${GODOTCPP_TARGETS} )
1717
set( TARGET_NAME "godot-cpp.test.${TARGET_ALIAS}" )
1818

1919
add_library( ${TARGET_NAME} SHARED EXCLUDE_FROM_ALL )

0 commit comments

Comments
 (0)