From 7303734b194ad5fe4feb032fb629352a99ed76fd Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Tue, 15 Jan 2019 16:56:33 +0100 Subject: [PATCH 1/2] removing static libs and changing flags --- CMakeLists.txt | 15 ++++++++++----- slsDetectorSoftware/CMakeLists.txt | 31 ++++++++++-------------------- slsReceiverSoftware/CMakeLists.txt | 15 ++++----------- 3 files changed, 24 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e6a6702b..e525f6d40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,16 @@ option (USE_RECEIVER "Receiver" OFF) option (USE_GUI "GUI" OFF) option (USE_TESTS "TESTS" ON) -if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation") -else () - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ") -endif () + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ") + + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # clang does not support -Wno-misleading-indentation +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation") +endif() + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread") set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread") diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt index f6f71d9a1..1e93cbb45 100644 --- a/slsDetectorSoftware/CMakeLists.txt +++ b/slsDetectorSoftware/CMakeLists.txt @@ -4,28 +4,19 @@ set(SOURCES slsDetector/slsDetectorUsers.cpp slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp - ../slsSupportLib/include/ClientInterface.cpp - ../slsSupportLib/include/utilities.cpp - ../slsSupportLib/src/string_utils.cpp + ${PROJECT_SOURCE_DIR}/slsSupportLib/include/ClientInterface.cpp + ${PROJECT_SOURCE_DIR}/slsSupportLib/include/utilities.cpp + ${PROJECT_SOURCE_DIR}/slsSupportLib/src/string_utils.cpp ) set(HEADERS ) include_directories( -../slsSupportLib/include -multiSlsDetector -sharedMemory -slsDetector -) - -add_library(slsDetectorStatic STATIC - ${SOURCES} - ${HEADERS} -) -set_target_properties(slsDetectorStatic PROPERTIES - ARCHIVE_OUTPUT_NAME SlsDetector - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + ${PROJECT_SOURCE_DIR}/slsSupportLib/include + multiSlsDetector + sharedMemory + slsDetector ) add_library(slsDetectorShared SHARED @@ -38,7 +29,6 @@ target_link_libraries(slsDetectorShared ) - set(PUBLICHEADERS ${PROJECT_SOURCE_DIR}/slsSupportLib/include/sls_detector_defs.h ${PROJECT_SOURCE_DIR}/slsSupportLib/include/sls_detector_funcs.h @@ -61,8 +51,6 @@ set_target_properties(slsDetectorShared PROPERTIES PUBLIC_HEADER "${PUBLICHEADERS}" ) - - add_subdirectory(slsDetectorClient) if(DOXYGEN_FOUND) @@ -75,7 +63,8 @@ if(DOXYGEN_FOUND) endif() -install(TARGETS slsDetectorShared slsDetectorStatic +install(TARGETS slsDetectorShared LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include - ARCHIVE DESTINATION lib) + ARCHIVE DESTINATION lib +) diff --git a/slsReceiverSoftware/CMakeLists.txt b/slsReceiverSoftware/CMakeLists.txt index f659522ce..f342c44df 100644 --- a/slsReceiverSoftware/CMakeLists.txt +++ b/slsReceiverSoftware/CMakeLists.txt @@ -41,15 +41,6 @@ include_directories( ) -add_library(slsReceiverStatic STATIC - ${SOURCES} - ${HEADERS} -) -set_target_properties(slsReceiverStatic PROPERTIES - ARCHIVE_OUTPUT_NAME SlsReceiver - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin -) - add_library(slsReceiverShared SHARED ${SOURCES} ${HEADERS} @@ -79,6 +70,7 @@ add_executable(slsReceiver set_target_properties(slsReceiver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) + target_link_libraries(slsReceiver slsReceiverShared pthread @@ -92,10 +84,11 @@ endif () -install(TARGETS slsReceiverShared slsReceiverStatic slsReceiver +install(TARGETS slsReceiverShared slsReceiver RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include) + PUBLIC_HEADER DESTINATION include +) \ No newline at end of file From 5e032c2c3e89b26194605b3c78e19eda8b9a415b Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Tue, 15 Jan 2019 17:03:04 +0100 Subject: [PATCH 2/2] added tests for compiler version --- CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e525f6d40..46c2769ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,16 +11,20 @@ option (USE_RECEIVER "Receiver" OFF) option (USE_GUI "GUI" OFF) option (USE_TESTS "TESTS" ON) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ") - - +#Testing for minimum version for compilers if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - # clang does not support -Wno-misleading-indentation + # clang does not support -Wno-misleading-indentation + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2) + message(FATAL_ERROR "Clang version must be at least 3.2!") + endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + message(FATAL_ERROR "GCC version must be at least 4.8!") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation") endif() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread") set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread") @@ -29,7 +33,6 @@ find_package(Qt4) find_package(Qwt 6) find_package(CBF) find_package(Doxygen) -# find_package(PNG REQUIRED) if (USE_HDF5) find_package(HDF5 1.10 COMPONENTS CXX) @@ -40,7 +43,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_INSTALL_RPATH "$ORIGIN") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - #zmq add_library(zmq STATIC IMPORTED GLOBAL) set(ZMQ_STATIC_ARCHIVE ${CMAKE_CURRENT_SOURCE_DIR}/slsSupportLib/include/libzmq.a) @@ -48,7 +50,6 @@ set_target_properties(zmq PROPERTIES IMPORTED_LOCATION ${ZMQ_STATIC_ARCHIVE} ) - if (USE_TEXTCLIENT) add_subdirectory(slsDetectorSoftware) endif (USE_TEXTCLIENT) @@ -57,8 +58,7 @@ if (USE_RECEIVER) add_subdirectory(slsReceiverSoftware) add_subdirectory(manual/manual-api) endif (USE_RECEIVER) - - + if (USE_GUI) if (QT4_FOUND AND QWT_FOUND) add_subdirectory(slsDetectorGui)