Skip to content

Commit

Permalink
Fixed dependency pack
Browse files Browse the repository at this point in the history
  • Loading branch information
synacker committed Sep 29, 2024
1 parent 5231072 commit 48ce0b3
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 67 deletions.
1 change: 1 addition & 0 deletions src/Daggy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ target_link_libraries(${TARGET} PRIVATE ${LINK_LIBRARIES})
target_precompile_headers(${TARGET} PRIVATE Precompiled.hpp)

install(TARGETS ${TARGET} RUNTIME)
include(package_deps)
2 changes: 1 addition & 1 deletion src/DaggyCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(TARGET DaggyCore)

find_package(Qt6 COMPONENTS Core Network REQUIRED)
add_library(${TARGET})

include(rpath_lib)

set_target_properties(${TARGET} PROPERTIES AUTOMOC ON)
Expand Down Expand Up @@ -115,3 +114,4 @@ else()
endif()

install(TARGETS ${TARGET} FILE_SET HEADERS)
include(package_deps)
2 changes: 0 additions & 2 deletions src/DaggyCore/tests/local/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set(SOURCES
main.cpp
)



qt6_add_executable(${TARGET} ${SOURCES})
include(rpath_bin)
add_test(NAME ${TARGET} COMMAND ${TARGET} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
Expand Down
9 changes: 6 additions & 3 deletions src/cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ else()
set(POSITION_INDEPENDENT_CODE OFF)
endif()

make_directory(${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
make_directory(${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})


make_directory(${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
make_directory(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
Expand All @@ -40,4 +44,3 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})



72 changes: 15 additions & 57 deletions src/cmake/package_deps.cmake
Original file line number Diff line number Diff line change
@@ -1,59 +1,17 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
if(UNIX AND NOT APPLE)
install(DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/daggy/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/daggy/
FILES_MATCHING
PATTERN libQt6Network.so*
PATTERN libQt6Core.so*
PATTERN libssh2.so*
PATTERN libyaml-cpp.so*
PATTERN libcrypto*.so*
)
elseif(APPLE)
install(DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/daggy/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/daggy/
FILES_MATCHING
PATTERN libQt6Network*dylib
PATTERN libQt6Core*dylib
PATTERN libssh2*dylib
PATTERN libyaml-cpp*dylib
PATTERN libcrypto*dylib
)
else()
install(TARGETS DaggyCore
DESTINATION ${CMAKE_INSTALL_BINDIR}
RUNTIME_DEPENDENCY_SET daggy_core_deps
)
if (PACKAGE_DEPS)
install(TARGETS ${TARGET}
RUNTIME_DEPENDENCY_SET ${TARGET}_deps
)

install(RUNTIME_DEPENDENCY_SET daggy_core_deps
PRE_EXCLUDE_REGEXES
[[api-ms-win-.*]]
[[ext-ms-.*]]
[[kernel32\.dll]]
POST_EXCLUDE_REGEXES
[[.*(\\|/)system32(\\|/).*\.dll]]
DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS} ${CONAN_LIB_DIRS}
)

if (CONSOLE)
install(TARGETS daggy
DESTINATION ${CMAKE_INSTALL_BINDIR}
RUNTIME_DEPENDENCY_SET daggy_deps
)

install(RUNTIME_DEPENDENCY_SET daggy_deps
PRE_EXCLUDE_REGEXES
[[api-ms-win-.*]]
[[ext-ms-.*]]
[[kernel32\.dll]]
POST_EXCLUDE_REGEXES
[[.*(\\|/)system32(\\|/).*\.dll]]
DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS} ${CONAN_LIB_DIRS}
)

install(FILES
${CMAKE_CURRENT_LIST_DIR}/daggyenv.bat
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
install(RUNTIME_DEPENDENCY_SET ${TARGET}_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=]
[=[ext-ms-]=]
[[kernel32\.dll]]
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=]
[=[^\/(lib|usr\/lib|usr\/local\/lib\/lib64)]=]
DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS} ${CONAN_LIB_DIRS}
)
endif()
4 changes: 2 additions & 2 deletions src/cmake/rpath_bin.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if(CONAN_BUILD)
if(APPLE)
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@executable_path/../${CMAKE_INSTALL_LIBDIR};@executable_path/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@executable_path/../${CMAKE_INSTALL_LIBDIR}")
elseif(UNIX)
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()
endif()
4 changes: 2 additions & 2 deletions src/cmake/rpath_lib.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if(CONAN_BUILD)
if(APPLE)
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@loader_path/${PROJECT_NAME}")
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@loader_path")
elseif(UNIX)
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN/${PROJECT_NAME}")
set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
endif()

0 comments on commit 48ce0b3

Please sign in to comment.