deps: Use wxWidgets 3.1.2 on Mac, use system SDK by default, various bugfixes

This commit is contained in:
Vojtech Kral 2019-01-10 13:49:06 +01:00
parent fcf41c7eb8
commit e5062e8662
6 changed files with 89 additions and 52 deletions

21
deps/CMakeLists.txt vendored
View File

@ -51,11 +51,22 @@ if (MSVC)
message(FATAL_ERROR "Unable to detect architecture") message(FATAL_ERROR "Unable to detect architecture")
endif () endif ()
elseif (APPLE) elseif (APPLE)
set(DEPS_OSX_TARGET "10.9" CACHE STRING "OS X SDK version to build against") message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}")
set(DEPS_OSX_SYSROOT if (CMAKE_OSX_DEPLOYMENT_TARGET)
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${DEPS_OSX_TARGET}.sdk" set(DEP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}")
CACHE PATH "OS X SDK directory" 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 ()
include("deps-macos.cmake") include("deps-macos.cmake")
else () else ()

13
deps/deps-linux.cmake vendored
View File

@ -25,6 +25,19 @@ ExternalProject_Add(dep_boost
INSTALL_COMMAND "" # b2 does that already INSTALL_COMMAND "" # b2 does that already
) )
ExternalProject_Add(dep_libpng
EXCLUDE_FROM_ALL 1
URL "https://github.com/glennrp/libpng/archive/v1.6.36.tar.gz"
URL_HASH SHA256=5bef5a850a9255365a2dc344671b7e9ef810de491bd479c2506ac3c337e2d84f
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_TESTS=OFF
${DEP_CMAKE_OPTS}
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
INSTALL_COMMAND ""
)
ExternalProject_Add(dep_libopenssl ExternalProject_Add(dep_libopenssl
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_ALL 1
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz" URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz"

43
deps/deps-macos.cmake vendored
View File

@ -1,13 +1,24 @@
# This ensures dependencies don't use SDK features which are not available in the version specified by Deployment target
# That can happen when one uses a recent SDK but specifies an older Deployment target
set(DEP_WERRORS_SDK "-Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
set(DEP_CMAKE_OPTS set(DEP_CMAKE_OPTS
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-DCMAKE_OSX_SYSROOT=${DEPS_OSX_SYSROOT}" "-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}"
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPS_OSX_TARGET}" "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
"-DCMAKE_CXX_FLAGS=${DEP_WERRORS_SDK}"
"-DCMAKE_C_FLAGS=${DEP_WERRORS_SDK}"
) )
include("deps-unix-common.cmake") include("deps-unix-common.cmake")
set(DEP_BOOST_OSX_TARGET "")
if (CMAKE_OSX_DEPLOYMENT_TARGET)
set(DEP_BOOST_OSX_TARGET "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif ()
ExternalProject_Add(dep_boost ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_ALL 1
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz" URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
@ -23,8 +34,8 @@ ExternalProject_Add(dep_boost
variant=release variant=release
threading=multi threading=multi
boost.locale.icu=off boost.locale.icu=off
"cflags=-fPIC -mmacosx-version-min=${DEPS_OSX_TARGET}" "cflags=-fPIC ${DEP_BOOST_OSX_TARGET}"
"cxxflags=-fPIC -mmacosx-version-min=${DEPS_OSX_TARGET}" "cxxflags=-fPIC ${DEP_BOOST_OSX_TARGET}"
install install
INSTALL_COMMAND "" # b2 does that already INSTALL_COMMAND "" # b2 does that already
) )
@ -76,18 +87,32 @@ ExternalProject_Add(dep_libcurl
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}" INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
) )
ExternalProject_Add(dep_libpng
EXCLUDE_FROM_ALL 1
URL "https://github.com/glennrp/libpng/archive/v1.6.36.tar.gz"
URL_HASH SHA256=5bef5a850a9255365a2dc344671b7e9ef810de491bd479c2506ac3c337e2d84f
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_TESTS=OFF
${DEP_CMAKE_OPTS}
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
INSTALL_COMMAND ""
)
ExternalProject_Add(dep_wxwidgets ExternalProject_Add(dep_wxwidgets
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_ALL 1
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2" URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.2/wxWidgets-3.1.2.tar.bz2"
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e URL_HASH SHA256=4cb8d23d70f9261debf7d6cfeca667fc0a7d2b6565adb8f1c484f9b674f1f27a
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h
CONFIGURE_COMMAND ./configure CONFIGURE_COMMAND env "CXXFLAGS=${DEP_WERRORS_SDK}" "CFLAGS=${DEP_WERRORS_SDK}" ./configure
"--prefix=${DESTDIR}/usr/local" "--prefix=${DESTDIR}/usr/local"
--disable-shared --disable-shared
--with-osx_cocoa --with-osx_cocoa
"--with-macosx-version-min=${DEPS_OSX_TARGET}" --with-macosx-sdk=${CMAKE_OSX_SYSROOT}
"--with-macosx-sdk=${DEPS_OSX_SYSROOT}" "--with-macosx-version-min=${DEP_OSX_TARGET}"
--with-opengl --with-opengl
--with-regex=builtin --with-regex=builtin
--with-libpng=builtin --with-libpng=builtin

View File

@ -35,16 +35,3 @@ ExternalProject_Add(dep_nlopt
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}" INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
ExternalProject_Add(dep_libpng
EXCLUDE_FROM_ALL 1
URL "http://prdownloads.sourceforge.net/libpng/libpng-1.6.35.tar.xz?download"
URL_HASH SHA256=23912ec8c9584917ed9b09c5023465d71709dce089be503c7867fec68a93bcd7
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_TESTS=OFF
${DEP_CMAKE_OPTS}
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
INSTALL_COMMAND ""
)

View File

@ -155,8 +155,8 @@ endif ()
ExternalProject_Add(dep_libpng ExternalProject_Add(dep_libpng
DEPENDS dep_zlib DEPENDS dep_zlib
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_ALL 1
URL "http://prdownloads.sourceforge.net/libpng/libpng-1.6.35.tar.xz?download" URL "https://github.com/glennrp/libpng/archive/v1.6.36.tar.gz"
URL_HASH SHA256=23912ec8c9584917ed9b09c5023465d71709dce089be503c7867fec68a93bcd7 URL_HASH SHA256=5bef5a850a9255365a2dc344671b7e9ef810de491bd479c2506ac3c337e2d84f
CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_ARGS CMAKE_ARGS
-DPNG_SHARED=OFF -DPNG_SHARED=OFF

View File

@ -1,26 +1,7 @@
# Building Slic3r PE on Mac OS # Building Slic3r PE on Mac OS
To build Slic3r PE on Mac OS, you will need to install XCode and an appropriate SDK. To build Slic3r PE on Mac OS, you will need to install XCode, [CMake](https://cmake.org/) (available on Brew) and possibly git.
You will also need [CMake](https://cmake.org/) installed (available on Brew) and possibly git.
Currently Slic3r PE is built against the Mac OS X SDK version 10.9.
Building against older SDKs is unsupported. Building against newer SDKs might work,
but there may be subtle issues, such as dark mode not working very well on Mojave or other GUI problems.
You can obtain the SDK 10.9 for example [in this repository](https://github.com/phracker/MacOSX-SDKs).
If you don't already have the 10.9 version as part of your Mac OS installation, please download it
and place it into a reachable location.
The default location for Mac OS SDKs is:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
Wherever the 10.9 SDK is, please note down its location, it will be required to build Slic3r.
On my system, for example, the path to the SDK is
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
### Dependencies ### Dependencies
@ -30,11 +11,16 @@ Use the following commands to build the dependencies:
mkdir build mkdir build
cd build cd build
cmake .. -DDEPS_OSX_SYSROOT=<path to the 10.9 SDK> cmake ..
make
This will create a dependencies bundle inside the `build/destdir` directory. This will create a dependencies bundle inside the `build/destdir` directory.
You can also customize the bundle output path using the `-DDESTDIR=<some path>` option passed to `cmake`. You can also customize the bundle output path using the `-DDESTDIR=<some path>` option passed to `cmake`.
**Warning**: Once the dependency bundle is installed in a destdir, the destdir cannot be moved elsewhere.
(This is because wxWidgets hardcode the installation path.)
### Building Slic3r ### Building Slic3r
If dependencies built without an error, you can proceed to build Slic3r itself. If dependencies built without an error, you can proceed to build Slic3r itself.
@ -42,7 +28,7 @@ Go back to top level Slic3r sources directory and use these commands:
mkdir build mkdir build
cd build cd build
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_SYSROOT=<path to the 10.9 SDK> cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local"
The `CMAKE_PREFIX_PATH` is the path to the dependencies bundle but with `/usr/local` appended - if you set a custom path The `CMAKE_PREFIX_PATH` is the path to the dependencies bundle but with `/usr/local` appended - if you set a custom path
using the `DESTDIR` option, you will need to change this accordingly. **Warning:** the `CMAKE_PREFIX_PATH` needs to be an absolute path. using the `DESTDIR` option, you will need to change this accordingly. **Warning:** the `CMAKE_PREFIX_PATH` needs to be an absolute path.
@ -56,7 +42,22 @@ where `N` is the number of CPU cores, so, for example `make -j4` for a 4-core ma
Alternatively, if you would like to use XCode GUI, modify the `cmake` command to include the `-GXcode` option: Alternatively, if you would like to use XCode GUI, modify the `cmake` command to include the `-GXcode` option:
cmake .. -GXcode -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_SYSROOT=<path to the 10.9 SDK> cmake .. -GXcode -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local"
and then open the `Slic3r.xcodeproj` file. and then open the `Slic3r.xcodeproj` file.
This should open up XCode where you can perform build using the GUI or perform other tasks. This should open up XCode where you can perform build using the GUI or perform other tasks.
### Note on Mac OS X SDKs
By default Slic3r builds against whichever SDK is the default on the current system.
This can be customized. The `CMAKE_OSX_SYSROOT` option sets the path to the SDK directory location
and the `CMAKE_OSX_DEPLOYMENT_TARGET` option sets the target OS X system version (eg. `10.14` or similar).
Note you can set just one value and the other will be guessed automatically.
In case you set both, the two settings need to agree with each other. (Building with a lower deployment target
is currently unsupported because some of the dependencies don't support this, most notably wxWidgets.)
Please note that the `CMAKE_OSX_DEPLOYMENT_TARGET` and `CMAKE_OSX_SYSROOT` options need to be set the same
on both the dependencies bundle as well as Slic3r PE itself.
Official Mac Slic3r builds are currently built against SDK 10.9 to ensure compatibility with older Macs.