From edbaa02a15f24732cc49fd52661f846eba97695c Mon Sep 17 00:00:00 2001 From: ZSaberLv0 Date: Tue, 26 Nov 2024 21:56:13 +0800 Subject: [PATCH] update --- .../Android/ZFLoader/zfapp/CMakeLists.txt | 2 +- ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt | 25 +++++++------- .../Android/ZFLoader/zfapp/CMakeLists.txt | 4 +-- .../cmake/ZFLoader/CMakeLists.txt | 33 ++++++++++++++++--- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/ZFLoader/zfproj/Android/ZFLoader/zfapp/CMakeLists.txt b/ZFLoader/zfproj/Android/ZFLoader/zfapp/CMakeLists.txt index 7001068..2860e52 100644 --- a/ZFLoader/zfproj/Android/ZFLoader/zfapp/CMakeLists.txt +++ b/ZFLoader/zfproj/Android/ZFLoader/zfapp/CMakeLists.txt @@ -25,7 +25,7 @@ function(ZFAddLib ZF_LIB_NAME_) add_library(${ZF_LIB_NAME_} SHARED IMPORTED) set_target_properties(${ZF_LIB_NAME_} PROPERTIES IMPORTED_LOCATION "${ZF_ROOT_PATH}/_release/Android/all/src/main/jniLibs/${ANDROID_ABI}/lib${ZF_LIB_NAME_}.so") target_link_libraries(ZFLoader ${ZF_LIB_NAME_}) -endfunction(ZFAddLib) +endfunction() ZFAddLib(ZFCore) ZFAddLib(ZFAlgorithm) diff --git a/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt b/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt index 2f469ed..b775d47 100644 --- a/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt +++ b/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4.1) +cmake_minimum_required(VERSION 3.16) project(ZFLoader) set(ZF_ROOT_PATH "${PROJECT_SOURCE_DIR}/../../../../../ZFFramework") include("${ZF_ROOT_PATH}/tools/spec/cmake/util.cmake") @@ -6,7 +6,6 @@ add_compile_options("$<$:-DDEBUG>") include("${PROJECT_SOURCE_DIR}/zfprojConfig.cmake" OPTIONAL) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../../../../_tmp/cmake/ZFLoader/app") execute_process(COMMAND sh "${ZF_ROOT_PATH}/tools/release/release_cmake.sh" 1) @@ -31,17 +30,19 @@ target_include_directories(ZFLoader PRIVATE "${PROJECT_SOURCE_DIR}/../../../zfsr function(ZFAddLib ZF_LIB_NAME_) target_include_directories(ZFLoader PRIVATE "${ZF_ROOT_PATH}/_release/cmake/all/include") - target_link_directories(ZFLoader PUBLIC "${ZF_ROOT_PATH}/_release/cmake/module/${ZF_LIB_NAME_}/lib/") - target_link_libraries(ZFLoader PUBLIC ${ZF_LIB_NAME_}) + target_link_directories(ZFLoader PUBLIC "${ZF_ROOT_PATH}/_release/cmake/module/${ZF_LIB_NAME_}/lib") + target_link_libraries(ZFLoader ${ZF_LIB_NAME_}) + install( + DIRECTORY "${ZF_ROOT_PATH}/_release/cmake/module/${ZF_LIB_NAME_}/lib/" + DESTINATION "${PROJECT_BINARY_DIR}/dist" + ) if(WIN32) - execute_process(COMMAND "${ZF_ROOT_PATH}\\tools\\common\\copy_check.bat" "${ZF_ROOT_PATH}\\_release\\cmake\\module\\${ZF_LIB_NAME_}\\lib\\" "${CMAKE_INSTALL_PREFIX}\\.") - execute_process(COMMAND "${ZF_ROOT_PATH}\\tools\\util\\copy_res.bat" "${ZF_ROOT_PATH}\\_release\\cmake\\module\\${ZF_LIB_NAME_}\\zfres\\" "${PROJECT_BINARY_DIR}\\zfres") + execute_process(COMMAND "${ZF_ROOT_PATH}\\tools\\util\\copy_res.bat" "${ZF_ROOT_PATH}\\_release\\cmake\\module\\${ZF_LIB_NAME_}\\zfres\\" "${PROJECT_BINARY_DIR}\\dist\\zfres") else() - execute_process(COMMAND sh "${ZF_ROOT_PATH}/tools/common/copy_check.sh" "${ZF_ROOT_PATH}/_release/cmake/module/${ZF_LIB_NAME_}/lib/" "${CMAKE_INSTALL_PREFIX}/.") - execute_process(COMMAND sh "${ZF_ROOT_PATH}/tools/util/copy_res.sh" "${ZF_ROOT_PATH}/_release/cmake/module/${ZF_LIB_NAME_}/zfres/" "${PROJECT_BINARY_DIR}/zfres") + execute_process(COMMAND sh "${ZF_ROOT_PATH}/tools/util/copy_res.sh" "${ZF_ROOT_PATH}/_release/cmake/module/${ZF_LIB_NAME_}/zfres/" "${PROJECT_BINARY_DIR}/dist/zfres") endif() -endfunction(ZFAddLib) +endfunction() ZFAddLib(ZFCore) ZFAddLib(ZFAlgorithm) @@ -68,8 +69,8 @@ else() endif() install(TARGETS ZFLoader EXPORT ZFLoader - LIBRARY DESTINATION "${PROJECT_BINARY_DIR}" - ARCHIVE DESTINATION "${PROJECT_BINARY_DIR}" - RUNTIME DESTINATION "${PROJECT_BINARY_DIR}" + LIBRARY DESTINATION "${PROJECT_BINARY_DIR}/dist" + ARCHIVE DESTINATION "${PROJECT_BINARY_DIR}/dist" + RUNTIME DESTINATION "${PROJECT_BINARY_DIR}/dist" ) diff --git a/ZFLoader/zfproj_with_src/Android/ZFLoader/zfapp/CMakeLists.txt b/ZFLoader/zfproj_with_src/Android/ZFLoader/zfapp/CMakeLists.txt index 92be77c..52fee9d 100644 --- a/ZFLoader/zfproj_with_src/Android/ZFLoader/zfapp/CMakeLists.txt +++ b/ZFLoader/zfproj_with_src/Android/ZFLoader/zfapp/CMakeLists.txt @@ -13,8 +13,8 @@ function(ZFAddSrc ZF_SRC_FILES_ PROJ_PATH_) ) set(${ZF_SRC_FILES_} ${${ZF_SRC_FILES_}} ${ZF_SRC_FILES_TMP} PARENT_SCOPE) - include_directories("${PROJ_PATH_}/zfsrc") -endfunction(ZFAddSrc) + target_include_directories(ZFLoader PRIVATE "${PROJ_PATH_}/zfsrc") +endfunction() ZFAddSrc(ZF_SRC_FILES ${PROJECT_SOURCE_DIR}/../../../..) diff --git a/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt b/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt index 1c0ead1..6851216 100644 --- a/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt +++ b/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4.1) +cmake_minimum_required(VERSION 3.16) project(ZFLoader) if(WIN32) @@ -25,13 +25,13 @@ function(ZFAddSrc ZF_LIB_NAMES_ LIB_NAME_ ZF_SRC_FILES_ PROJ_PATH_) "${PROJ_PATH_}/zfsrc_ext/*.cpp" ) set(${ZF_SRC_FILES_} ${${ZF_SRC_FILES_}} ${ZF_SRC_FILES_TMP} PARENT_SCOPE) - include_directories("${PROJ_PATH_}/zfsrc") + target_include_directories(ZFLoader PRIVATE "${PROJ_PATH_}/zfsrc") if(WIN32) - execute_process(COMMAND "${ZF_ROOT_PATH}\\tools\\util\\copy_res.bat" "${PROJ_PATH_}\\zfres\\" "${PROJECT_BINARY_DIR}\\zfres") + execute_process(COMMAND "${ZF_ROOT_PATH}\\tools\\util\\copy_res.bat" "${PROJ_PATH_}\\zfres\\" "${PROJECT_BINARY_DIR}\\dist\\zfres") else() - execute_process(COMMAND sh "${ZF_ROOT_PATH}/tools/util/copy_res.sh" "${PROJ_PATH_}/zfres/" "${PROJECT_BINARY_DIR}/zfres") + execute_process(COMMAND sh "${ZF_ROOT_PATH}/tools/util/copy_res.sh" "${PROJ_PATH_}/zfres/" "${PROJECT_BINARY_DIR}/dist/zfres") endif() -endfunction(ZFAddSrc) +endfunction() ZFAddSrc(ZF_LIB_NAMES ZFLoader ZF_SRC_FILES ${PROJECT_SOURCE_DIR}/../../..) @@ -78,3 +78,26 @@ foreach(LIB_NAME_ ${ZF_LIB_NAMES}) target_compile_definitions(ZFLoader PUBLIC ZFLIB_${LIB_NAME_}=) endforeach() +install(TARGETS ZFLoader EXPORT ZFLoader + LIBRARY DESTINATION "${PROJECT_BINARY_DIR}/dist" + ARCHIVE DESTINATION "${PROJECT_BINARY_DIR}/dist" + RUNTIME DESTINATION "${PROJECT_BINARY_DIR}/dist" + ) + +install(CODE [[ + file(GET_RUNTIME_DEPENDENCIES + EXECUTABLES "$" + RESOLVED_DEPENDENCIES_VAR _r_deps + POST_EXCLUDE_REGEXES + ".*system32.*" + ) + foreach(_file ${_r_deps}) + file(INSTALL + DESTINATION "$/dist" + TYPE SHARED_LIBRARY + FOLLOW_SYMLINK_CHAIN + FILES "${_file}" + ) + endforeach() + ]]) +