From 67c6bcec4f0dcf85db1ea72a130bf1a63a39cc77 Mon Sep 17 00:00:00 2001 From: halx99 Date: Thu, 17 Feb 2022 21:31:39 +0800 Subject: [PATCH] [cmake] Rename BUILD_LUA_LIBS to AX_ENABLE_EXT_LUA --- CMakeLists.txt | 10 +++++----- cmake/Modules/CocosBuildHelpers.cmake | 2 +- cmake/Modules/CocosBuildSet.cmake | 2 +- core/CMakeLists.txt | 4 ++-- extensions/CMakeLists.txt | 2 +- extensions/ImGuiEXT/CMakeLists.txt | 2 +- templates/lua-template-default/CMakeLists.txt | 2 +- tests/lua-tests/project/CMakeLists.txt | 2 +- thirdparty/CMakeLists.txt | 10 +++------- 9 files changed, 16 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14461babd7..41a4eb0620 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,16 +45,16 @@ include(PreventInSourceBuilds) # works before build libcocos2d include(CocosBuildSet) -option(BUILD_TESTS "Build cpp & lua tests" ON) +option(AX_BUILD_TESTS "Build cpp & lua tests" ON) -set(BUILD_LUA_LIBS ON) +set(AX_ENABLE_EXT_LUA ON) add_subdirectory(${ADXE_ROOT_PATH}/core ${ENGINE_BINARY_PATH}/adxe/core) # prevent tests project to build "adxe/core" again set(BUILD_ENGINE_DONE ON) -if(BUILD_TESTS) +if(AX_BUILD_TESTS) # add cpp-template-default into project(adxe) for tmp test add_subdirectory(${ADXE_ROOT_PATH}/templates/cpp-template-default ${ENGINE_BINARY_PATH}/tests/HelloCpp) @@ -66,9 +66,9 @@ if(BUILD_TESTS) add_subdirectory(${ADXE_ROOT_PATH}/tests/fairygui-tests ${ENGINE_BINARY_PATH}/tests/fairygui-tests) endif() - if(BUILD_LUA_LIBS) + if(AX_ENABLE_EXT_LUA) add_subdirectory(${ADXE_ROOT_PATH}/templates/lua-template-default ${ENGINE_BINARY_PATH}/tests/HelloLua) add_subdirectory(${ADXE_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test) - endif(BUILD_LUA_LIBS) + endif(AX_ENABLE_EXT_LUA) endif() diff --git a/cmake/Modules/CocosBuildHelpers.cmake b/cmake/Modules/CocosBuildHelpers.cmake index 71c98c5352..bc801ac16e 100644 --- a/cmake/Modules/CocosBuildHelpers.cmake +++ b/cmake/Modules/CocosBuildHelpers.cmake @@ -162,7 +162,7 @@ function(copy_thirdparty_dlls cocos_target destDir) # list(APPEND DEPENDENCIES ${INTERFACE_LINK_LIBRARIES}) # endif() - if(BUILD_LUA_LIBS) # TODO: rename to AX_ENABLE_EXT_LUA + if(AX_ENABLE_EXT_LUA) list(APPEND DEPENDENCIES ${LUA_ENGINE}) list(APPEND DEPENDENCIES tolua) endif() diff --git a/cmake/Modules/CocosBuildSet.cmake b/cmake/Modules/CocosBuildSet.cmake index dfa5384652..2529c9dae4 100644 --- a/cmake/Modules/CocosBuildSet.cmake +++ b/cmake/Modules/CocosBuildSet.cmake @@ -29,7 +29,7 @@ message(STATUS "PYTHON_PATH:" ${PYTHON_COMMAND}) message(STATUS "COCOS_COMMAND_PATH:" ${COCOS_COMMAND}) message(STATUS "HOST_SYSTEM:" ${CMAKE_HOST_SYSTEM_NAME}) # the default behavior of build module -option(BUILD_LUA_LIBS "Build lua libraries" OFF) +option(AX_ENABLE_EXT_LUA "Build lua libraries" OFF) # hold the extensions list to auto link to app set(CC_EXTENSION_LIBS "" CACHE INTERNAL "extensions for auto link to target application") diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 568c94f576..d4d84e4a5e 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -27,7 +27,7 @@ # this CMakeLists is to generate Cocos2d-x Engine Library # build adxe -# build adxelua if BUILD_LUA_LIBS=ON +# build adxelua if AX_ENABLE_EXT_LUA=ON # The version number set(ADXE_VERSION 1.0) @@ -149,7 +149,7 @@ set_target_properties(${ADXE_CORE_LIB} ) ## Lua bindings lib -# if(BUILD_LUA_LIBS) +# if(AX_ENABLE_EXT_LUA) # add_subdirectory(${ADXE_ROOT_PATH}/extensions/scripting/lua-bindings ${ENGINE_BINARY_PATH}/core/lua-bindings) # endif() diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index 30d95f6b20..01a1f24928 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -117,7 +117,7 @@ if(AX_ENABLE_EXT_COCOSTUDIO) endif() endif() -if(BUILD_LUA_LIBS) # TODO: rename to AX_ENABLE_EXT_LUA +if(AX_ENABLE_EXT_LUA) add_subdirectory(scripting/lua-bindings) endif() diff --git a/extensions/ImGuiEXT/CMakeLists.txt b/extensions/ImGuiEXT/CMakeLists.txt index dedcb529bb..5612671f42 100644 --- a/extensions/ImGuiEXT/CMakeLists.txt +++ b/extensions/ImGuiEXT/CMakeLists.txt @@ -33,7 +33,7 @@ set(SOURCE #~ implot/implot_demo.cpp ) -#~ if(BUILD_LUA_LIBS) +#~ if(AX_ENABLE_EXT_LUA) #~ include_directories( #~ lua-bindings #~ ${ADXE_ROOT_PATH}/thirdparty/lua/luajit/include diff --git a/templates/lua-template-default/CMakeLists.txt b/templates/lua-template-default/CMakeLists.txt index 1ca15179eb..3b327c398d 100644 --- a/templates/lua-template-default/CMakeLists.txt +++ b/templates/lua-template-default/CMakeLists.txt @@ -52,7 +52,7 @@ if(NOT DEFINED BUILD_ENGINE_DONE) # to test HelloLua into root project set(CMAKE_MODULE_PATH ${ADXE_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - set(BUILD_LUA_LIBS ON) + set(AX_ENABLE_EXT_LUA ON) add_subdirectory(${ADXE_ROOT_PATH}/core ${ENGINE_BINARY_PATH}/adxe/core) endif() diff --git a/tests/lua-tests/project/CMakeLists.txt b/tests/lua-tests/project/CMakeLists.txt index f3ac2aeb0b..4871a607da 100644 --- a/tests/lua-tests/project/CMakeLists.txt +++ b/tests/lua-tests/project/CMakeLists.txt @@ -20,7 +20,7 @@ if(NOT DEFINED BUILD_ENGINE_DONE) set(CMAKE_MODULE_PATH ${ADXE_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - set(BUILD_LUA_LIBS ON) + set(AX_ENABLE_EXT_LUA ON) add_subdirectory(${ADXE_ROOT_PATH}/core ${ENGINE_BINARY_PATH}/adxe/core) endif() diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 3147f12341..1369a5cc61 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -66,7 +66,8 @@ add_library(thirdparty STATIC empty.cpp) # header only libs target_include_directories(thirdparty - INTERFACE "robin-map/include" + INTERFACE "fmt/include" + INTERFACE "robin-map/include" ) if (ANDROID) @@ -207,7 +208,7 @@ if(AX_WITH_ASTC) endif(AX_WITH_ASTC) # use lua/js specific libs by property to prevent conflict -if(BUILD_LUA_LIBS) +if(AX_ENABLE_EXT_LUA) add_subdirectory(lua/${AX_LUA_ENGINE}) add_subdirectory(lua/tolua) add_subdirectory(lua/lua-cjson) @@ -335,11 +336,6 @@ if(AX_WITH_KCP) target_compile_definitions(thirdparty PUBLIC YASIO_HAVE_KCP=1) endif() -# fmt-lib -add_subdirectory(fmt) -target_link_libraries(thirdparty fmt-header-only) -configure_target_outdir(fmt) - # put "thirdparty" into thirdparty folder, too configure_target_outdir(thirdparty)