forked from libocca/occa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (58 loc) · 1.98 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
cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
message(STATUS "Using CMake version ${CMAKE_VERSION}")
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0056 NEW)
OPTION(USE_INTEL "Use Intel compilers" OFF)
IF (USE_INTEL)
message("Using Intel compilers")
include(IntelCompilers)
ENDIF()
# Set project
project (occa)
include(OS)
OPTION(ALLOW_CUDA "Allow CUDA" ON)
OPTION(ALLOW_MPI "Allow MPI" OFF)
OPTION(ALLOW_OPENMP "Allow OpenMP" ON)
OPTION(ALLOW_OPENCL "Allow OpenCL" ON)
OPTION(ALLOW_METAL "Allow Metal" ON)
SET(PROJ_DIR ${CMAKE_CURRENT_SOURCE_DIR})
link_directories(${PROJ_DIR}/lib)
find_package(Threads REQUIRED)
SET(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
IF (ALLOW_OPENMP)
INCLUDE(OpenMP)
ENDIF()
IF (ALLOW_OPENCL)
INCLUDE(OpenCL)
ENDIF()
# searches for CUDA if allowed
IF (ALLOW_CUDA)
include(CUDA)
ENDIF()
# searches for MPI if allowed
IF (ALLOW_MPI)
include(MPI)
ENDIF()
IF (ALLOW_METAL)
include(Metal)
ENDIF()
add_definitions(-DUSE_CMAKE)
include_directories(${PROJ_DIR}/include)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-c++11-long-long")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-long-long")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
include_directories(${PROJECT_BINARY_DIR})
SET(OCCA_BUILD_DIR ${PROJECT_BINARY_DIR})
# TODO:
CONFIGURE_FILE( scripts/compiledDefinesTemplate.hpp.in ${PROJECT_BINARY_DIR}/occa/defines/compiledDefines.hpp )
# will not work because build directory unknown to runtime compiler
# CONFIGURE_FILE( scripts/compiledDefinesTemplate.hpp.in ${PROJECT_SOURCE_DIR}/include/occa/defines/compiledDefines.hpp )
install(FILES ${PROJECT_BINARY_DIR}/occa/defines/compiledDefines.hpp DESTINATION include/occa/defines)
add_subdirectory(src)
add_subdirectory(bin)
# add_subdirectory(tests)
add_subdirectory(examples)
install(DIRECTORY include/ DESTINATION include)