forked from debanshusingh/CIS563-FluidSolver
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
127 lines (112 loc) · 4.66 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
# credit - base CMake config : Yining Karl Li , edited CMake config: Akshay Shah & Debanshu Singh
#name your project
project(FluidSolver)
cmake_minimum_required(VERSION 2.8)
# set creates a variable
set (NUPARU "nuparu")
# add include and src directories to path
include_directories(
${NUPARU}/include
${NUPARU}/src
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# 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 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" REQUIRED)
find_library(BOOST_IOSTREAMS boost_iostreams)
find_library(BOOST_SYSTEM boost_system)
find_library(OPENVDB openvdb REQUIRED)
find_library(OPENVDB_POINTS openvdb_points)
find_library(HALF Half REQUIRED)
find_library(TBB NAMES tbb tbbmalloc)
find_library(ZLIB z)
find_library(ANT AntTweakBar)
#Iex IexMath Imath IlmThread
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}
${OPENGL_LIBRARY}
${BOOST_IOSTREAMS}
${BOOST_SYSTEM}
${OPENVDB}
${OPENVDB_POINTS}
${TBB}
${ZLIB}
${HALF}
${ANT})
# OSX-specific hacks/fixes
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#Link IOKit because this is where we get GL stuff for OSX
set(COCOA "-framework Cocoa")
set(COREVIDEO "-framework CoreVideo")
set(IOKIT "-framework IOKit")
set(CORE_LIBS ${CORE_LIBS} ${COCOA} ${IOKIT} ${COREVIDEO})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Linux specific hacks/fixes
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CORE_LIBS ${CORE_LIBS} X11 Xxf86vm Xrandr pthread Xi)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lz")
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 -Ofast -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
main.cpp
core/display/InputHandler.cpp
core/display/InputHandler.h
core/display/Window.cpp
core/display/Window.h
core/fileIO/SceneLoader.cpp
core/fileIO/SceneLoader.h
core/geometry/Bound.cpp
core/geometry/Bound.h
core/geometry/Box.cpp
core/geometry/Box.h
core/geometry/Geo.cpp
core/geometry/Geo.h
core/geometry/GeoObject.h
core/solver/FluidSolver.cpp
core/solver/FluidSolver.h
core/util/math.h
core/display/shaders/particle.frag.h core/display/shaders/particle.vert.h core/display/painters/ParticlesPainter.cpp core/display/painters/ParticlesPainter.h core/display/painters/Painter.cpp core/display/painters/Painter.h core/display/painters/BoxPainter.cpp core/display/painters/BoxPainter.h core/display/shaders/flat.vert.h core/display/shaders/flat.frag.h core/scenes/default.h core/camera/Camera.cpp core/camera/Camera.h core/solver/grid/Grid.cpp core/solver/grid/Grid.h core/solver/grid/MACGrid.cpp core/solver/grid/MACGrid.h core/solver/FluidParticle.h core/fileIO/ParticlesWriter.cpp core/fileIO/ParticlesWriter.h core/util/hacks.h core/display/painters/GridVectorAttributePainter.cpp core/display/painters/GridVectorAttributePainter.h core/display/shaders/gridAttr.geo.h core/util/flags.h core/display/painters/GridScalarAttributePainter.cpp core/display/painters/GridScalarAttributePainter.h core/display/shaders/gridScal.vert.h core/display/shaders/gridScal.frag.h)
add_executable(FluidSolver ${CORE_SRC})
target_link_libraries(FluidSolver ${CORE_LIBS})