-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCMakeLists.txt
54 lines (44 loc) · 1.89 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
cmake_minimum_required(VERSION 2.8)
project(loom)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-sign-compare -Wno-strict-aliasing -Wno-unknown-pragmas")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -funsafe-math-optimizations")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLOOM_ASSUME_X86")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDIST_DISALLOW_SLOW_FALLBACKS")
# use tcmalloc
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
if(DEFINED ENV{CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{CXX_FLAGS}")
endif()
message("CXX_FLAGS =${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -DDIST_DEBUG_LEVEL=3 -DLOOM_DEBUG_LEVEL=3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1")
include_directories("${CMAKE_SOURCE_DIR}/include")
# germ of a future FindDistributions.cmake
find_path(DISTRIBUTIONS_INCLUDE_DIR distributions/random.hpp)
if(NOT DISTRIBUTIONS_INCLUDE_DIR)
message(FATAL_ERROR
"distributions include dir not found, try setting CMAKE_PREFIX_PATH")
else()
message(STATUS
"using distributions include dir ${DISTRIBUTIONS_INCLUDE_DIR}")
endif()
message("BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
message("PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
find_library(DISTRIBUTIONS_LIBRARIES distributions_shared_release)
else()
set(CMAKE_EXECUTABLE_SUFFIX "_debug")
find_library(DISTRIBUTIONS_LIBRARIES distributions_shared_debug)
endif()
if(DISTRIBUTIONS_LIBRARIES)
message("linking against ${DISTRIBUTIONS_LIBRARIES}")
else()
message(FATAL_ERROR
"distributions libraries not found, try setting CMAKE_PREFIX_PATH")
endif()
add_subdirectory(src)
set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_FILE_NAME "loom")
include(CPack)