@@ -41,6 +41,7 @@ option(PROFILE "Enable compiling with profiling / test coverage instrumentation"
41
41
option (MXECROSS "Enable setup for MXE cross platform build" OFF )
42
42
option (OFFLINE_DOCS "Download Documentation for offline usage" OFF )
43
43
option (USE_MIMALLOC "Use mimalloc as malloc replacement." ON )
44
+ option (USE_BUILTIN_OPENCSG "Use OpenCSG from submodule." OFF )
44
45
option (USE_CCACHE "Use ccache to speed up compilation." ON )
45
46
option (ENABLE_CAIRO "Enable support for cairo vector graphics library." ON )
46
47
option (ENABLE_SPNAV "Enable support for libspnav input driver." ON )
@@ -185,9 +186,21 @@ macro(find_graphics)
185
186
if (NULLGL)
186
187
target_compile_definitions (OpenSCAD PRIVATE NULLGL)
187
188
else ()
188
- find_package (OpenCSG REQUIRED QUIET )
189
- target_link_libraries (OpenSCAD PRIVATE ${OPENCSG_LIBRARY} )
190
- message (STATUS "OpenCSG: ${OPENCSG_VERSION_STRING} " )
189
+ if (NOT USE_BUILTIN_OPENCSG)
190
+ find_package (OpenCSG REQUIRED QUIET )
191
+ target_link_libraries (OpenSCAD PRIVATE ${OPENCSG_LIBRARY} )
192
+ message (STATUS "OpenCSG: ${OPENCSG_VERSION_STRING} " )
193
+ if (MSVC )
194
+ find_path (OPENCSG_INCLUDE_DIRS opencsg/opencsg.h)
195
+ target_include_directories (OpenSCAD SYSTEM PRIVATE "${OPENCSG_INCLUDE_DIRS} /opencsg" )
196
+ else ()
197
+ find_path (OPENCSG_INCLUDE_DIRS opencsg.h)
198
+ target_include_directories (OpenSCAD SYSTEM PRIVATE ${OPENCSG_INCLUDE_DIRS} )
199
+ endif ()
200
+ else ()
201
+ target_link_libraries (OpenSCAD PRIVATE OpenCSG)
202
+ message (STATUS "OpenCSG: <submodule>" )
203
+ endif ()
191
204
target_compile_definitions (OpenSCAD PRIVATE ENABLE_OPENCSG)
192
205
193
206
find_package (GLEW REQUIRED QUIET )
@@ -409,6 +422,10 @@ if(NOT MSVC)
409
422
endif ()
410
423
endif ()
411
424
425
+ if (USE_BUILTIN_OPENCSG)
426
+ include ("submodules/CMakeLists-OpenCSG.txt" )
427
+ endif (USE_BUILTIN_OPENCSG)
428
+
412
429
# Automatically add the current source and build directories to the include path.
413
430
set (CMAKE_INCLUDE_CURRENT_DIR ON ) # (does not propagate down to subdirectories)
414
431
@@ -564,8 +581,8 @@ elseif(UNIX)
564
581
set (OFFSCREEN_METHOD "Unix GLX on X11" )
565
582
message (STATUS "Offscreen OpenGL Context - using Unix GLX on X11" )
566
583
set (PLATFORM_SOURCES ${PLATFORM_SOURCES} src/glview/offscreen-old/OffscreenContextGLX.cc)
567
- find_library (X11_LIBRARY X11)
568
- target_link_libraries (OpenSCAD PRIVATE ${X11_LIBRARY} )
584
+ find_package ( X11 REQUIRED )
585
+ target_link_libraries (OpenSCAD PRIVATE X11::X11 )
569
586
endif ()
570
587
endif ()
571
588
elseif (WIN32 )
0 commit comments