summaryrefslogtreecommitdiff
path: root/graphics/instant-meshes/files/patch-ext_nanogui_CMakeLists.txt
blob: 5b00124c0977712a579592ec68470a766f64dba6 (plain)
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
--- ext/nanogui/CMakeLists.txt.orig	2016-10-15 20:12:12 UTC
+++ ext/nanogui/CMakeLists.txt
@@ -6,12 +6,6 @@ if (POLICY CMP0058)
   cmake_policy(SET CMP0058 NEW)
 endif()
 
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw/src")
-  message(FATAL_ERROR "The NanoGUI dependency repositories (GLFW, etc.) are missing! "
-    "You probably did not clone the project with --recursive. It is possible to recover "
-    "by calling \"git submodule update --init --recursive\"")
-endif()
-
 if (WIN32)
   set(NANOGUI_USE_GLAD_DEFAULT ON)
 else()
@@ -61,9 +55,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
 endif()
 
-# Compile GLFW
-add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw" "ext_build/glfw")
-
 # Python support: add NANOGUI_PYTHON flag to all targets
 if (NANOGUI_BUILD_PYTHON)
   list(APPEND NANOGUI_EXTRA_DEFS -DNANOGUI_PYTHON)
@@ -174,13 +165,6 @@ if (NANOGUI_BUILD_SHARED)
   endif()
 endif()
 
-# Always use libc++ on Clang
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
-endif()
-
 if (NANOGUI_USE_GLAD)
   # Build and include GLAD on Windows
   list(APPEND LIBNANOGUI_EXTRA_SOURCE
@@ -197,12 +181,12 @@ if (NANOGUI_USE_GLAD)
 endif()
 
 list(APPEND NANOGUI_EXTRA_INCS
-  "${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw/include"
+  "${CMAKE_INSTALL_PREFIX}/include/GLFW"
   "${CMAKE_CURRENT_SOURCE_DIR}/ext/nanovg/src"
 )
 
 if (NOT NANOGUI_EIGEN_INCLUDE_DIR)
-  set(NANOGUI_EIGEN_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/eigen")
+  set(NANOGUI_EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/eigen3")
   list(APPEND NANOGUI_EXTRA_INCS "${NANOGUI_EIGEN_INCLUDE_DIR}")
 endif()
 
@@ -226,9 +210,12 @@ elseif(CMAKE_SYSTEM MATCHES "Linux" OR C
   if(CMAKE_SYSTEM MATCHES "Linux")
     list(APPEND NANOGUI_EXTRA_LIBS dl)
   endif()
+  if(CMAKE_SYSTEM MATCHES "FreeBSD")
+    list(APPEND NANOGUI_EXTRA_LIBS glfw)
+  endif()
 endif()
 
-include_directories(${NANOGUI_EIGEN_INCLUDE_DIR} ext/glfw/include ext/nanovg/src include ${CMAKE_CURRENT_BINARY_DIR})
+include_directories(${NANOGUI_EIGEN_INCLUDE_DIR} ext/nanovg/src include ${CMAKE_CURRENT_BINARY_DIR})
 
 # Run simple C converter to put font files into the data segment
 add_executable(bin2c resources/bin2c.c)
@@ -311,7 +298,6 @@ add_library(nanogui-obj OBJECT
 
 add_library(nanogui ${NANOGUI_LIBRARY_TYPE}
   $<TARGET_OBJECTS:nanogui-obj>
-  $<TARGET_OBJECTS:glfw_objects>
 )
 
 if (${NANOGUI_LIBRARY_TYPE} MATCHES "SHARED")