2019-11-23 20:27:39 +08:00
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
# default value for cocos2dx extensions modules to Build
|
|
|
|
# currently 7 extensions
|
|
|
|
# extensions dependicies: COCOSTUDIO may depend on spine & dragonBones if they are present in buildset
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2020-10-18 12:31:45 +08:00
|
|
|
option(BUILD_EXTENSION_GUI "Build extension GUI" ON)
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
option(BUILD_EXTENSION_ASSETMANAGER "Build extension asset-manager" ON)
|
|
|
|
option(BUILD_EXTENSION_PARTICLE3D "Build extension Particle3D" ON)
|
|
|
|
option(BUILD_EXTENSION_PHYSICS_NODE "Build extension physics-nodes" ON)
|
|
|
|
|
|
|
|
option(BUILD_EXTENSION_SPINE "Build extension spine" ON)
|
2020-08-04 21:13:26 +08:00
|
|
|
option(BUILD_EXTENSION_DRAGONBONES "Build extension DragonBones" ON)
|
2020-08-03 20:31:47 +08:00
|
|
|
|
|
|
|
option(BUILD_EXTENSION_COCOSTUDIO "Build extension cocostudio" ON)
|
|
|
|
|
2020-08-04 12:31:33 +08:00
|
|
|
option(BUILD_EXTENSION_FAIRYGUI "Build extension FairyGUI" ON)
|
|
|
|
|
2020-09-25 11:07:56 +08:00
|
|
|
if(WINDOWS OR MACOSX OR LINUX)
|
2020-09-08 13:38:16 +08:00
|
|
|
option(BUILD_EXTENSION_IMGUIEXT "Build extension ImGuiEXT" ON)
|
|
|
|
else()
|
|
|
|
set(BUILD_EXTENSION_IMGUIEXT OFF)
|
|
|
|
endif()
|
2020-09-04 17:19:51 +08:00
|
|
|
|
2020-10-17 16:32:16 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
cmake_policy(SET CMP0079 NEW)
|
|
|
|
endif()
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
function(setup_cocos_extension_config target_name)
|
2020-10-17 16:32:16 +08:00
|
|
|
set(options DNTLINK opt_DNTLINK)
|
|
|
|
cmake_parse_arguments(opt "" "${options}" ""
|
|
|
|
"" ${ARGN} )
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
if(ANDROID)
|
2021-05-18 16:40:30 +08:00
|
|
|
target_link_libraries(${target_name} INTERFACE ${ADXE_CORE_LIB})
|
|
|
|
target_include_directories(${target_name} PRIVATE $<TARGET_PROPERTY:${ADXE_CORE_LIB},INTERFACE_INCLUDE_DIRECTORIES>)
|
2020-08-09 22:41:06 +08:00
|
|
|
# target_compile_definitions(${target_name} PRIVATE CP_USE_CGTYPES=0)
|
|
|
|
# target_compile_definitions(${target_name} PRIVATE CP_USE_DOUBLES=0)
|
2020-08-03 20:31:47 +08:00
|
|
|
else()
|
2021-05-18 16:40:30 +08:00
|
|
|
target_link_libraries(${target_name} ${ADXE_CORE_LIB})
|
2020-08-03 20:31:47 +08:00
|
|
|
endif()
|
2020-10-17 16:32:16 +08:00
|
|
|
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
target_compile_definitions(${target_name} PRIVATE _USREXDLL=1)
|
|
|
|
endif()
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
set_target_properties(${target_name}
|
|
|
|
PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
2021-04-22 22:01:47 +08:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
2020-08-03 20:31:47 +08:00
|
|
|
FOLDER "Extensions"
|
|
|
|
)
|
|
|
|
|
2020-10-17 16:32:16 +08:00
|
|
|
if(NOT opt_DNTLINK)
|
|
|
|
set(CC_EXTENSION_LIBS "${target_name};${CC_EXTENSION_LIBS}" CACHE INTERNAL "extensions for auto link to target application")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(XCODE OR VS)
|
|
|
|
cocos_mark_code_files("${target_name}")
|
|
|
|
endif()
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
endfunction()
|
|
|
|
|
2020-10-18 12:31:45 +08:00
|
|
|
if(BUILD_EXTENSION_GUI)
|
|
|
|
add_subdirectory(GUI)
|
|
|
|
endif()
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
if(BUILD_EXTENSION_ASSETMANAGER)
|
|
|
|
add_subdirectory(assets-manager)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_EXTENSION_PARTICLE3D)
|
|
|
|
add_subdirectory(Particle3D)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_EXTENSION_PHYSICS_NODE)
|
|
|
|
add_subdirectory(physics-nodes)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_EXTENSION_SPINE)
|
|
|
|
add_subdirectory(spine)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_EXTENSION_DRAGONBONES)
|
2020-10-18 00:27:23 +08:00
|
|
|
add_subdirectory(DragonBones)
|
2020-08-03 20:31:47 +08:00
|
|
|
endif()
|
|
|
|
|
2020-08-04 12:31:33 +08:00
|
|
|
if(BUILD_EXTENSION_FAIRYGUI)
|
|
|
|
add_subdirectory(fairygui)
|
2020-10-17 16:32:16 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
target_link_libraries(fairygui spine)
|
|
|
|
else()
|
|
|
|
target_include_directories(fairygui PUBLIC ${CMAKE_CURRENT_LIST_DIR}/spine/runtime/include)
|
|
|
|
endif()
|
2020-08-04 12:31:33 +08:00
|
|
|
endif()
|
|
|
|
|
2020-09-05 17:10:09 +08:00
|
|
|
if(BUILD_EXTENSION_IMGUIEXT)
|
|
|
|
add_subdirectory(ImGuiEXT)
|
2020-09-04 17:19:51 +08:00
|
|
|
endif()
|
|
|
|
|
2020-10-17 16:32:16 +08:00
|
|
|
if(BUILD_EXTENSION_COCOSTUDIO)
|
2020-10-21 10:12:00 +08:00
|
|
|
add_subdirectory(cocostudio)
|
2020-10-17 16:32:16 +08:00
|
|
|
if(BUILD_EXTENSION_SPINE)
|
2020-10-21 10:12:00 +08:00
|
|
|
target_compile_definitions(cocostudio PUBLIC CC_BUILD_WITH_SPINE=1)
|
2020-10-17 16:32:16 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2020-10-21 10:12:00 +08:00
|
|
|
target_link_libraries(cocostudio spine particle3d)
|
2020-10-17 16:32:16 +08:00
|
|
|
else()
|
2020-10-21 10:12:00 +08:00
|
|
|
target_include_directories(cocostudio PUBLIC ${CMAKE_CURRENT_LIST_DIR}/spine/runtime/include)
|
2020-10-17 16:32:16 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(BUILD_EXTENSION_DRAGONBONES)
|
2020-10-21 10:12:00 +08:00
|
|
|
target_compile_definitions(cocostudio PRIVATE CC_BUILD_WITH_DRANGBONES=1)
|
2020-10-17 16:32:16 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2020-10-21 10:12:00 +08:00
|
|
|
target_link_libraries(cocostudio DragonBones)
|
2020-10-17 16:32:16 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_LUA_LIBS) # TODO: rename to BUILD_EXTENSION_LUA
|
|
|
|
add_subdirectory(scripting/lua-bindings)
|
|
|
|
endif()
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
message(STATUS "CC_EXTENSION_LIBS:${CC_EXTENSION_LIBS}")
|