-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
93 lines (71 loc) · 3.31 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
#########################################
# 2D Fluid Simulations #
#---------------------------------------#
# @author Nikolaus Rauch #
# @date 04.11.2023 #
#---------------------------------------#
#########################################
cmake_minimum_required( VERSION 3.9 )
project( 2D-Fluids )
message("\n * 2D Fluid Simulations ")
message(STATUS "${PROJECT_NAME} build environment --")
message(STATUS "Build system: ${CMAKE_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}")
#########################################
# CMake-Stuff #
#########################################
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
#########################################
# Global Compiler Options #
#########################################
set(GCC_COMPILE_OPTIONS "-Wall")
set(GCC_COMPILE_DEBUG_OPTIONS "${GCC_COMPILE_OPTIONS};-ggdb;-O0")
set(GCC_COMPILE_RELEASE_OPTIONS "${GCC_COMPILE_OPTIONS};-O3")
set(MSVC_COMPILE_OPTIONS "/Wall")
set(MSVC_COMPILE_DEBUG_OPTIONS "${MSVC_COMPILE_OPTIONS};/Zi")
set(MSVC_COMPILE_RELEASE_OPTIONS "${MSVC_COMPILE_OPTIONS};/O2")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<CONFIG:DEBUG>>:${GCC_COMPILE_DEBUG_OPTIONS}>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<CONFIG:RELEASE>>:${GCC_COMPILE_RELEASE_OPTIONS}>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:DEBUG>>:${MSVC_COMPILE_DEBUG_OPTIONS}>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:RELEASE>>:${MSVC_COMPILE_RELEASE_OPTIONS}>")
#########################################
# Build External-Libraries #
#########################################
add_subdirectory(external/glm)
set_property(TARGET glm_static APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
target_include_directories( glm_static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external>
)
add_subdirectory(external/glfw)
set_property(TARGET glfw APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
target_include_directories( glfw PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external/glfw/include>
)
add_subdirectory(external/imgui)
set_property(TARGET imgui_static APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
add_subdirectory(external/stb_image)
set_property(TARGET stb_image APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
#################################
# OpenMP #
#################################
option(COMPILE_WITH_OPENMP "enable openmp parallelization" ON)
find_package(OpenMP)
if(OpenMP_CXX_FOUND AND COMPILE_WITH_OPENMP)
message(STATUS "Build with OpenMP version ${OpenMP_CXX_VERSION}")
else()
message(STATUS "Build without OpenMP")
endif()
#########################################
# Build Viewer #
#########################################
add_subdirectory(viewer)
#########################################
# Fluid Simulation Library #
#########################################
add_subdirectory(fluid_sim)
#########################################
# Examples #
#########################################
add_subdirectory(examples)