Modularize build system usage of dependencies.

Must check for the existence of a bundled dep before we use it,
since e.g. Debian has to strip some files for license and policy reasons.
This commit is contained in:
Ryan Pavlik 2020-12-02 11:50:16 -06:00
parent 1f17534a02
commit bb15e2287f
18 changed files with 393 additions and 208 deletions

18
src/external/eigen.cmake vendored Normal file
View File

@ -0,0 +1,18 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_EIGEN "Allow use of bundled Eigen source" ON)
option(ALLOW_SYSTEM_EIGEN "Allow use of system-provided Eigen" ON)
if(ALLOW_SYSTEM_EIGEN AND EIGEN3_INCLUDE_DIR)
message(STATUS "- Eigen - using system-provided library")
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
elseif(ALLOW_BUNDLED_EIGEN AND EXISTS "${EIGEN_DIR}/Eigen/Eigen")
message(STATUS "- Eigen - using bundled source")
set(EIGEN_INCLUDE_DIRS ${EIGEN_DIR})
else()
message(
FATAL_ERROR
"Eigen is required - at least one of ALLOW_SYSTEM_EIGEN or ALLOW_BUNDLED_EIGEN must be enabled and found.")
endif()

View File

@ -1,45 +1,43 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
# newuoa - optional and header-only, for several plugins including all that use levmar
set(NEWUOA_DIR ${VCGDIR}/wrap/newuoa)
message(STATUS "- newuoa - using bundled source")
add_library(external-newuoa INTERFACE)
target_include_directories(external-newuoa INTERFACE ${NEWUOA_DIR}/include)
include(${EXTERNAL_DIR}/newuoa.cmake)
# levmar - optional, for several plugins
set(LEVMAR_DIR ${EXTERNAL_DIR}/levmar-2.3)
add_subdirectory(${LEVMAR_DIR})
include(${EXTERNAL_DIR}/levmar.cmake)
# lib3ds - optional, for io_3ds
set(LIB3DS_DIR ${EXTERNAL_DIR}/lib3ds-1.3.0)
add_subdirectory(${LIB3DS_DIR})
include(${EXTERNAL_DIR}/lib3ds.cmake)
# gmp or mpir - optional, for filter_csg
set(MPIR_DIR ${EXTERNAL_DIR}/mpir)
add_subdirectory(${MPIR_DIR})
include(${EXTERNAL_DIR}/gmp-mpir.cmake)
# muparser - optional, for filter_func
set(MUPARSER_DIR ${EXTERNAL_DIR}/muparser_v225)
add_subdirectory(${MUPARSER_DIR})
include(${EXTERNAL_DIR}/muparser.cmake)
# OpenCTM - optional, for io_ctm
set(OPENCTM_DIR ${EXTERNAL_DIR}/OpenCTM-1.0.3)
add_subdirectory(${OPENCTM_DIR})
include(${EXTERNAL_DIR}/openctm.cmake)
# structure-synth - optional, for filter_ssynth
set(SSYNTH_DIR ${EXTERNAL_DIR}/structuresynth-1.5)
add_subdirectory(${SSYNTH_DIR})
include(${EXTERNAL_DIR}/ssynth.cmake)
# qhull - optional, for filter_qhull
set(QHULL_DIR ${EXTERNAL_DIR}/qhull-2003.1)
add_subdirectory(${QHULL_DIR})
include(${EXTERNAL_DIR}/qhull.cmake)
# u3d - optional, for io_u3d
set(U3D_DIR ${EXTERNAL_DIR}/u3d)
add_subdirectory(${U3D_DIR})
#set_property(TARGET external-IDTFConverter PROPERTY FOLDER External)
include(${EXTERNAL_DIR}/u3d.cmake)
# opengr - optional and header-only, for filter_globalregistration
set(OPENGR_DIR ${EXTERNAL_DIR}/OpenGR)
message(STATUS "- OpenGR - using bundled source")
add_library(external-opengr INTERFACE)
target_include_directories(external-opengr INTERFACE ${OPENGR_DIR}/src/)
include(${EXTERNAL_DIR}/opengr.cmake)

50
src/external/glew.cmake vendored Normal file
View File

@ -0,0 +1,50 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_GLEW "Allow use of bundled GLEW source" ON)
option(ALLOW_SYSTEM_GLEW "Allow use of system-provided GLEW" ON)
unset(HAVE_SYSTEM_GLEW)
if(DEFINED GLEW_VERSION)
if((TARGET GLEW::GLEW) AND (${GLEW_VERSION} VERSION_GREATER_EQUAL "2.0.0"))
set(HAVE_SYSTEM_GLEW TRUE)
endif()
endif()
if(ALLOW_SYSTEM_GLEW AND HAVE_SYSTEM_GLEW)
message(STATUS "- glew - using system-provided library")
add_library(external-glew INTERFACE)
target_link_libraries(external-glew INTERFACE GLEW::GLEW)
if(TARGET OpenGL::OpenGL)
target_link_libraries(external-glew INTERFACE OpenGL::OpenGL)
elseif(TARGET OpenGL::GL)
target_link_libraries(external-glew INTERFACE OpenGL::GL)
else()
message(FATAL_ERROR "OpenGL not found or your CMake version is too old!")
endif()
elseif(ALLOW_BUNDLED_GLEW AND EXISTS "${GLEW_DIR}/src/glew.c")
message(STATUS "- glew - using bundled source")
add_library(external-glew STATIC "${GLEW_DIR}/src/glew.c")
target_compile_definitions(external-glew PUBLIC GLEW_STATIC)
target_include_directories(external-glew SYSTEM PUBLIC ${GLEW_DIR}/include)
if(TARGET OpenGL::OpenGL)
target_link_libraries(external-glew PUBLIC OpenGL::OpenGL)
elseif(TARGET OpenGL::GL)
target_link_libraries(external-glew PUBLIC OpenGL::GL)
else()
message(FATAL_ERROR "OpenGL not found or your CMake version is too old!")
endif()
if(TARGET OpenGL::GLX)
target_link_libraries(external-glew PUBLIC OpenGL::GLX)
endif()
set_property(TARGET external-glew PROPERTY FOLDER External)
# TODO not sure what this was for, but it's almost certainly wrong on at least one compiler
# since it's not in a compiler conditional.
# target_compile_options(external-glew PRIVATE -w)
else()
message(
FATAL_ERROR
"GLEW is required - at least one of ALLOW_SYSTEM_GLEW or ALLOW_BUNDLED_GLEW must be enabled and found.")
endif()

48
src/external/gmp-mpir.cmake vendored Normal file
View File

@ -0,0 +1,48 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_SYSTEM_GMP "Allow use of system-provided GMP" ON)
option(ALLOW_BUNDLED_MPIR "Allow use of bundled MPIR binaries" ON)
unset(HAVE_BUNDLED_MPIR)
if (APPLE AND EXISTS "${MPIR_DIR}/macx64/libmpir.a" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
# We have mac binaries for x64
# TODO check target processor architecture, not just pointer size
set(HAVE_BUNDLED_MPIR APPLE-x64)
elseif(WIN32 AND MSVC AND EXISTS "${MPIR_DIR}/win32-msvc/mpir.lib" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
# We have windows binaries for x64
# TODO check target processor architecture, not just pointer size
set(HAVE_BUNDLED_MPIR WIN-x64)
endif()
# gmp or mpir - optional, for filter_csg
if(ALLOW_SYSTEM_GMP AND GMP_FOUND)
message(STATUS "- GMP/MPIR - using system-provided GMP library")
add_library(external-gmp INTERFACE)
target_include_directories(external-gmp SYSTEM INTERFACE ${GMP_INCLUDE_DIRS})
target_link_libraries(external-gmp INTERFACE ${GMP_LIBRARIES})
elseif(ALLOW_BUNDLED_MPIR AND HAVE_BUNDLED_MPIR)
message(STATUS "- GMP/MPIR - using already built MPIR library")
add_library(external-mpir SHARED IMPORTED GLOBAL)
add_library(external-mpirxx SHARED IMPORTED GLOBAL)
# TODO why are we copying these? They're static libraries, not needed at runtime.
if (HAVE_BUNDLED_MPIR STREQUAL "WIN-x64")
file(
COPY ${MPIR_DIR}/win32-msvc/mpir.lib ${MPIR_DIR}/win32-msvc/mpirxx.lib
DESTINATION ${MESHLAB_LIB_OUTPUT_DIR})
set_property(TARGET external-mpir PROPERTY IMPORTED_IMPLIB "${MESHLAB_LIB_OUTPUT_DIR}/mpir.lib")
set_property(TARGET external-mpir PROPERTY IMPORTED_LOCATION "${MESHLAB_LIB_OUTPUT_DIR}/mpir.lib")
set_property(TARGET external-mpirxx PROPERTY IMPORTED_IMPLIB "${MESHLAB_LIB_OUTPUT_DIR}/mpirxx.lib")
set_property(TARGET external-mpirxx PROPERTY IMPORTED_LOCATION "${MESHLAB_LIB_OUTPUT_DIR}/mpirxx.lib")
target_include_directories(external-mpir INTERFACE ${EXTERNAL_DIR}/inc/win32-msvc/mpir-2.2.1_x64)
elseif(HAVE_BUNDLED_MPIR STREQUAL "APPLE-x64")
file(
COPY ${MPIR_DIR}/macx64/libmpir.a ${MPIR_DIR}/macx64/libmpirxx.a
DESTINATION ${MESHLAB_LIB_OUTPUT_DIR})
set_property(TARGET external-mpir PROPERTY IMPORTED_LOCATION "${MESHLAB_LIB_OUTPUT_DIR}/libmpir.a")
set_property(TARGET external-mpirxx PROPERTY IMPORTED_LOCATION "${MESHLAB_LIB_OUTPUT_DIR}/libmpirxx.a")
target_include_directories(external-mpir INTERFACE ${EXTERNAL_DIR}/inc/macx64/mpir-2.4.0)
endif()
endif()

View File

@ -1,15 +1,52 @@
message(STATUS "- levmar - using bundled source")
add_library(
external-levmar STATIC
"${LEVMAR_DIR}/compiler.h"
"${LEVMAR_DIR}/lm.h"
"${LEVMAR_DIR}/misc.h"
"${LEVMAR_DIR}/Axb.c"
"${LEVMAR_DIR}/lm.c"
"${LEVMAR_DIR}/lmbc.c"
"${LEVMAR_DIR}/lmblec.c"
"${LEVMAR_DIR}/lmlec.c"
"${LEVMAR_DIR}/misc.c")
target_include_directories(external-levmar PUBLIC ${LEVMAR_DIR})
set_property(TARGET external-levmar PROPERTY FOLDER External)
target_compile_options(external-levmar PRIVATE -w)
# levmar CMake file; see http://www.cmake.org and
# http://www.insightsoftwareconsortium.org/wiki/index.php/CMake_Tutorial
PROJECT(LEVMAR)
#CMAKE_MINIMUM_REQUIRED(VERSION 1.4)
# compiler flags
ADD_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # do not free memory between linear solvers calls
#REMOVE_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY)
# f2c is sometimes equivalent to libF77 & libI77; in that case, set HAVE_F2C to 0
SET(HAVE_F2C 1 CACHE BOOL "Do we have f2c or F77/I77?" )
# the directory where the lapack/blas/f2c libraries reside
SET(LAPACKBLAS_DIR /usr/lib CACHE PATH "Path to lapack/blas libraries")
# actual names for the lapack/blas/f2c libraries
SET(LAPACK_LIB lapack CACHE STRING "The name of the lapack library")
SET(BLAS_LIB blas CACHE STRING "The name of the blas library")
IF(HAVE_F2C)
SET(F2C_LIB f2c CACHE STRING "The name of the f2c library")
ELSE(HAVE_F2C)
SET(F77_LIB libF77 CACHE STRING "The name of the F77 library")
SET(I77_LIB libI77 CACHE STRING "The name of the I77 library")
ENDIF(HAVE_F2C)
########################## NO CHANGES BEYOND THIS POINT ##########################
#INCLUDE_DIRECTORIES(/usr/include)
LINK_DIRECTORIES(${LAPACKBLAS_DIR})
# levmar library source files
ADD_LIBRARY(levmar STATIC
lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c
lm.h misc.h compiler.h
)
# demo program
ADD_EXECUTABLE(lmdemo lmdemo.c lm.h)
# libraries the demo depends on
IF(HAVE_F2C)
TARGET_LINK_LIBRARIES(lmdemo levmar ${LAPACK_LIB} ${BLAS_LIB} ${F2C_LIB})
ELSE(HAVE_F2C)
TARGET_LINK_LIBRARIES(lmdemo levmar ${LAPACK_LIB} ${BLAS_LIB} ${F77_LIB} ${I77_LIB})
ENDIF(HAVE_F2C)
# make sure that the library is built before the demo
ADD_DEPENDENCIES(lmdemo levmar)
#SUBDIRS(matlab)
#ADD_TEST(levmar_tst lmdemo)

View File

@ -1,52 +0,0 @@
# levmar CMake file; see http://www.cmake.org and
# http://www.insightsoftwareconsortium.org/wiki/index.php/CMake_Tutorial
PROJECT(LEVMAR)
#CMAKE_MINIMUM_REQUIRED(VERSION 1.4)
# compiler flags
ADD_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # do not free memory between linear solvers calls
#REMOVE_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY)
# f2c is sometimes equivalent to libF77 & libI77; in that case, set HAVE_F2C to 0
SET(HAVE_F2C 1 CACHE BOOL "Do we have f2c or F77/I77?" )
# the directory where the lapack/blas/f2c libraries reside
SET(LAPACKBLAS_DIR /usr/lib CACHE PATH "Path to lapack/blas libraries")
# actual names for the lapack/blas/f2c libraries
SET(LAPACK_LIB lapack CACHE STRING "The name of the lapack library")
SET(BLAS_LIB blas CACHE STRING "The name of the blas library")
IF(HAVE_F2C)
SET(F2C_LIB f2c CACHE STRING "The name of the f2c library")
ELSE(HAVE_F2C)
SET(F77_LIB libF77 CACHE STRING "The name of the F77 library")
SET(I77_LIB libI77 CACHE STRING "The name of the I77 library")
ENDIF(HAVE_F2C)
########################## NO CHANGES BEYOND THIS POINT ##########################
#INCLUDE_DIRECTORIES(/usr/include)
LINK_DIRECTORIES(${LAPACKBLAS_DIR})
# levmar library source files
ADD_LIBRARY(levmar STATIC
lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c
lm.h misc.h compiler.h
)
# demo program
ADD_EXECUTABLE(lmdemo lmdemo.c lm.h)
# libraries the demo depends on
IF(HAVE_F2C)
TARGET_LINK_LIBRARIES(lmdemo levmar ${LAPACK_LIB} ${BLAS_LIB} ${F2C_LIB})
ELSE(HAVE_F2C)
TARGET_LINK_LIBRARIES(lmdemo levmar ${LAPACK_LIB} ${BLAS_LIB} ${F77_LIB} ${I77_LIB})
ENDIF(HAVE_F2C)
# make sure that the library is built before the demo
ADD_DEPENDENCIES(lmdemo levmar)
#SUBDIRS(matlab)
#ADD_TEST(levmar_tst lmdemo)

23
src/external/levmar.cmake vendored Normal file
View File

@ -0,0 +1,23 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_LEVMAR "Allow use of bundled levmar source" ON)
if(ALLOW_BUNDLED_LEVMAR AND EXISTS "${LEVMAR_DIR}/lm.h")
message(STATUS "- levmar - using bundled source")
add_library(
external-levmar STATIC
"${LEVMAR_DIR}/compiler.h"
"${LEVMAR_DIR}/lm.h"
"${LEVMAR_DIR}/misc.h"
"${LEVMAR_DIR}/Axb.c"
"${LEVMAR_DIR}/lm.c"
"${LEVMAR_DIR}/lmbc.c"
"${LEVMAR_DIR}/lmblec.c"
"${LEVMAR_DIR}/lmlec.c"
"${LEVMAR_DIR}/misc.c")
target_include_directories(external-levmar PUBLIC ${LEVMAR_DIR})
set_property(TARGET external-levmar PROPERTY FOLDER External)
target_link_libraries(external-levmar PRIVATE external-disable-warnings)
endif()

View File

@ -1,8 +1,16 @@
if(TARGET Lib3ds::Lib3ds)
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_LIB3DS "Allow use of bundled lib3ds source" ON)
option(ALLOW_SYSTEM_LIB3DS "Allow use of system-provided lib3ds" ON)
if(ALLOW_SYSTEM_LIB3DS AND TARGET Lib3ds::Lib3ds)
message(STATUS "- lib3ds - using system-provided library")
add_library(external-lib3ds INTERFACE)
target_link_libraries(external-lib3ds INTERFACE Lib3ds::Lib3ds)
else()
elseif(ALLOW_BUNDLED_LIB3DS AND EXISTS "${LIB3DS_DIR}/lib3ds/types.h")
message(STATUS "- lib3ds - using bundled source")
add_library(
external-lib3ds STATIC
@ -47,5 +55,7 @@ else()
target_include_directories(external-lib3ds SYSTEM PUBLIC "${LIB3DS_DIR}")
target_compile_definitions(external-lib3ds PUBLIC LIB3DS_STATIC)
set_property(TARGET external-lib3ds PROPERTY FOLDER External)
target_compile_options(external-lib3ds PRIVATE -w)
# TODO not sure what this was for, but it's almost certainly wrong on at least one compiler
# since it's not in a compiler conditional.
# target_compile_options(external-glew PRIVATE -w)
endif()

View File

@ -1,8 +1,15 @@
if(TARGET muparser::muparser)
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_MUPARSER "Allow use of bundled muparser source" ON)
option(ALLOW_SYSTEM_MUPARSER "Allow use of system-provided muparser" ON)
if(ALLOW_SYSTEM_MUPARSER AND TARGET muparser::muparser)
message(STATUS "- muparser - using system-provided library")
add_library(external-muparser INTERFACE)
target_link_libraries(external-muparser INTERFACE muparser::muparser)
else()
elseif(ALLOW_BUNDLED_MUPARSER AND EXISTS "${MUPARSER_DIR}/src/muParser.cpp")
message(STATUS "- muparser - using bundled source")
add_library(
external-muparser STATIC
@ -18,5 +25,4 @@ else()
target_include_directories(external-muparser SYSTEM PUBLIC ${MUPARSER_DIR}/include)
target_compile_definitions(external-muparser PUBLIC _UNICODE)
set_property(TARGET external-muparser PROPERTY FOLDER External)
target_compile_options(external-muparser PRIVATE -w)
endif()

11
src/external/newuoa.cmake vendored Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_NEWUOA "Allow use of bundled newuoa source" ON)
if(ALLOW_BUNDLED_NEWUOA AND EXISTS "${NEWUOA_DIR}/include/newuoa.h")
message(STATUS "- newuoa - using bundled source")
add_library(external-newuoa INTERFACE)
target_include_directories(external-newuoa INTERFACE ${NEWUOA_DIR}/include)
endif()

View File

@ -1,8 +1,15 @@
if(TARGET OpenCTM::OpenCTM)
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_OPENCTM "Allow use of bundled OpenCTM source" ON)
option(ALLOW_SYSTEM_OPENCTM "Allow use of system-provided OpenCTM" ON)
if(ALLOW_SYSTEM_OPENCTM AND TARGET OpenCTM::OpenCTM)
message(STATUS "- OpenCTM - using system-provided library")
add_library(external-openctm INTERFACE)
target_link_libraries(external-openctm INTERFACE OpenCTM::OpenCTM)
else()
elseif(ALLOW_BUNDLED_OPENCTM AND EXISTS "${OPENCTM_DIR}/lib/openctm.c")
message(STATUS "- OpenCTM - using bundled source")
# Modified liblzma included - can't build against system version
add_library(
@ -26,5 +33,4 @@ else()
target_compile_definitions(external-openctm PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
set_property(TARGET external-openctm PROPERTY FOLDER External)
target_compile_options(external-openctm PRIVATE -w)
endif()

11
src/external/opengr.cmake vendored Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_OPENGR "Allow use of bundled OpenGR source" ON)
if(ALLOW_BUNDLED_OPENGR AND EXISTS "${OPENGR_DIR}/src/gr/algorithms/match4pcsBase.h")
message(STATUS "- OpenGR - using bundled source")
add_library(external-opengr INTERFACE)
target_include_directories(external-opengr INTERFACE ${OPENGR_DIR}/src/)
endif()

View File

@ -1,10 +1,17 @@
if(TARGET Qhull::libqhull)
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_QHULL "Allow use of bundled Qhull source" ON)
option(ALLOW_SYSTEM_QHULL "Allow use of system-provided QHull" ON)
if(ALLOW_SYSTEM_QHULL AND TARGET Qhull::libqhull)
message(STATUS "- qhull - using system-provided library")
add_library(external-qhull INTERFACE)
target_link_libraries(external-qhull INTERFACE Qhull::libqhull)
target_compile_definitions(external-qhull INTERFACE SYSTEM_QHULL)
target_include_directories(external-qhull INTERFACE ${QHULL_libqhull_INCLUDE_DIR}/libqhull)
else()
elseif(ALLOW_BUNDLED_QHULL AND EXISTS "${QHULL_DIR}/src/qhull.h")
message(STATUS "- qhull - using bundled source")
add_library(
external-qhull STATIC
@ -32,5 +39,4 @@ else()
"${QHULL_DIR}/src/user.h")
target_include_directories(external-qhull INTERFACE "${QHULL_DIR}/src")
set_property(TARGET external-qhull PROPERTY FOLDER External)
target_compile_options(external-qhull PRIVATE -w)
endif()

108
src/external/ssynth.cmake vendored Normal file
View File

@ -0,0 +1,108 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_SSYNTH "Allow use of bundled structure-synth source" ON)
if(ALLOW_BUNDLED_SSYNTH AND EXISTS "${SSYNTH_DIR}/ssynth/StructureSynth/Model/Action.h")
message(STATUS "- structure-synth - using bundled source")
# Can't use a system version because using StructureSynth as a library is not common
add_library(
external-ssynth STATIC
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Action.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/AmbiguousRule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Builder.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ColorPool.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/CustomRule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ExecutionStack.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveClass.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveRule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RandomStreams.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleRef.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleSet.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/State.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Transformation.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/TransformationLoop.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/EisenParser.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Preprocessor.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Tokenizer.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Exceptions/Exception.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Box.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Dot.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/EngineWidget.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Grid.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Line.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Mesh.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Object3D.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/AtomicCounter.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RenderThread.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/Sampler.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/RaytraceTriangle.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Sphere.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Triangle.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/ListWidgetLogger.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/Logging.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Matrix4.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Random.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Vector3.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/ColorUtils.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/MiniParser.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Persistence.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Version.h"
"${SSYNTH_DIR}/ssynth/ThirdPartyCode/MersenneTwister/MersenneTwister.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/OpenGLRenderer.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/Renderer.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/TemplateRenderer.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Action.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/AmbiguousRule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Builder.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ColorPool.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/CustomRule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ExecutionStack.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveClass.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveRule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RandomStreams.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleRef.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleSet.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/State.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Transformation.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/TransformationLoop.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/EisenParser.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Preprocessor.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Tokenizer.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Box.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Dot.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Grid.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Line.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Mesh.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Object3D.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/AtomicCounter.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RenderThread.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/Sampler.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/RaytraceTriangle.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Triangle.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/ListWidgetLogger.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/Logging.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Matrix4.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Random.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Vector3.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/ColorUtils.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/MiniParser.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Persistence.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Version.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/Renderer.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/TemplateRenderer.cpp")
# These sources were disabled in the .pro file: "${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/EngineWidget.cpp"
# "${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp"
# "${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Sphere.cpp"
# "${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/OpenGLRenderer.cpp"
target_include_directories(external-ssynth SYSTEM PUBLIC "${SSYNTH_DIR}/ssynth")
target_link_libraries(external-ssynth PRIVATE Qt5::Core Qt5::Xml Qt5::OpenGL OpenGL::GLU)
set_property(TARGET external-ssynth PROPERTY FOLDER External)
endif()

View File

@ -1,101 +0,0 @@
message(STATUS "- structure-synth - using bundled source")
# Can't use a system version because using StructureSynth as a library is not common
add_library(
external-ssynth STATIC
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Action.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/AmbiguousRule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Builder.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ColorPool.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/CustomRule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ExecutionStack.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveClass.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveRule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RandomStreams.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rule.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleRef.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleSet.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/State.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Transformation.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/TransformationLoop.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/EisenParser.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Preprocessor.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Tokenizer.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Exceptions/Exception.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Box.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Dot.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/EngineWidget.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Grid.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Line.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Mesh.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Object3D.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/AtomicCounter.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RenderThread.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/Sampler.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/RaytraceTriangle.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Sphere.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Triangle.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/ListWidgetLogger.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/Logging.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Matrix4.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Random.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Vector3.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/ColorUtils.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/MiniParser.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Persistence.h"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Version.h"
"${SSYNTH_DIR}/ssynth/ThirdPartyCode/MersenneTwister/MersenneTwister.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/OpenGLRenderer.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/Renderer.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/TemplateRenderer.h"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Action.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/AmbiguousRule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Builder.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ColorPool.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/CustomRule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/ExecutionStack.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveClass.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/PrimitiveRule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RandomStreams.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rule.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleRef.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/RuleSet.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/State.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Transformation.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/TransformationLoop.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/EisenParser.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Preprocessor.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Parser/Tokenizer.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Box.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Dot.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Grid.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Line.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Mesh.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Object3D.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/AtomicCounter.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RenderThread.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/Sampler.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/RaytraceTriangle.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Triangle.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/ListWidgetLogger.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Logging/Logging.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Matrix4.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Random.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Math/Vector3.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/ColorUtils.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/MiniParser.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Persistence.cpp"
"${SSYNTH_DIR}/ssynth/SyntopiaCore/Misc/Version.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/Renderer.cpp"
"${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/TemplateRenderer.cpp")
# These sources were disabled in the .pro file: "${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/EngineWidget.cpp"
# "${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp"
# "${SSYNTH_DIR}/ssynth/SyntopiaCore/GLEngine/Sphere.cpp"
# "${SSYNTH_DIR}/ssynth/StructureSynth/Model/Rendering/OpenGLRenderer.cpp"
target_include_directories(external-ssynth SYSTEM PUBLIC "${SSYNTH_DIR}/ssynth")
target_link_libraries(external-ssynth PRIVATE Qt5::Core Qt5::Xml Qt5::OpenGL OpenGL::GLU)
set_property(TARGET external-ssynth PROPERTY FOLDER External)
target_compile_options(external-ssynth PRIVATE -w)

10
src/external/u3d.cmake vendored Normal file
View File

@ -0,0 +1,10 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_U3D "Allow use of bundled u3d source" ON)
if(ALLOW_BUNDLED_U3D AND EXISTS "${U3D_DIR}/CMakeLists.txt")
message(STATUS "- u3d - using bundled source")
add_subdirectory(${U3D_DIR})
endif()

View File

@ -1,4 +1,3 @@
message(STATUS "- u3d - using bundled source")
IF(APPLE)
# Tiger build

View File

@ -1,17 +1,20 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
# GLEW - required
set(GLEW_DIR ${EXTERNAL_DIR}/glew-2.1.0)
add_subdirectory(${GLEW_DIR})
include(${EXTERNAL_DIR}/glew.cmake)
# VCGLIb -- required
# VCGLib -- required
if(NOT VCGDIR)
get_filename_component(VCGDIR "${CMAKE_CURRENT_LIST_DIR}/vcglib" ABSOLUTE)
if(NOT EXISTS ${VCGDIR})
set(VCGDIR NOTFOUND)
endif()
endif()
set(VCGDIR
"${VCGDIR}")
set(VCGDIR "${VCGDIR}")
if(NOT VCGDIR)
message(FATAL_ERROR "VCGLib not found. Please clone recursively the MeshLab repo.")
@ -21,11 +24,5 @@ include_directories(${VCGDIR} ${CMAKE_CURRENT_SOURCE_DIR})
# Eigen3 - required
set(EIGEN_DIR ${VCGDIR}/eigenlib)
if(EIGEN3_INCLUDE_DIR)
message(STATUS "- Eigen - using system-provided library")
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
else()
message(STATUS "- Eigen - using bundled source")
set(EIGEN_INCLUDE_DIRS ${EIGEN_DIR})
endif()
include(${EXTERNAL_DIR}/eigen.cmake)
include_directories(${EIGEN_INCLUDE_DIRS})