-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
80 lines (65 loc) · 3.02 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.1)
PROJECT(PeanutButterNJelly)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/")
SET(embree_DIR ""
CACHE FILEPATH "Directory containing an embree-config.cmake file")
SET(ospray_DIR ""
CACHE FILEPATH "Directory containing an osprayConfig.cmake file")
FIND_PACKAGE(ospray REQUIRED)
FIND_PACKAGE(embree 3.2 REQUIRED)
OPTION(USE_NETCDF "Enable NetCDF file reading" ON)
OPTION(BUILD_EXAMPLES "Build example applications" ON)
OPTION(BUILD_DOCUMENTATION "Build documentation with Sphinx" OFF)
SET(PBNJ_LIBS ${EMBREE_LIBRARIES} ${OSPRAY_LIBRARIES})
SET(PBNJ_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include"
${OSPRAY_INCLUDE_DIRS} ${EMBREE_INCLUDE_DIRS})
MESSAGE(STATUS "PBNJ LIBS: ${PBNJ_LIBS}")
MESSAGE(STATUS "OSPRAY LIBS: ${OSPRAY_LIBRARIES}")
MESSAGE(STATUS "EMBREE LIBS: ${EMBREE_LIBRARIES}")
#USE_NETCDF adds netcdf includes/libs for data reading
IF(USE_NETCDF)
# give cmake some hints to finding NetCDF - god knows it needs it
SET(NETCDF_INCLUDE_DIR "/usr/include"
CACHE FILEPATH "Path to NetCDF includes")
SET(NETCDF_LIBRARY "/usr/lib/x86_64-linux-gnu/libnetcdf_c++4.so"
CACHE FILEPATH "Path to NetCDF library")
# set this else the findnetcdf won't look in system paths
SET(NETCDF_USE_DEFAULT_PATHS ON)
FIND_PACKAGE(NetCDF COMPONENTS CXX)
IF(NETCDF_FOUND)
ADD_DEFINITIONS(-DPBNJ_NETCDF)
SET(PBNJ_INCLUDE_DIRS ${PBNJ_INCLUDE_DIRS}
${NETCDF_CXX_INCLUDE_DIRS})
SET(PBNJ_LIBS ${PBNJ_LIBS} ${NETCDF_CXX_LIBRARIES})
ELSE()
MESSAGE(FATAL_ERROR
"Requested NetCDF but the library could not be found")
ENDIF()
ENDIF(USE_NETCDF)
FILE(GLOB PBNJ_SOURCES "src/*.cpp" "src/lodepng/*.cpp")
ADD_LIBRARY(pbnj SHARED ${PBNJ_SOURCES})
TARGET_INCLUDE_DIRECTORIES(pbnj PUBLIC ${PBNJ_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(pbnj ${PBNJ_LIBS} pthread jpeg)
IF(BUILD_EXAMPLES)
ADD_EXECUTABLE(simpleVolumeRender ${PBNJ_SOURCES}
"src/test/simpleVolumeRender.cpp")
TARGET_LINK_LIBRARIES(simpleVolumeRender ${PBNJ_LIBS} pthread jpeg)
TARGET_INCLUDE_DIRECTORIES(simpleVolumeRender PUBLIC ${PBNJ_INCLUDE_DIRS})
ADD_EXECUTABLE(timeSeries ${PBNJ_SOURCES} "src/test/timeSeries.cpp")
TARGET_LINK_LIBRARIES(timeSeries ${PBNJ_LIBS} pthread jpeg)
TARGET_INCLUDE_DIRECTORIES(timeSeries PUBLIC ${PBNJ_INCLUDE_DIRS})
ADD_EXECUTABLE(benchmark ${PBNJ_SOURCES} "src/test/benchmark.cpp")
TARGET_LINK_LIBRARIES(benchmark ${PBNJ_LIBS} pthread jpeg)
TARGET_INCLUDE_DIRECTORIES(benchmark PUBLIC ${PBNJ_INCLUDE_DIRS})
ADD_EXECUTABLE(omni ${PBNJ_SOURCES} "src/test/omni.cpp")
TARGET_LINK_LIBRARIES(omni ${PBNJ_LIBS} pthread jpeg)
TARGET_INCLUDE_DIRECTORIES(omni PUBLIC ${PBNJ_INCLUDE_DIRS})
ENDIF(BUILD_EXAMPLES)
IF(BUILD_DOCUMENTATION)
ADD_SUBDIRECTORY(docs)
ENDIF(BUILD_DOCUMENTATION)
# install rules
INSTALL(TARGETS pbnj LIBRARY DESTINATION lib)
INSTALL(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/" DESTINATION include
FILES_MATCHING PATTERN "*.h")