From feaad6335d17f78229d04be9f0b79f5989dd3076 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 2 Jun 2022 00:15:21 -0400 Subject: [PATCH] build: Set up cmake 'install' build target The 'install' build target creates a self-contained (deployable) sparkd package. It copies the sparkd executable and its dependencies into a single directory (no symlinks), which can then be copied/deployed to another machine. Run `cmake --build . --target install` to install sparkd in the directory defined by the CMAKE_INSTALL_PREFIX variable. --- CMakeLists.txt | 3 +++ src/lib/CMakeLists.txt | 4 +++- src/server/sparkd/CMakeLists.txt | 2 ++ src/web/CMakeLists.txt | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ae7045da..f200e516f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,4 +70,7 @@ else () DEPENDS sparkd data_files_dir) add_custom_target(server_layout ALL DEPENDS ${CMAKE_BINARY_DIR}/server) + + install(FILES "${CMAKE_SOURCE_DIR}/externals/linux/lib/${CMAKE_BUILD_TYPE}/libACE-5.7.5.so" DESTINATION bin) + install(FILES "${CMAKE_SOURCE_DIR}/externals/linux/lib/${CMAKE_BUILD_TYPE}/libOnixS.IceImpactMulticastPriceFeedHandlerCpp.so.3.16.0.0" DESTINATION bin) endif() diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index c255c0b57..3d0a366db 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -135,7 +135,9 @@ else () -ldl -static-libgcc -static-libstdc++ - -pthread) + -pthread) + + install(TARGETS libspark DESTINATION bin) endif() if (WIN32) diff --git a/src/server/sparkd/CMakeLists.txt b/src/server/sparkd/CMakeLists.txt index cc9754766..decd1cbdb 100644 --- a/src/server/sparkd/CMakeLists.txt +++ b/src/server/sparkd/CMakeLists.txt @@ -41,3 +41,5 @@ target_link_libraries( sparkd add_custom_command(TARGET sparkd POST_BUILD COMMAND ln -fs ${CMAKE_BINARY_DIR}/src/lib/libspark.so ${CMAKE_CURRENT_BINARY_DIR}) + +install(TARGETS sparkd DESTINATION bin) diff --git a/src/web/CMakeLists.txt b/src/web/CMakeLists.txt index c50352a88..2fd284f54 100644 --- a/src/web/CMakeLists.txt +++ b/src/web/CMakeLists.txt @@ -32,3 +32,4 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/web/ui/bundle.js add_custom_target(web_ui_bundle ALL DEPENDS ${CMAKE_BINARY_DIR}/web/ui/bundle.js) +install(DIRECTORY "${CMAKE_BINARY_DIR}/web" DESTINATION bin)