axmol/extensions/CMakeLists.txt

131 lines
3.6 KiB
CMake
Raw Normal View History

2022-10-01 16:24:52 +08:00
# default value for axmol extensions modules to Build
# currently 7 extensions
# extensions dependicies: COCOSTUDIO may depend on spine & dragonBones if they are present in buildset
2022-02-17 17:11:17 +08:00
option(AX_ENABLE_EXT_GUI "Build extension GUI" ON)
2022-02-17 17:11:17 +08:00
option(AX_ENABLE_EXT_ASSETMANAGER "Build extension asset-manager" ON)
option(AX_ENABLE_EXT_PARTICLE3D "Build extension Particle3D" ON)
option(AX_ENABLE_EXT_PHYSICS_NODE "Build extension physics-nodes" ON)
2022-02-17 17:11:17 +08:00
option(AX_ENABLE_EXT_SPINE "Build extension spine" ON)
option(AX_ENABLE_EXT_DRAGONBONES "Build extension DragonBones" ON)
2022-02-17 17:11:17 +08:00
option(AX_ENABLE_EXT_COCOSTUDIO "Build extension cocostudio" ON)
2022-02-17 17:11:17 +08:00
option(AX_ENABLE_EXT_FAIRYGUI "Build extension FairyGUI" ON)
2020-08-04 12:31:33 +08:00
option(AX_ENABLE_EXT_LIVE2D "Build extension Live2D" OFF)
if(WINDOWS OR MACOSX OR LINUX)
option(AX_ENABLE_EXT_IMGUI "Build extension ImGui" ON)
else()
2022-02-17 17:11:17 +08:00
set(AX_ENABLE_EXT_IMGUI OFF)
endif()
2020-09-04 16:13:40 +08:00
2020-10-17 16:32:16 +08:00
if(BUILD_SHARED_LIBS)
cmake_policy(SET CMP0079 NEW)
endif()
2022-08-11 15:41:10 +08:00
function(setup_ax_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)
2022-08-08 18:02:17 +08:00
target_link_libraries(${target_name} INTERFACE ${_AX_CORE_LIB})
target_include_directories(${target_name} PRIVATE $<TARGET_PROPERTY:${_AX_CORE_LIB},INTERFACE_INCLUDE_DIRECTORIES>)
# 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()
2022-08-08 18:02:17 +08:00
target_link_libraries(${target_name} ${_AX_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"
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(_AX_EXTENSION_LIBS "${target_name};${_AX_EXTENSION_LIBS}" CACHE INTERNAL "extensions for auto link to target application")
2020-10-17 16:32:16 +08:00
endif()
if(XCODE OR VS)
2022-08-11 15:41:10 +08:00
ax_mark_code_files("${target_name}")
2020-10-17 16:32:16 +08:00
endif()
2020-08-03 20:31:47 +08:00
endfunction()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_GUI)
add_subdirectory(GUI)
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_ASSETMANAGER)
add_subdirectory(assets-manager)
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_PARTICLE3D)
add_subdirectory(Particle3D)
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_PHYSICS_NODE)
add_subdirectory(physics-nodes)
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_SPINE)
add_subdirectory(spine)
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_DRAGONBONES)
add_subdirectory(DragonBones)
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_FAIRYGUI)
2020-08-04 12:31:33 +08:00
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()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_IMGUI)
add_subdirectory(ImGui)
2020-09-04 16:13:40 +08:00
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_COCOSTUDIO)
add_subdirectory(cocostudio)
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_SPINE)
2022-07-08 07:17:41 +08:00
target_compile_definitions(cocostudio PUBLIC AX_BUILD_WITH_SPINE=1)
2020-10-17 16:32:16 +08:00
if(BUILD_SHARED_LIBS)
target_link_libraries(cocostudio spine particle3d)
2020-10-17 16:32:16 +08:00
else()
target_include_directories(cocostudio PUBLIC ${CMAKE_CURRENT_LIST_DIR}/spine/runtime/include)
2020-10-17 16:32:16 +08:00
endif()
endif()
2022-02-17 17:11:17 +08:00
if(AX_ENABLE_EXT_DRAGONBONES)
2022-07-08 07:17:41 +08:00
target_compile_definitions(cocostudio PRIVATE AX_BUILD_WITH_DRANGBONES=1)
2020-10-17 16:32:16 +08:00
if(BUILD_SHARED_LIBS)
target_link_libraries(cocostudio DragonBones)
2020-10-17 16:32:16 +08:00
endif()
endif()
endif()
if(AX_ENABLE_EXT_LIVE2D)
add_subdirectory(Live2D)
endif()
if(AX_ENABLE_EXT_LUA)
2020-10-17 16:32:16 +08:00
add_subdirectory(scripting/lua-bindings)
endif()
2022-10-01 16:24:52 +08:00
message(STATUS "Enabled ${_AX_CORE_LIB} extensions:${_AX_EXTENSION_LIBS}")