diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5fcd2b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,123 @@ +### C++ template +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### CMake template +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +.idea/ +tmp/* +test_package/build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 82bde89..94e5e71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,15 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.20) project(Libnest2D) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED) +# Use C++17 Standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Add our own cmake module path. list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/) -include(RequirePackage) - option(LIBNEST2D_BUILD_UNITTESTS "If enabled, googletest framework will be downloaded and the provided unit tests will be included in the build." OFF) @@ -160,19 +160,9 @@ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/FindClipper.cmake" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/FindNLopt.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/FindTBB.cmake" DESTINATION ${ConfigPackageLocation} COMPONENT Devel ) - -rp_install_versions_file(${ConfigPackageLocation}) - -foreach(p ${LIBNEST2D_PUBLIC_PACKAGES}) - set(_pkgstr "${_pkgstr} ${p}") -endforeach() -message(STATUS "Installed Libnest2DConfig.cmake will require packages:${_pkgstr}") - diff --git a/cmake_modules/FindClipper.cmake b/cmake_modules/FindClipper.cmake deleted file mode 100644 index bdc9353..0000000 --- a/cmake_modules/FindClipper.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# Find Clipper library (http://www.angusj.com/delphi/clipper.php). -# The following variables are set -# -# CLIPPER_FOUND -# CLIPPER_INCLUDE_DIRS -# CLIPPER_LIBRARIES -# -# It searches the environment variable $CLIPPER_PATH automatically. - -unset(CLIPPER_FOUND CACHE) -unset(CLIPPER_INCLUDE_DIRS CACHE) -unset(CLIPPER_LIBRARIES CACHE) -unset(CLIPPER_LIBRARIES_RELEASE CACHE) -unset(CLIPPER_LIBRARIES_DEBUG CACHE) - -if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)") - set(CLIPPER_BUILD_TYPE DEBUG) -else() - set(CLIPPER_BUILD_TYPE RELEASE) -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 -) - -set(_deb_postfix "d") - -FIND_LIBRARY(CLIPPER_LIBRARIES_RELEASE polyclipping ${LIB_SEARCHDIRS}) -FIND_LIBRARY(CLIPPER_LIBRARIES_DEBUG polyclipping${_deb_postfix} ${LIB_SEARCHDIRS}) - -if(CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}) - set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}}") -else() - set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_RELEASE}") -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Clipper - "Clipper library cannot be found. Consider set CLIPPER_PATH environment variable" - CLIPPER_INCLUDE_DIRS - CLIPPER_LIBRARIES) - -MARK_AS_ADVANCED( - CLIPPER_INCLUDE_DIRS - CLIPPER_LIBRARIES) - -if(CLIPPER_FOUND) - add_library(Clipper::Clipper UNKNOWN IMPORTED) - set_target_properties(Clipper::Clipper PROPERTIES IMPORTED_LOCATION ${CLIPPER_LIBRARIES}) - set_target_properties(Clipper::Clipper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CLIPPER_INCLUDE_DIRS}) - if(CLIPPER_LIBRARIES_RELEASE AND CLIPPER_LIBRARIES_DEBUG) - set_target_properties(Clipper::Clipper PROPERTIES - IMPORTED_LOCATION_DEBUG ${CLIPPER_LIBRARIES_DEBUG} - IMPORTED_LOCATION_RELWITHDEBINFO ${CLIPPER_LIBRARIES_RELEASE} - IMPORTED_LOCATION_RELEASE ${CLIPPER_LIBRARIES_RELEASE} - IMPORTED_LOCATION_MINSIZEREL ${CLIPPER_LIBRARIES_RELEASE} - ) - endif() -endif() diff --git a/cmake_modules/FindNLopt.cmake b/cmake_modules/FindNLopt.cmake deleted file mode 100644 index 9114e36..0000000 --- a/cmake_modules/FindNLopt.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# Find NLopt library. -# The following variables are set -# -# NLopt_FOUND -# NLopt_INCLUDE_DIRS -# NLopt_LIBRARIES -# -# It searches the environment variable $NLopt_PATH automatically. - -unset(NLopt_FOUND CACHE) -unset(NLopt_INCLUDE_DIRS CACHE) -unset(NLopt_LIBRARIES CACHE) -unset(NLopt_LIBRARIES_RELEASE CACHE) -unset(NLopt_LIBRARIES_DEBUG CACHE) - -if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)") - set(NLopt_BUILD_TYPE DEBUG) -else() - set(NLopt_BUILD_TYPE RELEASE) -endif() - -FIND_PATH(NLopt_INCLUDE_DIRS nlopt.hpp - $ENV{NLopt_PATH} - $ENV{NLopt_PATH}/cpp/ - $ENV{NLopt_PATH}/include/ - ${CMAKE_PREFIX_PATH}/include/nlopt - ${CMAKE_PREFIX_PATH}/include/ - /opt/local/include/ - /opt/local/include/nlopt/ - /usr/local/include/ - /usr/local/include/nlopt/ - /usr/include - /usr/include/nlopt/) - -set(LIB_SEARCHDIRS - $ENV{NLopt_PATH} - $ENV{NLopt_PATH}/cpp/ - $ENV{NLopt_PATH}/cpp/build/ - $ENV{NLopt_PATH}/lib/ - $ENV{NLopt_PATH}/lib/nlopt/ - ${CMAKE_PREFIX_PATH}/lib/ - ${CMAKE_PREFIX_PATH}/lib/nlopt/ - /opt/local/lib/ - /opt/local/lib/nlopt/ - /usr/local/lib/ - /usr/local/lib/nlopt/ - /usr/lib/nlopt -) - -set(_deb_postfix "d") - -FIND_LIBRARY(NLopt_LIBRARIES_RELEASE nlopt ${LIB_SEARCHDIRS}) -FIND_LIBRARY(NLopt_LIBRARIES_DEBUG nlopt${_deb_postfix} ${LIB_SEARCHDIRS}) - -if(NLopt_LIBRARIES_${NLopt_BUILD_TYPE}) - set(NLopt_LIBRARIES "${NLopt_LIBRARIES_${NLopt_BUILD_TYPE}}") -else() - set(NLopt_LIBRARIES "${NLopt_LIBRARIES_RELEASE}") -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(NLopt - "NLopt library cannot be found. Consider set NLopt_PATH environment variable" - NLopt_INCLUDE_DIRS - NLopt_LIBRARIES) - -MARK_AS_ADVANCED( - NLopt_INCLUDE_DIRS - NLopt_LIBRARIES) - -if(NLopt_FOUND) - add_library(NLopt::nlopt UNKNOWN IMPORTED) - set_target_properties(NLopt::nlopt PROPERTIES IMPORTED_LOCATION ${NLopt_LIBRARIES}) - set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${NLopt_INCLUDE_DIRS}) - if(NLopt_LIBRARIES_RELEASE AND NLopt_LIBRARIES_DEBUG) - set_target_properties(NLopt::nlopt PROPERTIES - IMPORTED_LOCATION_DEBUG ${NLopt_LIBRARIES_DEBUG} - IMPORTED_LOCATION_RELWITHDEBINFO ${NLopt_LIBRARIES_RELEASE} - IMPORTED_LOCATION_RELEASE ${NLopt_LIBRARIES_RELEASE} - IMPORTED_LOCATION_MINSIZEREL ${NLopt_LIBRARIES_RELEASE} - ) - endif() -endif() diff --git a/cmake_modules/RequirePackage.cmake b/cmake_modules/RequirePackage.cmake deleted file mode 100644 index 32ea311..0000000 --- a/cmake_modules/RequirePackage.cmake +++ /dev/null @@ -1,271 +0,0 @@ -# RP Package manager default install dir will be set globally -set(RP_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/dependencies CACHE STRING "Dependencies location") - -if (MSVC) - set(_default_confs "Release;Debug") -else() - set(_default_confs "Release") -endif() - -set(RP_CONFIGURATION_TYPES ${_default_confs} CACHE STRING "Build configurations for the dependencies") -option(RP_ENABLE_DOWNLOADING "Enable downloading of bundled packages if not found in system." OFF) - -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_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) -list(REMOVE_DUPLICATES CMAKE_MODULE_PATH) - -# Packages for which require_package is called are gathered in this list. -set(RP_USED_PACKAGES "" CACHE INTERNAL "") - -if (NOT CMAKE_PREFIX_PATH) - set(CMAKE_PREFIX_PATH "") -endif() - -list(APPEND CMAKE_PREFIX_PATH ${RP_INSTALL_PREFIX}) - -function(download_package) - - cmake_parse_arguments(RP_ARGS - "QUIET;REQUIRED" - "VERSION;PACKAGE;REPOSITORY_PATH;INSTALL_PATH" - "COMPONENTS;OPTIONAL_COMPONENTS" ${ARGN}) - - if(NOT RP_ARGS_REPOSITORY_PATH) - if(RP_REPOSITORY_DIR) - set(RP_ARGS_REPOSITORY_PATH ${RP_REPOSITORY_DIR}) - else() - set(RP_ARGS_REPOSITORY_PATH ${PROJECT_SOURCE_DIR}/external) - endif() - endif() - - set(_err_type "WARNING") - if(RP_ARGS_REQUIRED) - set(_err_type "FATAL_ERROR") - endif() - - if(NOT RP_ARGS_PACKAGE) - set(RP_ARGS_PACKAGE ${ARGV0}) - endif() - - if(NOT EXISTS ${RP_ARGS_REPOSITORY_PATH}/+${RP_ARGS_PACKAGE}) - if(NOT RP_ARGS_QUIET OR RP_ARGS_REQUIRED) - message(${_err_type} "No package definition exists for ${RP_ARGS_PACKAGE}") - endif() - endif() - - if(NOT RP_ARGS_INSTALL_PATH) - if(RP_INSTALL_PREFIX) - set(RP_ARGS_INSTALL_PATH ${RP_INSTALL_PREFIX}) - else() - set(RP_ARGS_INSTALL_PATH ${PROJECT_BINARY_DIR}/rp_packages) - endif() - endif() - - if(NOT RP_ARGS_VERSION) - set(RP_ARGS_VERSION ${ARGV1}) - endif() - - if (RP_ARGS_QUIET) - set(OUTPUT_QUIET "OUTPUT_QUIET") - else() - unset(OUTPUT_QUIET) - endif() - - set(_CONFIGS "${RP_CONFIGURATION_TYPES}") - if (EXISTS ${RP_BUILD_PATH}/+${RP_ARGS_PACKAGE}/configs.txt) - file(READ ${RP_BUILD_PATH}/+${RP_ARGS_PACKAGE}/configs.txt _CONFIGS) - - if(NOT RP_ARGS_QUIET) - message(STATUS "${RP_ARGS_PACKAGE} configs: ${_CONFIGS}") - endif() - endif() - - if (NOT _CONFIGS) # No config is specified, default to release - set(_CONFIGS "Release") - endif() - - set(_configured FALSE) - get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - - set(_configs_line "") - if (_is_multi) - set(_configs_line "-DCMAKE_CONFIGURATION_TYPES:STRING=${_CONFIGS}") - else () - set(_configs_line "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}") - endif () - - set(_postfix_line "") - foreach(_cf ${_CONFIGS}) - string(TOUPPER "${_cf}" _CF) - if (RP_${_CF}_POSTFIX) - list(APPEND _postfix_line -DRP_${_CF}_POSTFIX:STRING=${RP_${_CF}_POSTFIX}) - endif () - endforeach() - - if(NOT RP_ARGS_QUIET) - message(STATUS "-----------------------------------------------------------------------------") - message(STATUS "Initializing/Updating RequirePackage repository cache") - message(STATUS "-----------------------------------------------------------------------------") - - if (NOT EXISTS ${RP_BUILD_PATH}) - file(MAKE_DIRECTORY ${RP_BUILD_PATH}) - endif() - endif() - - set(_apple_line "") - if (APPLE) - if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) - endif () - list (APPEND _apple_line "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}") - endif() - - execute_process( - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -A "${CMAKE_GENERATOR_PLATFORM}" - -D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}" - -D "CMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}" - -D "CMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}" - -D "CMAKE_INSTALL_PREFIX:PATH=${RP_ARGS_INSTALL_PATH}" - -D "RP_FORCE_DOWNLOADING:BOOL=${RP_FORCE_DOWNLOADING}" - -D "RP_FIND_QUIETLY:BOOL=${RP_ARGS_QUIET}" - -D "RP_FIND_REQUIRED:BOOL=OFF" - -D "BUILD_SHARED_LIBS=${RP_BUILD_SHARED_LIBS}" - -D "AS_RP_PROCESS:INTERNAL=TRUE" - "${_configs_line}" - "${_postfix_line}" - ${_apple_line} - ${RP_ARGS_REPOSITORY_PATH} - RESULT_VARIABLE CONFIG_STEP_RESULT - ${OUTPUT_QUIET} - WORKING_DIRECTORY "${RP_BUILD_PATH}" - ) - - if(CONFIG_STEP_RESULT) - if(NOT RP_ARGS_QUIET OR RP_ARGS_REQUIRED) - message(${_err_type} "CMake step for ${RP_ARGS_PACKAGE} failed: ${CONFIG_STEP_RESULT}") - endif() - endif() - - - # Hide output if requested - if (NOT RP_ARGS_QUIET) - message(STATUS "------------------------------------------------------------------------------") - message(STATUS "Downloading/updating ${RP_ARGS_PACKAGE}") - message(STATUS "------------------------------------------------------------------------------") - endif() - - foreach(_conf IN ITEMS ${_CONFIGS}) - - if(NOT RP_ARGS_QUIET) - message(STATUS "Building config: ${_conf} of package ${RP_ARGS_PACKAGE}") - endif() - - if (NOT _is_multi) - set(_configs_line "-DCMAKE_BUILD_TYPE:STRING=${_conf}") - endif () - - if(NOT _configured OR NOT _is_multi) - 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 "AS_RP_PROCESS:INTERNAL=ON" - -D "RP_FIND_QUIETLY:BOOL=${RP_ARGS_QUIET}" - -D "RP_FIND_REQUIRED:BOOL=${RP_ARGS_REQUIRED}" - "${_configs_line}" - ${RP_ARGS_REPOSITORY_PATH} - RESULT_VARIABLE CONFIG_STEP_RESULT - #OUTPUT_VARIABLE CONFIG_STEP_OUTP - #ERROR_VARIABLE CONFIG_STEP_OUTP - ${OUTPUT_QUIET} - WORKING_DIRECTORY "${RP_BUILD_PATH}" - ) - - if(CONFIG_STEP_RESULT) - if(NOT RP_ARGS_QUIET OR RP_ARGS_REQUIRED) - message(${_err_type} "CMake step for ${RP_ARGS_PACKAGE} failed: ${CONFIG_STEP_RESULT}") - endif() - else() - set(_configured TRUE) - endif() - endif() - - # Can proceed with the build step - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --target rp_${RP_ARGS_PACKAGE} --config ${_conf} - RESULT_VARIABLE BUILD_STEP_RESULT - #OUTPUT_VARIABLE BUILD_STEP_OUTP - ERROR_VARIABLE BUILD_STEP_OUTP - ${OUTPUT_QUIET} - WORKING_DIRECTORY "${RP_BUILD_PATH}" - ) - - if(BUILD_STEP_RESULT) - if(NOT RP_ARGS_QUIET OR RP_ARGS_REQUIRED) - message(${_err_type} "Build step (${_conf}) for ${RP_ARGS_PACKAGE} failed: ${BUILD_STEP_OUTP}") - endif() - endif() - endforeach(_conf IN ${_CONFIGS}) - -endfunction() - -macro(require_package RP_ARGS_PACKAGE) - set(options REQUIRED QUIET) - set(oneValueArgs "VERSION") - set(multiValueArgs "") - cmake_parse_arguments(RP_ARGS - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # if(NOT RP_ARGS_VERSION) - # set(RP_ARGS_VERSION ${ARGV1}) - # endif() - - if(NOT RP_FORCE_DOWNLOADING) - find_package(${RP_ARGS_PACKAGE} ${RP_ARGS_VERSION} QUIET ${RP_ARGS_UNPARSED_ARGUMENTS}) - endif() - - set(_REQUIRED "") - if (RP_ARGS_REQUIRED) - set(_REQUIRED "REQUIRED") - endif () - - set(_QUIET "") - if (RP_ARGS_QUIET) - set(_QUIET "QUIET") - endif () - - if(NOT ${RP_ARGS_PACKAGE}_FOUND) - if (RP_ENABLE_DOWNLOADING) - download_package(${RP_ARGS_PACKAGE} ${RP_ARGS_VERSION} ${_QUIET} ${_REQUIRED} ${RP_ARGS_UNPARSED_ARGUMENTS} ) - endif() - - find_package(${RP_ARGS_PACKAGE} ${RP_ARGS_VERSION} - ${_QUIET} ${_REQUIRED} ${RP_ARGS_UNPARSED_ARGUMENTS}) - endif() - - list(APPEND RP_USED_PACKAGES ${RP_ARGS_PACKAGE}) - set(RP_USED_PACKAGES "${RP_USED_PACKAGES}" CACHE INTERNAL "") - set(RP_${RP_ARGS_PACKAGE}_VERSION ${RP_ARGS_VERSION} CACHE INTERNAL "") - set(ignoreMe "RP_${RP_ARGS_PACKAGE}_VERSION") - -endmacro() - -function(rp_install_versions_file dest) - set(_out "") - set(_fname ${RP_BUILD_PATH}/RPPackageVersions.cmake) - foreach(p ${RP_USED_PACKAGES}) - set(_out "${_out}set(${p}_VERSION ${RP_${p}_VERSION})\n") - endforeach() - file(WRITE ${_fname} ${_out}) - install(FILES ${_fname} DESTINATION ${dest}) -endfunction() diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..fd72126 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,87 @@ +from pathlib import Path + +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake + +from conans.errors import ConanInvalidConfiguration +from conans.tools import Version +from conan.tools.files import files + +required_conan_version = ">=1.46.2" + + +class Libnest2DConan(ConanFile): + name = "libnest2d" + description = "2D irregular bin packaging and nesting library written in modern C++" + topics = ("conan", "cura", "prusaslicer", "nesting", "c++", "bin packaging") + settings = "os", "compiler", "build_type", "arch" + build_policy = "missing" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tests": [True, False], + "header_only": [True, False], + "geometries": ["clipper", "boost", "eigen"], + "optimizer": ["nlopt", "optimlib"], + "threading": ["std", "tbb", "omp", "none"] + } + default_options = { + "shared": True, + "tests": False, + "fPIC": True, + "header_only": False, + "geometries": "clipper", + "optimizer": "nlopt", + "threading": "std" + } + scm = { + "type": "git", + "subfolder": ".", + "url": "auto", + "revision": "auto" + } + + def configure(self): + if self.options.shared or self.settings.compiler == "Visual Studio": + del self.options.fPIC + if self.options.geometries == "clipper": + self.options["clipper"].shared = self.options.shared + self.options["boost"].shared = self.options.shared + if self.options.optimizer == "nlopt": + self.options["nlopt"].shared = self.options.shared + + def build_requirements(self): + if self.options.tests: + self.build_requires("catch2/2.13.6", force_host_context=True) + + def requirements(self): + if self.options.geometries == "clipper": + self.requires("clipper/6.4.2") + self.requires("boost/1.78.0") + elif self.options.geometries == "eigen": + self.requires("eigen/3.3.7") + if self.options.optimizer == "nlopt": + self.requires("nlopt/2.7.0") + + def generate(self): + cmake = CMakeDeps(self) + cmake.generate() + + tc = CMakeToolchain(self) + + # Don't use Visual Studio as the CMAKE_GENERATOR + if self.settings.compiler == "Visual Studio": + tc.blocks["generic_system"].values["generator_platform"] = None + tc.blocks["generic_system"].values["toolset"] = None + + tc.variables["LIBNEST2D_HEADER_ONLY"] = self.options.header_only + if self.options.header_only: + tc.variables["BUILD_SHARED_LIBS"] = False + else: + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["LIBNEST2D_BUILD_UNITTESTS"] = self.options.tests + tc.variables["LIBNEST2D_GEOMETRIES"] = self.options.geometries + tc.variables["LIBNEST2D_OPTIMIZER"] = self.options.optimizer + tc.variables["LIBNEST2D_THREADING"] = self.options.threading + + tc.generate() diff --git a/external/+Boost/CMakeLists.txt b/external/+Boost/CMakeLists.txt deleted file mode 100644 index 36dd224..0000000 --- a/external/+Boost/CMakeLists.txt +++ /dev/null @@ -1,131 +0,0 @@ -include(ExternalProject) - -if (WIN32) - set(_bootstrap_cmd bootstrap.bat) - set(_build_cmd b2.exe) -else() - set(_bootstrap_cmd ./bootstrap.sh) - set(_build_cmd ./b2) -endif() - -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(_boost_toolset gcc) -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - if (MSVC_VERSION EQUAL 1800) - # 1800 = VS 12.0 (v120 toolset) - set(_boost_toolset "msvc-12.0") - elseif (MSVC_VERSION EQUAL 1900) - # 1900 = VS 14.0 (v140 toolset) - set(_boost_toolset "msvc-14.0") - elseif (MSVC_VERSION LESS 1920) - # 1910-1919 = VS 15.0 (v141 toolset) - set(_boost_toolset "msvc-14.1") - elseif (MSVC_VERSION LESS 1930) - # 1920-1929 = VS 16.0 (v142 toolset) - set(_boost_toolset "msvc-14.2") - else () - message(FATAL_ERROR "Unsupported MSVC version") - endif () -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - if (WIN32) - set(_boost_toolset "clang-win") - else() - set(_boost_toolset "clang") - endif() -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(_boost_toolset "intel") -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - set(_boost_toolset "clang") -endif() - -if (RP_PACKAGE STREQUAL "Boost") - message(STATUS "Deduced boost toolset: ${_boost_toolset} based on ${CMAKE_CXX_COMPILER_ID} compiler") -endif() - -set(_libs "") -foreach(_comp ${RP_Boost_COMPONENTS}) - list(APPEND _libs "--with-${_comp}") -endforeach() - -if (BUILD_SHARED_LIBS) - set(_link shared) -else() - set(_link static) -endif() - -set(_bits "") -if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") - set(_bits 64) -elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") - set(_bits 32) -endif () - -include(ProcessorCount) -ProcessorCount(NPROC) -file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX} _prefix) - -set(_boost_flags "") -if (UNIX) - set(_boost_flags "cflags=-fPIC;cxxflags=-fPIC") -elseif(APPLE) - set(_boost_flags - "cflags=-fPIC -mmacosx-version-min=${RP_OSX_TARGET};" - "cxxflags=-fPIC -mmacosx-version-min=${RP_OSX_TARGET};" - "mflags=-fPIC -mmacosx-version-min=${RP_OSX_TARGET};" - "mmflags=-fPIC -mmacosx-version-min=${RP_OSX_TARGET}") -endif() - -set(_boost_variants "") -if(CMAKE_BUILD_TYPE) - list(APPEND CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE}) - list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) -endif() -list(FIND CMAKE_CONFIGURATION_TYPES "Release" _cfg_rel) -list(FIND CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" _cfg_relwdeb) -list(FIND CMAKE_CONFIGURATION_TYPES "MinSizeRel" _cfg_minsizerel) -list(FIND CMAKE_CONFIGURATION_TYPES "Debug" _cfg_deb) - -if (_cfg_rel GREATER -1 OR _cfg_relwdeb GREATER -1 OR _cfg_minsizerel GREATER -1) - list(APPEND _boost_variants release) -endif() - -if (_cfg_deb GREATER -1) - list(APPEND _boost_variants debug) -endif() - -if (NOT _boost_variants) - set(_boost_variants release) -endif() - -set(_build_cmd ${_build_cmd} - ${_boost_flags} - -j${NPROC} - ${_libs} - --layout=versioned - toolset=${_boost_toolset} - address-model=${_bits} - link=${_link} - threading=multi - boost.locale.icu=off - ${_boost_variants}) - -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 - URL "http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.gz" - URL_HASH SHA256=8aa4e330c870ef50a896634c931adf468b21f8a69b77007e45c444151229f665 - CONFIGURE_COMMAND "${_bootstrap_cmd}" - PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/common.jam ./tools/build/src/tools/common.jam - BUILD_COMMAND "${_build_cmd}" - BUILD_IN_SOURCE ON - INSTALL_COMMAND "${_install_cmd}" -) diff --git a/external/+Boost/common.jam b/external/+Boost/common.jam deleted file mode 100644 index 75d995a..0000000 --- a/external/+Boost/common.jam +++ /dev/null @@ -1,1095 +0,0 @@ -# Copyright 2003, 2005 Dave Abrahams -# Copyright 2005, 2006 Rene Rivera -# Copyright 2005 Toon Knapen -# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - -# Provides actions common to all toolsets, such as creating directories and -# removing files. - -import os ; -import modules ; -import utility ; -import print ; -import type ; -import feature ; -import errors ; -import path ; -import sequence ; -import toolset ; -import virtual-target ; -import numbers ; - -if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] -{ - .debug-configuration = true ; -} -if [ MATCH (--show-configuration) : [ modules.peek : ARGV ] ] -{ - .show-configuration = true ; -} - -# Configurations -# -# The following class helps to manage toolset configurations. Each configuration -# has a unique ID and one or more parameters. A typical example of a unique ID -# is a condition generated by 'common.check-init-parameters' rule. Other kinds -# of IDs can be used. Parameters may include any details about the configuration -# like 'command', 'path', etc. -# -# A toolset configuration may be in one of the following states: -# -# - registered -# Configuration has been registered (e.g. explicitly or by auto-detection -# code) but has not yet been marked as used, i.e. 'toolset.using' rule has -# not yet been called for it. -# - used -# Once called 'toolset.using' rule marks the configuration as 'used'. -# -# The main difference between the states above is that while a configuration is -# 'registered' its options can be freely changed. This is useful in particular -# for autodetection code - all detected configurations may be safely overwritten -# by user code. - -class configurations -{ - import errors ; - - rule __init__ ( ) - { - } - - # Registers a configuration. - # - # Returns 'true' if the configuration has been added and an empty value if - # it already exists. Reports an error if the configuration is 'used'. - # - rule register ( id ) - { - if $(id) in $(self.used) - { - errors.error "common: the configuration '$(id)' is in use" ; - } - - local retval ; - - if ! $(id) in $(self.all) - { - self.all += $(id) ; - - # Indicate that a new configuration has been added. - retval = true ; - } - - return $(retval) ; - } - - # Mark a configuration as 'used'. - # - # Returns 'true' if the state of the configuration has been changed to - # 'used' and an empty value if it the state has not been changed. Reports an - # error if the configuration is not known. - # - rule use ( id ) - { - if ! $(id) in $(self.all) - { - errors.error "common: the configuration '$(id)' is not known" ; - } - - local retval ; - - if ! $(id) in $(self.used) - { - self.used += $(id) ; - - # Indicate that the configuration has been marked as 'used'. - retval = true ; - } - - return $(retval) ; - } - - # Return all registered configurations. - # - rule all ( ) - { - return $(self.all) ; - } - - # Return all used configurations. - # - rule used ( ) - { - return $(self.used) ; - } - - # Returns the value of a configuration parameter. - # - rule get ( id : param ) - { - return $(self.$(param).$(id)) ; - } - - # Sets the value of a configuration parameter. - # - rule set ( id : param : value * ) - { - self.$(param).$(id) = $(value) ; - } -} - - -# The rule for checking toolset parameters. Trailing parameters should all be -# parameter name/value pairs. The rule will check that each parameter either has -# a value in each invocation or has no value in each invocation. Also, the rule -# will check that the combination of all parameter values is unique in all -# invocations. -# -# Each parameter name corresponds to a subfeature. This rule will declare a -# subfeature the first time a non-empty parameter value is passed and will -# extend it with all the values. -# -# The return value from this rule is a condition to be used for flags settings. -# -rule check-init-parameters ( toolset requirement * : * ) -{ - local sig = $(toolset) ; - local condition = $(toolset) ; - local subcondition ; - for local index in 2 3 4 5 6 7 8 9 - { - local name = $($(index)[1]) ; - local value = $($(index)[2]) ; - - if $(value)-is-not-empty - { - condition = $(condition)-$(value) ; - if $(.had-unspecified-value.$(toolset).$(name)) - { - errors.user-error - "$(toolset) initialization: parameter '$(name)'" - "inconsistent" : "no value was specified in earlier" - "initialization" : "an explicit value is specified now" ; - } - # The below logic is for intel compiler. It calls this rule with - # 'intel-linux' and 'intel-win' as toolset, so we need to get the - # base part of toolset name. We can not pass 'intel' as toolset - # because in that case it will be impossible to register versionless - # intel-linux and intel-win toolsets of a specific version. - local t = $(toolset) ; - local m = [ MATCH "([^-]*)-" : $(toolset) ] ; - if $(m) - { - t = $(m[1]) ; - } - if ! $(.had-value.$(toolset).$(name)) - { - if ! $(.declared-subfeature.$(t).$(name)) - { - feature.subfeature toolset $(t) : $(name) : : propagated ; - .declared-subfeature.$(t).$(name) = true ; - } - .had-value.$(toolset).$(name) = true ; - } - feature.extend-subfeature toolset $(t) : $(name) : $(value) ; - subcondition += $(value) ; - } - else - { - if $(.had-value.$(toolset).$(name)) - { - errors.user-error - "$(toolset) initialization: parameter '$(name)'" - "inconsistent" : "an explicit value was specified in an" - "earlier initialization" : "no value is specified now" ; - } - .had-unspecified-value.$(toolset).$(name) = true ; - } - sig = $(sig)$(value:E="")- ; - } - # We also need to consider requirements on the toolset as we can - # configure the same toolset multiple times with different options that - # are selected with the requirements. - if $(requirement) - { - sig = $(sig)$(requirement:J=,) ; - } - if $(sig) in $(.all-signatures) - { - local message = - "duplicate initialization of $(toolset) with the following parameters: " ; - for local index in 2 3 4 5 6 7 8 9 - { - local p = $($(index)) ; - if $(p) - { - message += "$(p[1]) = $(p[2]:E=)" ; - } - } - message += "previous initialization at $(.init-loc.$(sig))" ; - errors.user-error - $(message[1]) : $(message[2]) : $(message[3]) : $(message[4]) : - $(message[5]) : $(message[6]) : $(message[7]) : $(message[8]) ; - } - .all-signatures += $(sig) ; - .init-loc.$(sig) = [ errors.nearest-user-location ] ; - - # If we have a requirement, this version should only be applied under that - # condition. To accomplish this we add a toolset requirement that imposes - # the toolset subcondition, which encodes the version. - if $(requirement) - { - local r = $(toolset) $(requirement) ; - r = $(r:J=,) ; - toolset.add-requirements "$(r):$(subcondition)" ; - } - - # We add the requirements, if any, to the condition to scope the toolset - # variables and options to this specific version. - condition += $(requirement) ; - - if $(.show-configuration) - { - ECHO "notice:" $(condition) ; - } - return $(condition:J=/) ; -} - - -# A helper rule to get the command to invoke some tool. If -# 'user-provided-command' is not given, tries to find binary named 'tool' in -# PATH and in the passed 'additional-path'. Otherwise, verifies that the first -# element of 'user-provided-command' is an existing program. -# -# This rule returns the command to be used when invoking the tool. If we can not -# find the tool, a warning is issued. If 'path-last' is specified, PATH is -# checked after 'additional-paths' when searching for 'tool'. -# -rule get-invocation-command-nodefault ( toolset : tool : - user-provided-command * : additional-paths * : path-last ? ) -{ - local command ; - if ! $(user-provided-command) - { - command = [ find-tool $(tool) : $(additional-paths) : $(path-last) ] ; - if ! $(command) && $(.debug-configuration) - { - ECHO "warning:" toolset $(toolset) "initialization:" can not find tool - $(tool) ; - ECHO "warning:" initialized from [ errors.nearest-user-location ] ; - } - } - else - { - command = [ check-tool $(user-provided-command) ] ; - if ! $(command) && $(.debug-configuration) - { - ECHO "warning:" toolset $(toolset) "initialization:" ; - ECHO "warning:" can not find user-provided command - '$(user-provided-command)' ; - ECHO "warning:" initialized from [ errors.nearest-user-location ] ; - } - } - - return $(command) ; -} - - -# Same as get-invocation-command-nodefault, except that if no tool is found, -# returns either the user-provided-command, if present, or the 'tool' parameter. -# -rule get-invocation-command ( toolset : tool : user-provided-command * : - additional-paths * : path-last ? ) -{ - local result = [ get-invocation-command-nodefault $(toolset) : $(tool) : - $(user-provided-command) : $(additional-paths) : $(path-last) ] ; - - if ! $(result) - { - if $(user-provided-command) - { - result = $(user-provided-command) ; - } - else - { - result = $(tool) ; - } - } - return $(result) ; -} - - -# Given an invocation command return the absolute path to the command. This -# works even if command has no path element and was found on the PATH. -# -rule get-absolute-tool-path ( command ) -{ - if $(command:D) - { - return $(command:D) ; - } - else - { - local m = [ GLOB [ modules.peek : PATH Path path ] : $(command) - $(command).exe ] ; - return $(m[1]:D) ; - } -} - - -# Attempts to find tool (binary) named 'name' in PATH and in 'additional-paths'. -# If found in PATH, returns 'name' and if found in additional paths, returns -# absolute name. If the tool is found in several directories, returns the first -# path found. Otherwise, returns an empty string. If 'path-last' is specified, -# PATH is searched after 'additional-paths'. -# -rule find-tool ( name : additional-paths * : path-last ? ) -{ - if $(name:D) - { - return [ check-tool-aux $(name) ] ; - } - local path = [ path.programs-path ] ; - local match = [ path.glob $(path) : $(name) $(name).exe ] ; - local additional-match = [ path.glob $(additional-paths) : $(name) - $(name).exe ] ; - - local result ; - if $(path-last) - { - result = $(additional-match) ; - if ! $(result) && $(match) - { - result = $(name) ; - } - } - else - { - if $(match) - { - result = $(name) ; - } - else - { - result = $(additional-match) ; - } - } - if $(result) - { - return [ path.native $(result[1]) ] ; - } -} - -# Checks if 'command' can be found either in path or is a full name to an -# existing file. -# -local rule check-tool-aux ( command ) -{ - if $(command:D) - { - if [ path.exists $(command) ] - # Both NT and Cygwin will run .exe files by their unqualified names. - || ( [ os.on-windows ] && [ path.exists $(command).exe ] ) - # Only NT will run .bat & .cmd files by their unqualified names. - || ( ( [ os.name ] = NT ) && ( [ path.exists $(command).bat ] || - [ path.exists $(command).cmd ] ) ) - { - return $(command) ; - } - } - else - { - if [ GLOB [ modules.peek : PATH Path path ] : $(command) ] - { - return $(command) ; - } - } -} - - -# Checks that a tool can be invoked by 'command'. If command is not an absolute -# path, checks if it can be found in 'path'. If command is an absolute path, -# check that it exists. Returns 'command' if ok or empty string otherwise. -# -local rule check-tool ( xcommand + ) -{ - if [ check-tool-aux $(xcommand[1]) ] || - [ check-tool-aux $(xcommand[-1]) ] - { - return $(xcommand) ; - } -} - - -# Handle common options for toolset, specifically sets the following flag -# variables: -# - CONFIG_COMMAND to $(command) -# - OPTIONS for compile to the value of in $(options) -# - OPTIONS for compile.c to the value of in $(options) -# - OPTIONS for compile.c++ to the value of in $(options) -# - OPTIONS for compile.asm to the value of in $(options) -# - OPTIONS for compile.fortran to the value of in $(options) -# - OPTIONS for link to the value of in $(options) -# -rule handle-options ( toolset : condition * : command * : options * ) -{ - if $(.debug-configuration) - { - ECHO "notice:" will use '$(command)' for $(toolset), condition - $(condition:E=(empty)) ; - } - - # The last parameter ('unchecked') says it is OK to set flags for another - # module. - toolset.flags $(toolset) CONFIG_COMMAND $(condition) : $(command) - : unchecked ; - - toolset.flags $(toolset).compile OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; - - toolset.flags $(toolset).compile.c OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; - - toolset.flags $(toolset).compile.c++ OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; - - toolset.flags $(toolset).compile.asm OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; - - toolset.flags $(toolset).compile.fortran OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; - - toolset.flags $(toolset).link OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; -} - - -# Returns the location of the "program files" directory on a Windows platform. -# -rule get-program-files-dir ( ) -{ - local ProgramFiles = [ modules.peek : ProgramFiles ] ; - if $(ProgramFiles) - { - ProgramFiles = "$(ProgramFiles:J= )" ; - } - else - { - ProgramFiles = "c:\\Program Files" ; - } - return $(ProgramFiles) ; -} - - -if [ os.name ] = NT -{ - NULL_DEVICE = "NUL" ; - IGNORE = "2>$(NULL_DEVICE) >$(NULL_DEVICE) & setlocal" ; - RM = del /f /q ; - CP = copy /b ; - LN ?= $(CP) ; - # Ugly hack to convince copy to set the timestamp of the destination to the - # current time by concatenating the source with a nonexistent file. Note - # that this requires /b (binary) as the default when concatenating files is - # /a (ascii). - WINDOWS-CP-HACK = "+ this-file-does-not-exist-A698EE7806899E69" ; -} -else if [ os.name ] = VMS -{ - NULL_DEVICE = "NL:" ; - PIPE = PIPE ; - IGNORE = "2>$(NULL_DEVICE) >$(NULL_DEVICE)" ; - RM = DELETE /NOCONF ; - CP = COPY /OVERWRITE ; - LN = $(CP) ; -} -else -{ - NULL_DEVICE = "/dev/null" ; - IGNORE = "2>$(NULL_DEVICE) >$(NULL_DEVICE)" ; - RM = rm -f ; - CP = cp ; - LN = ln ; -} - -NULL_OUT = ">$(NULL_DEVICE)" ; - -rule null-device ( ) -{ - return $(NULL_DEVICE) ; -} - - -rule rm-command ( ) -{ - return $(RM) ; -} - - -rule copy-command ( ) -{ - return $(CP) ; -} - - -if "\n" = "n" -{ - # Escape characters not supported so use ugly hacks. Will not work on Cygwin - # - see below. - nl = " -" ; - q = "" ; -} -else -{ - nl = "\n" ; - q = "\"" ; -} - - -rule newline-char ( ) -{ - return $(nl) ; -} - - -# Returns the command needed to set an environment variable on the current -# platform. The variable setting persists through all following commands and is -# visible in the environment seen by subsequently executed commands. In other -# words, on Unix systems, the variable is exported, which is consistent with the -# only possible behavior on Windows systems. -# -rule variable-setting-command ( variable : value ) -{ - if [ os.name ] = NT - { - return "set $(variable)=$(value)$(nl)" ; - } - else if [ os.name ] = VMS - { - return "$(variable) == $(q)$(value)$(q)$(nl)" ; - } - else - { - # If we do not have escape character support in bjam, the cod below - # blows up on CYGWIN, since the $(nl) variable holds a Windows new-line - # \r\n sequence that messes up the executed export command which then - # reports that the passed variable name is incorrect. - # But we have a check for cygwin in kernel/bootstrap.jam already. - return "$(variable)=$(q)$(value)$(q)$(nl)export $(variable)$(nl)" ; - } -} - - -# Returns a command to sets a named shell path variable to the given NATIVE -# paths on the current platform. -# -rule path-variable-setting-command ( variable : paths * ) -{ - local sep = [ os.path-separator ] ; - return [ variable-setting-command $(variable) : $(paths:J=$(sep)) ] ; -} - - -# Returns a command that prepends the given paths to the named path variable on -# the current platform. -# -rule prepend-path-variable-command ( variable : paths * ) -{ - return [ path-variable-setting-command $(variable) - : $(paths) [ os.expand-variable $(variable) ] ] ; -} - - -# Return a command which can create a file. If 'r' is result of invocation, then -# 'r foobar' will create foobar with unspecified content. What happens if file -# already exists is unspecified. -# -rule file-creation-command ( ) -{ - if [ os.name ] = NT - { - # A few alternative implementations on Windows: - # - # 'type NUL >> ' - # That would construct an empty file instead of a file containing - # a space and an end-of-line marker but it would also not change - # the target's timestamp in case the file already exists. - # - # 'type NUL > ' - # That would construct an empty file instead of a file containing - # a space and an end-of-line marker but it would also destroy an - # already existing file by overwriting it with an empty one. - # - # I guess the best solution would be to allow Boost Jam to define - # built-in functions such as 'create a file', 'touch a file' or 'copy a - # file' which could be used from inside action code. That would allow - # completely portable operations without this kind of kludge. - # (22.02.2009.) (Jurko) - return "echo. > " ; - } - else if [ os.name ] = VMS - { - return "APPEND /NEW NL: " ; - } - else - { - return "touch " ; - } -} - - -# Returns a command that may be used for 'touching' files. It is not a real -# 'touch' command on NT because it adds an empty line at the end of file but it -# works with source files. -# -rule file-touch-command ( ) -{ - if [ os.name ] = NT - { - return "echo. >> " ; - } - else if [ os.name ] = VMS - { - return "APPEND /NEW NL: " ; - } - else - { - return "touch " ; - } -} - - -rule MkDir -{ - # If dir exists, do not update it. Do this even for $(DOT). - NOUPDATE $(<) ; - - if $(<) != $(DOT) && ! $($(<)-mkdir) - { - # Cheesy gate to prevent multiple invocations on same dir. - $(<)-mkdir = true ; - - # Schedule the mkdir build action. - common.mkdir $(<) ; - - # Prepare a Jam 'dirs' target that can be used to make the build only - # construct all the target directories. - DEPENDS dirs : $(<) ; - - # Recursively create parent directories. $(<:P) = $(<)'s parent & we - # recurse until root. - - local s = $(<:P) ; - if [ os.name ] = NT - { - switch $(s) - { - case "*:" : s = ; - case "*:\\" : s = ; - } - } - - if $(s) - { - if $(s) != $(<) - { - DEPENDS $(<) : $(s) ; - MkDir $(s) ; - } - else - { - NOTFILE $(s) ; - } - } - } -} - - -#actions MkDir1 -#{ -# mkdir "$(<)" -#} - -# The following quick-fix actions should be replaced using the original MkDir1 -# action once Boost Jam gets updated to correctly detect different paths leading -# up to the same filesystem target and triggers their build action only once. -# (todo) (04.07.2008.) (Jurko) - -if [ os.name ] = NT -{ - actions quietly mkdir - { - if not exist "$(<)\\" mkdir "$(<)" - } -} -else -{ - actions quietly mkdir - { - mkdir -p "$(<)" - } -} - - -actions piecemeal together existing Clean -{ - $(RM) "$(>)" -} - - -rule copy -{ -} - - -actions copy -{ - $(CP) "$(>)" $(WINDOWS-CP-HACK) "$(<)" -} - - -rule RmTemps -{ -} - - -actions quietly updated piecemeal together RmTemps -{ - $(RM) "$(>)" $(IGNORE) -} - - -actions hard-link -{ - $(RM) "$(<)" 2$(NULL_OUT) $(NULL_OUT) - $(LN) "$(>)" "$(<)" $(NULL_OUT) -} - - -if [ os.name ] = VMS -{ - actions mkdir - { - IF F$PARSE("$(<:W)") .EQS. "" THEN CREATE /DIR $(<:W) - } - - actions piecemeal together existing Clean - { - $(RM) $(>:WJ=;*,);* - } - - actions copy - { - $(CP) $(>:WJ=,) $(<:W) - } - - actions quietly updated piecemeal together RmTemps - { - $(PIPE) $(RM) $(>:WJ=;*,);* $(IGNORE) - } - - actions hard-link - { - $(PIPE) $(RM) $(>[1]:W);* $(IGNORE) - $(PIPE) $(LN) $(>[1]:W) $(<:W) $(NULL_OUT) - } -} - -# Given a target, as given to a custom tag rule, returns a string formatted -# according to the passed format. Format is a list of properties that is -# represented in the result. For each element of format the corresponding target -# information is obtained and added to the result string. For all, but the -# literal, the format value is taken as the as string to prepend to the output -# to join the item to the rest of the result. If not given "-" is used as a -# joiner. -# -# The format options can be: -# -# [joiner] -# :: The basename of the target name. -# [joiner] -# :: The abbreviated toolset tag being used to build the target. -# [joiner] -# :: Indication of a multi-threaded build. -# [joiner] -# :: Collective tag of the build runtime. -# [joiner] -# :: Short version tag taken from the given "version-feature" in the -# build properties. Or if not present, the literal value as the -# version number. -# [joiner] -# :: Direct lookup of the given property-name value in the build -# properties. /property-name/ is a regular expression. E.g. -# will match every toolset. -# /otherwise/ -# :: The literal value of the format argument. -# -# For example this format: -# -# boost_ -# -# Might return: -# -# boost_thread-vc80-mt-gd-1_33.dll, or -# boost_regex-vc80-gd-1_33.dll -# -# The returned name also has the target type specific prefix and suffix which -# puts it in a ready form to use as the value from a custom tag rule. -# -rule format-name ( format * : name : type ? : property-set ) -{ - local result = "" ; - for local f in $(format) - { - switch $(f:G) - { - case : - result += $(name:B) ; - - case : - result += [ join-tag $(f:G=) : [ toolset-tag $(name) : $(type) : - $(property-set) ] ] ; - - case : - result += [ join-tag $(f:G=) : [ threading-tag $(name) : $(type) - : $(property-set) ] ] ; - - case : - result += [ join-tag $(f:G=) : [ runtime-tag $(name) : $(type) : - $(property-set) ] ] ; - - case : - result += [ join-tag $(f:G=) : [ qt-tag $(name) : $(type) : - $(property-set) ] ] ; - - case : - result += [ join-tag $(f:G=) : [ address-model-tag $(name) : - $(type) : $(property-set) ] ] ; - - case : - result += [ join-tag $(f:G=) : [ arch-and-model-tag $(name) : - $(type) : $(property-set) ] ] ; - - case : - local key = [ MATCH : $(f:G) ] ; - local version = [ $(property-set).get <$(key)> ] ; - version ?= $(key) ; - version = [ MATCH "^([^.]+)[.]([^.]+)[.]?([^.]*)" : $(version) ] ; - result += [ join-tag $(f:G=) : $(version[1])_$(version[2]) ] ; - - case : - local key = [ MATCH : $(f:G) ] ; - local p0 = [ MATCH <($(key))> : [ $(property-set).raw ] ] ; - if $(p0) - { - local p = [ $(property-set).get <$(p0)> ] ; - if $(p) - { - result += [ join-tag $(f:G=) : $(p) ] ; - } - } - - case * : - result += $(f:G=) ; - } - } - return [ virtual-target.add-prefix-and-suffix $(result:J=) : $(type) : - $(property-set) ] ; -} - - -local rule join-tag ( joiner ? : tag ? ) -{ - if ! $(joiner) { joiner = - ; } - return $(joiner)$(tag) ; -} - - -local rule toolset-tag ( name : type ? : property-set ) -{ - local tag = ; - - local properties = [ $(property-set).raw ] ; - switch [ $(property-set).get ] - { - case borland* : tag += bcb ; - case clang* : - { - switch [ $(property-set).get ] - { - case darwin : tag += clang-darwin ; - case linux : tag += clang ; - case win : tag += clangw ; - } - } - case como* : tag += como ; - case cw : tag += cw ; - case darwin* : tag += xgcc ; - case edg* : tag += edg ; - case gcc* : - { - switch [ $(property-set).get ] - { - case *windows* : tag += mgw ; - case * : tag += gcc ; - } - } - case intel : - if [ $(property-set).get ] = win - { - tag += iw ; - } - else - { - tag += il ; - } - case kcc* : tag += kcc ; - case kylix* : tag += bck ; - #case metrowerks* : tag += cw ; - #case mingw* : tag += mgw ; - case mipspro* : tag += mp ; - case msvc* : tag += vc ; - case qcc* : tag += qcc ; - case sun* : tag += sw ; - case tru64cxx* : tag += tru ; - case vacpp* : tag += xlc ; - } - local version = [ MATCH "([0123456789]+)[.]?([0123456789]*)" - : $(properties) ] ; - # For historical reasons, vc6.0 and vc7.0 use different naming. - if $(tag) = vc - { - if $(version[1]) = 6 - { - # Cancel minor version. - version = 6 ; - } - else if $(version[1]) = 7 && $(version[2]) = 0 - { - version = 7 ; - } - } - - # From GCC 5, versioning changes and minor becomes patch - if ( $(tag) = gcc || $(tag) = mgw ) && [ numbers.less 4 $(version[1]) ] - { - version = $(version[1]) ; - } - - # Ditto, from Clang 4 - if ( $(tag) = clang || $(tag) = clangw ) && [ numbers.less 3 $(version[1]) ] - { - version = $(version[1]) ; - } - - # On intel, version is not added, because it does not matter and it is the - # version of vc used as backend that matters. Ideally, we should encode the - # backend version but that would break compatibility with V1. - if $(tag) = iw - { - version = ; - } - - # On borland, version is not added for compatibility with V1. - if $(tag) = bcb - { - version = ; - } - - tag += $(version) ; - - return $(tag:J=) ; -} - - -local rule threading-tag ( name : type ? : property-set ) -{ - if multi in [ $(property-set).raw ] - { - return mt ; - } -} - - -local rule runtime-tag ( name : type ? : property-set ) -{ - local tag = ; - - local properties = [ $(property-set).raw ] ; - if static in $(properties) { tag += s ; } - - # This is an ugly thing. In V1, there is code to automatically detect which - # properties affect a target. So, if does not affect gcc - # toolset, the tag rules will not even see . Similar - # functionality in V2 is not implemented yet, so we just check for toolsets - # known to care about runtime debugging. - if ( msvc in $(properties) ) || - ( stlport in $(properties) ) || - ( win in $(properties) ) - { - if on in $(properties) { tag += g ; } - } - - if on in $(properties) { tag += y ; } - if debug in $(properties) { tag += d ; } - if stlport in $(properties) { tag += p ; } - if hostios in $(properties) { tag += n ; } - - return $(tag:J=) ; -} - - -# Create a tag for the Qt library version -# "4.6.0" will result in tag "qt460" -local rule qt-tag ( name : type ? : property-set ) -{ - local v = [ MATCH "([0123456789]+)[.]?([0123456789]*)[.]?([0123456789]*)" : - [ $(property-set).get ] ] ; - return qt$(v:J=) ; -} - - -# Create a tag for the address-model -# 64 will simply generate "64" -local rule address-model-tag ( name : type ? : property-set ) -{ - return [ $(property-set).get ] ; -} - -# Create a tag for the architecture and model -# x86 32 would generate "x32" -# This relies on the fact that all architectures start with -# unique letters. -local rule arch-and-model-tag ( name : type ? : property-set ) -{ - local architecture = [ $(property-set).get ] ; - local address-model = [ $(property-set).get ] ; - - local arch = [ MATCH ^(.) : $(architecture) ] ; - - return $(arch)$(address-model) ; -} - -rule __test__ ( ) -{ - import assert ; - - local save-os = [ modules.peek os : .name ] ; - - modules.poke os : .name : LINUX ; - assert.result "PATH=\"foo:bar:baz\"\nexport PATH\n" - : path-variable-setting-command PATH : foo bar baz ; - assert.result "PATH=\"foo:bar:$PATH\"\nexport PATH\n" - : prepend-path-variable-command PATH : foo bar ; - - modules.poke os : .name : NT ; - assert.result "set PATH=foo;bar;baz\n" - : path-variable-setting-command PATH : foo bar baz ; - assert.result "set PATH=foo;bar;%PATH%\n" - : prepend-path-variable-command PATH : foo bar ; - - modules.poke os : .name : $(save-os) ; -} diff --git a/external/+Catch2/CMakeLists.txt b/external/+Catch2/CMakeLists.txt deleted file mode 100644 index 0211478..0000000 --- a/external/+Catch2/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -include(ExternalProject) -ExternalProject_Add( - rp_Catch2 - URL "https://github.com/catchorg/Catch2/archive/v2.9.1.tar.gz" - URL_HASH SHA256=0b36488aca6265e7be14da2c2d0c748b4ddb9c70a1ea4da75736699c629f14ac - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCATCH_INSTALL_DOCS=OFF - -DCATCH_BUILD_TESTING=OFF - -DCATCH_INSTALL_HELPERS=ON -) diff --git a/external/+Clipper/CMakeLists.txt b/external/+Clipper/CMakeLists.txt deleted file mode 100644 index 6ea945a..0000000 --- a/external/+Clipper/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -require_dependency(Boost) - -rp_add_cmake_project(Clipper - GIT_REPOSITORY https://github.com/tamasmeszaros/libpolyclipping.git -) diff --git a/external/+GTest/CMakeLists.txt b/external/+GTest/CMakeLists.txt deleted file mode 100644 index 24e7c99..0000000 --- a/external/+GTest/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -rp_add_cmake_project(GTest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.10.0 - CMAKE_ARGS - -DBUILD_GTEST:BOOL=ON - -DBUILD_GMOCK:BOOL=OFF -) diff --git a/external/+NLopt/CMakeLists.txt b/external/+NLopt/CMakeLists.txt deleted file mode 100644 index 70c5218..0000000 --- a/external/+NLopt/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -rp_add_cmake_project(NLopt - GIT_REPOSITORY https://github.com/stevengj/nlopt.git - GIT_TAG v2.6.1 - CMAKE_ARGS - -DNLOPT_PYTHON:BOOL=OFF - -DNLOPT_OCTAVE:BOOL=OFF - -DNLOPT_MATLAB:BOOL=OFF - -DNLOPT_GUILE:BOOL=OFF - -DNLOPT_SWIG:BOOL=OFF - -DNLOPT_TESTS:BOOL=OFF -) diff --git a/external/+TBB/CMakeLists.txt b/external/+TBB/CMakeLists.txt deleted file mode 100644 index 3a4f134..0000000 --- a/external/+TBB/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set (_tbb_confs "") -if (BUILD_SHARED_LIBS) - set(_tbb_confs -DTBB_BUILD_STATIC:BOOL=OFF -DTBB_BUILD_SHARED:BOOL=ON) -else() - set(_tbb_confs -DTBB_BUILD_STATIC:BOOL=ON -DTBB_BUILD_SHARED:BOOL=OFF) -endif() - -rp_add_cmake_project( - TBB - #GIT_REPOSITORY https://github.com/wjakob/tbb.git - #GIT_TAG 20357d83871e4cb93b2c724fe0c337cd999fd14f - URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz" - URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe - CMAKE_ARGS - ${_tbb_confs} - -DTBB_BUILD_TESTS=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_DEBUG_POSTFIX=_debug -) - diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt deleted file mode 100644 index 931908b..0000000 --- a/external/CMakeLists.txt +++ /dev/null @@ -1,268 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(RequiredPackages) - -function(_message) - message(${ARGV}) -endfunction() - -macro(message) - if (NOT CMAKE_FIND_PACKAGE_NAME AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - _message(${ARGV}) - endif () -endmacro() - -find_package(Git QUIET REQUIRED) - -macro(subdirlist result curdir) - file(GLOB children RELATIVE ${curdir} ${curdir}/*) - set(dirlist "") - foreach(child ${children}) - if(IS_DIRECTORY ${curdir}/${child}) - string(REGEX MATCH "^\\+([a-zA-Z0-9]+)" is_package ${child}) - if(is_package) - list(APPEND dirlist ${CMAKE_MATCH_1}) - endif() - endif() - endforeach() - set(${result} ${dirlist}) -endmacro() - -if (NOT RP_PACKAGES) - subdirlist(RP_PACKAGES ${CMAKE_CURRENT_LIST_DIR}) -endif() - -# If RP_PACKAGE is defined and non-empty, this subdir was called by RequirePackage module. -# Otherwise it was called by another means as a normal subdirectory or parent project - -set(RP_ALL_TARGETS "") -set(RP_PACKAGE_SETUP_SCRIPT "" CACHE STRING "Specify custom package setup script.") -set(RP_PACKAGE_MOD_SCRIPT "" CACHE STRING "Specify a script where package download targets can be tweaked.") -if (NOT AS_RP_PROCESS) - - set (RP_FORCE_DOWNLOADING OFF CACHE BOOL "Force all packages to be built even if installed in system.") - - # Instruction: append package names to RP_ALL_TARGETS to be included in ALL - if (NOT RP_PACKAGE_SETUP_SCRIPT) - include(PackageSetup.cmake) - else () - include(${RP_PACKAGE_SETUP_SCRIPT}) - endif () - -endif() - -if (RP_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX "${RP_INSTALL_PREFIX}" CACHE STRING "" FORCE) -endif () - -set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build the packages as shared libraries.") -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake-modules) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake-modules/overrides) - -if (NOT AS_RP_PROCESS) - message(STATUS "Package summary:") -endif () - -foreach(p ${RP_PACKAGES}) - if (NOT RP_PACKAGE) - set(RP_${p}_FOUND FALSE CACHE INTERNAL "") - endif () - if (RP_FORCE_DOWNLOADING AND NOT AS_RP_PROCESS) - list(FIND RP_ALL_TARGETS ${p} _idx) - if (_idx LESS 0) - message(STATUS "Available: ${p}") - else () - message(STATUS "Selected: ${p}") - endif () - endif() -endforeach() - -# Filter out packages that are present in system -if (NOT RP_FORCE_DOWNLOADING AND NOT AS_RP_PROCESS) - foreach(p ${RP_PACKAGES}) - find_package(${p} ${RP_${p}_VERSION} QUIET COMPONENTS ${RP_${p}_COMPONENTS}) - if (${p}_FOUND) - set (RP_${p}_FOUND TRUE CACHE INTERNAL "") - message(STATUS "Installed: ${p}") - list(REMOVE_ITEM RP_ALL_TARGETS ${p}) - else () - list(FIND RP_ALL_TARGETS ${p} _idx) - if (_idx LESS 0) - message(STATUS "Available: ${p}") - else() - message(STATUS "Selected: ${p}") - endif () - endif () - endforeach() -endif () - -get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - -function(require_dependency dep_name ) - - cmake_parse_arguments(RD_ARGS "REQUIRED;QUIET" "VERSION" "COMPONENTS" ${ARGN}) - - list(FIND RP_PACKAGES ${dep_name} _idx) - set(_found_target true) - if (_idx LESS 0) - set(_found_target false) - endif () - - # set(dep_ver ${ARGV1}) - - # TODO: Forward the highest version of RP and RD VERSION - # TODO: Forward the union of components of RP and RD COMPONENTS and OPTIONAL COMPONENTS - - # Ignore REQUIRED, forward QUIET of RP - - if (AS_RP_PROCESS) - list(FIND ${PACKAGE}_DEPENDS rp_${dep_name} _is_added_idx) - if (_is_added_idx GREATER -1 OR RP_${dep_name}_FOUND OR ${dep_name}_FOUND) - return() - endif () - endif () - - if(NOT RP_FORCE_DOWNLOADING OR NOT _found_target) - find_package(${dep_name} ${dep_ver} QUIET ${RD_ARGS_UNPARSED_ARGUMENTS}) - if (${dep_name}_FOUND) - set(RP_${dep_name}_FOUND TRUE CACHE INTERNAL "") - endif() - - if(RP_${dep_name}_FOUND AND NOT RP_FIND_QUIETLY) - message(STATUS "Link ${dep_name} (installed) to rp_${PACKAGE}") - endif() - endif() - - if(NOT RP_${dep_name}_FOUND) - if (_found_target) - list(APPEND ${PACKAGE}_DEPENDS rp_${dep_name}) - list(REMOVE_DUPLICATES ${PACKAGE}_DEPENDS) - set(${PACKAGE}_DEPENDS "${${PACKAGE}_DEPENDS}" CACHE INTERNAL "") - - if(NOT RP_${dep_name}_FOUND AND NOT RP_FIND_QUIETLY) - message(STATUS "Link rp_${dep_name} to rp_${PACKAGE}") - endif() - endif() - endif() - -endfunction() - -include(ExternalProject) - -function(rp_add_cmake_project projectname) - - cmake_parse_arguments(P_ARGS "" "INSTALL_DIR;BINARY_DIR" "CMAKE_ARGS" ${ARGN}) - - set(_configs_line -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - set(_postfix_line "") - - set(RP_RELEASE_POSTFIX "" CACHE STRING "") - set(RP_DEBUG_POSTFIX "d" CACHE STRING "") - set(RP_RELWITHDEBINFO_POSTFIX "_rwdi" CACHE STRING "") - set(RP_MINSIZEREL_POSTFIX "_msr" CACHE STRING "") - - if (_is_multi) - #string(REPLACE ";" " " _configs "${CMAKE_CONFIGURATION_TYPES}") - #set(_configs_line "-DCMAKE_CONFIGURATION_TYPES:STRING=${_configs}") - set(_configs_line "") - set(_configs ${CMAKE_CONFIGURATION_TYPES}) - foreach(_Conf ${_configs}) - string(TOUPPER "${_Conf}" _CONF) - if (RP_${_CONF}_POSTFIX) - list(APPEND _postfix_line -DCMAKE_${_CONF}_POSTFIX:STRING=${RP_${_CONF}_POSTFIX}) - endif () - endforeach() - else () - set(_configs_line -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - string(TOUPPER "${CMAKE_BUILD_TYPE}" _CONF) - set(_conf ${RP_${_CONF}_POSTFIX}) - if(RP_${_CONF}_POSTFIX) - list(APPEND _postfix_line -DCMAKE_${_CONF}_POSTFIX:STRING=${RP_${_CONF}_POSTFIX}) - endif () - endif () - - ExternalProject_Add( - rp_${projectname} - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BINARY_DIR ${RP_PACKAGE_BUILD_DIR} - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH:STRING=${CMAKE_INSTALL_PREFIX} - -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - "${_configs_line}" - "${_postfix_line}" - ${P_ARGS_CMAKE_ARGS} - ${P_ARGS_UNPARSED_ARGUMENTS} - ) - -endfunction() - -if (APPLE) - message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}") - if (CMAKE_OSX_DEPLOYMENT_TARGET) - set(RP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}") - message("OS X Deployment Target: ${RP_OSX_TARGET}") - else () - # Attempt to infer the SDK version from the CMAKE_OSX_SYSROOT, - # this is done because wxWidgets need the min version explicitly set - string(REGEX MATCH "[0-9]+[.][0-9]+[.]sdk$" DEP_OSX_TARGET "${CMAKE_OSX_SYSROOT}") - string(REGEX MATCH "^[0-9]+[.][0-9]+" DEP_OSX_TARGET "${DEP_OSX_TARGET}") - - if (NOT RP_OSX_TARGET) - message(FATAL_ERROR "Could not determine OS X SDK version. Please use -DCMAKE_OSX_DEPLOYMENT_TARGET=") - endif () - - message("OS X Deployment Target (inferred from SDK): ${RP_OSX_TARGET}") - endif () - set (DEP_OSX_TARGET ${RP_OSX_TARGET}) -endif () - -add_custom_target(rp ALL) - -if (RP_PACKAGE) - add_dependencies(rp rp_${RP_PACKAGE}) -endif () - -foreach(PACKAGE IN ITEMS ${RP_PACKAGES}) - if(_is_multi) - set(RP_PACKAGE_BUILD_DIR "rp_${PACKAGE}-build/") - else() - set(RP_PACKAGE_BUILD_DIR "rp_${PACKAGE}-build/${CMAKE_BUILD_TYPE}") - endif() - - add_subdirectory("+${PACKAGE}" EXCLUDE_FROM_ALL) - -endforeach() - -foreach(PACKAGE IN ITEMS ${RP_PACKAGES}) - if(${PACKAGE}_DEPENDS) - foreach(tgt ${${PACKAGE}_DEPENDS}) - if (NOT TARGET ${tgt}) - message(FATAL_ERROR "Required package target ${tgt} is not defined!") - endif () - endforeach() - add_dependencies(rp_${PACKAGE} ${${PACKAGE}_DEPENDS}) - endif() -endforeach() - -if (NOT AS_RP_PROCESS) - foreach(_pkg ${RP_ALL_TARGETS}) - add_dependencies(rp rp_${_pkg}) - endforeach() -endif() - -if (RP_PACKAGE_MOD_SCRIPT) - include(${RP_PACKAGE_MOD_SCRIPT}) -endif () - -unset(RP_PACKAGE) -unset(RP_${RP_PACKAGE}_COMPONENTS) -unset(RP_${RP_PACKAGE}_COMPONENTS) -unset(RP_${RP_PACKAGE}_OPTIONAL_COMPONENTS) -unset(RP_${RP_PACKAGE}_VERSION) -unset(RP_FIND_REQUIRED) -unset(RP_FIND_QUIETLY) -unset(RP_PACKAGE_BUILD_DIR) diff --git a/external/PackageSetup.cmake b/external/PackageSetup.cmake deleted file mode 100644 index 6f4ac4d..0000000 --- a/external/PackageSetup.cmake +++ /dev/null @@ -1,12 +0,0 @@ -set(RP_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/destdir/" CACHE STRING "") - -set(RP_Boost_VERSION 1.70) - -set (RP_OpenVDB_COMPONENTS openvdb) -set (RP_wxWidgets_VERSION 3.1.3) - -if (NOT BUILD_SHARED_LIBS) - set(TBB_STATIC ON) -endif () - -set(RP_ALL_TARGETS ${RP_PACKAGES}) diff --git a/include/libnest2d/backends/clipper/CMakeLists.txt b/include/libnest2d/backends/clipper/CMakeLists.txt index 031a0a0..b92aba4 100644 --- a/include/libnest2d/backends/clipper/CMakeLists.txt +++ b/include/libnest2d/backends/clipper/CMakeLists.txt @@ -1,14 +1,15 @@ add_library(clipperBackend INTERFACE) -require_package(Clipper 6.1 REQUIRED) -target_link_libraries(clipperBackend INTERFACE Clipper::Clipper) +find_package(clipper 6.1 REQUIRED) +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) +find_package(Boost 1.58 REQUIRED) -if(TARGET Boost::boost) - target_link_libraries(clipperBackend INTERFACE Boost::boost ) +if(TARGET boost::boost) + target_link_libraries(clipperBackend INTERFACE boost::boost ) elseif(Boost_INCLUDE_DIRS_FOUND) target_include_directories(clipperBackend INTERFACE $ ) endif() @@ -20,4 +21,4 @@ include/libnest2d/backends/clipper/clipper_polygon.hpp set(LIBNEST2D_SRCFILES ${LIBNEST2D_SRCFILES} PARENT_SCOPE) install(TARGETS clipperBackend EXPORT Libnest2DTargets INCLUDES DESTINATION include) -set(LIBNEST2D_PUBLIC_PACKAGES "${LIBNEST2D_PUBLIC_PACKAGES};Boost;Clipper" CACHE INTERNAL "") +set(LIBNEST2D_PUBLIC_PACKAGES "${LIBNEST2D_PUBLIC_PACKAGES};Boost;clipper" CACHE INTERNAL "") diff --git a/include/libnest2d/backends/clipper/clipper_polygon.hpp b/include/libnest2d/backends/clipper/clipper_polygon.hpp index 6511fbb..5993221 100644 --- a/include/libnest2d/backends/clipper/clipper_polygon.hpp +++ b/include/libnest2d/backends/clipper/clipper_polygon.hpp @@ -1,7 +1,7 @@ #ifndef CLIPPER_POLYGON_HPP #define CLIPPER_POLYGON_HPP -#include +#include namespace ClipperLib { diff --git a/include/libnest2d/optimizers/nlopt/CMakeLists.txt b/include/libnest2d/optimizers/nlopt/CMakeLists.txt index 97fb5d6..50d35f2 100644 --- a/include/libnest2d/optimizers/nlopt/CMakeLists.txt +++ b/include/libnest2d/optimizers/nlopt/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(nloptOptimizer INTERFACE) -require_package(NLopt 1.4 REQUIRED) +find_package(NLopt 2.7 REQUIRED) target_link_libraries(nloptOptimizer INTERFACE NLopt::nlopt) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8bf527c..a210413 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -require_package(Catch2 2.9.1 REQUIRED) +find_package(catch2 2.9.1 REQUIRED) add_executable(tests_clipper_nlopt test.cpp