This repository was archived by the owner on Jul 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathCMakeLists.txt
52 lines (40 loc) · 1.57 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
# CMakeLists file
#
cmake_minimum_required (VERSION 2.8.0)
project (FastRGF)
# whether to use openmp (default is on)
option(OPENMP "Use openmp for multi-threads" ON)
set(CMAKE_CXX_FLAGS "-O3 -std=c++11")
#set(CMAKE_CXX_FLAGS "-g -std=c++11 -Wall")
if(OPENMP)
message("use openmp for multi-threads")
# use openmp
add_definitions("-DUSE_OMP")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# mac os x: clang does not support openmp, need to install a g++ with openmp support
# if the executables are gcc-7 and g++-7, then use the following in build/
# cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
#
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "[gG][nN][uU]")
message(FATAL_ERROR "Compilation only with g++ is supported\n Install a gcc-x and g++-x and use cmake command option -DCMAKE_C_COMPILER=gcc-x -DCMAKE_CXX_COMPILER=g++-x")
endif()
set(CMAKE_CXX_COMPILER_ID "GNU")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
else()
message("use standard c++11 thread library")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -ftree-vectorize -ffast-math")
endif()
if(WIN32 AND MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
endif()
message("c++ compiler= " ${CMAKE_CXX_COMPILER})
message("c++ options= " ${CMAKE_CXX_FLAGS})
get_directory_property(cDirDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
message("c++ definitions= " ${cDirDefs})
include_directories(include)
add_subdirectory(src/base)
add_subdirectory(src/forest)
add_subdirectory(src/exe)