-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SKA-318: cmake install target improvements (#28)
- install target can now also be used with "--target install" (not only for "--target package") - output folder structure has been reworked for that purpose - updated readme.md and demo script accordingly
- Loading branch information
1 parent
501525c
commit 49a2add
Showing
9 changed files
with
117 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,11 @@ out/ | |
/out/ | ||
/.vs/ | ||
/build/ | ||
/_build/ | ||
/install/ | ||
/_install/ | ||
/Downloads/ | ||
/bin/ | ||
/lib/ | ||
/*/build/ | ||
/CMakeSettings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | |
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(SILKIT_ADAPTERS_VCAN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") | ||
set(SILKIT_ADAPTERS_VCAN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") | ||
set(SILKIT_ADAPTERS_VCAN_LIBRARY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib") | ||
|
||
set(SILKIT_VERSION "4.0.36" CACHE STRING "If no SIL Kit package is specified, this version will be downloaded") | ||
set(SILKIT_VERSION "4.0.42" CACHE STRING "If no SIL Kit package is specified, this version will be downloaded") | ||
set(SILKIT_FLAVOR "ubuntu-18.04-x86_64-gcc" CACHE STRING "If no SIL Kit package is specified, this package flavor will be downloaded") | ||
|
||
find_package(Threads REQUIRED) | ||
|
@@ -33,12 +34,11 @@ if(DEFINED SILKIT_PACKAGE_DIR) | |
else() | ||
# otherwise, look for an installed version of SIL Kit | ||
message(STATUS "SILKIT_PACKAGE_DIR has not been set by user. Attempting to find an installed version of SIL Kit") | ||
if(WIN32) | ||
# only look for installed version of SIL Kit (.msi) if environment is Windows | ||
find_package(SilKit 4.0.7 | ||
CONFIG | ||
) | ||
endif() | ||
|
||
find_package(SilKit 4.0.7 | ||
CONFIG | ||
) | ||
|
||
if(NOT SilKit_FOUND) | ||
# if installed SIL Kit is not found, fetch it from github.com | ||
message(STATUS "No installed version of SIL Kit was found. Attempting to fetch [SilKit-${SILKIT_VERSION}-${SILKIT_FLAVOR}] from github.com") | ||
|
@@ -86,43 +86,91 @@ add_subdirectory(SocketCAN/demos) | |
|
||
install( | ||
DIRECTORY | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN | ||
${CMAKE_CURRENT_SOURCE_DIR}/third_party | ||
DESTINATION . | ||
COMPONENT source | ||
EXCLUDE_FROM_ALL | ||
REGEX "\.git$" EXCLUDE | ||
REGEX "\.github$" EXCLUDE | ||
) | ||
|
||
install( | ||
DIRECTORY | ||
${CMAKE_CURRENT_SOURCE_DIR}/third_party | ||
DESTINATION . | ||
FILES | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN/demos/shell_scripts/OpenVCan_can0.sh | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN/demos/shell_scripts/SendSocketCANFrames.sh | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN/demos/shell_scripts/setup_vCAN_start_adapter_send_frames.sh | ||
DESTINATION SocketCAN/demos/shell_scripts | ||
PERMISSIONS | ||
OWNER_READ OWNER_WRITE OWNER_EXECUTE | ||
GROUP_READ GROUP_EXECUTE | ||
WORLD_READ WORLD_EXECUTE | ||
COMPONENT source | ||
REGEX "\.git$" EXCLUDE | ||
REGEX "\.github$" EXCLUDE | ||
EXCLUDE_FROM_ALL | ||
) | ||
|
||
install( | ||
FILES | ||
CMakeLists.txt | ||
CMakePresets.json | ||
DESTINATION . | ||
FILES | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN/demos/CANoe4SW_SE/run.sh | ||
${CMAKE_CURRENT_SOURCE_DIR}/SocketCAN/demos/CANoe4SW_SE/run_all.sh | ||
DESTINATION SocketCAN/demos/CANoe4SW_SE | ||
PERMISSIONS | ||
OWNER_READ OWNER_WRITE OWNER_EXECUTE | ||
GROUP_READ GROUP_EXECUTE | ||
WORLD_READ WORLD_EXECUTE | ||
COMPONENT source | ||
EXCLUDE_FROM_ALL | ||
) | ||
|
||
install( | ||
FILES | ||
CMakeLists.txt | ||
CMakePresets.json | ||
LICENSE | ||
README.md | ||
README.md | ||
SECURITY.md | ||
CONTRIBUTING.md | ||
DESTINATION . | ||
COMPONENT source | ||
EXCLUDE_FROM_ALL | ||
) | ||
|
||
include(GNUInstallDirs) | ||
|
||
install( | ||
DIRECTORY | ||
${SILKIT_ADAPTERS_VCAN_OUTPUT_DIRECTORY} | ||
DESTINATION build | ||
COMPONENT bin | ||
FILES | ||
${SILKIT_ADAPTERS_VCAN_LIBRARY_DIRECTORY}/libSilKit.so | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PERMISSIONS | ||
OWNER_READ OWNER_WRITE | ||
GROUP_READ | ||
WORLD_READ | ||
COMPONENT lib | ||
EXCLUDE_FROM_ALL | ||
) | ||
|
||
install( | ||
TARGETS | ||
SilKitDemoCanEchoDevice | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime | ||
PERMISSIONS | ||
OWNER_READ OWNER_WRITE OWNER_EXECUTE | ||
GROUP_READ GROUP_EXECUTE | ||
WORLD_READ WORLD_EXECUTE | ||
EXCLUDE_FROM_ALL | ||
) | ||
|
||
# only SilKitAdapterSocketCAN should be installed to /usr/local/bin by calling --target install (therefore it is not excluded) | ||
install( | ||
TARGETS | ||
SilKitAdapterSocketCAN | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/SilKitAdapterSocketCAN COMPONENT Development | ||
PERMISSIONS | ||
OWNER_READ OWNER_WRITE OWNER_EXECUTE | ||
GROUP_READ GROUP_EXECUTE | ||
WORLD_READ WORLD_EXECUTE | ||
) | ||
|
||
############################################################################### | ||
|
@@ -137,4 +185,8 @@ set(CPACK_PACKAGE_VENDOR "Vector Informatik") | |
set(CPACK_PACKAGE_CONTACT "[email protected]") | ||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}${PACKAGE_FILENAME_SUFFIX}") | ||
|
||
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) | ||
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) | ||
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY ON) | ||
|
||
include(CPack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters