forked from debanshusingh/CIS563-FluidSolver
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
148 lines (125 loc) · 4.45 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
##################
# Korra #
##################
# credit - base CMake config : Yining Karl Li , edited CMake config: Akshay Shah & Debanshu Singh
#name your project
project(Korra)
cmake_minimum_required(VERSION 2.8)
# include source directories
include_directories(
src/
)
# set creates a variable
set (NUPARU "nuparu")
# add include and src directories to path
include_directories(
${NUPARU}/include
${NUPARU}/src
)
# Add path for pre-compiled libraries here (we will later link them with our compiled source)
# Add Nuparu library to path for OSX, linux and windows
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${NUPARU}/lib/osx)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${NUPARU}/lib/linux /usr/lib64)
elseif(WIN32)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${NUPARU}/lib/win)
endif()
# set creates a variable
set (THIRDPARTY "src/thirdparty")
# add include and src directories to path for nanogui
include_directories(
${THIRDPARTY}/nanogui/include
${THIRDPARTY}/nanogui/src
)
# NanoGUI library path
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${THIRDPARTY}/nanogui)
# add include and src directories to path for openvdb_points
include_directories(
/usr/local/include/openvdb/
/usr/local/openvdb/
/Library/Frameworks/Houdini.framework/Versions/15.0.347/Resources/toolkit/include/
)
# OpenVDB point library path
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/local/openvdb/lib)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /Library/Frameworks/Houdini.framework/Versions/15.0.347/Libraries/)
#set include variables
set(GLFW_INCLUDE_DIR ${NUPARU}/include )
set(GLEW_INCLUDE_DIR ${NUPARU}/include )
set(GLFW_LIBRARY_DIR ${CMAKE_LIBRARY_PATH})
set(GLEW_LIBRARY_DIR ${CMAKE_LIBRARY_PATH})
# Use find_package & find_library to link with
find_package(OPENGL REQUIRED)
find_package(GLEW)
find_library(GLFW_LIBRARY "glfw3" HINTS ${GLFW_LIBRARY_DIR})
find_library(JSONCPP "jsoncpp")
find_library(TBB "tbb")
find_library(NANOGUI "nanogui")
find_library(HALF "half")
find_library(OPENVDB "openvdb")
find_library(OPENVDB_POINTS "openvdb_points")
add_definitions(
-DTW_STATIC
-DTW_NO_LIB_PRAGMA
-DTW_NO_DIRECT3D
-DGLEW_STATIC
-D_CRT_SECURE_NO_WARNINGS
)
set(CORE_LIBS ${GLFW_LIBRARY} ${GLUT_LIBRARY} ${GLEW_LIBRARY} ${JSONCPP} ${TBB} ${HALF} ${OPENVDB} ${OPENVDB_POINTS} ${NANOGUI} ${OPENGL_LIBRARY} )
# OSX-specific hacks/fixes
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(COCOA Cocoa)
find_library(COREVIDEO CoreVideo)
find_library(IOKIT IOKit)
find_library(COREFOUNDATION CoreFoundation)
find_library(CARBON_FRAMEWORK Carbon)
set(CORE_LIBS ${CORE_LIBS} "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo -framework Carbon")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Linux specific hacks/fixes
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lX11 -lXxf86vm -lXrandr -lpthread -lXi")
endif()
# set compiler flags for c++11
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -m64 -msse2 -w")
elseif(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if(MSVC)
set(COMPILER_FLAGS
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
endif()
# Add source files you want to compile (.cpp)
set(CORE_SRC
nuparu/src/stb_image/stb_image_write.c
src/loadShaders.cpp
src/utility.cpp
src/main.cpp
src/shaderProgram/shaderProgram.cpp
src/shaderProgram/particleAdvectProgram.cpp
src/input/keyboardControl.cpp
src/viewer.cpp
src/camera/camera.cpp
src/geometry/geometry.cpp
src/geometry/box.cpp
src/geometry/fluidGeo.cpp
src/fluidSolver/fluidParticle.cpp
src/fluidSolver/fluidSolver.cpp
src/fluidSolver/SPHGrid.cpp
src/fluidSolver/SPHSolver.cpp
src/scene/scene.cpp
)
add_executable(Korra ${CORE_SRC})
target_link_libraries(Korra ${CORE_LIBS})
# Include zlib for osx
find_package( ZLIB REQUIRED )
if ( ZLIB_FOUND )
include_directories( ${ZLIB_INCLUDE_DIRS} )
target_link_libraries( Korra ${ZLIB_LIBRARIES} )
endif( ZLIB_FOUND )