Skip to content

Commit 3058bff

Browse files
committed
fmk - moving to traditional CMAkeLists files for better readability and integration with IDE's of applications in SimCenterBAckend
1 parent e3f8675 commit 3058bff

158 files changed

Lines changed: 737 additions & 1980 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 45 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,52 @@
1-
############################################################################################################################
2-
##
3-
## SimCenterBackendApplications main cmake file
4-
##
5-
## Contents:
6-
## - Definition of build options
7-
## - Compiler variables ( c++ standard, warnings etc. )
8-
## - Finding of service libraries. Required: Intel MKL, Intel IPP
9-
## the include paths are set, and the libraries are added to variable SERVICE_LIBS
10-
## - Subdirectory cmake lists are called
11-
## -> createEDP/ Contains all modules for creating engineering demand parameters
12-
## -> createEVENT/ Contains all modules for creating natural hazard events
13-
## -> createSAM/ Contains all modules for creating structural analysis model
14-
## -> performDL/ Contains all modules for performing damage and loss assessment
15-
## -> performSIMULATION/ Contains all modules for performing structural simulation
16-
## -> performUQ/ Contains all modules for uncertainty quantification
17-
##
18-
############################################################################################################################
1+
cmake_minimum_required(VERSION 3.15)
2+
project(SimCenterBackendApplications C CXX)
193

4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
set(CMAKE_CXX_EXTENSIONS OFF)
207

21-
############################################################################################################################
22-
##
23-
## Project name, version, Custom CMake functions
24-
##
25-
############################################################################################################################
26-
27-
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
28-
PROJECT(SimCenterBackendApplications)
29-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
30-
set(CMAKE_VERBOSE_MAKEFILE ON)
31-
set (CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE)
32-
SET (CONAN_DISABLE_CHECK_COMPILER ON)
33-
include(SimCenterFunctions)
34-
include(CMakeParseArguments)
35-
36-
# set(CMAKE_CXX_STANDARD 11)
378
set(CMAKE_COLOR_MAKEFILE ON)
38-
set(CMAKE_VERBOSE_MAKEFILE OF)
39-
40-
if (NOT CMAKE_BUILD_TYPE)
41-
set(CMAKE_BUILD_TYPE "Debug")
42-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g")
43-
endif (NOT CMAKE_BUILD_TYPE)
44-
45-
############################################################################################################################
46-
##
47-
## Definition of build options
48-
##
49-
############################################################################################################################
50-
# Currently no tests to build, so turn this off
51-
option(BUILD_TESTING "Enable testing for stochastic module" OFF)
52-
53-
# Every folder that is listed here can contain modules or tests
54-
# this can be extended by applications to have own modules
55-
list(APPEND SIMCENTER_MODULE_DIRS "${PROJECT_SOURCE_DIR}/modules")
56-
list(REMOVE_DUPLICATES SIMCENTER_MODULE_DIRS )
57-
set(SIMCENTER_MODULE_DIRS ${SIMCENTER_MODULE_DIRS} CACHE INTERNAL "All folders that contain modules or tests" )
58-
59-
# Bring in dependencies from Conan, only getting required libs for Intel MKL and IPP
60-
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
61-
conan_basic_setup(TARGETS)
9+
set(CMAKE_VERBOSE_MAKEFILE ON)
6210

63-
############################################################################################################################
64-
##
65-
## Subdirectories
66-
##
67-
############################################################################################################################
11+
include(${CMAKE_BINARY_DIR}/conan_toolchain.cmake)
12+
13+
# On macOS, Apple Clang ships without OpenMP. Homebrew's libomp provides it but
14+
# is keg-only, so we must hint CMake before find_package(OpenMP) is called anywhere.
15+
if(APPLE)
16+
find_program(_brew brew)
17+
if(_brew)
18+
execute_process(COMMAND ${_brew} --prefix libomp
19+
OUTPUT_VARIABLE _libomp_prefix
20+
OUTPUT_STRIP_TRAILING_WHITESPACE
21+
ERROR_QUIET)
22+
if(_libomp_prefix AND EXISTS "${_libomp_prefix}")
23+
# Flags for FindOpenMP — no -I here, handled separately below
24+
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp")
25+
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp")
26+
set(OpenMP_CXX_LIB_NAMES "omp")
27+
set(OpenMP_C_LIB_NAMES "omp")
28+
set(OpenMP_omp_LIBRARY "${_libomp_prefix}/lib/libomp.dylib")
29+
# Make omp.h findable for any target in the build
30+
include_directories(SYSTEM "${_libomp_prefix}/include")
31+
link_directories("${_libomp_prefix}/lib")
32+
message(STATUS "macOS: using Homebrew libomp at ${_libomp_prefix}")
33+
else()
34+
message(WARNING "macOS: libomp not found via Homebrew. Run: brew install libomp")
35+
endif()
36+
endif()
37+
endif()
38+
39+
40+
find_package(jansson REQUIRED)
41+
find_package(ZLIB REQUIRED)
42+
find_package(CURL REQUIRED)
43+
find_package(Eigen3 REQUIRED)
44+
find_package(clara REQUIRED)
45+
find_package(nanoflann REQUIRED)
46+
find_package(NLopt REQUIRED)
47+
find_package(kissfft REQUIRED)
48+
find_package(Boost REQUIRED)
49+
find_package(nlohmann_json REQUIRED)
6850

69-
# All include paths are specified relative to ./ directory
7051
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/modules)
71-
72-
# Sources
7352
add_subdirectory(modules)
74-
# Tests (CURRENT NO TESTS, SO COMMENTED OUT...)
75-
# if(BUILD_TESTING)
76-
# add_subdirectory(tests)
77-
# else()
78-
# add_subdirectory(tests EXCLUDE_FROM_ALL)
79-
# endif()

cmake/SimCenterConanCompat.cmake

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)