Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#Would prefer to make this 3.1, as it makes C++ dialect selection automatic.
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.9)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
Expand All @@ -8,23 +7,18 @@ RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)

project (DDESimulatorTemplate CXX C)
#Would prefer to use CMAKE_CXX_STANDARD in CMake 3.1, but not yet
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
project (DDESimulatorTemplate LANGUAGES CXX;C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

string(REPLACE ";" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} "
"-g -fconcepts -pedantic -fmax-errors=3 -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy "
"-Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs "
"-Wnoexcept -Woverloaded-virtual -Wredundant-decls -Wstrict-null-sentinel -Wstrict-overflow=5 "
"-Wswitch-default -Wundef -Wunused -Wzero-as-null-pointer-constant -Wuseless-cast -Wsuggest-override")
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

#Checking if compiler has OpenMP Support
find_package(OpenMP REQUIRED)

set(Real "double" CACHE STRING "dense::Real")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDENSE_CONFIGURABLE_Real=\"${Real}\"")
Expand Down
6 changes: 5 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function(SIMCORELIB localname simdir)

target_include_directories(${localname} PUBLIC ${simdir})
target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source)
target_link_libraries(${localname} PRIVATE OpenMP::OpenMP_CXX)
endif (NOT TARGET ${localname})
endfunction(SIMCORELIB localname simdir)

Expand All @@ -35,6 +36,7 @@ function(SIMULATION localname simdir)
target_include_directories(${localname} PUBLIC ${simdir})
target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source)
target_link_libraries(${localname} PUBLIC ${localname}_lib)
target_link_libraries(${localname} PRIVATE OpenMP::OpenMP_CXX)
endfunction(SIMULATION localname simdir)

function(CUDASIMCORELIB localname simdir)
Expand Down Expand Up @@ -85,6 +87,7 @@ function(PARAM_SEARCH_LIB localname simdir)
${PROJECT_SOURCE_DIR}/source/search/sres.cpp)
target_include_directories(${localname} PUBLIC ${simdir})
target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source)
target_link_libraries(${localname} PRIVATE OpenMP::OpenMP_CXX)
endif (NOT TARGET ${localname})
endfunction(PARAM_SEARCH_LIB localname simdir)

Expand Down Expand Up @@ -127,7 +130,8 @@ if( ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${PROJECT_BINARY_DIR}/source)
if (EXISTS ${PROJECT_BINARY_DIR}/param_search_main.cpp)
PARAM_SEARCH(paramsearch_lib ${PROJECT_BINARY_DIR})
add_executible(paramsearch ${PROJECT_BINARY_DIR}/param_search_main.cpp)
target_link_libraries(paramsearch paramsearch_lib simulation_lib)
target_link_libraries(paramsearch PUBLIC paramsearch_lib simulation_lib)
target_link_libraries(paramsearch PRIVATE OpenMP::OpenMP_CXX)
endif (EXISTS ${PROJECT_BINARY_DIR}/param_search_main.cpp)
endif (${BUILD_TESTS_ONLY})
#add_test(ctest_simulation main -p ../param_list.csv -c 200 -w 50 -s 0.01 -a 0.1 -r 10 -t 60 -e ../data_out.csv)
Expand Down