-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c342f95
commit 2ccad66
Showing
4 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying | ||
# file Copyright.txt or https://cmake.org/licensing for details. | ||
|
||
#[=======================================================================[.rst: | ||
FindMMESH | ||
-------- | ||
Find the native MMESH includes and library. | ||
IMPORTED Targets | ||
^^^^^^^^^^^^^^^^ | ||
This module defines :prop_tgt:`IMPORTED` target ``MMESH::MMESH``, if | ||
MMESH has been found. | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
This module defines the following variables: | ||
:: | ||
MMESH_INCLUDE_DIRS - where to find meshdecimation.h, etc. | ||
MMESH_LIBRARIES - List of libraries when using mmesh. | ||
MMESH_FOUND - True if mmesh found. | ||
Hints | ||
^^^^^ | ||
A user may set ``MMESH_ROOT`` to a mmesh installation root to tell this | ||
module where to look. | ||
#]=======================================================================] | ||
|
||
set(_MMESH_SEARCHES) | ||
|
||
# Search MMESH_ROOT first if it is set. | ||
if(MMESH_ROOT) | ||
set(_MMESH_SEARCH_ROOT PATHS ${MMESH_ROOT} NO_DEFAULT_PATH) | ||
list(APPEND _MMESH_SEARCHES _MMESH_SEARCH_ROOT) | ||
endif() | ||
|
||
set(MMESH_NAMES mmesh) | ||
|
||
# Try each search configuration. | ||
foreach(search ${_MMESH_SEARCHES}) | ||
find_path(MMESH_INCLUDE_DIR NAMES meshdecimation.h ${${search}} PATH_SUFFIXES include include/mmesh mmesh) | ||
endforeach() | ||
|
||
# Allow MMESH_LIBRARY to be set manually, as the location of the openNURBS library | ||
if(NOT MMESH_LIBRARY) | ||
foreach(search ${_MMESH_SEARCHES}) | ||
find_library(MMESH_LIBRARY NAMES ${MMESH_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib) | ||
endforeach() | ||
endif() | ||
|
||
unset(MMESH_NAMES) | ||
|
||
mark_as_advanced(MMESH_INCLUDE_DIR) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(MMESH REQUIRED_VARS MMESH_LIBRARY MMESH_INCLUDE_DIR) | ||
|
||
if(MMESH_FOUND) | ||
set(MMESH_INCLUDE_DIRS ${MMESH_INCLUDE_DIR}) | ||
|
||
if(NOT MMESH_LIBRARIES) | ||
set(MMESH_LIBRARIES ${MMESH_LIBRARY}) | ||
endif() | ||
|
||
if(NOT TARGET MMESH::MMESH) | ||
add_library(MMESH::MMESH UNKNOWN IMPORTED) | ||
set_target_properties(MMESH::MMESH PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${MMESH_INCLUDE_DIRS}") | ||
|
||
if(MMESH_LIBRARY_RELEASE) | ||
set_property(TARGET MMESH::MMESH APPEND PROPERTY | ||
IMPORTED_CONFIGURATIONS RELEASE) | ||
set_target_properties(MMESH::MMESH PROPERTIES | ||
IMPORTED_LOCATION_RELEASE "${MMESH_LIBRARY_RELEASE}") | ||
endif() | ||
|
||
if(MMESH_LIBRARY_DEBUG) | ||
set_property(TARGET MMESH::MMESH APPEND PROPERTY | ||
IMPORTED_CONFIGURATIONS DEBUG) | ||
set_target_properties(MMESH::MMESH PROPERTIES | ||
IMPORTED_LOCATION_DEBUG "${MMESH_LIBRARY_DEBUG}") | ||
endif() | ||
|
||
if(NOT MMESH_LIBRARY_RELEASE AND NOT MMESH_LIBRARY_DEBUG) | ||
set_property(TARGET MMESH::MMESH APPEND PROPERTY | ||
IMPORTED_LOCATION "${MMESH_LIBRARY}") | ||
endif() | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
cad_enable(MMESH "librt") | ||
|
||
bext_enable(MMESH) | ||
|
||
# Decision made | ||
|
||
if (ENABLE_MMESH) | ||
|
||
git_submodule_init(mmesh src/mmcore.c) | ||
|
||
TargetDeps(MMESH) | ||
|
||
ExternalProject_Add(MMESH_BLD | ||
URL "${CMAKE_CURRENT_SOURCE_DIR}/mmesh" | ||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS} | ||
#PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/mmesh.patch | ||
CMAKE_ARGS | ||
${BUILD_TYPE_SPECIFIER} | ||
-DBIN_DIR=${BIN_DIR} | ||
-DLIB_DIR=${LIB_DIR} | ||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX} | ||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR} | ||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR} | ||
LOG_CONFIGURE ${EXT_BUILD_QUIET} | ||
LOG_BUILD ${EXT_BUILD_QUIET} | ||
LOG_INSTALL ${EXT_BUILD_QUIET} | ||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET} | ||
STEP_TARGETS install | ||
) | ||
|
||
TargetInstallDeps(MMESH MMESH_DEPENDS) | ||
|
||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX | ||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/mmesh/LICENSE | ||
${DOC_LICENSE_DIR}/mmesh.txt | ||
COPYONLY | ||
) | ||
|
||
endif (ENABLE_MMESH) | ||
|
||
# Local Variables: | ||
# tab-width: 8 | ||
# mode: cmake | ||
# indent-tabs-mode: t | ||
# End: | ||
# ex: shiftwidth=2 tabstop=8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PATCH | ||
|