-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
64 lines (50 loc) · 1.64 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
cmake_minimum_required(VERSION 3.13)
project(vpmr)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
option(USE_AVX2 "Use AVX2" OFF)
if (USE_AVX2)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
endif ()
endif ()
include_directories(eigen)
include_directories(eigen/unsupported)
include_directories(mpreal)
include_directories(exprtk)
include_directories(exprtk-custom-types)
include_directories(pybind11/include)
if (MINGW)
find_package(TBB REQUIRED)
link_libraries(TBB::tbb)
else ()
link_libraries(tbb)
endif ()
link_libraries(gmp mpfr)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
elseif (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=auto")
endif ()
include(CheckIncludeFile)
check_include_file("Windows.h" HAVE_WINDOWS_H)
if (HAVE_WINDOWS_H)
add_definitions(-DHAVE_WINDOWS_H)
endif ()
add_executable(vpmr src/VPMR.cpp)
find_package(Python3 COMPONENTS Development Interpreter)
if (Python3_FOUND)
message(STATUS "Python3: ${Python3_VERSION}")
include_directories(${Python3_INCLUDE_DIRS})
add_subdirectory(pybind11)
pybind11_add_module(_pyvpmr src/VPMR.cpp)
target_compile_definitions(_pyvpmr PRIVATE PYVPMR)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_sources(${PROJECT_NAME} PRIVATE resource/vpmr.rc)
if (MINGW)
target_compile_options(${PROJECT_NAME} PRIVATE "-Wa,-mbig-obj")
target_compile_options(_pyvpmr PRIVATE "-Wa,-mbig-obj")
endif ()
endif ()
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")