Просмотр исходного кода

Fix cmake with msvc generator.

* Remove unused libnest2d files. Make it use the global build script targets.
* Modify FindTBB to address multi-config builds and take care of __TBB_NO_IMPLICIT_LINKAGE
* Move FindNLopt to project common cmake module dir
* Rename libnest.hpp to nester.hpp and libnest.h to libnest.hpp 
* Clean up common test suite build scripts
tamasmeszaros 5 лет назад
Родитель
Сommit
fbc174ad06

+ 9 - 7
CMakeLists.txt

@@ -291,14 +291,14 @@ if(SLIC3R_STATIC)
 endif()
 set(TBB_DEBUG 1)
 find_package(TBB REQUIRED)
-include_directories(${TBB_INCLUDE_DIRS})
-add_definitions(${TBB_DEFINITIONS})
-if(MSVC)
-    # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
-    add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE)
-endif()
+# include_directories(${TBB_INCLUDE_DIRS})
+# add_definitions(${TBB_DEFINITIONS})
+# if(MSVC)
+#     # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
+#     add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE)
+# endif()
 # The Intel TBB library will use the std::exception_ptr feature of C++11.
-add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
+# add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
 
 find_package(CURL REQUIRED)
 include_directories(${CURL_INCLUDE_DIRS})
@@ -375,6 +375,8 @@ add_custom_target(pot
     COMMENT "Generate pot file from strings in the source tree"
 )
 
+find_package(NLopt 1.4 REQUIRED)
+
 # libslic3r, PrusaSlicer GUI and the PrusaSlicer executable.
 add_subdirectory(src)
 set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT PrusaSlicer_app_console)

+ 8 - 10
src/libnest2d/cmake_modules/FindNLopt.cmake → cmake/modules/FindNLopt.cmake

@@ -21,8 +21,7 @@
 set(NLopt_FOUND        FALSE)
 set(NLopt_ERROR_REASON "")
 set(NLopt_DEFINITIONS  "")
-set(NLopt_LIBS)
-
+unset(NLopt_LIBS CACHE)
 
 set(NLopt_DIR $ENV{NLOPT})
 if(NOT NLopt_DIR)
@@ -48,15 +47,14 @@ if(NOT NLopt_DIR)
 		set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt header file '${_NLopt_HEADER_FILE_NAME}'.")
 	endif()
 	unset(_NLopt_HEADER_FILE_NAME)
-	unset(_NLopt_HEADER_FILE)
-
+	
 	if(NOT NLopt_FOUND)
 		set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} NLopt not found in system directories (and environment variable NLOPT is not set).")
 	else()
 	get_filename_component(NLopt_INCLUDE_DIR ${_NLopt_HEADER_FILE} DIRECTORY )
 	endif()
 
-
+    unset(_NLopt_HEADER_FILE CACHE)
 
 else()
 
@@ -95,7 +93,7 @@ else()
 		set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt header file '${_NLopt_HEADER_FILE_NAME}' in '${NLopt_INCLUDE_DIR}'.")
 	endif()
 	unset(_NLopt_HEADER_FILE_NAME)
-	unset(_NLopt_HEADER_FILE)
+	unset(_NLopt_HEADER_FILE CACHE)
 
 endif()
 
@@ -114,10 +112,10 @@ if(NLopt_FOUND)
 	message(STATUS "Found NLopt in '${NLopt_DIR}'.")
 	message(STATUS "Using NLopt include directory '${NLopt_INCLUDE_DIR}'.")
 	message(STATUS "Using NLopt library '${NLopt_LIBS}'.")
-	add_library(Nlopt::Nlopt INTERFACE IMPORTED)
-	set_target_properties(Nlopt::Nlopt PROPERTIES INTERFACE_LINK_LIBRARIES ${NLopt_LIBS})
-	set_target_properties(Nlopt::Nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${NLopt_INCLUDE_DIR})
-	set_target_properties(Nlopt::Nlopt PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${NLopt_DEFINITIONS}")
+	add_library(NLopt::nlopt INTERFACE IMPORTED)
+	set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_LINK_LIBRARIES ${NLopt_LIBS})
+	set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${NLopt_INCLUDE_DIR})
+	set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${NLopt_DEFINITIONS}")
 	# target_link_libraries(Nlopt::Nlopt INTERFACE ${NLopt_LIBS})
 	# target_include_directories(Nlopt::Nlopt INTERFACE ${NLopt_INCLUDE_DIR})
     # target_compile_definitions(Nlopt::Nlopt INTERFACE ${NLopt_DEFINITIONS})

+ 11 - 21
cmake/modules/FindTBB.cmake

@@ -250,26 +250,23 @@ if(NOT TBB_FOUND)
     endif()
   endforeach()
 
-  unset(TBB_STATIC_SUFFIX)
-
   ##################################
   # Set compile flags and libraries
   ##################################
 
   set(TBB_DEFINITIONS_RELEASE "")
-  set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
+  set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1")
     
   if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
-    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
     set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
-  elseif(TBB_LIBRARIES_RELEASE)
-    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
-    set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
-  elseif(TBB_LIBRARIES_DEBUG)
-    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
-    set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
   endif()
 
+  if (MSVC AND TBB_STATIC)
+    set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)
+  endif ()
+
+  unset (TBB_STATIC_SUFFIX)
+
   find_package_handle_standard_args(TBB 
       REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
       HANDLE_COMPONENTS
@@ -280,25 +277,18 @@ if(NOT TBB_FOUND)
   ##################################
 
   if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
-    add_library(tbb UNKNOWN IMPORTED)
-    set_target_properties(tbb PROPERTIES
+    add_library(TBB::tbb UNKNOWN IMPORTED)
+    set_target_properties(TBB::tbb PROPERTIES
           INTERFACE_INCLUDE_DIRECTORIES  ${TBB_INCLUDE_DIRS}
           IMPORTED_LOCATION              ${TBB_LIBRARIES})
     if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
-      set_target_properties(tbb PROPERTIES
-          INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
+      set_target_properties(TBB::tbb PROPERTIES
+          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS};$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:${TBB_DEFINITIONS_DEBUG}>;$<$<CONFIG:Release>:${TBB_DEFINITIONS_RELEASE}>"
           IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
           IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE}
           IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
           IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
           )
-    elseif(TBB_LIBRARIES_RELEASE)
-      set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
-    else()
-      set_target_properties(tbb PROPERTIES
-          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
-          IMPORTED_LOCATION              ${TBB_LIBRARIES_DEBUG}
-          )
     endif()
   endif()
 

+ 0 - 1
src/CMakeLists.txt

@@ -16,7 +16,6 @@ add_subdirectory(semver)
 add_subdirectory(libigl)
 
 # Adding libnest2d project for bin packing...
-set(LIBNEST2D_UNITTESTS ON CACHE BOOL "Force generating unittests for libnest2d")
 add_subdirectory(libnest2d)
 
 add_subdirectory(libslic3r)

+ 27 - 102
src/libnest2d/CMakeLists.txt

@@ -1,106 +1,31 @@
-cmake_minimum_required(VERSION 3.0)
-
-project(Libnest2D)
-
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
-    # Update if necessary
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long ")
-endif()
-
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED)
-
-# Add our own cmake module path.
-list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/)
-
-option(LIBNEST2D_HEADER_ONLY "If enabled static library will not be built." ON)
-
-set(GEOMETRY_BACKENDS clipper boost eigen)
-set(LIBNEST2D_GEOMETRIES clipper CACHE STRING "Geometry backend")
-set_property(CACHE LIBNEST2D_GEOMETRIES PROPERTY STRINGS ${GEOMETRY_BACKENDS})
-list(FIND GEOMETRY_BACKENDS ${LIBNEST2D_GEOMETRIES} GEOMETRY_TYPE)
-if(${GEOMETRY_TYPE} EQUAL -1)
-    message(FATAL_ERROR "Option ${LIBNEST2D_GEOMETRIES} not supported, valid entries are ${GEOMETRY_BACKENDS}")
-endif()
-
-set(OPTIMIZERS nlopt optimlib)
-set(LIBNEST2D_OPTIMIZER nlopt CACHE STRING "Optimization backend")
-set_property(CACHE LIBNEST2D_OPTIMIZER PROPERTY STRINGS ${OPTIMIZERS})
-list(FIND OPTIMIZERS ${LIBNEST2D_OPTIMIZER} OPTIMIZER_TYPE)
-if(${OPTIMIZER_TYPE} EQUAL -1)
-    message(FATAL_ERROR "Option ${LIBNEST2D_OPTIMIZER} not supported, valid entries are ${OPTIMIZERS}")
-endif()
-
-add_library(libnest2d INTERFACE)
-
-set(SRC_DIR ${PROJECT_SOURCE_DIR}/include)
-
 set(LIBNEST2D_SRCFILES
-    ${SRC_DIR}/libnest2d/libnest2d.hpp         # Templates only
-    ${SRC_DIR}/libnest2d/geometry_traits.hpp
-    ${SRC_DIR}/libnest2d/geometry_traits_nfp.hpp
-    ${SRC_DIR}/libnest2d/common.hpp
-    ${SRC_DIR}/libnest2d/optimizer.hpp
-    ${SRC_DIR}/libnest2d/utils/metaloop.hpp
-    ${SRC_DIR}/libnest2d/utils/rotfinder.hpp
-    ${SRC_DIR}/libnest2d/utils/rotcalipers.hpp
-    ${SRC_DIR}/libnest2d/utils/bigint.hpp
-    ${SRC_DIR}/libnest2d/utils/rational.hpp
-    ${SRC_DIR}/libnest2d/placers/placer_boilerplate.hpp
-    ${SRC_DIR}/libnest2d/placers/bottomleftplacer.hpp
-    ${SRC_DIR}/libnest2d/placers/nfpplacer.hpp
-    ${SRC_DIR}/libnest2d/selections/selection_boilerplate.hpp
-    ${SRC_DIR}/libnest2d/selections/filler.hpp
-    ${SRC_DIR}/libnest2d/selections/firstfit.hpp
-    ${SRC_DIR}/libnest2d/selections/djd_heuristic.hpp
+    include/libnest2d/libnest2d.hpp
+    include/libnest2d/nester.hpp
+    include/libnest2d/geometry_traits.hpp
+    include/libnest2d/geometry_traits_nfp.hpp
+    include/libnest2d/common.hpp
+    include/libnest2d/optimizer.hpp
+    include/libnest2d/utils/metaloop.hpp
+    include/libnest2d/utils/rotfinder.hpp
+    include/libnest2d/utils/rotcalipers.hpp
+    include/libnest2d/placers/placer_boilerplate.hpp
+    include/libnest2d/placers/bottomleftplacer.hpp
+    include/libnest2d/placers/nfpplacer.hpp
+    include/libnest2d/selections/selection_boilerplate.hpp
+    #include/libnest2d/selections/filler.hpp
+    include/libnest2d/selections/firstfit.hpp
+    #include/libnest2d/selections/djd_heuristic.hpp
+    include/libnest2d/backends/clipper/geometries.hpp
+    include/libnest2d/backends/clipper/clipper_polygon.hpp
+    include/libnest2d/optimizers/nlopt/nlopt_boilerplate.hpp
+    include/libnest2d/optimizers/nlopt/simplex.hpp
+    include/libnest2d/optimizers/nlopt/subplex.hpp
+    include/libnest2d/optimizers/nlopt/genetic.hpp
+    src/libnest2d.cpp
     )
 
-set(TBB_STATIC ON)
-find_package(TBB QUIET)
-if(TBB_FOUND)
-    message(STATUS "Parallelization with Intel TBB")
-    target_include_directories(libnest2d INTERFACE ${TBB_INCLUDE_DIRS})
-    target_compile_definitions(libnest2d INTERFACE ${TBB_DEFINITIONS} -DUSE_TBB)
-    if(MSVC)
-       # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
-       target_compile_definitions(libnest2d INTERFACE -D__TBB_NO_IMPLICIT_LINKAGE)
-    endif()
-    # The Intel TBB library will use the std::exception_ptr feature of C++11.
-    target_compile_definitions(libnest2d INTERFACE -DTBB_USE_CAPTURED_EXCEPTION=0)
-
-    find_package(Threads REQUIRED)
-    target_link_libraries(libnest2d INTERFACE 
-        tbb # VS debug mode needs linking this way:
-        # ${TBB_LIBRARIES} 
-        ${CMAKE_DL_LIBS}
-        Threads::Threads
-        )
-else()
-   find_package(OpenMP QUIET)
-
-   if(OpenMP_CXX_FOUND)
-       message(STATUS "Parallelization with OpenMP")
-       target_include_directories(libnest2d INTERFACE OpenMP::OpenMP_CXX)
-       target_link_libraries(libnest2d INTERFACE OpenMP::OpenMP_CXX)
-   else()
-       message("Parallelization with C++11 threads")
-       find_package(Threads REQUIRED)
-       target_link_libraries(libnest2d INTERFACE Threads::Threads)
-   endif()
-endif()
-
-add_subdirectory(${SRC_DIR}/libnest2d/backends/${LIBNEST2D_GEOMETRIES})
-target_link_libraries(libnest2d INTERFACE ${LIBNEST2D_GEOMETRIES}Backend)
-
-add_subdirectory(${SRC_DIR}/libnest2d/optimizers/${LIBNEST2D_OPTIMIZER})
-target_link_libraries(libnest2d INTERFACE ${LIBNEST2D_OPTIMIZER}Optimizer)
-
-# target_sources(libnest2d INTERFACE ${LIBNEST2D_SRCFILES})
-target_include_directories(libnest2d INTERFACE ${SRC_DIR})
+add_library(libnest2d ${LIBNEST2D_SRCFILES})
 
-if(NOT LIBNEST2D_HEADER_ONLY)
-    set(LIBNAME libnest2d_${LIBNEST2D_GEOMETRIES}_${LIBNEST2D_OPTIMIZER})
-    add_library(${LIBNAME} ${PROJECT_SOURCE_DIR}/src/libnest2d.cpp)
-    target_link_libraries(${LIBNAME} PUBLIC libnest2d)
-    target_compile_definitions(${LIBNAME} PUBLIC LIBNEST2D_STATIC)
-endif()
+target_include_directories(libnest2d PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
+target_link_libraries(libnest2d PUBLIC clipper NLopt::nlopt TBB::tbb Boost::boost)
+target_compile_definitions(libnest2d PUBLIC LIBNEST2D_STATIC LIBNEST2D_OPTIMIZER_nlopt LIBNEST2D_GEOMETRIES_clipper)

+ 0 - 35
src/libnest2d/cmake_modules/DownloadNLopt.cmake

@@ -1,35 +0,0 @@
-include(DownloadProject)
-
-if (CMAKE_VERSION VERSION_LESS 3.2)
-    set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
-else()
-    set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
-endif()
-
-set(URL_NLOPT "https://github.com/stevengj/nlopt.git" 
-    CACHE STRING "Location of the nlopt git repository")
-
-# set(NLopt_DIR ${CMAKE_BINARY_DIR}/nlopt)
-include(DownloadProject)
-download_project(   PROJ                nlopt
-                    GIT_REPOSITORY      ${URL_NLOPT}
-                    GIT_TAG             v2.5.0
-                    # CMAKE_CACHE_ARGS    -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${NLopt_DIR}
-                    ${UPDATE_DISCONNECTED_IF_AVAILABLE}
-)
-
-set(SHARED_LIBS_STATE BUILD_SHARED_LIBS)
-set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
-set(NLOPT_PYTHON OFF CACHE BOOL "" FORCE)
-set(NLOPT_OCTAVE OFF CACHE BOOL "" FORCE)
-set(NLOPT_MATLAB OFF CACHE BOOL "" FORCE)
-set(NLOPT_GUILE OFF CACHE BOOL "" FORCE)
-set(NLOPT_SWIG OFF CACHE BOOL "" FORCE)
-set(NLOPT_LINK_PYTHON OFF CACHE BOOL "" FORCE)
-
-add_subdirectory(${nlopt_SOURCE_DIR} ${nlopt_BINARY_DIR})
-
-set(NLopt_LIBS nlopt)
-set(NLopt_INCLUDE_DIR ${nlopt_BINARY_DIR} 
-                      ${nlopt_BINARY_DIR}/src/api)
-set(SHARED_LIBS_STATE ${SHARED_STATE})

+ 0 - 17
src/libnest2d/cmake_modules/DownloadProject.CMakeLists.cmake.in

@@ -1,17 +0,0 @@
-# Distributed under the OSI-approved MIT License.  See accompanying
-# file LICENSE or https://github.com/Crascit/DownloadProject for details.
-
-cmake_minimum_required(VERSION 2.8.2)
-
-project(${DL_ARGS_PROJ}-download NONE)
-
-include(ExternalProject)
-ExternalProject_Add(${DL_ARGS_PROJ}-download
-                    ${DL_ARGS_UNPARSED_ARGUMENTS}
-                    SOURCE_DIR          "${DL_ARGS_SOURCE_DIR}"
-                    BINARY_DIR          "${DL_ARGS_BINARY_DIR}"
-                    CONFIGURE_COMMAND   ""
-                    BUILD_COMMAND       ""
-                    INSTALL_COMMAND     ""
-                    TEST_COMMAND        ""
-)

+ 0 - 182
src/libnest2d/cmake_modules/DownloadProject.cmake

@@ -1,182 +0,0 @@
-# Distributed under the OSI-approved MIT License.  See accompanying
-# file LICENSE or https://github.com/Crascit/DownloadProject for details.
-#
-# MODULE:   DownloadProject
-#
-# PROVIDES:
-#   download_project( PROJ projectName
-#                    [PREFIX prefixDir]
-#                    [DOWNLOAD_DIR downloadDir]
-#                    [SOURCE_DIR srcDir]
-#                    [BINARY_DIR binDir]
-#                    [QUIET]
-#                    ...
-#   )
-#
-#       Provides the ability to download and unpack a tarball, zip file, git repository,
-#       etc. at configure time (i.e. when the cmake command is run). How the downloaded
-#       and unpacked contents are used is up to the caller, but the motivating case is
-#       to download source code which can then be included directly in the build with
-#       add_subdirectory() after the call to download_project(). Source and build
-#       directories are set up with this in mind.
-#
-#       The PROJ argument is required. The projectName value will be used to construct
-#       the following variables upon exit (obviously replace projectName with its actual
-#       value):
-#
-#           projectName_SOURCE_DIR
-#           projectName_BINARY_DIR
-#
-#       The SOURCE_DIR and BINARY_DIR arguments are optional and would not typically
-#       need to be provided. They can be specified if you want the downloaded source
-#       and build directories to be located in a specific place. The contents of
-#       projectName_SOURCE_DIR and projectName_BINARY_DIR will be populated with the
-#       locations used whether you provide SOURCE_DIR/BINARY_DIR or not.
-#
-#       The DOWNLOAD_DIR argument does not normally need to be set. It controls the
-#       location of the temporary CMake build used to perform the download.
-#
-#       The PREFIX argument can be provided to change the base location of the default
-#       values of DOWNLOAD_DIR, SOURCE_DIR and BINARY_DIR. If all of those three arguments
-#       are provided, then PREFIX will have no effect. The default value for PREFIX is
-#       CMAKE_BINARY_DIR.
-#
-#       The QUIET option can be given if you do not want to show the output associated
-#       with downloading the specified project.
-#
-#       In addition to the above, any other options are passed through unmodified to
-#       ExternalProject_Add() to perform the actual download, patch and update steps.
-#       The following ExternalProject_Add() options are explicitly prohibited (they
-#       are reserved for use by the download_project() command):
-#
-#           CONFIGURE_COMMAND
-#           BUILD_COMMAND
-#           INSTALL_COMMAND
-#           TEST_COMMAND
-#
-#       Only those ExternalProject_Add() arguments which relate to downloading, patching
-#       and updating of the project sources are intended to be used. Also note that at
-#       least one set of download-related arguments are required.
-#
-#       If using CMake 3.2 or later, the UPDATE_DISCONNECTED option can be used to
-#       prevent a check at the remote end for changes every time CMake is run
-#       after the first successful download. See the documentation of the ExternalProject
-#       module for more information. It is likely you will want to use this option if it
-#       is available to you. Note, however, that the ExternalProject implementation contains
-#       bugs which result in incorrect handling of the UPDATE_DISCONNECTED option when
-#       using the URL download method or when specifying a SOURCE_DIR with no download
-#       method. Fixes for these have been created, the last of which is scheduled for
-#       inclusion in CMake 3.8.0. Details can be found here:
-#
-#           https://gitlab.kitware.com/cmake/cmake/commit/bdca68388bd57f8302d3c1d83d691034b7ffa70c
-#           https://gitlab.kitware.com/cmake/cmake/issues/16428
-#
-#       If you experience build errors related to the update step, consider avoiding
-#       the use of UPDATE_DISCONNECTED.
-#
-# EXAMPLE USAGE:
-#
-#   include(DownloadProject)
-#   download_project(PROJ                googletest
-#                    GIT_REPOSITORY      https://github.com/google/googletest.git
-#                    GIT_TAG             master
-#                    UPDATE_DISCONNECTED 1
-#                    QUIET
-#   )
-#
-#   add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
-#
-#========================================================================================
-
-
-set(_DownloadProjectDir "${CMAKE_CURRENT_LIST_DIR}")
-
-include(CMakeParseArguments)
-
-function(download_project)
-
-    set(options QUIET)
-    set(oneValueArgs
-        PROJ
-        PREFIX
-        DOWNLOAD_DIR
-        SOURCE_DIR
-        BINARY_DIR
-        # Prevent the following from being passed through
-        CONFIGURE_COMMAND
-        BUILD_COMMAND
-        INSTALL_COMMAND
-        TEST_COMMAND
-    )
-    set(multiValueArgs "")
-
-    cmake_parse_arguments(DL_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
-    # Hide output if requested
-    if (DL_ARGS_QUIET)
-        set(OUTPUT_QUIET "OUTPUT_QUIET")
-    else()
-        unset(OUTPUT_QUIET)
-        message(STATUS "Downloading/updating ${DL_ARGS_PROJ}")
-    endif()
-
-    # Set up where we will put our temporary CMakeLists.txt file and also
-    # the base point below which the default source and binary dirs will be.
-    # The prefix must always be an absolute path.
-    if (NOT DL_ARGS_PREFIX)
-        set(DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}")
-    else()
-        get_filename_component(DL_ARGS_PREFIX "${DL_ARGS_PREFIX}" ABSOLUTE
-                               BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-    endif()
-    if (NOT DL_ARGS_DOWNLOAD_DIR)
-        set(DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-download")
-    endif()
-
-    # Ensure the caller can know where to find the source and build directories
-    if (NOT DL_ARGS_SOURCE_DIR)
-        set(DL_ARGS_SOURCE_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-src")
-    endif()
-    if (NOT DL_ARGS_BINARY_DIR)
-        set(DL_ARGS_BINARY_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-build")
-    endif()
-    set(${DL_ARGS_PROJ}_SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" PARENT_SCOPE)
-    set(${DL_ARGS_PROJ}_BINARY_DIR "${DL_ARGS_BINARY_DIR}" PARENT_SCOPE)
-
-    # The way that CLion manages multiple configurations, it causes a copy of
-    # the CMakeCache.txt to be copied across due to it not expecting there to
-    # be a project within a project.  This causes the hard-coded paths in the
-    # cache to be copied and builds to fail.  To mitigate this, we simply
-    # remove the cache if it exists before we configure the new project.  It
-    # is safe to do so because it will be re-generated.  Since this is only
-    # executed at the configure step, it should not cause additional builds or
-    # downloads.
-    file(REMOVE "${DL_ARGS_DOWNLOAD_DIR}/CMakeCache.txt")
-
-    # Create and build a separate CMake project to carry out the download.
-    # If we've already previously done these steps, they will not cause
-    # anything to be updated, so extra rebuilds of the project won't occur.
-    # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project
-    # has this set to something not findable on the PATH.
-    configure_file("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in"
-                   "${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
-    execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
-                        -D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}"
-                        .
-                    RESULT_VARIABLE result
-                    ${OUTPUT_QUIET}
-                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
-    )
-    if(result)
-        message(FATAL_ERROR "CMake step for ${DL_ARGS_PROJ} failed: ${result}")
-    endif()
-    execute_process(COMMAND ${CMAKE_COMMAND} --build .
-                    RESULT_VARIABLE result
-                    ${OUTPUT_QUIET}
-                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
-    )
-    if(result)
-        message(FATAL_ERROR "Build step for ${DL_ARGS_PROJ} failed: ${result}")
-    endif()
-
-endfunction()

+ 0 - 58
src/libnest2d/cmake_modules/FindClipper.cmake

@@ -1,58 +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.
-
-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/)
-
-FIND_LIBRARY(CLIPPER_LIBRARIES polyclipping
-    $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)
-
-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 INTERFACE IMPORTED)
-    set_target_properties(Clipper::Clipper PROPERTIES INTERFACE_LINK_LIBRARIES ${CLIPPER_LIBRARIES})
-    set_target_properties(Clipper::Clipper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CLIPPER_INCLUDE_DIRS})
-    #target_link_libraries(Clipper::Clipper INTERFACE ${CLIPPER_LIBRARIES})
-    #target_include_directories(Clipper::Clipper INTERFACE ${CLIPPER_INCLUDE_DIRS})
-endif()

+ 0 - 134
src/libnest2d/include/libnest2d.h

@@ -1,134 +0,0 @@
-#ifndef LIBNEST2D_H
-#define LIBNEST2D_H
-
-// The type of backend should be set conditionally by the cmake configuriation
-// for now we set it statically to clipper backend
-#ifdef LIBNEST2D_BACKEND_CLIPPER
-#include <libnest2d/backends/clipper/geometries.hpp>
-#endif
-
-#ifdef LIBNEST2D_OPTIMIZER_NLOPT
-// We include the stock optimizers for local and global optimization
-#include <libnest2d/optimizers/nlopt/subplex.hpp>     // Local subplex for NfpPlacer
-#include <libnest2d/optimizers/nlopt/genetic.hpp>     // Genetic for min. bounding box
-#endif
-
-#include <libnest2d/libnest2d.hpp>
-#include <libnest2d/placers/bottomleftplacer.hpp>
-#include <libnest2d/placers/nfpplacer.hpp>
-#include <libnest2d/selections/firstfit.hpp>
-#include <libnest2d/selections/filler.hpp>
-#include <libnest2d/selections/djd_heuristic.hpp>
-
-namespace libnest2d {
-
-using Point = PointImpl;
-using Coord = TCoord<PointImpl>;
-using Box = _Box<PointImpl>;
-using Segment = _Segment<PointImpl>;
-using Circle = _Circle<PointImpl>;
-
-using Item = _Item<PolygonImpl>;
-using Rectangle = _Rectangle<PolygonImpl>;
-using PackGroup = _PackGroup<PolygonImpl>;
-
-using FillerSelection = selections::_FillerSelection<PolygonImpl>;
-using FirstFitSelection = selections::_FirstFitSelection<PolygonImpl>;
-using DJDHeuristic  = selections::_DJDHeuristic<PolygonImpl>;
-
-template<class Bin> // Generic placer for arbitrary bin types
-using _NfpPlacer = placers::_NofitPolyPlacer<PolygonImpl, Bin>;
-
-// NfpPlacer is with Box bin
-using NfpPlacer = _NfpPlacer<Box>;
-
-// This supports only box shaped bins
-using BottomLeftPlacer = placers::_BottomLeftPlacer<PolygonImpl>;
-
-#ifdef LIBNEST2D_STATIC
-
-extern template class Nester<NfpPlacer, FirstFitSelection>;
-extern template class Nester<BottomLeftPlacer, FirstFitSelection>;
-extern template std::size_t Nester<NfpPlacer, FirstFitSelection>::execute(
-        std::vector<Item>::iterator, std::vector<Item>::iterator);
-extern template std::size_t Nester<BottomLeftPlacer, FirstFitSelection>::execute(
-        std::vector<Item>::iterator, std::vector<Item>::iterator);
-
-#endif
-
-template<class Placer = NfpPlacer, class Selector = FirstFitSelection>
-struct NestConfig {
-    typename Placer::Config placer_config;
-    typename Selector::Config selector_config;
-    using Placement = typename Placer::Config;
-    using Selection = typename Selector::Config;
-    
-    NestConfig() = default;
-    NestConfig(const typename Placer::Config &cfg)   : placer_config{cfg} {}
-    NestConfig(const typename Selector::Config &cfg) : selector_config{cfg} {}
-    NestConfig(const typename Placer::Config &  pcfg,
-               const typename Selector::Config &scfg)
-        : placer_config{pcfg}, selector_config{scfg} {}
-};
-
-struct NestControl {
-    ProgressFunction progressfn;
-    StopCondition stopcond = []{ return false; };
-    
-    NestControl() = default;
-    NestControl(ProgressFunction pr) : progressfn{std::move(pr)} {}
-    NestControl(StopCondition sc) : stopcond{std::move(sc)} {}
-    NestControl(ProgressFunction pr, StopCondition sc)
-        : progressfn{std::move(pr)}, stopcond{std::move(sc)}
-    {}
-};
-
-template<class Placer = NfpPlacer,
-         class Selector = FirstFitSelection,
-         class Iterator = std::vector<Item>::iterator>
-std::size_t nest(Iterator from, Iterator to,
-                 const typename Placer::BinType & bin,
-                 Coord dist = 0,
-                 const NestConfig<Placer, Selector> &cfg = {},
-                 NestControl ctl = {})
-{
-    _Nester<Placer, Selector> nester{bin, dist, cfg.placer_config, cfg.selector_config};
-    if(ctl.progressfn) nester.progressIndicator(ctl.progressfn);
-    if(ctl.stopcond) nester.stopCondition(ctl.stopcond);
-    return nester.execute(from, to);
-}
-
-#ifdef LIBNEST2D_STATIC
-
-extern template class Nester<NfpPlacer, FirstFitSelection>;
-extern template class Nester<BottomLeftPlacer, FirstFitSelection>;
-extern template std::size_t nest(std::vector<Item>::iterator from,
-                                 std::vector<Item>::iterator from to,
-                                 const Box & bin,
-                                 Coord dist,
-                                 const NestConfig<NfpPlacer, FirstFitSelection> &cfg,
-                                 NestControl ctl);
-extern template std::size_t nest(std::vector<Item>::iterator from,
-                                 std::vector<Item>::iterator from to,
-                                 const Box & bin,
-                                 Coord dist,
-                                 const NestConfig<BottomLeftPlacer, FirstFitSelection> &cfg,
-                                 NestControl ctl);
-
-#endif
-
-template<class Placer = NfpPlacer,
-         class Selector = FirstFitSelection,
-         class Container = std::vector<Item>>
-std::size_t nest(Container&& cont,
-                 const typename Placer::BinType & bin,
-                 Coord dist = 0,
-                 const NestConfig<Placer, Selector> &cfg = {},
-                 NestControl ctl = {})
-{
-    return nest<Placer, Selector>(cont.begin(), cont.end(), bin, dist, cfg, ctl);
-}
-
-}
-
-#endif // LIBNEST2D_H

Некоторые файлы не были показаны из-за большого количества измененных файлов