diff --git a/CMakeLists.txt b/CMakeLists.txt index 352bf28ffc9c0af7011b5ed07683a9e01b0eb631..62ab32e9831217a2219cf884f3e9b869d0ee04ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,11 +23,41 @@ if(SASS_ENABLE_SANITIZERS) endif() endif() +# Add the "-Werror" compiler flag to the specified target +function(add_werror target) + if(NOT MSVC) + target_compile_options(${target} PRIVATE -Werror -Wno-error=deprecated-declarations -Wundef) + check_cxx_compiler_flag("-Werror -Wsuggest-override" CXX_SUPPORTS_SUGGEST_OVERRIDE) + if(CXX_SUPPORTS_SUGGEST_OVERRIDE) + target_compile_options(${target} PRIVATE "-Wsuggest-override") + endif() + # If we call directly -Wimplicit-fallthrough it's use it as a error ! not a warning + # we need to tell gcc that we can't want to manage it as error + # If code is ok we need to add [[fallthrough]]; before code + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_options(${target} PRIVATE -Wno-error=implicit-fallthrough -Wimplicit-fallthrough) + endif() + endif() +endfunction() + +if(SASS_USE_WERROR) + add_werror(SassenaCore) + add_werror(sassena) +endif() + +if (SASS_BUILD_DOCS) + add_subdirectory(docs) +endif() + include(ExternalProject) include(FeatureSummary) include(GenerateExportHeader) include(GNUInstallDirs) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +configure_file(cmake/SassenaConfig.hpp.cmake ${CMAKE_CURRENT_BINARY_DIR}/generated/SassenaConfig.hpp @ONLY) + if(USE_DEVELOPER_MODE) find_package(Doxygen) set_package_properties( diff --git a/src/app/SassenaConfig.hpp.cmake b/cmake/SassenaConfig.hpp.cmake similarity index 100% rename from src/app/SassenaConfig.hpp.cmake rename to cmake/SassenaConfig.hpp.cmake diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 65812865d1e3b6651392c1f5582ef54034e2b789..603c90ae24bb428c5ca17aada59dab1224993dcf 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -1,41 +1,15 @@ - -configure_file( - "SassenaConfig.hpp.cmake" - "SassenaConfig.hpp" @ONLY -) - -set(sassena_SRCS - s_stage.cpp - sassena.cpp - s_maketnx.cpp -) - -set(common_SRCS - common.hpp - common.cpp -) - add_executable(sassena sassena.cpp - ${common_SRCS} ) add_executable(s_stage s_stage.cpp - ${common_SRCS} ) - add_executable(s_maketnx s_maketnx.cpp - ${common_SRCS} ) -# ADD_EXECUTABLE(unit_broadcast -# src/common.cpp -# tests/unit_broadcast.cpp -# ) - target_link_libraries (sassena PRIVATE SassenaCore @@ -54,5 +28,4 @@ TARGET_LINK_LIBRARIES (s_stage SassenaCore ) - install(TARGETS sassena s_maketnx s_stage) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e64b0b78dd2a3de2028e76e3d6a2604c529c4d46..413d65864870d99874dc4b38e14cd44454864e5e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,4 +1,3 @@ - if(CRAY) set(CMAKE_CXX_COMPILER /opt/cray/xt-asyncpe/3.7/bin/CC) message(STATUS "Cray is chosen.") @@ -126,6 +125,7 @@ target_include_directories( $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sample> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/stager> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/scatter_devices> + $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated> PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/math