Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2018-10-16 12:06:26 +0300
committerVojtech Kral <vojtech@kral.hk>2018-10-16 12:56:22 +0300
commit97e7b6f18b83100b25998ba737b5a1df0a8af529 (patch)
treebf52e4a948ed7b3eee13596fa0201b77e3f769bb /deps
parent0263769d8f5462523cbf32899be5d4e4f3629ea1 (diff)
deps: Fix arch resolution on Windows
Diffstat (limited to 'deps')
-rw-r--r--deps/CMakeLists.txt53
-rw-r--r--deps/deps-windows.cmake14
2 files changed, 42 insertions, 25 deletions
diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
index 72df1a2fc..852d17fa2 100644
--- a/deps/CMakeLists.txt
+++ b/deps/CMakeLists.txt
@@ -1,3 +1,21 @@
+#
+# 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
+# when building Slic3r - to do this, set the CMAKE_PREFIX_PATH to the destdir's location.
+#
+# 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
+# as appropriate anyway (cf. the `NPROC` variable).
+#
+# 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.
+#
+
project(Slic3r-deps)
cmake_minimum_required(VERSION 3.2)
@@ -9,28 +27,27 @@ if (NPROC EQUAL 0)
set(NPROC 1)
endif ()
-if (MSVC)
- set(DEPS_BITS 64)
- set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir-64")
- include("deps-windows.cmake")
- add_custom_target(deps_64
- DEPENDS dep_boost_64 dep_tbb_64 dep_libcurl_64 dep_wxwidgets_64
- )
+set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir")
- set(DEPS_BITS 32)
- set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir-32")
- include("deps-windows.cmake")
- add_custom_target(deps_32
- DEPENDS dep_boost_32 dep_tbb_32 dep_libcurl_32 dep_wxwidgets_32
- )
+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 ()
else ()
- set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir")
include("deps-unix-static.cmake")
-
- add_custom_target(deps ALL
- DEPENDS dep_boost dep_tbb dep_libcurl dep_wxwidgets
- )
endif()
+add_custom_target(deps ALL
+ DEPENDS dep_boost dep_tbb dep_libcurl dep_wxwidgets
+)
+
# 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).
diff --git a/deps/deps-windows.cmake b/deps/deps-windows.cmake
index 8a276c54e..2be0d448a 100644
--- a/deps/deps-windows.cmake
+++ b/deps/deps-windows.cmake
@@ -1,5 +1,5 @@
-ExternalProject_Add("dep_boost_${DEPS_BITS}"
+ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1
URL "https://dl.bintray.com/boostorg/release/1.63.0/source/boost_1_63_0.tar.gz"
URL_HASH SHA256=fe34a4e119798e10b8cc9e565b3b0284e9fd3977ec8a1b19586ad1dec397088b
@@ -25,13 +25,13 @@ ExternalProject_Add("dep_boost_${DEPS_BITS}"
)
-if ($DEPS_BITS EQUAL 32)
+if (${DEPS_BITS} EQUAL 32)
set(DEP_TBB_GEN "Visual Studio 12")
else ()
set(DEP_TBB_GEN "Visual Studio 12 Win64")
endif ()
-ExternalProject_Add("dep_tbb_${DEPS_BITS}"
+ExternalProject_Add(dep_tbb
EXCLUDE_FROM_ALL 1
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
@@ -46,13 +46,13 @@ ExternalProject_Add("dep_tbb_${DEPS_BITS}"
)
-if ($DEPS_BITS EQUAL 32)
+if (${DEPS_BITS} EQUAL 32)
set(DEP_LIBCURL_TARGET "x86")
else ()
set(DEP_LIBCURL_TARGET "x64")
endif ()
-ExternalProject_Add("dep_libcurl_${DEPS_BITS}"
+ExternalProject_Add(dep_libcurl
EXCLUDE_FROM_ALL 1
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
@@ -64,7 +64,7 @@ ExternalProject_Add("dep_libcurl_${DEPS_BITS}"
&& "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
)
-if ($DEPS_BITS EQUAL 32)
+if (${DEPS_BITS} EQUAL 32)
set(DEP_WXWIDGETS_TARGET "")
set(DEP_WXWIDGETS_LIBDIR "vc_lib")
else ()
@@ -72,7 +72,7 @@ else ()
set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib")
endif ()
-ExternalProject_Add("dep_wxwidgets_${DEPS_BITS}"
+ExternalProject_Add(dep_wxwidgets
EXCLUDE_FROM_ALL 1
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e