-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
executable file
·60 lines (45 loc) · 1.55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.15)
# verbosity
set(CMAKE_VERBOSE_MAKEFILE ON)
# set the project name
project(excogito C)
# to compile libraries such as optimize with openMP. Avoid WARNINGS about #pragma in optimize.c
if(UNIX AND NOT APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
endif()
if(UNIX AND APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xpreprocessor -fopenmp")
endif()
if(APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xpreprocessor -fopenmp")
endif()
# Release build type
SET(CMAKE_BUILD_TYPE Release)
ADD_DEFINITIONS(-ffast-math)
ADD_DEFINITIONS(-march=native)
# add link to include
include_directories(${CMAKE_SOURCE_DIR}/include /usr/local/include/)
# add subdirectory lib
add_subdirectory(${CMAKE_SOURCE_DIR}/lib)
# add the executable
add_executable(excogito excogito.c)
# linking library
target_link_libraries(excogito PUBLIC lib)
if(UNIX AND NOT APPLE)
target_link_libraries(excogito PRIVATE m)
SET(GCC_COVERAGE_COMPILE_FLAGS "-Wall -fopenmp")
endif()
if(UNIX AND APPLE)
target_link_libraries(excogito PRIVATE m argp omp -L/usr/local/lib)
SET(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Xpreprocessor -fopenmp")
endif()
if(APPLE)
target_link_libraries(excogito PRIVATE m argp omp -L/usr/local/lib)
SET(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Xpreprocessor -fopenmp")
endif()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
# putting all pieces together
target_include_directories(excogito PUBLIC
"${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/lib"
)