-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
executable file
·98 lines (83 loc) · 3.1 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
cmake_minimum_required(VERSION 3.11)
project(GEL)
find_package(Threads)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# set(CMAKE_CXX_FLAGS "-std=c++1z")
add_definitions(-DGLEW_STATIC)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include_directories(./src/GEL)
add_definitions(-DGLEW_STATIC)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif ()
option(Use_GLGraphics "Compile the OpenGL Viewer" ON)
if (Use_GLGraphics)
find_package(OpenGL REQUIRED)
include(FetchContent)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.3.2
)
FetchContent_GetProperties(glfw)
if(NOT glfw_POPULATED)
FetchContent_Populate(glfw)
set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs")
set(GLFW_BUILD_TESTS OFF CACHE INTERNAL "Build the GLFW test programs")
set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "Build the GLFW documentation")
set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target")
add_subdirectory(${glfw_SOURCE_DIR} ${glfw_BINARY_DIR})
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
add_compile_definitions(GL_SILENCE_DEPRECATION)
include_directories(./src/)
SET(CMAKE_INSTALL_RPATH "@loader_path/")
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif ()
endif ()
aux_source_directory(./src/GEL/CGLA CGLA_SRC_LIST)
aux_source_directory(./src/GEL/Geometry GEO_SRC_LIST)
aux_source_directory(./src/GEL/HMesh MSH_SRC_LIST)
aux_source_directory(./src/GEL/Util UTL_SRC_LIST)
if (Use_GLGraphics)
include_directories(./src/GEL/GL/include)
aux_source_directory(./src/GEL/GL GL_SRC_LIST)
aux_source_directory(./src/GEL/GLGraphics GLG_SRC_LIST)
add_library(GEL STATIC ${CGLA_SRC_LIST} ${GEO_SRC_LIST} ${MSH_SRC_LIST} ${UTL_SRC_LIST} ${GL_SRC_LIST} ${GLG_SRC_LIST})
target_link_libraries(GEL Threads::Threads OpenGL::GLU OpenGL::GL ${COCOA_LIBRARY})
# not right now ...
# add_subdirectory(./src/demo)
else ()
add_library(GEL STATIC ${CGLA_SRC_LIST} ${GEO_SRC_LIST} ${MSH_SRC_LIST} ${UTL_SRC_LIST})
target_link_libraries(GEL Threads::Threads)
endif ()
include_directories(./src)
aux_source_directory(./src/PyGEL PYG_SRC_LIST)
if (Use_GLGraphics)
add_library(PyGEL SHARED ${PYG_SRC_LIST})
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_include_directories(PyGEL PRIVATE ${glfw_SOURCE_DIR}/include)
endif ()
target_link_libraries(PyGEL GEL glfw ${GLFW_LIBRARIES})
else ()
list(REMOVE_ITEM PYG_SRC_LIST "./src/PyGEL/Viewer.cpp")
add_library(PyGEL SHARED ${PYG_SRC_LIST})
target_link_libraries(PyGEL GEL)
endif ()
install(TARGETS GEL)
install(TARGETS PyGEL GEL
LIBRARY DESTINATION PyGEL
ARCHIVE DESTINATION PyGEL)
# Install Header Files
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/GEL
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)