mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	Add building option ENABLE_STRIP to enable the generation of stripped binaries (without debgging information). Set to OFF by default
This commit is contained in:
		| @@ -75,10 +75,17 @@ option(ENABLE_LOG "Enable logging" ON) | ||||
|  | ||||
| option(ENABLE_ARMA_NO_DEBUG OFF) | ||||
|  | ||||
| option(ENABLE_STRIP "Create stripped binaries without debugging symbols, potentially smaller in size (GCC-only, Release build mode)" OFF) | ||||
|  | ||||
| if((NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) OR WIN32) | ||||
|     set(ENABLE_STRIP OFF) | ||||
| endif() | ||||
|  | ||||
| if(ENABLE_PACKAGING) | ||||
|     set(ENABLE_GENERIC_ARCH ON) | ||||
|     set(ENABLE_ARMA_NO_DEBUG ON) | ||||
|     set(CMAKE_VERBOSE_MAKEFILE ON) | ||||
|     set(ENABLE_STRIP OFF) | ||||
| endif() | ||||
|  | ||||
| # Testing | ||||
| @@ -221,6 +228,9 @@ else() | ||||
| endif() | ||||
| gnsssdr_check_build_type(${CMAKE_BUILD_TYPE}) | ||||
| set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") | ||||
| if(NOT (${CMAKE_BUILD_TYPE} STREQUAL "Release")) | ||||
|     set(ENABLE_STRIP OFF) | ||||
| endif() | ||||
|  | ||||
| # Enable optimization options in GCC for Release and RelWithDebInfo build types | ||||
| if((${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) | ||||
| @@ -886,13 +896,10 @@ if(NOT VOLKGNSSSDR_FOUND) | ||||
|     endif() | ||||
|  | ||||
|     set(STRIP_VOLK_GNSSSDR_PROFILE "") | ||||
|     if(ENABLE_PACKAGING) | ||||
|     if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) | ||||
|             if(CMAKE_CROSSCOMPILING) | ||||
|                 set(STRIP_VOLK_GNSSSDR_PROFILE "-DENABLE_STRIP=OFF -DCMAKE_VERBOSE_MAKEFILE=ON") | ||||
|             else() | ||||
|                 set(STRIP_VOLK_GNSSSDR_PROFILE "-DENABLE_STRIP=ON -DCMAKE_VERBOSE_MAKEFILE=ON") | ||||
|             endif() | ||||
|         set(STRIP_VOLK_GNSSSDR_PROFILE "-DENABLE_STRIP=${ENABLE_STRIP}") | ||||
|         if(ENABLE_PACKAGING) | ||||
|             set(STRIP_VOLK_GNSSSDR_PROFILE "${STRIP_VOLK_GNSSSDR_PROFILE} -DCMAKE_VERBOSE_MAKEFILE=ON") | ||||
|         endif() | ||||
|     endif() | ||||
|  | ||||
| @@ -2917,6 +2924,7 @@ add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging." | ||||
| add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.") | ||||
| add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.") | ||||
| add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging with Google glog.") | ||||
| add_feature_info(ENABLE_STRIP ENABLE_STRIP "Enables the generation of stripped binaries (without debugging symbols).") | ||||
| add_feature_info(ENABLE_UNIT_TESTING ENABLE_UNIT_TESTING "Enables building of Unit Tests.") | ||||
| add_feature_info(ENABLE_UNIT_TESTING_MINIMAL ENABLE_UNIT_TESTING_MINIMAL "Enables building a minimal set of Unit Tests.") | ||||
| add_feature_info(ENABLE_UNIT_TESTING_EXTRA ENABLE_UNIT_TESTING_EXTRA "Enables building of Extra Unit Tests and downloading of external data files.") | ||||
|   | ||||
| @@ -15,6 +15,10 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc | ||||
| - Faster internal handling of `Gnss_Synchro` objects by reducing the amount of | ||||
|   copying via adding `noexcept` move constructor and move assignment operators, | ||||
|   so the move semantics are also used in STL containers. | ||||
| - Add building option `ENABLE_STRIP` to generate stripped binaries (that is, | ||||
|   without debugging symbols), smaller in size and potentially providing better | ||||
|   performance than non-stripped counterparts. Only for GCC in Release build | ||||
|   mode. Set to `OFF` by default. | ||||
|  | ||||
| ### Improvements in Maintainability: | ||||
|  | ||||
|   | ||||
| @@ -170,7 +170,7 @@ endif() | ||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS} -Wall") | ||||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") | ||||
|  | ||||
| option(ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without shared libraries)" OFF) | ||||
| option(ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without debugging symbols)" OFF) | ||||
| if(ENABLE_STRIP) | ||||
|     set(CMAKE_VERBOSE_MAKEFILE ON) | ||||
| endif() | ||||
|   | ||||
| @@ -68,13 +68,14 @@ endif() | ||||
|  | ||||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||||
|     if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||||
|         target_link_libraries(gnss-sdr | ||||
|             PRIVATE | ||||
|                 "-lc++" | ||||
|         ) | ||||
|         target_link_libraries(gnss-sdr PRIVATE "-lc++") | ||||
|     endif() | ||||
| endif() | ||||
|  | ||||
| if(ENABLE_STRIP) | ||||
|     set_target_properties(gnss-sdr PROPERTIES LINK_FLAGS "-s") | ||||
| endif() | ||||
|  | ||||
| if(ENABLE_CLANG_TIDY) | ||||
|     if(CLANG_TIDY_EXE) | ||||
|         set_target_properties(gnss-sdr | ||||
|   | ||||
| @@ -507,6 +507,9 @@ if(ENABLE_UNIT_TESTING) | ||||
|     if(ENABLE_UNIT_TESTING_EXTRA) | ||||
|         target_link_libraries(run_tests PRIVATE Gpstk::gpstk) | ||||
|     endif() | ||||
|     if(ENABLE_STRIP) | ||||
|         set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s") | ||||
|     endif() | ||||
|     if(ENABLE_INSTALL_TESTS) | ||||
|         if(EXISTS ${CMAKE_SOURCE_DIR}/install/run_tests) | ||||
|             file(REMOVE ${CMAKE_SOURCE_DIR}/install/run_tests) | ||||
| @@ -653,6 +656,10 @@ function(add_system_test executable) | ||||
|         ) | ||||
|     endif() | ||||
|  | ||||
|     if(ENABLE_STRIP) | ||||
|         set_target_properties(${executable} PROPERTIES LINK_FLAGS "-s") | ||||
|     endif() | ||||
|  | ||||
|     if(ENABLE_INSTALL_TESTS) | ||||
|         if(EXISTS ${CMAKE_SOURCE_DIR}/install/${executable}) | ||||
|             file(REMOVE ${CMAKE_SOURCE_DIR}/install/${executable}) | ||||
|   | ||||
| @@ -107,6 +107,10 @@ if(Boost_VERSION_STRING VERSION_GREATER 1.72.99) | ||||
|     ) | ||||
| endif() | ||||
|  | ||||
| if(ENABLE_STRIP) | ||||
|     set_target_properties(front-end-cal PROPERTIES LINK_FLAGS "-s") | ||||
| endif() | ||||
|  | ||||
| if(ENABLE_CLANG_TIDY) | ||||
|     if(CLANG_TIDY_EXE) | ||||
|         set_target_properties(front-end-cal | ||||
|   | ||||
| @@ -72,6 +72,10 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND | ||||
|             ${GPSTK_INCLUDE_DIR} | ||||
|     ) | ||||
|  | ||||
|     if(ENABLE_STRIP) | ||||
|         set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s") | ||||
|     endif() | ||||
|  | ||||
|     add_custom_command(TARGET obsdiff POST_BUILD | ||||
|         COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:obsdiff> | ||||
|         ${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:obsdiff> | ||||
|   | ||||
| @@ -97,6 +97,10 @@ if(Boost_FOUND) | ||||
|         add_dependencies(rinex2assist gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) | ||||
|     endif() | ||||
|  | ||||
|     if(ENABLE_STRIP) | ||||
|         set_target_properties(rinex2assist PROPERTIES LINK_FLAGS "-s") | ||||
|     endif() | ||||
|  | ||||
|     add_custom_command(TARGET rinex2assist POST_BUILD | ||||
|         COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:rinex2assist> | ||||
|             ${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:rinex2assist> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez