2020-10-05 09:44:50 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2019-05-13 13:14:33 +00:00
|
|
|
project(PrusaSlicer)
|
2017-08-16 17:05:08 +00:00
|
|
|
|
2018-09-24 09:53:05 +00:00
|
|
|
include("version.inc")
|
2019-01-04 11:06:25 +00:00
|
|
|
include(GNUInstallDirs)
|
2021-08-19 08:15:42 +00:00
|
|
|
include(CMakeDependentOption)
|
2019-01-04 11:06:25 +00:00
|
|
|
|
2018-09-24 09:53:05 +00:00
|
|
|
set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
2018-10-11 13:19:53 +00:00
|
|
|
file(TO_NATIVE_PATH "${SLIC3R_RESOURCES_DIR}" SLIC3R_RESOURCES_DIR_WIN)
|
2018-09-24 09:53:05 +00:00
|
|
|
|
2017-08-18 21:18:27 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
message(STATUS "No build type selected, default to Release")
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
|
|
|
|
endif()
|
|
|
|
|
2017-08-28 21:11:43 +00:00
|
|
|
if(DEFINED ENV{SLIC3R_STATIC})
|
2019-08-16 14:17:37 +00:00
|
|
|
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
|
2017-08-28 21:11:43 +00:00
|
|
|
else()
|
2019-08-16 14:17:37 +00:00
|
|
|
if (MSVC OR MINGW OR APPLE)
|
|
|
|
set(SLIC3R_STATIC_INITIAL 1)
|
|
|
|
else()
|
|
|
|
set(SLIC3R_STATIC_INITIAL 0)
|
|
|
|
endif()
|
2017-08-28 21:11:43 +00:00
|
|
|
endif()
|
2017-08-16 17:05:08 +00:00
|
|
|
|
2019-05-13 13:14:33 +00:00
|
|
|
option(SLIC3R_STATIC "Compile PrusaSlicer with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
|
|
|
|
option(SLIC3R_GUI "Compile PrusaSlicer with GUI components (OpenGL, wxWidgets)" 1)
|
|
|
|
option(SLIC3R_FHS "Assume PrusaSlicer is to be installed in a FHS directory structure" 0)
|
2019-01-07 18:17:10 +00:00
|
|
|
option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0)
|
2019-01-11 11:24:25 +00:00
|
|
|
option(SLIC3R_PCH "Use precompiled headers" 1)
|
2017-08-16 17:05:08 +00:00
|
|
|
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
2018-08-17 10:38:33 +00:00
|
|
|
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
|
2018-10-22 12:53:48 +00:00
|
|
|
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
|
2018-11-07 14:23:00 +00:00
|
|
|
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
|
2023-03-31 14:49:26 +00:00
|
|
|
option(SLIC3R_UBSAN "Enable UBSan on Clang and GCC" 0)
|
2022-07-27 11:39:38 +00:00
|
|
|
option(SLIC3R_ENABLE_FORMAT_STEP "Enable compilation of STEP file support" 1)
|
2021-08-19 08:15:42 +00:00
|
|
|
# If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable.
|
2021-08-23 08:16:26 +00:00
|
|
|
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
|
2017-08-16 17:05:08 +00:00
|
|
|
|
2021-07-14 14:26:44 +00:00
|
|
|
set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
|
|
|
|
|
2019-03-25 14:50:07 +00:00
|
|
|
set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
|
|
|
|
|
2021-02-02 17:08:30 +00:00
|
|
|
set(IS_CROSS_COMPILE FALSE)
|
|
|
|
|
2023-03-31 14:49:26 +00:00
|
|
|
if (SLIC3R_STATIC)
|
|
|
|
# Prefer config scripts over find modules. This is helpful when building with
|
|
|
|
# the static dependencies. Many libraries have their own export scripts
|
|
|
|
# while having a Find<PkgName> module in standard cmake installation.
|
|
|
|
# (e.g. CURL)
|
|
|
|
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
|
|
|
endif ()
|
|
|
|
|
2020-08-03 13:50:05 +00:00
|
|
|
if (APPLE)
|
|
|
|
set(CMAKE_FIND_FRAMEWORK LAST)
|
|
|
|
set(CMAKE_FIND_APPBUNDLE LAST)
|
2021-02-02 17:08:30 +00:00
|
|
|
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
|
|
|
|
if (CMAKE_OSX_ARCHITECTURES AND _arch_idx LESS 0)
|
|
|
|
set(IS_CROSS_COMPILE TRUE)
|
|
|
|
endif ()
|
2020-08-03 13:50:05 +00:00
|
|
|
endif ()
|
|
|
|
|
2018-11-02 10:57:57 +00:00
|
|
|
# Proposal for C++ unit tests and sandboxes
|
|
|
|
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
|
2019-09-24 08:48:24 +00:00
|
|
|
option(SLIC3R_BUILD_TESTS "Build unit tests" ON)
|
2018-11-02 10:57:57 +00:00
|
|
|
|
2021-02-02 17:08:30 +00:00
|
|
|
if (IS_CROSS_COMPILE)
|
|
|
|
message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!")
|
|
|
|
set(SLIC3R_PERL_XS OFF CACHE BOOL "" FORCE)
|
|
|
|
set(SLIC3R_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
|
endif ()
|
|
|
|
|
2019-01-11 11:24:25 +00:00
|
|
|
# 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()
|
|
|
|
|
2019-04-12 10:16:44 +00:00
|
|
|
if (SLIC3R_GUI)
|
|
|
|
add_definitions(-DSLIC3R_GUI)
|
|
|
|
endif ()
|
|
|
|
|
2021-08-19 08:15:42 +00:00
|
|
|
if(SLIC3R_DESKTOP_INTEGRATION)
|
|
|
|
add_definitions(-DSLIC3R_DESKTOP_INTEGRATION)
|
|
|
|
endif ()
|
|
|
|
|
2019-08-01 14:03:52 +00:00
|
|
|
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
|
|
|
set(IS_CLANG_CL TRUE)
|
2019-08-16 14:17:37 +00:00
|
|
|
|
|
|
|
# clang-cl can interpret SYSTEM header paths if -imsvc is used
|
|
|
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-imsvc")
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
|
|
|
|
-Wno-old-style-cast -Wno-reserved-id-macro -Wno-c++98-compat-pedantic")
|
2019-08-01 14:03:52 +00:00
|
|
|
else ()
|
|
|
|
set(IS_CLANG_CL FALSE)
|
|
|
|
endif ()
|
|
|
|
|
2018-10-26 16:08:43 +00:00
|
|
|
if (MSVC)
|
2019-08-01 14:03:52 +00:00
|
|
|
if (SLIC3R_MSVC_COMPILE_PARALLEL AND NOT IS_CLANG_CL)
|
2019-08-16 14:17:37 +00:00
|
|
|
add_compile_options(/MP)
|
2018-10-26 16:08:43 +00:00
|
|
|
endif ()
|
|
|
|
# /bigobj (Increase Number of Sections in .Obj file)
|
2018-10-29 15:01:26 +00:00
|
|
|
# error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
|
2019-05-13 17:31:20 +00:00
|
|
|
# Generate symbols at every build target, even for the release.
|
2019-06-04 20:06:42 +00:00
|
|
|
add_compile_options(-bigobj -Zm520 /Zi)
|
2020-01-13 14:57:31 +00:00
|
|
|
# Disable STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17.
|
|
|
|
#FIXME Remove this line after eigen library adapts to the new C++17 adaptor rules.
|
|
|
|
add_compile_options(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
|
2021-02-10 16:28:56 +00:00
|
|
|
# Disable warnings on conversion from unsigned to signed (possible loss of data)
|
|
|
|
# C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data. An integer type is converted to a smaller integer type.
|
|
|
|
# C4267: The compiler detected a conversion from size_t to a smaller type.
|
|
|
|
add_compile_options(/wd4244 /wd4267)
|
2023-03-31 14:49:26 +00:00
|
|
|
# Enforce strict C++ conformance, so our code that compiles on MSVC also compiles on GCC and clang.
|
|
|
|
add_compile_options(/permissive-)
|
2017-08-16 17:05:08 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-08-16 14:17:37 +00:00
|
|
|
if (MINGW)
|
|
|
|
add_compile_options(-Wa,-mbig-obj)
|
|
|
|
endif ()
|
|
|
|
|
2021-02-11 08:58:04 +00:00
|
|
|
if (NOT MSVC)
|
2021-02-11 17:02:01 +00:00
|
|
|
# ARMs (Raspberry PI) use an unsigned char by default. Let's make it consistent for PrusaSlicer on all platforms.
|
2021-02-11 08:58:04 +00:00
|
|
|
add_compile_options(-fsigned-char)
|
|
|
|
endif ()
|
|
|
|
|
2019-01-02 12:38:02 +00:00
|
|
|
# Display and check CMAKE_PREFIX_PATH
|
|
|
|
message(STATUS "SLIC3R_STATIC: ${SLIC3R_STATIC}")
|
|
|
|
if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
|
|
|
|
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (from cache or command line)")
|
|
|
|
set(PREFIX_PATH_CHECK ${CMAKE_PREFIX_PATH})
|
|
|
|
elseif (NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
|
|
|
|
message(STATUS "CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH} (from environment)")
|
|
|
|
set(PREFIX_PATH_CHECK $ENV{CMAKE_PREFIX_PATH})
|
|
|
|
else ()
|
|
|
|
message(STATUS "CMAKE_PREFIX_PATH: (default)")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
foreach (DIR ${PREFIX_PATH_CHECK})
|
|
|
|
if (NOT EXISTS "${DIR}")
|
|
|
|
message(WARNING "CMAKE_PREFIX_PATH element doesn't exist: ${DIR}")
|
|
|
|
endif ()
|
|
|
|
endforeach ()
|
2018-02-23 15:48:11 +00:00
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
# Add our own cmake module path.
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
|
|
|
|
|
2018-05-17 08:37:26 +00:00
|
|
|
enable_testing ()
|
|
|
|
|
2019-12-20 09:33:53 +00:00
|
|
|
# Enable C++17 language standard.
|
2019-12-18 10:53:28 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2018-09-19 09:02:24 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2019-01-29 08:57:17 +00:00
|
|
|
if(NOT WIN32)
|
2019-01-30 14:27:11 +00:00
|
|
|
# Add DEBUG flags to debug builds.
|
2019-01-29 08:57:17 +00:00
|
|
|
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
|
|
|
|
endif()
|
|
|
|
|
2018-09-21 18:11:33 +00:00
|
|
|
# To be able to link libslic3r with the Perl XS module.
|
|
|
|
# Once we get rid of Perl and libslic3r is linked statically, we can get rid of -fPIC
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
|
2018-06-04 19:22:42 +00:00
|
|
|
# WIN10SDK_PATH is used to point CMake to the WIN10 SDK installation directory.
|
|
|
|
# We pick it from environment if it is not defined in another way
|
|
|
|
if(WIN32)
|
2021-03-08 08:38:14 +00:00
|
|
|
if(NOT DEFINED WIN10SDK_PATH)
|
|
|
|
if(DEFINED ENV{WIN10SDK_PATH})
|
|
|
|
set(WIN10SDK_PATH "$ENV{WIN10SDK_PATH}")
|
2019-08-16 14:17:37 +00:00
|
|
|
endif()
|
2021-03-08 08:38:14 +00:00
|
|
|
endif()
|
|
|
|
if(DEFINED WIN10SDK_PATH)
|
|
|
|
if (EXISTS "${WIN10SDK_PATH}/include/winrt/windows.graphics.printing3d.h")
|
|
|
|
set(WIN10SDK_INCLUDE_PATH "${WIN10SDK_PATH}/Include")
|
|
|
|
else()
|
|
|
|
message("WIN10SDK_PATH is invalid: ${WIN10SDK_PATH}")
|
|
|
|
message("${WIN10SDK_PATH}/include/winrt/windows.graphics.printing3d.h was not found")
|
|
|
|
message("STL fixing by the Netfabb service will not be compiled")
|
|
|
|
unset(WIN10SDK_PATH)
|
2019-08-16 14:17:37 +00:00
|
|
|
endif()
|
2021-03-08 08:38:14 +00:00
|
|
|
else()
|
|
|
|
# Try to use the default Windows 10 SDK path.
|
|
|
|
set(WIN10SDK_INCLUDE_PATH "$ENV{WindowsSdkDir}/Include/$ENV{WindowsSDKVersion}")
|
|
|
|
if (NOT EXISTS "${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h")
|
|
|
|
message("${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h was not found")
|
|
|
|
message("STL fixing by the Netfabb service will not be compiled")
|
|
|
|
unset(WIN10SDK_INCLUDE_PATH)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(WIN10SDK_INCLUDE_PATH)
|
2018-11-07 12:40:24 +00:00
|
|
|
message("Building with Win10 Netfabb STL fixing service support")
|
|
|
|
add_definitions(-DHAS_WIN10SDK)
|
2021-03-08 08:38:14 +00:00
|
|
|
include_directories("${WIN10SDK_INCLUDE_PATH}")
|
2018-11-07 12:40:24 +00:00
|
|
|
else()
|
|
|
|
message("Building without Win10 Netfabb STL fixing service support")
|
|
|
|
endif()
|
2018-06-04 19:22:42 +00:00
|
|
|
endif()
|
|
|
|
|
2018-12-13 17:51:08 +00:00
|
|
|
if (APPLE)
|
2019-01-11 16:05:57 +00:00
|
|
|
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)")
|
2018-12-13 17:51:08 +00:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
find_package(PkgConfig REQUIRED)
|
2019-01-06 23:25:38 +00:00
|
|
|
|
|
|
|
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()
|
2019-04-23 09:02:57 +00:00
|
|
|
|
|
|
|
# Boost on Raspberry-Pi does not link to pthreads.
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Threads REQUIRED)
|
2020-04-29 08:50:28 +00:00
|
|
|
|
|
|
|
find_package(DBus REQUIRED)
|
|
|
|
include_directories(${DBUS_INCLUDE_DIRS})
|
2018-09-19 09:02:24 +00:00
|
|
|
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.
|
2019-01-06 23:25:38 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
|
2018-09-19 09:02:24 +00:00
|
|
|
endif()
|
|
|
|
|
2019-08-01 14:03:52 +00:00
|
|
|
if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
|
2019-08-16 14:17:37 +00:00
|
|
|
if (NOT MINGW)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
|
|
|
endif ()
|
2019-01-06 23:25:38 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" )
|
|
|
|
|
2018-09-19 09:27:04 +00:00
|
|
|
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
2018-10-29 16:04:27 +00:00
|
|
|
add_compile_options(-Werror=return-type)
|
2018-11-07 14:23:00 +00:00
|
|
|
|
2019-10-17 07:56:38 +00:00
|
|
|
# removes LOTS of extraneous Eigen warnings (GCC only supports it since 6.1)
|
|
|
|
# https://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
|
|
|
add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
|
|
|
|
endif()
|
2019-06-25 11:03:10 +00:00
|
|
|
|
2021-02-08 16:50:29 +00:00
|
|
|
# Clang reports legacy OpenGL calls as deprecated. Turn off the warning for now
|
|
|
|
# to reduce the clutter, we know about this one. It should be reenabled after
|
|
|
|
# we finally get rid of the deprecated code.
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
|
|
add_compile_options(-Wno-deprecated-declarations)
|
|
|
|
endif()
|
|
|
|
|
2023-03-31 14:49:26 +00:00
|
|
|
# Clang reports misleading indentation for some IF blocks because of mixing tabs with spaces.
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
|
|
add_compile_options(-Wno-misleading-indentation)
|
|
|
|
endif()
|
|
|
|
|
2019-06-25 11:03:10 +00:00
|
|
|
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
|
|
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
|
|
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
|
|
|
|
# We will turn the warning of for GCC for now:
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
add_compile_options(-Wno-unknown-pragmas)
|
|
|
|
endif()
|
|
|
|
|
2021-03-25 09:11:54 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (SLIC3R_ASAN)
|
|
|
|
# ASAN should be available on MSVC starting with Visual Studio 2019 16.9
|
|
|
|
# https://devblogs.microsoft.com/cppblog/address-sanitizer-for-msvc-now-generally-available/
|
2021-06-01 09:12:14 +00:00
|
|
|
add_compile_options(-fsanitize=address)
|
2021-03-25 09:11:54 +00:00
|
|
|
|
|
|
|
if (NOT MSVC)
|
2021-06-01 09:12:14 +00:00
|
|
|
add_compile_options(-fno-omit-frame-pointer)
|
2018-11-26 18:02:30 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
|
2019-10-14 14:30:07 +00:00
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
|
2021-03-25 09:11:54 +00:00
|
|
|
endif ()
|
2018-11-26 18:02:30 +00:00
|
|
|
|
2021-03-25 09:11:54 +00:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
|
2018-11-07 14:23:00 +00:00
|
|
|
endif ()
|
2021-03-25 09:11:54 +00:00
|
|
|
endif ()
|
2018-09-19 09:27:04 +00:00
|
|
|
|
2023-03-31 14:49:26 +00:00
|
|
|
if (SLIC3R_UBSAN)
|
|
|
|
# Stacktrace for every report is enabled by default. It can be disabled by running PrusaSlicer with "UBSAN_OPTIONS=print_stacktrace=0".
|
|
|
|
|
|
|
|
# Define macro SLIC3R_UBSAN to allow detection in the source code if this sanitizer is enabled.
|
|
|
|
add_compile_definitions(SLIC3R_UBSAN)
|
|
|
|
|
|
|
|
# Clang supports much more useful checks than GCC, so when Clang is detected, another checks will be enabled.
|
|
|
|
# List of what GCC is checking: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
|
|
|
|
# List of what Clang is checking: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set(_ubsan_flags "-fsanitize=undefined,integer")
|
|
|
|
else ()
|
|
|
|
set(_ubsan_flags "-fsanitize=undefined")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
add_compile_options(${_ubsan_flags} -fno-omit-frame-pointer)
|
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_ubsan_flags}")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_ubsan_flags}")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${_ubsan_flags}")
|
|
|
|
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lubsan")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
2019-01-24 10:30:29 +00:00
|
|
|
if (APPLE)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
|
|
|
|
endif ()
|
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
# Where all the bundled libraries reside?
|
2019-01-04 11:06:25 +00:00
|
|
|
set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
|
|
set(LIBDIR_BIN ${CMAKE_CURRENT_BINARY_DIR}/src)
|
2018-09-19 09:02:24 +00:00
|
|
|
# For the bundled boost libraries (boost::nowide)
|
|
|
|
include_directories(${LIBDIR})
|
2019-01-04 11:06:25 +00:00
|
|
|
# For generated header files
|
|
|
|
include_directories(${LIBDIR_BIN}/platform)
|
2018-09-19 09:02:24 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
2019-08-16 14:17:37 +00:00
|
|
|
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
|
|
|
if(MSVC)
|
|
|
|
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
|
2020-12-01 10:59:03 +00:00
|
|
|
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -DBOOST_SYSTEM_USE_UTF8 )
|
2021-02-10 10:04:46 +00:00
|
|
|
# Force the source code encoding to UTF-8. See PrusaSlicer GH pull request #5583
|
|
|
|
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
|
|
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
2019-08-16 14:17:37 +00:00
|
|
|
endif(MSVC)
|
|
|
|
endif(WIN32)
|
2018-09-19 09:02:24 +00:00
|
|
|
|
|
|
|
add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
|
|
|
|
|
2020-02-27 16:01:50 +00:00
|
|
|
# Disable unsafe implicit wxString to const char* / std::string and vice versa. This implicit conversion breaks the UTF-8 encoding quite often.
|
|
|
|
add_definitions(-DwxNO_UNSAFE_WXSTRING_CONV)
|
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
# Find and configure boost
|
|
|
|
if(SLIC3R_STATIC)
|
|
|
|
# Use static boost libraries.
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
# Use boost libraries linked statically to the C++ runtime.
|
|
|
|
# set(Boost_USE_STATIC_RUNTIME ON)
|
|
|
|
endif()
|
|
|
|
#set(Boost_DEBUG ON)
|
2019-08-16 14:17:37 +00:00
|
|
|
# set(Boost_COMPILER "-mgw81")
|
2021-02-10 15:02:32 +00:00
|
|
|
# boost::process was introduced first in version 1.64.0,
|
|
|
|
# boost::beast::detail::base64 was introduced first in version 1.66.0
|
|
|
|
set(MINIMUM_BOOST_VERSION "1.66.0")
|
2021-03-08 07:35:32 +00:00
|
|
|
set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time;iostreams")
|
2019-10-22 14:32:21 +00:00
|
|
|
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components})
|
2019-06-13 11:15:10 +00:00
|
|
|
|
|
|
|
add_library(boost_libs INTERFACE)
|
|
|
|
add_library(boost_headeronly INTERFACE)
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
# BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
|
|
|
|
target_compile_definitions(boost_headeronly INTERFACE BOOST_ASIO_DISABLE_KQUEUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT SLIC3R_STATIC)
|
|
|
|
target_compile_definitions(boost_headeronly INTERFACE BOOST_LOG_DYN_LINK)
|
|
|
|
endif()
|
|
|
|
|
2019-10-22 14:32:21 +00:00
|
|
|
function(slic3r_remap_configs targets from_Cfg to_Cfg)
|
2019-10-24 15:32:05 +00:00
|
|
|
if(MSVC)
|
|
|
|
string(TOUPPER ${from_Cfg} from_CFG)
|
|
|
|
|
|
|
|
foreach(tgt ${targets})
|
|
|
|
if(TARGET ${tgt})
|
|
|
|
set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2019-10-22 14:32:21 +00:00
|
|
|
endfunction()
|
|
|
|
|
2019-06-13 11:15:10 +00:00
|
|
|
if(TARGET Boost::system)
|
|
|
|
message(STATUS "Boost::boost exists")
|
|
|
|
target_link_libraries(boost_headeronly INTERFACE Boost::boost)
|
2019-10-23 14:24:59 +00:00
|
|
|
|
|
|
|
# Only from cmake 3.12
|
|
|
|
# list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets)
|
|
|
|
set(_boost_targets "")
|
|
|
|
foreach(comp ${_boost_components})
|
|
|
|
list(APPEND _boost_targets "Boost::${comp}")
|
|
|
|
endforeach()
|
|
|
|
|
2019-08-16 14:17:37 +00:00
|
|
|
target_link_libraries(boost_libs INTERFACE
|
2019-06-13 11:15:10 +00:00
|
|
|
boost_headeronly # includes the custom compile definitions as well
|
2019-10-22 14:32:21 +00:00
|
|
|
${_boost_targets}
|
2019-06-13 11:15:10 +00:00
|
|
|
)
|
2019-10-22 14:32:21 +00:00
|
|
|
slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release)
|
2019-06-13 11:15:10 +00:00
|
|
|
else()
|
|
|
|
target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
|
2018-09-19 09:02:24 +00:00
|
|
|
endif()
|
|
|
|
|
2019-10-22 14:32:21 +00:00
|
|
|
|
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
# Find and configure intel-tbb
|
|
|
|
if(SLIC3R_STATIC)
|
|
|
|
set(TBB_STATIC 1)
|
|
|
|
endif()
|
|
|
|
set(TBB_DEBUG 1)
|
|
|
|
find_package(TBB REQUIRED)
|
2023-03-31 14:49:26 +00:00
|
|
|
slic3r_remap_configs(TBB::tbb RelWithDebInfo Release)
|
2019-10-14 10:50:08 +00:00
|
|
|
# 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()
|
2018-09-19 09:02:24 +00:00
|
|
|
# The Intel TBB library will use the std::exception_ptr feature of C++11.
|
2019-10-14 10:50:08 +00:00
|
|
|
# add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
|
2018-09-19 09:02:24 +00:00
|
|
|
|
|
|
|
find_package(CURL REQUIRED)
|
2020-03-06 14:16:46 +00:00
|
|
|
|
|
|
|
add_library(libcurl INTERFACE)
|
|
|
|
target_link_libraries(libcurl INTERFACE CURL::libcurl)
|
|
|
|
|
2021-07-22 10:38:50 +00:00
|
|
|
# Fixing curl's cmake config script bugs
|
2020-03-06 14:16:46 +00:00
|
|
|
if (NOT WIN32)
|
|
|
|
# Required by libcurl
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
target_link_libraries(libcurl INTERFACE ZLIB::ZLIB)
|
2021-07-22 10:38:50 +00:00
|
|
|
else()
|
|
|
|
target_link_libraries(libcurl INTERFACE crypt32)
|
2020-03-06 14:16:46 +00:00
|
|
|
endif()
|
2018-09-19 09:02:24 +00:00
|
|
|
|
|
|
|
## OPTIONAL packages
|
|
|
|
|
|
|
|
# Find eigen3 or use bundled version
|
|
|
|
if (NOT SLIC3R_STATIC)
|
2019-07-13 15:56:43 +00:00
|
|
|
find_package(Eigen3 3.3)
|
2018-09-19 09:02:24 +00:00
|
|
|
endif ()
|
2019-07-13 15:56:43 +00:00
|
|
|
if (NOT EIGEN3_FOUND)
|
|
|
|
set(EIGEN3_FOUND 1)
|
2018-09-19 09:02:24 +00:00
|
|
|
set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/)
|
|
|
|
endif ()
|
2019-06-19 12:52:55 +00:00
|
|
|
include_directories(BEFORE SYSTEM ${EIGEN3_INCLUDE_DIR})
|
2018-09-19 09:02:24 +00:00
|
|
|
|
2022-05-23 08:55:23 +00:00
|
|
|
# Find expat. We have our overriden FindEXPAT which exports libexpat target
|
|
|
|
# no matter what.
|
2022-01-19 09:46:12 +00:00
|
|
|
find_package(EXPAT REQUIRED)
|
2020-04-28 07:56:54 +00:00
|
|
|
|
2023-03-31 14:49:26 +00:00
|
|
|
add_library(libexpat INTERFACE)
|
|
|
|
|
|
|
|
if (TARGET EXPAT::EXPAT )
|
|
|
|
target_link_libraries(libexpat INTERFACE EXPAT::EXPAT)
|
|
|
|
elseif(TARGET expat::expat)
|
|
|
|
target_link_libraries(libexpat INTERFACE expat::expat)
|
|
|
|
endif ()
|
|
|
|
|
2020-04-29 14:26:39 +00:00
|
|
|
find_package(PNG REQUIRED)
|
2018-09-19 09:02:24 +00:00
|
|
|
|
2020-10-23 14:28:14 +00:00
|
|
|
set(OpenGL_GL_PREFERENCE "LEGACY")
|
2019-12-11 11:24:21 +00:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
# Find glew or use bundled version
|
2021-08-19 14:56:22 +00:00
|
|
|
if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_GLEW)
|
2019-12-11 11:24:21 +00:00
|
|
|
set(GLEW_USE_STATIC_LIBS ON)
|
|
|
|
set(GLEW_VERBOSE ON)
|
|
|
|
endif()
|
|
|
|
|
2023-03-31 14:49:26 +00:00
|
|
|
find_package(GLEW REQUIRED)
|
2018-09-19 09:02:24 +00:00
|
|
|
|
2019-06-26 11:26:49 +00:00
|
|
|
# Find the Cereal serialization library
|
2020-02-07 10:07:22 +00:00
|
|
|
find_package(cereal REQUIRED)
|
2023-03-31 14:49:26 +00:00
|
|
|
add_library(libcereal INTERFACE)
|
|
|
|
if (NOT TARGET cereal::cereal)
|
|
|
|
target_link_libraries(libcereal INTERFACE cereal)
|
|
|
|
else()
|
|
|
|
target_link_libraries(libcereal INTERFACE cereal::cereal)
|
|
|
|
endif()
|
2019-06-26 11:26:49 +00:00
|
|
|
|
2018-10-12 12:19:08 +00:00
|
|
|
# l10n
|
2018-10-11 13:19:53 +00:00
|
|
|
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
|
2019-12-22 10:54:23 +00:00
|
|
|
add_custom_target(gettext_make_pot
|
2021-12-03 15:18:21 +00:00
|
|
|
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --debug --boost
|
2018-10-11 13:19:53 +00:00
|
|
|
-f "${L10N_DIR}/list.txt"
|
2019-05-13 10:13:28 +00:00
|
|
|
-o "${L10N_DIR}/PrusaSlicer.pot"
|
2021-08-23 14:26:47 +00:00
|
|
|
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${L10N_DIR}
|
2018-10-11 13:19:53 +00:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
COMMENT "Generate pot file from strings in the source tree"
|
|
|
|
)
|
2022-02-09 11:52:50 +00:00
|
|
|
|
|
|
|
add_custom_target(gettext_merge_community_po_with_pot
|
2021-12-03 15:18:21 +00:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2022-02-09 11:52:50 +00:00
|
|
|
COMMENT "Merge community po with new generated pot file"
|
2021-12-03 15:18:21 +00:00
|
|
|
)
|
|
|
|
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/PrusaSlicer*.po")
|
2022-02-09 11:52:50 +00:00
|
|
|
# list of names of directories, which are licalized by PS internally
|
|
|
|
list(APPEND PS_L10N_DIRS "cs" "de" "es" "fr" "it" "ja" "pl")
|
2021-12-03 15:18:21 +00:00
|
|
|
foreach(po_file ${L10N_PO_FILES})
|
2022-02-09 11:52:50 +00:00
|
|
|
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
|
|
|
GET_FILENAME_COMPONENT(po_dir_name "${po_dir}" NAME)
|
|
|
|
list(FIND PS_L10N_DIRS ${po_dir_name} found_dir_id)
|
|
|
|
# found_dir_id==-1 means that po_dir_name wasn't found in PS_L10N_DIRS
|
|
|
|
if(found_dir_id LESS 0)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET gettext_merge_community_po_with_pot PRE_BUILD
|
|
|
|
COMMAND msgmerge -N -o ${po_file} ${po_file} "${L10N_DIR}/PrusaSlicer.pot"
|
|
|
|
# delete obsolete lines from resulting PO to avoid conflicts after a merging of it with wxWidgets.po
|
|
|
|
COMMAND msgattrib --no-obsolete -o ${po_file} ${po_file}
|
|
|
|
DEPENDS ${po_file}
|
|
|
|
)
|
|
|
|
endif()
|
2021-12-03 15:18:21 +00:00
|
|
|
endforeach()
|
2021-12-21 12:27:31 +00:00
|
|
|
|
|
|
|
add_custom_target(gettext_concat_wx_po_with_po
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
COMMENT "Concatenate and merge wxWidgets localization po with PrusaSlicer po file"
|
|
|
|
)
|
|
|
|
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/PrusaSlicer*.po")
|
|
|
|
foreach(po_file ${L10N_PO_FILES})
|
|
|
|
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
|
|
|
GET_FILENAME_COMPONENT(po_dir_name "${po_dir}" NAME)
|
|
|
|
SET(wx_po_file "${L10N_DIR}/wx_locale/${po_dir_name}.po")
|
|
|
|
#SET(po_new_file "${po_dir}/PrusaSlicer_.po")
|
|
|
|
add_custom_command(
|
|
|
|
TARGET gettext_concat_wx_po_with_po PRE_BUILD
|
Localization: Added missed phrases -> Updated POT and dictionaries for CZ, PL, IT, ES, DE, FR
+ Command to remove obsolite lines is added to gettext_concat_wx_po_with_po and gettext_merge_po_with_pot scripts
+ POs for CA, KR, NL, BR, RU, TR, UK, ZH are merged with new POT
+ Updated all MO files
2022-01-21 11:34:14 +00:00
|
|
|
COMMAND msgcat --use-first -o ${po_file} ${po_file} ${wx_po_file}
|
2022-01-27 14:59:25 +00:00
|
|
|
# delete obsolete lines from resulting PO
|
Localization: Added missed phrases -> Updated POT and dictionaries for CZ, PL, IT, ES, DE, FR
+ Command to remove obsolite lines is added to gettext_concat_wx_po_with_po and gettext_merge_po_with_pot scripts
+ POs for CA, KR, NL, BR, RU, TR, UK, ZH are merged with new POT
+ Updated all MO files
2022-01-21 11:34:14 +00:00
|
|
|
COMMAND msgattrib --no-obsolete -o ${po_file} ${po_file}
|
2021-12-21 12:27:31 +00:00
|
|
|
DEPENDS ${po_file}
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
2019-12-22 10:54:23 +00:00
|
|
|
add_custom_target(gettext_po_to_mo
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2022-01-10 07:43:15 +00:00
|
|
|
COMMENT "Generate localization mo files (binary) from po files (texts)"
|
2019-12-22 10:54:23 +00:00
|
|
|
)
|
|
|
|
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/PrusaSlicer*.po")
|
|
|
|
foreach(po_file ${L10N_PO_FILES})
|
|
|
|
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
|
|
|
SET(mo_file "${po_dir}/PrusaSlicer.mo")
|
|
|
|
add_custom_command(
|
|
|
|
TARGET gettext_po_to_mo PRE_BUILD
|
2021-12-03 15:18:21 +00:00
|
|
|
COMMAND msgfmt ARGS --check-format -o ${mo_file} ${po_file}
|
|
|
|
#COMMAND msgfmt ARGS --check-compatibility -o ${mo_file} ${po_file}
|
2019-12-22 10:54:23 +00:00
|
|
|
DEPENDS ${po_file}
|
|
|
|
)
|
|
|
|
endforeach()
|
2018-09-19 09:02:24 +00:00
|
|
|
|
2019-10-14 10:50:08 +00:00
|
|
|
find_package(NLopt 1.4 REQUIRED)
|
|
|
|
|
2019-10-25 11:09:25 +00:00
|
|
|
if(SLIC3R_STATIC)
|
|
|
|
set(OPENVDB_USE_STATIC_LIBS ON)
|
|
|
|
set(USE_BLOSC TRUE)
|
2021-07-14 14:26:44 +00:00
|
|
|
endif ()
|
2019-10-25 11:09:25 +00:00
|
|
|
|
2021-07-14 14:26:44 +00:00
|
|
|
find_package(OpenVDB 5.0 COMPONENTS openvdb)
|
2019-10-29 15:27:53 +00:00
|
|
|
if(OpenVDB_FOUND)
|
|
|
|
slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release)
|
2020-01-16 13:25:01 +00:00
|
|
|
slic3r_remap_configs(Blosc::blosc RelWithDebInfo Release)
|
2021-07-14 14:26:44 +00:00
|
|
|
else ()
|
|
|
|
message(FATAL_ERROR "OpenVDB could not be found with the bundled find module. "
|
|
|
|
"You can try to specify the find module location of your "
|
|
|
|
"OpenVDB installation with the OPENVDB_FIND_MODULE_PATH cache variable.")
|
|
|
|
endif ()
|
2019-10-25 11:09:25 +00:00
|
|
|
|
2019-12-10 16:42:25 +00:00
|
|
|
set(TOP_LEVEL_PROJECT_DIR ${PROJECT_SOURCE_DIR})
|
|
|
|
function(prusaslicer_copy_dlls target)
|
|
|
|
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
|
|
|
set(_bits 64)
|
|
|
|
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
|
|
|
set(_bits 32)
|
|
|
|
endif ()
|
|
|
|
|
2020-02-06 10:59:02 +00:00
|
|
|
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
|
|
|
get_target_property(_alt_out_dir ${target} RUNTIME_OUTPUT_DIRECTORY)
|
|
|
|
|
|
|
|
if (_alt_out_dir)
|
|
|
|
set (_out_dir "${_alt_out_dir}")
|
|
|
|
elseif (_is_multi)
|
|
|
|
set (_out_dir "$<TARGET_PROPERTY:${target},BINARY_DIR>/$<CONFIG>")
|
|
|
|
else ()
|
|
|
|
set (_out_dir "$<TARGET_PROPERTY:${target},BINARY_DIR>")
|
|
|
|
endif ()
|
2019-12-10 16:42:25 +00:00
|
|
|
|
|
|
|
# This has to be a separate target due to the windows command line lenght limits
|
|
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
2020-02-06 10:59:02 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${TOP_LEVEL_PROJECT_DIR}/deps/GMP/gmp/lib/win${_bits}/libgmp-10.dll ${_out_dir}
|
2019-12-10 16:42:25 +00:00
|
|
|
COMMENT "Copy gmp runtime to build tree"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
2020-02-06 10:59:02 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${TOP_LEVEL_PROJECT_DIR}/deps/MPFR/mpfr/lib/win${_bits}/libmpfr-4.dll ${_out_dir}
|
2019-12-10 16:42:25 +00:00
|
|
|
COMMENT "Copy mpfr runtime to build tree"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2019-10-25 11:09:25 +00:00
|
|
|
|
2019-05-13 13:14:33 +00:00
|
|
|
# libslic3r, PrusaSlicer GUI and the PrusaSlicer executable.
|
2018-09-19 09:02:24 +00:00
|
|
|
add_subdirectory(src)
|
2019-05-13 13:14:33 +00:00
|
|
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT PrusaSlicer_app_console)
|
2018-09-19 09:02:24 +00:00
|
|
|
|
2021-08-23 14:26:47 +00:00
|
|
|
add_dependencies(gettext_make_pot hintsToPot)
|
|
|
|
|
2018-09-19 09:02:24 +00:00
|
|
|
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
|
2018-09-19 15:19:06 +00:00
|
|
|
# Also runs the unit / integration tests.
|
|
|
|
#FIXME Port the tests into C++ to finally get rid of the Perl!
|
2018-10-22 12:53:48 +00:00
|
|
|
if (SLIC3R_PERL_XS)
|
|
|
|
add_subdirectory(xs)
|
|
|
|
endif ()
|
2018-03-12 08:39:32 +00:00
|
|
|
|
2018-11-02 10:57:57 +00:00
|
|
|
if(SLIC3R_BUILD_SANDBOXES)
|
|
|
|
add_subdirectory(sandboxes)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(SLIC3R_BUILD_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
|
|
|
|
2019-01-04 11:06:25 +00:00
|
|
|
|
|
|
|
# Resources install target, configure fhs.hpp on UNIX
|
|
|
|
if (WIN32)
|
|
|
|
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
|
2019-07-16 21:12:07 +00:00
|
|
|
elseif (SLIC3R_FHS)
|
2020-10-24 15:38:11 +00:00
|
|
|
# CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
|
2019-05-13 13:14:33 +00:00
|
|
|
set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/PrusaSlicer")
|
2021-07-09 15:44:58 +00:00
|
|
|
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/ DESTINATION ${SLIC3R_FHS_RESOURCES}
|
2021-08-10 13:35:38 +00:00
|
|
|
PATTERN "*/udev" EXCLUDE
|
2021-07-09 15:44:58 +00:00
|
|
|
)
|
|
|
|
install(FILES src/platform/unix/PrusaSlicer.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
|
|
|
install(FILES src/platform/unix/PrusaGcodeviewer.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
|
|
|
foreach(SIZE 32 128 192)
|
|
|
|
install(FILES ${SLIC3R_RESOURCES_DIR}/icons/PrusaSlicer_${SIZE}px.png
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME PrusaSlicer.png
|
|
|
|
)
|
|
|
|
install(FILES ${SLIC3R_RESOURCES_DIR}/icons/PrusaSlicer-gcodeviewer_${SIZE}px.png
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME PrusaSlicer-gcodeviewer.png
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/udev/ DESTINATION lib/udev/rules.d)
|
2019-07-16 21:12:07 +00:00
|
|
|
else ()
|
2020-10-16 12:04:10 +00:00
|
|
|
install(FILES src/platform/unix/PrusaSlicer.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/applications)
|
2020-10-27 07:45:04 +00:00
|
|
|
install(FILES src/platform/unix/PrusaGcodeviewer.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/applications)
|
2019-07-16 21:12:07 +00:00
|
|
|
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
|
2019-01-04 11:06:25 +00:00
|
|
|
endif ()
|
2020-10-16 12:04:10 +00:00
|
|
|
|
2019-01-04 11:06:25 +00:00
|
|
|
configure_file(${LIBDIR}/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/platform/unix/fhs.hpp)
|