-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
84 lines (71 loc) · 2.6 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
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -stdlib=libc++ -fexperimental-library")
project(mesh2audio LANGUAGES C CXX)
if(APPLE)
enable_language(OBJC)
endif()
add_subdirectory(lib)
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp)
# Create a dummy output that depends on all resource files,
# so that changes in resource files trigger a re-copy of the changed files to the build directory.
file(GLOB_RECURSE RES_FILES LIST_DIRECTORIES false "res/*.*")
set(DUMMY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dummy_res")
add_custom_command(
OUTPUT ${DUMMY_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E copy_directory "../res" "${CMAKE_CURRENT_BINARY_DIR}/res"
DEPENDS ${RES_FILES}
COMMENT "Copying resource files to build directory"
)
add_custom_target(CopyResources ALL DEPENDS ${DUMMY_OUTPUT})
set(IMGUI_DIR lib/imgui)
set(IMPLOT_DIR lib/implot)
add_executable(${PROJECT_NAME}
${IMGUI_DIR}/imgui_demo.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/imgui.cpp
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_DIR}/backends/imgui_impl_sdl3.cpp
${IMPLOT_DIR}/implot.cpp
${IMPLOT_DIR}/implot_items.cpp
${IMPLOT_DIR}/implot_demo.cpp
lib/ImGuizmo/ImGuizmo.cpp
lib/quickhull/QuickHull.cpp
${SOURCES}
)
add_dependencies(${PROJECT_NAME} CopyResources)
set(INCLUDE_EXECUTABLE OFF CACHE STRING "Build the mesh2faust executable" FORCE)
set(Mesh2FaustDir ${CMAKE_CURRENT_SOURCE_DIR}/lib/faust/tools/physicalModeling/mesh2faust)
add_subdirectory(${Mesh2FaustDir})
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
include_directories(
${IMGUI_DIR}
${IMGUI_DIR}/backends
${IMPLOT_DIR}
lib/imspinner
lib/ImGuizmo
lib/glm
lib/miniaudio
lib/faust/architecture
lib/nanosvg/src
lib/date/include/date
lib/libnpy/include
lib/tetgen
lib/quickhull
${Mesh2FaustDir}/src
src
)
if(APPLE)
target_include_directories(${PROJECT_NAME} PRIVATE /opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3)
else()
target_include_directories(${PROJECT_NAME} PRIVATE /usr/include/eigen3)
endif()
# `dynamiclib` is faust.
target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL GLEW::GLEW SDL3::SDL3 nfd dynamiclib mesh2faust tetgen reactphysics3d OpenMeshCore)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wno-elaborated-enum-base -DIMGUI_IMPL_OPENGL_LOADER_GLEW)
add_definitions(-DTETLIBRARY)