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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
diff --git a/cmake/LibiglWindows.cmake b/cmake/LibiglWindows.cmake
index b98aa55..46c68a7 100644
--- a/cmake/LibiglWindows.cmake
+++ b/cmake/LibiglWindows.cmake
@@ -1,4 +1,4 @@
-if(MSVC)
+if(0)
option(IGL_STATIC_RUNTIME "Use libigl with the static MSVC runtime." OFF)
if(IGL_STATIC_RUNTIME)
message(STATUS "MSVC -> forcing use of statically-linked runtime.")
diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake
index d07bbb3..a33cefa 100644
--- a/cmake/libigl.cmake
+++ b/cmake/libigl.cmake
@@ -107,7 +107,8 @@ if(HUNTER_ENABLED)
endif()
# Eigen
-if(NOT TARGET Eigen3::Eigen)
+find_package(Eigen3 CONFIG REQUIRED)
+if(0)
igl_download_eigen()
add_library(igl_eigen INTERFACE)
target_include_directories(igl_eigen SYSTEM INTERFACE
@@ -296,9 +297,9 @@ endif()
################################################################################
### Compile the embree part ###
if(LIBIGL_WITH_EMBREE)
- set(EMBREE_DIR "${LIBIGL_EXTERNAL}/embree")
+ find_package(embree 3 CONFIG REQUIRED)
- if(NOT TARGET embree)
+ if(0)
igl_download_embree()
set(EMBREE_TESTING_INTENSITY 0 CACHE STRING "")
@@ -315,8 +315,11 @@ if(LIBIGL_WITH_EMBREE)
endif()
compile_igl_module("embree")
target_link_libraries(igl_embree ${IGL_SCOPE} embree)
- target_include_directories(igl_embree ${IGL_SCOPE} ${EMBREE_DIR}/include)
+ if(LIBIGL_USE_STATIC_LIBRARY)
+ find_package(TBB CONFIG REQUIRED)
+ target_link_libraries(igl_embree ${IGL_SCOPE} TBB::tbb)
target_compile_definitions(igl_embree ${IGL_SCOPE} -DEMBREE_STATIC_LIB)
+ endif()
endif()
@@ -358,11 +359,12 @@ if(LIBIGL_WITH_OPENGL)
endif()
# glad module
- if(NOT TARGET glad)
+ find_package(glad CONFIG REQUIRED)
+ if(0)
igl_download_glad()
add_subdirectory(${LIBIGL_EXTERNAL}/glad glad)
endif()
- target_link_libraries(igl_opengl ${IGL_SCOPE} glad)
+ target_link_libraries(igl_opengl ${IGL_SCOPE} glad::glad)
endif()
################################################################################
@@ -371,7 +373,8 @@ if(LIBIGL_WITH_OPENGL_GLFW)
if(TARGET igl::opengl)
# GLFW module
compile_igl_module("opengl/glfw")
- if(NOT TARGET glfw)
+ find_package(glfw3 CONFIG REQUIRED)
+ if(0)
igl_download_glfw()
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
@@ -394,11 +397,12 @@ if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
if(TARGET igl::opengl_glfw)
# ImGui module
compile_igl_module("opengl/glfw/imgui")
- if(NOT TARGET imgui)
+ find_package(imgui CONFIG REQUIRED)
+ if(0)
igl_download_imgui()
add_subdirectory(${LIBIGL_EXTERNAL}/libigl-imgui imgui)
endif()
- target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui)
+ target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui::imgui)
endif()
endif()
@@ -408,12 +412,22 @@ if(LIBIGL_WITH_PNG)
# png/ module is anomalous because it also depends on opengl it really should
# be moved into the opengl/ directory and namespace ...
if(TARGET igl_opengl)
- if(NOT TARGET stb_image)
+ find_path(stb_include_dir stb.h)
+ find_package(opengl REQUIRED)
+ find_package(libpng CONFIG REQUIRED)
+ find_package(glad CONFIG REQUIRED)
+ if (BUILD_SHARED_LIBS)
+ set(libpng_LIBRARIES png)
+ else()
+ set(libpng_LIBRARIES png_static)
+ endif()
+ if(0)
igl_download_stb()
add_subdirectory(${LIBIGL_EXTERNAL}/stb stb_image)
endif()
compile_igl_module("png" "")
- target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
+ target_include_directories(igl_png INTERFACE ${stb_include_dir})
+ target_link_libraries(igl_png ${IGL_SCOPE} OpenGL::GL ${libpng_LIBRARIES} glad::glad)
endif()
endif()
@@ -461,7 +475,8 @@ endif()
### Compile the xml part ###
if(LIBIGL_WITH_XML)
set(TINYXML2_DIR "${LIBIGL_EXTERNAL}/tinyxml2")
- if(NOT TARGET tinyxml2)
+ find_package(tinyxml2 CONFIG REQUIRED)
+ if(0)
igl_download_tinyxml2()
add_library(tinyxml2 STATIC ${TINYXML2_DIR}/tinyxml2.cpp ${TINYXML2_DIR}/tinyxml2.h)
target_include_directories(tinyxml2 PUBLIC ${TINYXML2_DIR})
@@ -471,7 +486,7 @@ if(LIBIGL_WITH_XML)
SOVERSION "3")
endif()
compile_igl_module("xml")
- target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2)
+ target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2::tinyxml2)
- target_include_directories(igl_xml ${IGL_SCOPE} ${TINYXML2_DIR})
+
endif()
diff --git a/include/igl/opengl/glfw/imgui/ImGuiHelpers.h b/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
index 1d3e3bc..682b6d7 100644
--- a/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
+++ b/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
@@ -10,7 +10,7 @@
////////////////////////////////////////////////////////////////////////////////
#include "ImGuiTraits.h"
-#include <imgui/imgui.h>
+#include <imgui.h>
#include <vector>
#include <string>
#include <algorithm>
diff --git a/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp b/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
index 47de487..6c607de 100644
--- a/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
+++ b/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
@@ -9,9 +9,9 @@
#include "ImGuiMenu.h"
#include "ImGuiHelpers.h"
#include <igl/project.h>
-#include <imgui/imgui.h>
+#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include <imgui_fonts_droid_sans.h>
#include <GLFW/glfw3.h>
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
diff --git a/include/igl/opengl/glfw/imgui/ImGuiTraits.h b/include/igl/opengl/glfw/imgui/ImGuiTraits.h
index 7dae22a..e6911c5 100644
--- a/include/igl/opengl/glfw/imgui/ImGuiTraits.h
+++ b/include/igl/opengl/glfw/imgui/ImGuiTraits.h
@@ -8,7 +8,7 @@
#ifndef IGL_OPENGL_GLFW_IMGUI_IMGUITRAITS_H
#define IGL_OPENGL_GLFW_IMGUI_IMGUITRAITS_H
-#include <imgui/imgui.h>
+#include <imgui.h>
// Extend ImGui by populating its namespace directly
namespace ImGui
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 273324d..cefbd52 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -15,12 +15,11 @@ igl_download_test_data()
set(IGL_TEST_DATA ${LIBIGL_EXTERNAL}/../tests/data)
### Download Catch2 unit test framework
-igl_download_catch2()
+find_package(Catch2 CONFIG REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${LIBIGL_EXTERNAL}/catch2/contrib)
# Add catch2
-add_subdirectory(${LIBIGL_EXTERNAL}/catch2 catch2)
# Create test executable
diff --git a/tutorial/106_ViewerMenu/main.cpp b/tutorial/106_ViewerMenu/main.cpp
index cc514e5..f1be538 100644
--- a/tutorial/106_ViewerMenu/main.cpp
+++ b/tutorial/106_ViewerMenu/main.cpp
@@ -2,7 +2,7 @@
#include <igl/opengl/glfw/Viewer.h>
#include <igl/opengl/glfw/imgui/ImGuiMenu.h>
#include <igl/opengl/glfw/imgui/ImGuiHelpers.h>
-#include <imgui/imgui.h>
+#include <imgui.h>
#include <iostream>
#include "tutorial_shared_path.h"
|