Skip to content

Commit

Permalink
Update RP framework
Browse files Browse the repository at this point in the history
fixes #20
  • Loading branch information
tamasmeszaros committed Mar 25, 2021
1 parent 620ebc8 commit bc2bd7f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 50 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/)

include(RequirePackage)

set(RP_REPOSITORY_DIR ${CMAKE_SOURCE_DIR}/external CACHE PATH "" FORCE)

option(LIBNEST2D_BUILD_UNITTESTS "If enabled, googletest framework will be downloaded
and the provided unit tests will be included in the build." OFF)

Expand Down
38 changes: 5 additions & 33 deletions cmake_modules/FindClipper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,14 @@ else()
endif()

FIND_PATH(CLIPPER_INCLUDE_DIRS clipper.hpp
$ENV{CLIPPER_PATH}
$ENV{CLIPPER_PATH}/cpp/
$ENV{CLIPPER_PATH}/include/
$ENV{CLIPPER_PATH}/include/polyclipping/
${PROJECT_SOURCE_DIR}/python/pymesh/third_party/include/
${PROJECT_SOURCE_DIR}/python/pymesh/third_party/include/polyclipping/
${CMAKE_PREFIX_PATH}/include/polyclipping
${CMAKE_PREFIX_PATH}/include/
/opt/local/include/
/opt/local/include/polyclipping/
/usr/local/include/
/usr/local/include/polyclipping/
/usr/include
/usr/include/polyclipping/)

set(LIB_SEARCHDIRS
$ENV{CLIPPER_PATH}
$ENV{CLIPPER_PATH}/cpp/
$ENV{CLIPPER_PATH}/cpp/build/
$ENV{CLIPPER_PATH}/lib/
$ENV{CLIPPER_PATH}/lib/polyclipping/
${PROJECT_SOURCE_DIR}/python/pymesh/third_party/lib/
${PROJECT_SOURCE_DIR}/python/pymesh/third_party/lib/polyclipping/
${CMAKE_PREFIX_PATH}/lib/
${CMAKE_PREFIX_PATH}/lib/polyclipping/
/opt/local/lib/
/opt/local/lib/polyclipping/
/usr/local/lib/
/usr/local/lib/polyclipping/
/usr/lib/polyclipping
)
PATH_SUFFIXES polyclipping
PATHS include/polyclipping ENV CLIPPER_PATH
)

set(_deb_postfix "d")

FIND_LIBRARY(CLIPPER_LIBRARIES_RELEASE polyclipping ${LIB_SEARCHDIRS})
FIND_LIBRARY(CLIPPER_LIBRARIES_DEBUG polyclipping${_deb_postfix} ${LIB_SEARCHDIRS})
FIND_LIBRARY(CLIPPER_LIBRARIES_RELEASE polyclipping)
FIND_LIBRARY(CLIPPER_LIBRARIES_DEBUG polyclipping${_deb_postfix})

if(CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE})
set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}}")
Expand Down
15 changes: 9 additions & 6 deletions cmake_modules/RequirePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ option(RP_ENABLE_DOWNLOADING "Enable downloading of bundled packages if not foun
include(CMakeDependentOption)
cmake_dependent_option(RP_FORCE_DOWNLOADING "Force downloading packages even if found." OFF "RP_ENABLE_DOWNLOADING" OFF)

set(RP_REPOSITORY_DIR ${CMAKE_CURRENT_LIST_DIR}/../external CACHE STRING "Package repository location")
set(RP_REPOSITORY_DIR ${CMAKE_CURRENT_LIST_DIR}/../packages CACHE STRING "Package repository location")
set(RP_BUILD_PATH ${PROJECT_BINARY_DIR}/rp_packages_build CACHE STRING "Binary dir for downloaded package builds")
option(RP_BUILD_SHARED_LIBS "Build dependencies as shared libraries" ${BUILD_SHARED_LIBS})

mark_as_advanced(RP_BUILD_PATH)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/overrides)
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/overrides)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/overrides)
endif ()

list(REMOVE_DUPLICATES CMAKE_MODULE_PATH)

# Packages for which require_package is called are gathered in this list.
Expand All @@ -29,7 +32,7 @@ if (NOT CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH "")
endif()

list(APPEND CMAKE_PREFIX_PATH ${RP_INSTALL_PREFIX})
list(INSERT CMAKE_PREFIX_PATH 0 ${RP_INSTALL_PREFIX})

function(download_package)

Expand Down Expand Up @@ -176,9 +179,9 @@ function(download_package)
execute_process(
COMMAND ${CMAKE_COMMAND}
-D "RP_PACKAGE:STRING=${RP_ARGS_PACKAGE}"
-D "RP_${RP_ARGS_PACKAGE}_COMPONENTS=\"${RP_ARGS_COMPONENTS}\""
-D "RP_${RP_ARGS_PACKAGE}_OPTIONAL_COMPONENTS=\"${RP_ARGS_OPTIONAL_COMPONENTS}\""
-D "RP_${RP_ARGS_PACKAGE}_VERSION=\"${RP_ARGS_VERSION}\""
-D "RP_${RP_ARGS_PACKAGE}_COMPONENTS=${RP_ARGS_COMPONENTS}"
-D "RP_${RP_ARGS_PACKAGE}_OPTIONAL_COMPONENTS=${RP_ARGS_OPTIONAL_COMPONENTS}"
-D "RP_${RP_ARGS_PACKAGE}_VERSION=${RP_ARGS_VERSION}"
-D "AS_RP_PROCESS:INTERNAL=ON"
-D "RP_FIND_QUIETLY:BOOL=${RP_ARGS_QUIET}"
-D "RP_FIND_REQUIRED:BOOL=${RP_ARGS_REQUIRED}"
Expand Down
18 changes: 8 additions & 10 deletions external/+Boost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ if (RP_PACKAGE STREQUAL "Boost")
endif()

set(_libs "")
foreach(_comp ${RP_Boost_COMPONENTS})
set(_comps ${RP_Boost_COMPONENTS})
if (NOT _comps)
set(_comps headers)
endif ()

foreach(_comp ${_comps})
list(APPEND _libs "--with-${_comp}")
endforeach()

Expand Down Expand Up @@ -107,17 +112,10 @@ set(_build_cmd ${_build_cmd}
link=${_link}
threading=multi
boost.locale.icu=off
${_boost_variants})
${_boost_variants}
stage)

set(_install_cmd ${_build_cmd} --prefix=${_prefix} install)

if (NOT _libs)
set(_install_cmd ${CMAKE_COMMAND} -E copy_directory boost ${CMAKE_INSTALL_PREFIX}/include/boost)
set(_build_cmd "")
set(_bootstrap_cmd "")
else()
list(APPEND _build_cmd "stage")
endif()

ExternalProject_Add(
rp_Boost
Expand Down
2 changes: 1 addition & 1 deletion include/libnest2d/backends/clipper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ target_link_libraries(clipperBackend INTERFACE Clipper::Clipper)

# Clipper backend is not enough on its own, it still need some functions
# from Boost geometry
require_package(Boost 1.58 REQUIRED)
require_package(Boost VERSION 1.58 REQUIRED COMPONENTS headers)

if(TARGET Boost::boost)
target_link_libraries(clipperBackend INTERFACE Boost::boost )
Expand Down

0 comments on commit bc2bd7f

Please sign in to comment.