-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
66 lines (52 loc) · 2.17 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
61
62
63
64
65
66
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
project(PANENE)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
set(PANENE_LIB_NAME panene)
set(PANENE_VERSION 0.0.1)
option(BUILD_STATIC "Build a static library" OFF)
option(BUILD_PYTHON_BINDINGS "Build Python bindings" ON)
option(COMPILE_FOR_BENCHMARK "Compile for benchmark (e.g., profiling)" ON)
option(DISABLE_X64 "Forcefully disable x64 optimizations even if hardware supports it (this disables AVX) " OFF)
option(DISABLE_AVX "Forcefully disable AVX even if hardware supports it" OFF)
find_package ( OpenMP )
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
include_directories(include)
# Require C++11 support, prefer ISO C++ over GNU variants,
# as relying solely on ISO C++ is more portable.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)
if (COMPILE_FOR_BENCHMARK)
add_definitions(-DBENCHMARK)
endif()
add_subdirectory(src)
add_subdirectory(benchmark)
enable_testing ()
add_subdirectory(tests)
# find python
find_package(PythonInterp)
if (NOT PYTHON_EXECUTABLE)
set(BUILD_PYTHON_BINDINGS OFF)
endif()
if (BUILD_PYTHON_BINDINGS)
add_subdirectory(python)
endif()
add_subdirectory(examples)
message( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
message( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
message( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} ) # important to know which compiler is used
message( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) # important to know the flags
message( STATUS "CMAKE_CXX_FLAGS_DEBUG: " ${CMAKE_CXX_FLAGS_DEBUG} )
message( STATUS "CMAKE_CXX_FLAGS_RELEASE: " ${CMAKE_CXX_FLAGS_RELEASE} )
message( STATUS "PYTHON_EXECUTABLE: " ${PYTHON_EXECUTABLE} )
message( STATUS "Building python bindings:" ${BUILD_PYTHON_BINDINGS})
message( STATUS "Compile for benchmark: " ${COMPILE_FOR_BENCHMARK})