Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « libnest2d « src « xs - github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 568d1a5a9133620ef34ad95b32213eed17f575af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
cmake_minimum_required(VERSION 2.8)

project(Libnest2D)

enable_testing()

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
  # Update if necessary
#  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
    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 ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/)

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

#set(LIBNEST2D_GEOMETRIES_TARGET "" CACHE STRING
#    "Build libnest2d with geometry classes implemented by the chosen target.")

#set(libnest2D_TEST_LIBRARIES "" CACHE STRING
#    "Libraries needed to compile the test executable for libnest2d.")


set(LIBNEST2D_SRCFILES
    libnest2d/libnest2d.hpp       # Templates only
    libnest2d.h         # Exports ready made types using template arguments
    libnest2d/geometry_traits.hpp
    libnest2d/geometries_io.hpp
    libnest2d/common.hpp
    libnest2d/placers/placer_boilerplate.hpp
    libnest2d/placers/bottomleftplacer.hpp
    libnest2d/placers/nfpplacer.hpp
    libnest2d/geometries_nfp.hpp
    libnest2d/selections/selection_boilerplate.hpp
    libnest2d/selections/filler.hpp
    libnest2d/selections/firstfit.hpp
    libnest2d/selections/djd_heuristic.hpp
    )

if((NOT LIBNEST2D_GEOMETRIES_TARGET) OR (LIBNEST2D_GEOMETRIES_TARGET STREQUAL ""))
    message(STATUS "libnest2D backend is default")

    if(NOT Boost_INCLUDE_DIRS_FOUND)
        find_package(Boost REQUIRED)
        # TODO automatic download of boost geometry headers
    endif()

    add_subdirectory(libnest2d/clipper_backend)

    set(LIBNEST2D_GEOMETRIES_TARGET ${CLIPPER_LIBRARIES})

    include_directories(BEFORE ${CLIPPER_INCLUDE_DIRS})
    include_directories(${Boost_INCLUDE_DIRS})

    list(APPEND LIBNEST2D_SRCFILES libnest2d/clipper_backend/clipper_backend.cpp
                                   libnest2d/clipper_backend/clipper_backend.hpp
                                   libnest2d/boost_alg.hpp)

else()
    message(STATUS "Libnest2D backend is: ${LIBNEST2D_GEOMETRIES_TARGET}")
endif()

add_library(libnest2d STATIC ${LIBNEST2D_SRCFILES} )
target_link_libraries(libnest2d ${LIBNEST2D_GEOMETRIES_TARGET})
target_include_directories(libnest2d PUBLIC ${CMAKE_SOURCE_DIR})

set(LIBNEST2D_HEADERS ${CMAKE_CURRENT_SOURCE_DIR})

get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
    set(LIBNEST2D_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
endif()

if(LIBNEST2D_UNITTESTS)
    add_subdirectory(tests)
endif()