-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
97 lines (84 loc) · 3.39 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
cmake_minimum_required(VERSION 3.5)
include_directories(ext/nanogui/include)
include_directories(ext/cpptoml/include)
include_directories(ext/stb_image)
# Compiler specific settings
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# Useful for debugging build errors
set(CMAKE_EXE_LINKER_FLAGS "-v")
else ()
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
endif()
# Disable building extras we won't need (pure C++ project)
set(NANOGUI_BUILD_EXAMPLE OFF CACHE BOOL " " FORCE)
set(NANOGUI_BUILD_PYTHON OFF CACHE BOOL " " FORCE)
set(NANOGUI_INSTALL OFF CACHE BOOL " " FORCE)
# Add the configurations from nanogui
add_subdirectory(ext/nanogui)
# For reliability of parallel build, make the NanoGUI targets dependencies
set_property(TARGET glfw glfw_objects nanogui PROPERTY FOLDER "dependencies")
# Various preprocessor definitions have been generated by NanoGUI
add_definitions(${NANOGUI_EXTRA_DEFS})
# On top of adding the path to nanogui/include, you may need extras
include_directories(${NANOGUI_EXTRA_INCS})
# Always use libc++ on Clang
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (HAS_LIBCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
if(HAS_LIBCPPABI)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lc++abi")
message(STATUS "maille-designer: using libc++ and libc++abi.")
else()
message(STATUS "maille-designer: using libc++.")
endif()
else()
message(STATUS "maille-designer: NOT using libc++.")
endif()
endif()
# Include OpenGL directories for FreeBSD
if(CMAKE_SYSTEM MATCHES "FreeBSD")
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
link_directories( "/usr/local/lib/" )
endif()
# Include header files
include_directories(src)
# Compile main maille-designer library
set(SOURCE_FILES
main.cpp
src/common.h src/common.cpp
src/mailleinlay.h
src/torus.h src/torus.cpp
src/ringglcanvas.h src/ringglcanvas.cpp
src/maillescreen.h src/maillescreen.cpp
src/tools/tool.h
src/tools/simpleaddtool.h src/tools/simpleaddtool.cpp
src/tools/weaveaddtool.h src/tools/weaveaddtool.cpp
src/tools/selectiontool.h src/tools/selectiontool.cpp
src/tools/colorpickertool.h src/tools/colorpickertool.cpp
src/tools/colorselecttool.h src/tools/colorselecttool.cpp
src/tools/translationtool.h src/tools/translationtool.cpp
src/tools/painttool.h src/tools/painttool.cpp
src/weaves/weave.h
src/weaves/european4in1.h src/weaves/european4in1.cpp
src/nanogui/optionalpopupbutton.h
)
# Enable warnings for our source files
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Wall -Wextra")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Wall")
endif()
# Compile a target using NanoGUI
if (WIN32)
add_executable(maille WIN32 ${SOURCE_FILES})
else ()
add_executable(maille ${SOURCE_FILES})
endif()
# Lastly, additional libraries may have been built for you. In addition to linking
# against NanoGUI, we need to link against those as well.
target_link_libraries(maille nanogui ${NANOGUI_EXTRA_LIBS})