-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
86 lines (72 loc) · 2.79 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cmake_minimum_required(VERSION 2.6)
project(MPI2 C CXX)
# add a NativeRelease build type
SET( CMAKE_CXX_FLAGS_NATIVERELEASE "-O3 -DNDEBUG -march=native -ftree-vectorize" CACHE STRING
"Flags used by the C++ compiler during native builds."
FORCE )
SET( CMAKE_C_FLAGS_NATIVERELEASE "-O3 -DNDEBUG -march=native -ftree-vectorize" CACHE STRING
"Flags used by the C compiler during native builds."
FORCE )
SET( CMAKE_EXE_LINKER_FLAGS_NATIVERELEASE "" CACHE STRING
"Flags used for linking binaries during native builds."
FORCE )
SET( CMAKE_SHARED_LINKER_FLAGS_NATIVERELEASE "" CACHE STRING
"Flags used by the shared libraries linker during native builds."
FORCE )
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_NATIVERELEASE
CMAKE_C_FLAGS_NATIVERELEASE
CMAKE_EXE_LINKER_FLAGS_NATIVERELEASE
CMAKE_SHARED_LINKER_FLAGS_NATIVERELEASE )
if(CMAKE_CONFIGURATION_TYPES)
list(APPEND CMAKE_CONFIGURATION_TYPES NativeRelease)
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
"Add the native configuration"
FORCE)
endif()
## default build type is native
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE NativeRelease CACHE STRING
"Choose the type of build. Options are: None Debug NativeRelease Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# handy stuff for eclipse
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
# definitions for visual studio
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# my own includes/libs
include_directories(~/local/include)
link_directories(~/local/lib)
# MPI
FIND_PACKAGE(MPI REQUIRED)
SET(CMAKE_C_COMPILER ccache)
SET(CMAKE_C_COMPILER_ARG1 mpicc)
SET(CMAKE_CXX_COMPILER ccache)
SET(CMAKE_CXX_COMPILER_ARG1 mpicxx)
# search for boost library
find_package(Boost 1.63 COMPONENTS serialization mpi thread system filesystem)
IF(NOT ${Boost_FOUND})
SET(BOOST_ROOT ~/local) # default
SET(Boost_NO_SYSTEM_PATHS ON) # force to use own build
find_package(Boost 1.63 COMPONENTS serialization mpi thread system filesystem REQUIRED)
ENDIF(NOT ${Boost_FOUND})
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
# include directories
include_directories(${MPI2_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${MPI2_SOURCE_DIR}/extern/include)
# install directories
SET(LIB_INSTALL_DIR lib)
SET(INCLUDE_INSTALL_DIR include)
# go
configure_file("${MPI2_SOURCE_DIR}/log4j.properties" "${CMAKE_CURRENT_BINARY_DIR}/")
add_subdirectory(util)
add_subdirectory(mpi2)
add_subdirectory(tools)
add_subdirectory(examples)