-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
74 lines (68 loc) · 1.8 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
cmake_minimum_required(VERSION 3.9)
project(skunkwork)
# Set up external dependencies
if (NOT APPLE)
find_package(OpenMP REQUIRED)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
find_package(OpenGL REQUIRED)
# Set up sub-builds and sources
add_subdirectory(ext)
add_subdirectory(include)
add_subdirectory(src)
# Set absolute path to res directory
add_definitions(-DRES_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}/res/")
# Set up project targets
# WIN32 tells to not build a cmd-app on windows
add_executable(cubnature WIN32 ${SKUNKWORK_SOURCES})
target_compile_features(cubnature
PRIVATE
cxx_std_17
)
if (MSVC)
target_compile_options(cubnature
PRIVATE
/Wall
)
else()
target_compile_options(cubnature
PRIVATE
-Wall
-pedantic
)
endif()
if (APPLE)
target_include_directories(cubnature
PRIVATE
/usr/local/Cellar/libomp/8.0.0/include
)
endif()
target_compile_definitions(cubnature PRIVATE ROCKET)
target_include_directories(cubnature
PRIVATE
${SKUNKWORK_INCLUDE_DIR}
)
target_link_libraries(cubnature
PRIVATE
${OPENGL_LIBRARIES}
bass
glfw
glm
libgl3w
librocket
imgui
)
if (APPLE)
target_link_libraries(cubnature
PRIVATE
/usr/local/Cellar/libomp/8.0.0/lib/libomp.a
)
endif()
# Copy dynamic libraries to build folder after build
# A cleaner way of doing this even with msvc's build structure?
add_custom_command(TARGET cubnature POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/ext/bass/lib
$<TARGET_FILE_DIR:cubnature>)