forked from FlorianRhiem/VFRendering
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
124 lines (105 loc) · 4.67 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(VFRendering VERSION 0.7.0)
option(BUILD_DEMO "Whether or not a demo executable should be built" OFF)
if((NOT qhull_LIBS) OR (NOT qhull_INCLUDE_DIRS))
if(qhull_LIBS)
message(WARNING "qhull_LIBS is set, but qhull_INCLUDE_DIRS is missing.")
endif()
if(qhull_INCLUDE_DIRS)
message(WARNING "qhull_INCLUDE_DIRS is set, but qhull_LIBS is missing.")
endif()
include(ExternalProject)
ExternalProject_add(qhull
GIT_REPOSITORY https://github.com/qhull/qhull.git
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/thirdparty-install"
PREFIX qhull-prefix
)
add_library(libqhullstatic_r STATIC IMPORTED)
set_property(TARGET libqhullstatic_r PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/qhull-prefix/src/qhull-build/${CMAKE_STATIC_LIBRARY_PREFIX}qhullstatic_r${CMAKE_STATIC_LIBRARY_SUFFIX})
add_dependencies(libqhullstatic_r qhull)
add_library(libqhullcpp STATIC IMPORTED)
set_property(TARGET libqhullcpp PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/qhull-prefix/src/qhull-build/${CMAKE_STATIC_LIBRARY_PREFIX}qhullcpp${CMAKE_STATIC_LIBRARY_SUFFIX})
set_property(TARGET libqhullcpp PROPERTY INTERFACE_LINK_LIBRARIES libqhullstatic_r)
add_dependencies(libqhullcpp qhull)
set(qhull_LIBS libqhullcpp)
set(qhull_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/thirdparty-install/include;${PROJECT_BINARY_DIR}/thirdparty-install/include/libqhullcpp")
endif()
set(SOURCE_FILES
src/ArrowRenderer.cxx
src/BoundingBoxRenderer.cxx
src/CombinedRenderer.cxx
src/CoordinateSystemRenderer.cxx
src/FPSCounter.cxx
src/Geometry.cxx
src/IsosurfaceRenderer.cxx
src/Options.cxx
src/RendererBase.cxx
src/SurfaceRenderer.cxx
src/Utilities.cxx
src/VectorfieldIsosurface.cxx
src/VectorSphereRenderer.cxx
src/View.cxx
${PROJECT_SOURCE_DIR}/thirdparty/glad/src/glad.c
)
set(HEADER_FILES
include/VectorfieldIsosurface.hxx
include/VFRendering/ArrowRenderer.hxx
include/VFRendering/BoundingBoxRenderer.hxx
include/VFRendering/CombinedRenderer.hxx
include/VFRendering/CoordinateSystemRenderer.hxx
include/VFRendering/FPSCounter.hxx
include/VFRendering/Geometry.hxx
include/VFRendering/IsosurfaceRenderer.hxx
include/VFRendering/Options.hxx
include/VFRendering/RendererBase.hxx
include/VFRendering/SurfaceRenderer.hxx
include/VFRendering/Utilities.hxx
include/VFRendering/VectorSphereRenderer.hxx
include/VFRendering/View.hxx
include/shaders
include/shaders/arrows.frag.glsl.hxx
include/shaders/arrows.vert.glsl.hxx
include/shaders/boundingbox.frag.glsl.hxx
include/shaders/boundingbox.vert.glsl.hxx
include/shaders/colormap.bluegreenred.glsl.hxx
include/shaders/colormap.bluered.glsl.hxx
include/shaders/colormap.bluewhitered.glsl.hxx
include/shaders/colormap.hsv.glsl.hxx
include/shaders/colormap.black.glsl.hxx
include/shaders/colormap.white.glsl.hxx
include/shaders/coordinatesystem.frag.glsl.hxx
include/shaders/coordinatesystem.vert.glsl.hxx
include/shaders/sphere_background.frag.glsl.hxx
include/shaders/sphere_background.vert.glsl.hxx
include/shaders/sphere_points.frag.glsl.hxx
include/shaders/sphere_points.vert.glsl.hxx
include/shaders/surface.frag.glsl.hxx
include/shaders/surface.vert.glsl.hxx
include/shaders/isosurface.frag.glsl.hxx
include/shaders/isosurface.vert.glsl.hxx
)
add_library(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${qhull_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/thirdparty/glm/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/thirdparty/glad/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${qhull_INCLUDE_DIRS})
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
install(DIRECTORY include/VFRendering DESTINATION include)
# Build demo
if (BUILD_DEMO)
add_executable(${PROJECT_NAME}Demo demo.cxx)
target_link_libraries(${PROJECT_NAME}Demo ${PROJECT_NAME})
if (${UNIX})
target_link_libraries(${PROJECT_NAME}Demo dl)
endif(${UNIX})
find_package(glfw3 3 REQUIRED)
target_link_libraries(${PROJECT_NAME}Demo glfw)
set_property(TARGET ${PROJECT_NAME}Demo PROPERTY CXX_STANDARD 11)
set_property(TARGET ${PROJECT_NAME}Demo PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${PROJECT_NAME}Demo PROPERTY CXX_EXTENSIONS OFF)
target_include_directories(${PROJECT_NAME}Demo PRIVATE ${PROJECT_SOURCE_DIR}/thirdparty/glad/include)
endif()