-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
69 lines (50 loc) · 2.04 KB
/
CMakeLists.txt
File metadata and controls
69 lines (50 loc) · 2.04 KB
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
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project(SphereMeshEditor)
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Find yaml-cpp package
find_package(yaml-cpp REQUIRED)
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib")
find_package(OpenMP COMPONENTS CXX)
include_directories(Math Math/Vector/ Math/Versor/ Math/Rotation/ Math/Point/ Math/Matrix/ Shader Core include/imgui)
find_package(glfw3 3.3 REQUIRED)
set(GLAD_DIR include/)
add_library(GLAD "${GLAD_DIR}/glad.c")
include_directories("${GLAD_DIR}")
add_library(tinyfiledialogs STATIC Core/tinyfiledialogs.c)
file(GLOB_RECURSE SOURCES "*.cpp" "*.hpp")
set(SEEN_FILES "")
set(DUPLICATE_FILES "")
foreach(source ${SOURCES})
# Check if the file has already been seen
if(source IN_LIST SEEN_FILES)
list(APPEND DUPLICATE_FILES ${source})
else()
list(APPEND SEEN_FILES ${source})
endif()
endforeach()
if(DUPLICATE_FILES)
message(FATAL_ERROR "Duplicate files found:")
foreach(duplicate ${DUPLICATE_FILES})
message(FATAL_ERROR "${duplicate}")
endforeach()
endif()
foreach(source ${SOURCES})
if(NOT (${source} MATCHES "/Math/" OR ${source} MATCHES "/Shader/" OR ${source} MATCHES "/Core/" OR ${source} MATCHES "/imgui/"))
list(REMOVE_ITEM SOURCES ${source})
endif()
endforeach()
foreach(source ${SOURCES})
message(STATUS "Source file: ${source}")
endforeach()
link_directories(/usr/local/lib)
add_executable(${PROJECT_NAME} ${SOURCES} main.cpp)
target_compile_options(${PROJECT_NAME} PUBLIC -g -O3 -march=native -flto -funroll-loops -std=c++17)
#target_compile_options(${PROJECT_NAME} PUBLIC -g -std=c++17)
#target_include_directories(${PROJECT_NAME} PUBLIC ${includes})
target_link_libraries(${PROJECT_NAME} glfw GLAD ${CMAKE_DL_LIBS} yaml-cpp tinyfiledialogs OpenMP::OpenMP_CXX)