diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 781dbd01a..fd8a27e86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ project(Slic3r) cmake_minimum_required(VERSION 3.2) include("version.inc") +include(GNUInstallDirs) + set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources") file(TO_NATIVE_PATH "${SLIC3R_RESOURCES_DIR}" SLIC3R_RESOURCES_DIR_WIN) @@ -22,7 +24,10 @@ endif() option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL}) option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1) +option(SLIC3R_FHS "Assume Slic3r is to be installed in a FHS directory structure" 0) +option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0) option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0) +option(SLIC3R_PCH "Use precompiled headers" 1) option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1) option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1) option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0) @@ -33,6 +38,15 @@ option(SLIC3R_SYNTAXONLY "Only perform source code correctness checking, option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF) option(SLIC3R_BUILD_TESTS "Build unit tests" OFF) +# Print out the SLIC3R_* cache options +get_cmake_property(_cache_vars CACHE_VARIABLES) +list (SORT _cache_vars) +foreach (_cache_var ${_cache_vars}) + if("${_cache_var}" MATCHES "^SLIC3R_") + message(STATUS "${_cache_var}: ${${_cache_var}}") + endif () +endforeach() + if (MSVC) if (SLIC3R_MSVC_COMPILE_PARALLEL) add_compile_options(/MP) @@ -42,7 +56,6 @@ if (MSVC) add_compile_options(-bigobj -Zm316) endif () - # Display and check CMAKE_PREFIX_PATH message(STATUS "SLIC3R_STATIC: ${SLIC3R_STATIC}") if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "") @@ -100,21 +113,26 @@ if(WIN32) endif() if (APPLE) - if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "OS X Deployment target (SDK version)" FORCE) + message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}") + if (CMAKE_OSX_DEPLOYMENT_TARGET) + message("OS X Deployment Target: ${CMAKE_OSX_DEPLOYMENT_TARGET}") + else () + message("OS X Deployment Target: (default)") endif () - message(STATUS "Mac OS deployment target (SDK version): ${CMAKE_OSX_DEPLOYMENT_TARGET}") endif () if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD. - add_compile_options(-std=c++11 -Wall -Wno-reorder) find_package(PkgConfig REQUIRED) + + if (CMAKE_VERSION VERSION_LESS "3.1") + # Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() endif() if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) # Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost. - add_compile_options(-fext-numeric-literals) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" ) if (SLIC3R_SYNTAXONLY) set(CMAKE_CXX_ARCHIVE_CREATE "true") @@ -131,9 +149,15 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) endif() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options(-Wall) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" ) + # On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error. add_compile_options(-Werror=return-type) + #removes LOTS of extraneous Eigen warnings + add_compile_options(-Wno-ignored-attributes) + if (SLIC3R_ASAN) add_compile_options(-fsanitize=address -fno-omit-frame-pointer) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") @@ -146,12 +170,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE endif() # Where all the bundled libraries reside? -set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/) +set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src) +set(LIBDIR_BIN ${CMAKE_CURRENT_BINARY_DIR}/src) # For the bundled boost libraries (boost::nowide) include_directories(${LIBDIR}) +# For generated header files +include_directories(${LIBDIR_BIN}/platform) # For libslic3r.h include_directories(${LIBDIR}/clipper ${LIBDIR}/polypartition) -#set(CMAKE_INCLUDE_CURRENT_DIR ON) if(WIN32) # BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking. @@ -215,7 +241,6 @@ endif() # The Intel TBB library will use the std::exception_ptr feature of C++11. add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0) -#set(CURL_DEBUG 1) find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIRS}) @@ -239,7 +264,7 @@ endif() # Find eigen3 or use bundled version if (NOT SLIC3R_STATIC) - find_package(Eigen3) + find_package(Eigen3 3) endif () if (NOT Eigen3_FOUND) set(Eigen3_FOUND 1) @@ -280,7 +305,6 @@ include_directories(${GLEW_INCLUDE_DIRS}) # l10n set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization") add_custom_target(pot - # FIXME: file list stale COMMAND xgettext --keyword=L --from-code=UTF-8 --debug -f "${L10N_DIR}/list.txt" -o "${L10N_DIR}/Slic3rPE.pot" @@ -307,5 +331,12 @@ if(SLIC3R_BUILD_TESTS) add_subdirectory(tests) endif() -file(GLOB MyVar var/*.png) -install(FILES ${MyVar} DESTINATION share/slic3r-prusa3d) + +# Resources install target, configure fhs.hpp on UNIX +if (WIN32) + install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources") +else () + set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/slic3r-prusa3d") + install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${SLIC3R_FHS_RESOURCES}") +endif () +configure_file(${LIBDIR}/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/platform/unix/fhs.hpp) |