From 96380180f4476c6376f20d1230547866ec6354d7 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 30 May 2019 17:48:32 +0200 Subject: [PATCH] Build system tweaks to get rid of cmake and boost warnings. --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 ++ src/admesh/CMakeLists.txt | 2 ++ src/boost/CMakeLists.txt | 4 +++ src/libnest2d/CMakeLists.txt | 4 ++- .../libnest2d/backends/clipper/CMakeLists.txt | 18 ++++++------- .../libnest2d/optimizers/nlopt/CMakeLists.txt | 26 +++++++++---------- src/libslic3r/CMakeLists.txt | 1 + src/miniz/CMakeLists.txt | 2 ++ 9 files changed, 37 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73805d0d8..719bdd04e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -241,7 +241,7 @@ if(NOT WIN32) endif() find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex) if(Boost_FOUND) - include_directories(${Boost_INCLUDE_DIRS}) +# include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) if (APPLE) # BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339 add_definitions(-DBOOST_ASIO_DISABLE_KQUEUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2745e4dd..4f6959623 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -142,6 +142,7 @@ if (MSVC) target_compile_definitions(PrusaSlicer_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE) add_dependencies(PrusaSlicer_app_gui PrusaSlicer) set_target_properties(PrusaSlicer_app_gui PROPERTIES OUTPUT_NAME "prusa-slicer") + target_include_directories(PrusaSlicer_app_gui SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) add_executable(PrusaSlicer_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc) # Generate debug symbols even in release mode. @@ -149,6 +150,7 @@ if (MSVC) target_compile_definitions(PrusaSlicer_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE) add_dependencies(PrusaSlicer_app_console PrusaSlicer) set_target_properties(PrusaSlicer_app_console PROPERTIES OUTPUT_NAME "prusa-slicer-console") + target_include_directories(PrusaSlicer_app_console SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) endif () # Link the resources dir to where Slic3r GUI expects it diff --git a/src/admesh/CMakeLists.txt b/src/admesh/CMakeLists.txt index 44c97c3f1..941a7eeb5 100644 --- a/src/admesh/CMakeLists.txt +++ b/src/admesh/CMakeLists.txt @@ -10,3 +10,5 @@ add_library(admesh STATIC stlinit.cpp util.cpp ) + +target_include_directories(admesh SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) diff --git a/src/boost/CMakeLists.txt b/src/boost/CMakeLists.txt index 2b23ec3b2..aae87340b 100644 --- a/src/boost/CMakeLists.txt +++ b/src/boost/CMakeLists.txt @@ -18,3 +18,7 @@ add_library(nowide STATIC nowide/utf8_codecvt.hpp nowide/windows.hpp ) + +target_include_directories(nowide SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) + + diff --git a/src/libnest2d/CMakeLists.txt b/src/libnest2d/CMakeLists.txt index 514498ee8..2508c984a 100644 --- a/src/libnest2d/CMakeLists.txt +++ b/src/libnest2d/CMakeLists.txt @@ -91,9 +91,11 @@ else() 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_sources(libnest2d INTERFACE ${LIBNEST2D_SRCFILES}) target_include_directories(libnest2d INTERFACE ${SRC_DIR}) if(NOT LIBNEST2D_HEADER_ONLY) diff --git a/src/libnest2d/include/libnest2d/backends/clipper/CMakeLists.txt b/src/libnest2d/include/libnest2d/backends/clipper/CMakeLists.txt index 462d1dd06..e20cbc70d 100644 --- a/src/libnest2d/include/libnest2d/backends/clipper/CMakeLists.txt +++ b/src/libnest2d/include/libnest2d/backends/clipper/CMakeLists.txt @@ -50,8 +50,8 @@ if(NOT TARGET clipper) # If there is a clipper target in the parent project we a else() # set(CLIPPER_INCLUDE_DIRS "" PARENT_SCOPE) # set(CLIPPER_LIBRARIES clipper PARENT_SCOPE) - add_library(ClipperBackend INTERFACE) - target_link_libraries(ClipperBackend INTERFACE clipper) + add_library(clipperBackend INTERFACE) + target_link_libraries(clipperBackend INTERFACE clipper) endif() # Clipper backend is not enough on its own, it still needs some functions @@ -61,14 +61,14 @@ if(NOT Boost_INCLUDE_DIRS_FOUND) # TODO automatic download of boost geometry headers endif() -target_include_directories(ClipperBackend INTERFACE ${Boost_INCLUDE_DIRS} ) -target_sources(ClipperBackend INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/geometries.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/clipper_polygon.hpp - ${SRC_DIR}/libnest2d/utils/boost_alg.hpp ) +target_include_directories(clipperBackend SYSTEM INTERFACE ${Boost_INCLUDE_DIRS} ) +#target_sources(ClipperBackend INTERFACE +# ${CMAKE_CURRENT_SOURCE_DIR}/geometries.hpp +# ${CMAKE_CURRENT_SOURCE_DIR}/clipper_polygon.hpp +# ${SRC_DIR}/libnest2d/utils/boost_alg.hpp ) -target_compile_definitions(ClipperBackend INTERFACE LIBNEST2D_BACKEND_CLIPPER) +target_compile_definitions(clipperBackend INTERFACE LIBNEST2D_BACKEND_CLIPPER) # And finally plug the ClipperBackend into libnest2d -target_link_libraries(libnest2d INTERFACE ClipperBackend) +#target_link_libraries(libnest2d INTERFACE ClipperBackend) diff --git a/src/libnest2d/include/libnest2d/optimizers/nlopt/CMakeLists.txt b/src/libnest2d/include/libnest2d/optimizers/nlopt/CMakeLists.txt index 5559ad645..4e16d4fc5 100644 --- a/src/libnest2d/include/libnest2d/optimizers/nlopt/CMakeLists.txt +++ b/src/libnest2d/include/libnest2d/optimizers/nlopt/CMakeLists.txt @@ -39,23 +39,23 @@ if(NOT NLopt_FOUND) set(NLopt_INCLUDE_DIR ${nlopt_BINARY_DIR} ${nlopt_BINARY_DIR}/src/api) set(SHARED_LIBS_STATE ${SHARED_STATE}) - add_library(NloptOptimizer INTERFACE) - target_link_libraries(NloptOptimizer INTERFACE nlopt) - target_include_directories(NloptOptimizer INTERFACE ${NLopt_INCLUDE_DIR}) + add_library(nloptOptimizer INTERFACE) + target_link_libraries(nloptOptimizer INTERFACE nlopt) + target_include_directories(nloptOptimizer INTERFACE ${NLopt_INCLUDE_DIR}) else() - add_library(NloptOptimizer INTERFACE) - target_link_libraries(NloptOptimizer INTERFACE Nlopt::Nlopt) + add_library(nloptOptimizer INTERFACE) + target_link_libraries(nloptOptimizer INTERFACE Nlopt::Nlopt) endif() -target_sources( NloptOptimizer INTERFACE -${CMAKE_CURRENT_SOURCE_DIR}/simplex.hpp -${CMAKE_CURRENT_SOURCE_DIR}/subplex.hpp -${CMAKE_CURRENT_SOURCE_DIR}/genetic.hpp -${CMAKE_CURRENT_SOURCE_DIR}/nlopt_boilerplate.hpp -) +#target_sources( NloptOptimizer INTERFACE +#${CMAKE_CURRENT_SOURCE_DIR}/simplex.hpp +#${CMAKE_CURRENT_SOURCE_DIR}/subplex.hpp +#${CMAKE_CURRENT_SOURCE_DIR}/genetic.hpp +#${CMAKE_CURRENT_SOURCE_DIR}/nlopt_boilerplate.hpp +#) -target_compile_definitions(NloptOptimizer INTERFACE LIBNEST2D_OPTIMIZER_NLOPT) +target_compile_definitions(nloptOptimizer INTERFACE LIBNEST2D_OPTIMIZER_NLOPT) # And finally plug the NloptOptimizer into libnest2d -target_link_libraries(libnest2d INTERFACE NloptOptimizer) +#target_link_libraries(libnest2d INTERFACE NloptOptimizer) diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index ce93d95fa..6a4fe3c28 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -180,6 +180,7 @@ if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY) endif () target_compile_definitions(libslic3r PUBLIC -DUSE_TBB) +target_include_directories(libslic3r SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBNEST2D_INCLUDES} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(libslic3r libnest2d diff --git a/src/miniz/CMakeLists.txt b/src/miniz/CMakeLists.txt index da92b1252..ce611f136 100644 --- a/src/miniz/CMakeLists.txt +++ b/src/miniz/CMakeLists.txt @@ -12,3 +12,5 @@ add_library(miniz STATIC miniz_tinfl.cpp miniz_zip.cpp ) + +target_link_libraries(miniz nowide)