-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
55 lines (42 loc) · 1.86 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
cmake_minimum_required(VERSION 2.8.12)
project(ReTouch)
### Compilation flags: adapt to your needs ###
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj") ### Enable parallel compilation
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
set(LIBRARIES "")
### On windows, you also need glew
if((UNIX AND NOT APPLE) OR WIN32)
set(GLEW_INSTALL OFF CACHE BOOL " " FORCE)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/glew" "glew")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ext/glew/include")
list(APPEND LIBRARIES "glew")
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 src to the include directories
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
### Include Eigen for linear algebra
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ext/eigen")
# Add the configurations from nanogui
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/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})
# Add referecne
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ext/nanogui/include")
### Compile all the cpp files in src
file(GLOB SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
)
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} nanogui ${NANOGUI_EXTRA_LIBS} ${LIBRARIES})