Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ endif()
### Enter subdirectories

# VCGLib -- required
if (VCGDIR) # VCGDIR exists - using custom user vcglib path
find_package(vcglib CONFIG)
if(TARGET vcglib::vcglib)
message(STATUS "- VCGLib - using system provided library")
add_library(vcglib ALIAS vcglib::vcglib)
get_target_property(VCGDIR vcglib::vcglib INTERFACE_INCLUDE_DIRECTORIES)
elseif (VCGDIR) # VCGDIR exists - using custom user vcglib path
if(EXISTS ${VCGDIR})
add_subdirectory(${VCGDIR} {CMAKE_CURRENT_BINARY_DIR}/vcglib)
message(STATUS "- VCGLib - using custom VCGDIR path library")
Expand Down Expand Up @@ -224,6 +229,29 @@ endforeach()
set(COPIED_FILES)

if (NOT MESHLAB_BUILD_ONLY_LIBRARIES)
# headers
install(DIRECTORY common DESTINATION include FILES_MATCHING PATTERN "*.h")
# CMake exports
if(TARGET vcglib::vcglib AND TARGET GLEW::GLEW)
install(EXPORT meshlabTargets
DESTINATION lib/cmake/meshlab
NAMESPACE meshlab::
FILE meshlabTargets.cmake
)
include(CMakePackageConfigHelpers)
# generate the config file that includes the exports
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/meshlabConfig.cmake"
INSTALL_DESTINATION lib/cmake/vcglib
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/meshlabConfig.cmake"
DESTINATION lib/cmake/meshlab
)
endif()

# shaders
set(SHADER_BASE_DIR "${MESHLAB_RESOURCES_DIR}/shaders")
file(
Expand Down
9 changes: 9 additions & 0 deletions src/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(GLEW)
find_dependency(OpenGL)
find_dependency(Qt5 COMPONENTS OpenGL Xml Network)
find_dependency(vcglib)

include ( "${CMAKE_CURRENT_LIST_DIR}/meshlabTargets.cmake" )
18 changes: 14 additions & 4 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ endif()

target_include_directories(meshlab-common
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/..)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:include>)

target_link_libraries(
meshlab-common
Expand All @@ -208,10 +209,19 @@ target_link_libraries(
Qt5::Widgets
Qt5::Xml
Qt5::Network
vcglib
external-glew
PRIVATE
external-easyexif
)
if(TARGET vcglib::vcglib)
target_link_libraries(meshlab-common PUBLIC vcglib::vcglib)
else()
target_link_libraries(meshlab-common PUBLIC vcglib)
endif()
if(TARGET GLEW::GLEW)
target_link_libraries(meshlab-common PUBLIC GLEW::GLEW)
else()
target_link_libraries(meshlab-common PUBLIC external-glew)
endif()

set_property(TARGET meshlab-common PROPERTY FOLDER Core)

Expand All @@ -234,4 +244,4 @@ endif()
set_target_properties(meshlab-common PROPERTIES
INSTALL_RPATH "$ORIGIN")

install(TARGETS meshlab-common DESTINATION ${MESHLAB_LIB_INSTALL_DIR})
install(TARGETS meshlab-common EXPORT meshlabTargets DESTINATION ${MESHLAB_LIB_INSTALL_DIR})
19 changes: 18 additions & 1 deletion src/external/levmar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,25 @@
# SPDX-License-Identifier: BSL-1.0

option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR "Allow download and use of levmar source" ON)
option(MESHLAB_ALLOW_SYSTEM_LEVMAR "Allow use of system-provided levmar" ON)

if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR)
find_path(levmar_INCLUDE_DIR NAMES levmar.h PATHS ${levmar_PREFIX})
find_library(levmar_LIBRARY NAMES levmar PATHS ${levmar_PREFIX})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
levmar
DEFAULT_MSG
levmar_LIBRARY
levmar_INCLUDE_DIR
)
mark_as_advanced(levmar_INCLUDE_DIR levmar_LIBRARY)

if(MESHLAB_ALLOW_SYSTEM_LEVMAR AND levmar_FOUND)
message(STATUS "- levmar - using system-provided library")
add_library(external-levmar INTERFACE)
target_link_libraries(external-levmar INTERFACE ${levmar_LIBRARY})
target_include_directories(external-levmar INTERFACE ${levmar_INCLUDE_DIR})
elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR)
set(LEVMAR_VERSION "2.6.1")

set(LEVMAR_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/levmar-${LEVMAR_VERSION}")
Expand Down
9 changes: 8 additions & 1 deletion src/external/lib3mf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@
#############################################################################

option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3MF "Allow download and use of lib3MF source" ON)
option(MESHLAB_ALLOW_SYSTEM_LIB3MF "Allow use of system-provided lib3MF" ON)

if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3MF)
find_package(lib3mf)

if(MESHLAB_ALLOW_SYSTEM_LIB3MF AND TARGET lib3mf::lib3mf)
message(STATUS "- Lib3MF - using system-provided library")
add_library(external-lib3mf INTERFACE)
target_link_libraries(external-lib3mf INTERFACE lib3mf::lib3mf)
elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3MF)
set(LIB3MF_VERSION "2.4.1")

set(LIB3MF_DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/lib3mf-${LIB3MF_VERSION})
Expand Down
9 changes: 8 additions & 1 deletion src/external/libigl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
# SPDX-License-Identifier: BSL-1.0

option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL "Allow download and use of LibIGL source" ON)
option(MESHLAB_ALLOW_SYSTEM_LIBIGL "Allow use of system-provided LibIGL" ON)

set(LIBIGL_VER 2.4.0)

if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL)
find_path(libigl_INCLUDE_DIR NAMES igl_inline.h PATH_SUFFIXES igl PATHS ${libigl_PREFIX})

if(MESHLAB_ALLOW_SYSTEM_LIBIGL AND libigl_INCLUDE_DIR)
message(STATUS "- LibIGL - using system-provided library")
add_library(external-libigl INTERFACE)
target_include_directories(external-libigl INTERFACE ${libigl_INCLUDE_DIR})
elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL)
set(LIBIGL_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-${LIBIGL_VER}")
set(LIBIGL_CHECK "${LIBIGL_DIR}/include/igl/igl_inline.h")

Expand Down
9 changes: 8 additions & 1 deletion src/external/nexus.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
# SPDX-License-Identifier: BSL-1.0

option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS "Allow download and use of nexus source" ON)
option(MESHLAB_ALLOW_SYSTEM_NEXUS "Allow use of system-provided nexus and corto" ON)

set(CORTO_VER 2025.07)
set(NEXUS_VER 2025.05)

if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS)
find_package(nexus CONFIG)

if(MESHLAB_ALLOW_SYSTEM_NEXUS AND TARGET nexus::nexus)
message(STATUS "- nexus - using system-provided library")
add_library(external-nexus INTERFACE)
target_link_libraries(external-nexus INTERFACE nexus::nexus)
elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS)
set(NEXUS_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/nexus-${NEXUS_VER}")
set(NEXUS_CHECK "${NEXUS_DIR}/CMakeLists.txt")
set(CORTO_DIR "${NEXUS_DIR}/src/corto")
Expand Down
2 changes: 1 addition & 1 deletion src/meshlabplugins/io_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ set(SOURCES

add_meshlab_plugin(io_base ${SOURCES} ${HEADERS})

target_link_libraries(io_base PRIVATE OpenGL::GLU)
target_link_libraries(io_base PRIVATE OpenGL::GLU external-easyexif)
2 changes: 1 addition & 1 deletion src/vcglib
Submodule vcglib updated 2 files
+33 −4 CMakeLists.txt
+7 −0 Config.cmake.in
Loading