Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ZSaberLv0 committed Nov 26, 2024
1 parent ad82723 commit edbaa02
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ZFLoader/zfproj/Android/ZFLoader/zfapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 13 additions & 12 deletions ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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")
add_compile_options("$<$<CONFIG:DEBUG>:-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)

Expand All @@ -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)
Expand All @@ -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"
)

Original file line number Diff line number Diff line change
Expand Up @@ -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}/../../../..)

Expand Down
33 changes: 28 additions & 5 deletions ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.1)
cmake_minimum_required(VERSION 3.16)
project(ZFLoader)

if(WIN32)
Expand All @@ -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}/../../..)

Expand Down Expand Up @@ -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 "$<TARGET_FILE:ZFLoader>"
RESOLVED_DEPENDENCIES_VAR _r_deps
POST_EXCLUDE_REGEXES
".*system32.*"
)
foreach(_file ${_r_deps})
file(INSTALL
DESTINATION "$<TARGET_FILE_DIR:ZFLoader>/dist"
TYPE SHARED_LIBRARY
FOLLOW_SYMLINK_CHAIN
FILES "${_file}"
)
endforeach()
]])

0 comments on commit edbaa02

Please sign in to comment.