2018-10-16 09:06:26 +00:00
|
|
|
|
#
|
|
|
|
|
# This CMake project downloads, configures and builds Slic3r PE dependencies on Unix and Windows.
|
|
|
|
|
#
|
|
|
|
|
# When using this script, it's recommended to perform an out-of-source build using CMake.
|
|
|
|
|
#
|
|
|
|
|
# All the dependencies are installed in a `destdir` directory in the root of the build directory,
|
|
|
|
|
# in a traditional Unix-style prefix structure. The destdir can be used directly by CMake
|
2018-10-23 17:08:26 +00:00
|
|
|
|
# when building Slic3r - to do this, set the CMAKE_PREFIX_PATH to ${destdir}/usr/local.
|
2019-01-07 15:28:57 +00:00
|
|
|
|
# Warning: On UNIX/Linux, you also need to set -DSLIC3R_STATIC=1 when building Slic3r.
|
2018-10-16 09:06:26 +00:00
|
|
|
|
#
|
|
|
|
|
# For better clarity of console output, it's recommended to _not_ use a parallelized build
|
|
|
|
|
# for the top-level command, ie. use `make -j 1` or `ninja -j 1` to force single-threaded top-level
|
|
|
|
|
# build. This doesn't degrade performance as individual dependencies are built in parallel fashion
|
2018-10-23 17:08:26 +00:00
|
|
|
|
# if supported by the dependency.
|
2018-10-16 09:06:26 +00:00
|
|
|
|
#
|
|
|
|
|
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
|
|
|
|
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
|
|
|
|
#
|
2018-12-03 09:48:06 +00:00
|
|
|
|
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-conffig` utility,
|
|
|
|
|
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
|
|
|
|
#
|
2018-10-16 09:06:26 +00:00
|
|
|
|
|
2018-10-12 12:19:08 +00:00
|
|
|
|
project(Slic3r-deps)
|
|
|
|
|
cmake_minimum_required(VERSION 3.2)
|
|
|
|
|
|
|
|
|
|
include(ExternalProject)
|
|
|
|
|
include(ProcessorCount)
|
2018-11-30 19:52:45 +00:00
|
|
|
|
|
2018-10-12 12:19:08 +00:00
|
|
|
|
ProcessorCount(NPROC)
|
|
|
|
|
if (NPROC EQUAL 0)
|
|
|
|
|
set(NPROC 1)
|
|
|
|
|
endif ()
|
|
|
|
|
|
2018-10-23 17:08:26 +00:00
|
|
|
|
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
|
2019-03-19 14:02:50 +00:00
|
|
|
|
|
2018-11-30 19:52:45 +00:00
|
|
|
|
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
|
2019-01-07 18:17:10 +00:00
|
|
|
|
option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF)
|
2018-10-23 17:08:26 +00:00
|
|
|
|
|
2018-11-30 19:52:45 +00:00
|
|
|
|
message(STATUS "Slic3r deps DESTDIR: ${DESTDIR}")
|
|
|
|
|
message(STATUS "Slic3r deps debug build: ${DEP_DEBUG}")
|
2018-10-16 07:20:56 +00:00
|
|
|
|
|
2018-10-16 09:06:26 +00:00
|
|
|
|
if (MSVC)
|
|
|
|
|
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
|
|
|
|
message(STATUS "\nDetected 64-bit compiler => building 64-bit deps bundle\n")
|
|
|
|
|
set(DEPS_BITS 64)
|
|
|
|
|
include("deps-windows.cmake")
|
|
|
|
|
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
|
|
|
|
message(STATUS "\nDetected 32-bit compiler => building 32-bit deps bundle\n")
|
|
|
|
|
set(DEPS_BITS 32)
|
|
|
|
|
include("deps-windows.cmake")
|
|
|
|
|
else ()
|
|
|
|
|
message(FATAL_ERROR "Unable to detect architecture")
|
|
|
|
|
endif ()
|
2018-11-30 19:52:45 +00:00
|
|
|
|
elseif (APPLE)
|
2019-01-10 12:49:06 +00:00
|
|
|
|
message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}")
|
|
|
|
|
if (CMAKE_OSX_DEPLOYMENT_TARGET)
|
|
|
|
|
set(DEP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
|
|
|
|
message("OS X Deployment Target: ${DEP_OSX_TARGET}")
|
|
|
|
|
else ()
|
|
|
|
|
# Attempt to infer the SDK version from the CMAKE_OSX_SYSROOT,
|
|
|
|
|
# this is done because wxWidgets need the min version explicitly set
|
|
|
|
|
string(REGEX MATCH "[0-9]+[.][0-9]+[.]sdk$" DEP_OSX_TARGET "${CMAKE_OSX_SYSROOT}")
|
|
|
|
|
string(REGEX MATCH "^[0-9]+[.][0-9]+" DEP_OSX_TARGET "${DEP_OSX_TARGET}")
|
|
|
|
|
|
|
|
|
|
if (NOT DEP_OSX_TARGET)
|
|
|
|
|
message(FATAL_ERROR "Could not determine OS X SDK version. Please use -DCMAKE_OSX_DEPLOYMENT_TARGET=<version>")
|
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
message("OS X Deployment Target (inferred from default): ${DEP_OSX_TARGET}")
|
|
|
|
|
endif ()
|
2018-11-30 19:52:45 +00:00
|
|
|
|
|
|
|
|
|
include("deps-macos.cmake")
|
2018-10-12 12:19:08 +00:00
|
|
|
|
else ()
|
2018-11-30 19:52:45 +00:00
|
|
|
|
include("deps-linux.cmake")
|
2018-10-12 12:19:08 +00:00
|
|
|
|
endif()
|
2018-10-15 15:28:05 +00:00
|
|
|
|
|
2018-10-16 09:06:26 +00:00
|
|
|
|
add_custom_target(deps ALL
|
2018-10-31 16:29:21 +00:00
|
|
|
|
DEPENDS
|
|
|
|
|
dep_boost
|
|
|
|
|
dep_tbb
|
|
|
|
|
dep_libcurl
|
|
|
|
|
dep_wxwidgets
|
|
|
|
|
dep_gtest
|
|
|
|
|
dep_nlopt
|
2018-10-16 09:06:26 +00:00
|
|
|
|
)
|
|
|
|
|
|
2018-10-15 15:28:05 +00:00
|
|
|
|
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
|
|
|
|
|
# because they seem to generate bogus build files (possibly a bug in ExternalProject).
|