diff --git a/.gitignore b/.gitignore index ee391713..3450948f 100755 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,6 @@ build/ *.so* *.a *.exe* -*.rpm* packages/ coverage/ diff --git a/CMakeLists.txt b/CMakeLists.txt index cdb0908d..79b39258 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,8 @@ OPTION (BUILD_UNIT_TESTS "Build tests" ON) OPTION (BUILD_PYTHON_BINDINGS "Build Python bindings." ON) OPTION (BUILD_CODE_COVERAGE "Build code coverage" OFF) OPTION (BUILD_DOCUMENTATION "Build documentation" OFF) -OPTION (BUILD_WITH_CLANG_COMPILER "Use Clang compiler." ON) +OPTION (BUILD_WITH_CLANG_COMPILER "Use Clang compiler." OFF) +OPTION (BUILD_WITH_DEBUG_SYMBOLS "Build with debug symbols." ON) ## Setup @@ -113,7 +114,7 @@ MESSAGE (STATUS "C++ compiler: ${CMAKE_CXX_COMPILER}") PROJECT (${PROJECT_NAME} VERSION ${PROJECT_VERSION_STRING} LANGUAGES "C" "CXX") -SET (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Limited Configs" FORCE) +SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo" CACHE STRING "Limited Configs" FORCE) IF (BUILD_CODE_COVERAGE) SET (CMAKE_BUILD_TYPE "Debug") @@ -135,6 +136,10 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wshadow -Wno-deprecated") +ELSE () + + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wshadow") + ENDIF () ### C++ 17 support @@ -143,7 +148,15 @@ SET (CMAKE_CXX_STANDARD 17) SET (CMAKE_CXX_STANDARD_REQUIRED ON) SET (CMAKE_CXX_EXTENSIONS OFF) -## Debugging Options +### Debug symbols + +IF (BUILD_WITH_DEBUG_SYMBOLS) + + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + +ENDIF () + +### Debugging Options SET (CMAKE_VERBOSE_MAKEFILE 0) # Use 1 for debugging, 0 for release @@ -219,7 +232,11 @@ ENDFOREACH () SET (Boost_USE_STATIC_LIBS ON) SET (Boost_USE_MULTITHREADED ON) -FIND_PACKAGE ("Boost" "1.82" REQUIRED COMPONENTS "system" "filesystem" "regex" "log" "stacktrace_basic") +FIND_PACKAGE ("Boost" "1.82" REQUIRED COMPONENTS "system" "filesystem" "regex" "log" "stacktrace_backtrace") + +## Stacktrace definitions + +ADD_DEFINITIONS(-DBOOST_STACKTRACE_USE_BACKTRACE -DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=) IF (NOT Boost_FOUND) MESSAGE (SEND_ERROR "[Boost] not found.") @@ -278,10 +295,8 @@ IF (BUILD_SHARED_LIBRARY) TARGET_INCLUDE_DIRECTORIES (${SHARED_LIBRARY_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/include/") TARGET_INCLUDE_DIRECTORIES (${SHARED_LIBRARY_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/src/") - TARGET_LINK_LIBRARIES (${SHARED_LIBRARY_TARGET} "stdc++") TARGET_LINK_LIBRARIES (${SHARED_LIBRARY_TARGET} "pthread") - TARGET_LINK_LIBRARIES (${SHARED_LIBRARY_TARGET} "Boost::filesystem" "Boost::log" ${Boost_STACKTRACE_BASIC_LIBRARY}) - TARGET_LINK_LIBRARIES (${SHARED_LIBRARY_TARGET} "dl") + TARGET_LINK_LIBRARIES (${SHARED_LIBRARY_TARGET} "Boost::filesystem" "Boost::log" ${Boost_STACKTRACE_BACKTRACE_LIBRARY}) TARGET_LINK_LIBRARIES (${SHARED_LIBRARY_TARGET} "yaml-cpp") SET_TARGET_PROPERTIES ( ${SHARED_LIBRARY_TARGET} PROPERTIES @@ -312,8 +327,7 @@ IF (BUILD_STATIC_LIBRARY) TARGET_INCLUDE_DIRECTORIES (${STATIC_LIBRARY_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/include/") TARGET_LINK_LIBRARIES (${STATIC_LIBRARY_TARGET} "pthread") - TARGET_LINK_LIBRARIES (${STATIC_LIBRARY_TARGET} "Boost::filesystem" "Boost::log" ${Boost_STACKTRACE_BASIC_LIBRARY}) - TARGET_LINK_LIBRARIES (${STATIC_LIBRARY_TARGET} "dl") + TARGET_LINK_LIBRARIES (${STATIC_LIBRARY_TARGET} "Boost::filesystem" "Boost::log" ${Boost_STACKTRACE_BACKTRACE_LIBRARY}) TARGET_LINK_LIBRARIES (${STATIC_LIBRARY_TARGET} "yaml-cpp") SET_TARGET_PROPERTIES (${STATIC_LIBRARY_TARGET} PROPERTIES VERSION ${PROJECT_VERSION_STRING} OUTPUT_NAME ${SHARED_LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1 INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/") @@ -341,8 +355,7 @@ IF (BUILD_UTILITY) TARGET_INCLUDE_DIRECTORIES (${UTILITY_TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/include/") TARGET_LINK_LIBRARIES (${UTILITY_TARGET} "pthread") - TARGET_LINK_LIBRARIES (${UTILITY_TARGET} "Boost::filesystem" "Boost::log" ${Boost_STACKTRACE_BASIC_LIBRARY}) - TARGET_LINK_LIBRARIES (${UTILITY_TARGET} "dl") + TARGET_LINK_LIBRARIES (${UTILITY_TARGET} "Boost::filesystem" "Boost::log" ${Boost_STACKTRACE_BACKTRACE_LIBRARY}) TARGET_LINK_LIBRARIES (${UTILITY_TARGET} ${SHARED_LIBRARY_TARGET}) SET_TARGET_PROPERTIES (${UTILITY_TARGET} PROPERTIES VERSION ${PROJECT_VERSION_STRING} OUTPUT_NAME ${SHARED_LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1 INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/") @@ -522,20 +535,5 @@ SET (CPACK_COMPONENT_GROUP_PYTHON_DESCRIPTION "Python bindings") SET (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) SET (CPACK_DEB_COMPONENT_INSTALL "ON") -SET (CPACK_RPM_COMPONENT_INSTALL "ON") - -SET (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST - /usr - /usr/bin - /usr/include - /usr/lib - /usr/share - /usr/local - /usr/local/bin - /usr/local/include - /usr/local/lib - /usr/local/share - /usr/share/man -) INCLUDE (CPack) diff --git a/Makefile b/Makefile index 0dd0daea..87092d77 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,7 @@ build-packages-cpp-standalone: ## Build C++ packages (standalone) --volume="/app/build" \ --workdir=/app/build \ $(docker_development_image_repository):$(docker_image_version) \ - /bin/bash -c "cmake -DBUILD_WITH_CLANG_COMPILER=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DCPACK_GENERATOR=DEB .. \ + /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DCPACK_GENERATOR=DEB .. \ && $(MAKE) package \ && mkdir -p /app/packages/cpp \ && mv /app/build/*.deb /app/packages/cpp" @@ -221,7 +221,7 @@ build-packages-python-standalone: ## Build Python packages (standalone) --volume="/app/build" \ --workdir=/app/build \ $(docker_development_image_repository):$(docker_image_version) \ - /bin/bash -c "cmake -DBUILD_WITH_CLANG_COMPILER=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=ON .. \ + /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=ON .. \ && $(MAKE) -j 4 \ && mkdir -p /app/packages/python \ && mv /app/build/bindings/python/dist/*.whl /app/packages/python" @@ -471,7 +471,7 @@ test-coverage-cpp-standalone: ## Run C++ tests with coverage (standalone) --volume="/app/build" \ --workdir=/app/build \ $(docker_development_image_repository):$(docker_image_version) \ - /bin/bash -c "cmake -DBUILD_WITH_CLANG_COMPILER=OFF -DBUILD_UNIT_TESTS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_CODE_COVERAGE=ON .. \ + /bin/bash -c "cmake -DBUILD_UNIT_TESTS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_CODE_COVERAGE=ON .. \ && $(MAKE) -j $(nproc) \ && $(MAKE) coverage \ && (rm -rf /app/coverage || true) \