From e9f55e2f319101f8eb93a9a6b08920b8c28d4af6 Mon Sep 17 00:00:00 2001 From: Matej Ferencevic Date: Wed, 11 Dec 2019 11:08:25 +0100 Subject: [PATCH] Strip query modules in release build Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2599 --- query_modules/CMakeLists.txt | 9 +++++++++ query_modules/connectivity/CMakeLists.txt | 8 ++++++++ query_modules/louvain/CMakeLists.txt | 8 ++++++++ tools/src/CMakeLists.txt | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/query_modules/CMakeLists.txt b/query_modules/CMakeLists.txt index a7fd08658..bbdbcdd39 100644 --- a/query_modules/CMakeLists.txt +++ b/query_modules/CMakeLists.txt @@ -12,6 +12,15 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "query_modules") add_library(example SHARED example.c) target_include_directories(example PRIVATE ${CMAKE_SOURCE_DIR}/include) target_compile_options(example PRIVATE -Wall) + +# Strip the library in release build. +string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type) +if (lower_build_type STREQUAL "release") + add_custom_command(TARGET example POST_BUILD + COMMAND strip -s $ + COMMENT "Stripping symbols and sections from example module") +endif() + install(PROGRAMS $ DESTINATION lib/memgraph/query_modules RENAME example.so) diff --git a/query_modules/connectivity/CMakeLists.txt b/query_modules/connectivity/CMakeLists.txt index ed3e730bd..185d747a5 100644 --- a/query_modules/connectivity/CMakeLists.txt +++ b/query_modules/connectivity/CMakeLists.txt @@ -5,6 +5,14 @@ include_directories(src) add_library(connectivity SHARED ${MODULE}) target_include_directories(connectivity PRIVATE ${CMAKE_SOURCE_DIR}/include) +# Strip the library in release build. +string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type) +if (lower_build_type STREQUAL "release") + add_custom_command(TARGET connectivity POST_BUILD + COMMAND strip -s $ + COMMENT "Stripping symbols and sections from connectivity module") +endif() + install(PROGRAMS $ DESTINATION lib/memgraph/query_modules RENAME connectivity.so) diff --git a/query_modules/louvain/CMakeLists.txt b/query_modules/louvain/CMakeLists.txt index 9329f816d..aff268e9b 100644 --- a/query_modules/louvain/CMakeLists.txt +++ b/query_modules/louvain/CMakeLists.txt @@ -18,6 +18,14 @@ add_library(louvain SHARED ${MODULE}) target_link_libraries(louvain louvain-core) target_include_directories(louvain PRIVATE ${CMAKE_SOURCE_DIR}/include) +# Strip the library in release build. +string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type) +if (lower_build_type STREQUAL "release") + add_custom_command(TARGET louvain POST_BUILD + COMMAND strip -s $ + COMMENT "Stripping symbols and sections from louvain module") +endif() + if (NOT MG_COMMUNITY) install(PROGRAMS $ DESTINATION lib/memgraph/query_modules diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt index 82c332ff0..fa1546287 100644 --- a/tools/src/CMakeLists.txt +++ b/tools/src/CMakeLists.txt @@ -25,10 +25,10 @@ string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type) if (lower_build_type STREQUAL "release") add_custom_command(TARGET mg_import_csv POST_BUILD COMMAND strip -s mg_import_csv - COMMENT Stripping symbols and sections from mg_import_csv) + COMMENT "Stripping symbols and sections from mg_import_csv") add_custom_command(TARGET mg_client POST_BUILD COMMAND strip -s mg_client - COMMENT Stripping symbols and sections from mg_client) + COMMENT "Stripping symbols and sections from mg_client") endif() # TODO (mferencevic): Currently the `mg_import_csv` tool is tailored to the old