Browse Source

Merge remote-tracking branch 'remotes/prusa/master'

WIP, in particular, have to review the custom beds svg/stl
supermerill 5 years ago
parent
commit
773972cc2c

+ 2 - 2
.clang-format

@@ -19,7 +19,7 @@ AlwaysBreakAfterDefinitionReturnType: None
 AlwaysBreakAfterReturnType: None
 AlwaysBreakBeforeMultilineStrings: false
 AlwaysBreakTemplateDeclarations: false
-BinPackArguments: false
+BinPackArguments: true
 BinPackParameters: false
 BraceWrapping:   
   AfterClass:      true
@@ -46,7 +46,7 @@ BreakConstructorInitializersBeforeComma: false
 BreakConstructorInitializers: BeforeComma
 BreakAfterJavaFieldAnnotations: false
 BreakStringLiterals: true
-ColumnLimit:     75
+ColumnLimit:     78
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: true
 ConstructorInitializerAllOnOneLineOrOnePerLine: true

+ 22 - 21
CMakeLists.txt

@@ -32,7 +32,6 @@ 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)
 option(SLIC3R_ASAN              "Enable ASan on Clang and GCC" 0)
-option(SLIC3R_SYNTAXONLY        "Only perform source code correctness checking, no binary output (UNIX only)" 0)
 
 set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
 
@@ -147,30 +146,28 @@ 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.
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
-
-    if (SLIC3R_SYNTAXONLY)
-        set(CMAKE_CXX_ARCHIVE_CREATE "true")
-        set(CMAKE_C_ARCHIVE_CREATE "true")
-        set(CMAKE_CXX_ARCHIVE_APPEND "true")
-        set(CMAKE_C_ARCHIVE_APPEND "true")
-        set(CMAKE_RANLIB "true")
-        set(CMAKE_C_LINK_EXECUTABLE "true")
-        set(CMAKE_CXX_LINK_EXECUTABLE "true")
-
-        set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> -fsyntax-only <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> && touch <OBJECT>")
-        set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -fsyntax-only <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> && touch <OBJECT>")
-    endif ()
 endif()
 
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-    add_compile_options(-Wall)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -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) # Tamas: Eigen include dirs are marked as SYSTEM
+    #removes LOTS of extraneous Eigen warnings (GCC only supports it since 6.1)
+    #if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.1)
+        # add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
+    #endif()
+
+    #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()
+
 
     if (SLIC3R_ASAN)
         add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
@@ -306,10 +303,10 @@ endif()
 
 # Find eigen3 or use bundled version
 if (NOT SLIC3R_STATIC)
-    find_package(Eigen3 3)
+    find_package(Eigen3 3.3)
 endif ()
-if (NOT Eigen3_FOUND)
-    set(Eigen3_FOUND 1)
+if (NOT EIGEN3_FOUND)
+    set(EIGEN3_FOUND 1)
     set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/)
 endif ()
 include_directories(BEFORE SYSTEM ${EIGEN3_INCLUDE_DIR})
@@ -344,6 +341,10 @@ if (NOT GLEW_FOUND)
 endif ()
 include_directories(${GLEW_INCLUDE_DIRS})
 
+# Find the Cereal serialization library
+add_library(cereal INTERFACE)
+target_include_directories(cereal INTERFACE include)
+
 # l10n
 set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
 add_custom_target(pot

+ 3 - 1
deps/CMakeLists.txt

@@ -88,6 +88,7 @@ if (MSVC)
         dep_libcurl
         dep_wxwidgets
         dep_gtest
+        dep_cereal
         dep_nlopt
         # dep_qhull # Experimental
         dep_zlib    # on Windows we still need zlib
@@ -102,9 +103,10 @@ else()
         dep_libcurl
         dep_wxwidgets
         dep_gtest
+        dep_cereal
         dep_nlopt
         dep_qhull
-        dep_libigl
+        # dep_libigl # Not working, static build has different Eigen
     )
 
 endif()

+ 1 - 1
deps/deps-macos.cmake

@@ -111,6 +111,6 @@ ExternalProject_Add(dep_wxwidgets
         --with-expat=builtin
         --disable-debug
         --disable-debug_flag
-    BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo
+    BUILD_COMMAND make "-j${NPROC}" && PATH=/usr/local/opt/gettext/bin/:$ENV{PATH} make -C locale allmo
     INSTALL_COMMAND make install
 )

+ 10 - 0
deps/deps-unix-common.cmake

@@ -19,6 +19,16 @@ ExternalProject_Add(dep_gtest
     CMAKE_ARGS -DBUILD_GMOCK=OFF ${DEP_CMAKE_OPTS} -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
 )
 
+ExternalProject_Add(dep_cereal
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz"
+#    URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
+    CMAKE_ARGS
+        -DJUST_INSTALL_CEREAL=on
+        -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
+        ${DEP_CMAKE_OPTS}
+)
+
 ExternalProject_Add(dep_nlopt
     EXCLUDE_FROM_ALL 1
     URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"

+ 14 - 0
deps/deps-windows.cmake

@@ -120,6 +120,20 @@ if (${DEP_DEBUG})
 endif ()
 
 
+ExternalProject_Add(dep_cereal
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz"
+#    URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
+    CMAKE_GENERATOR "${DEP_MSVC_GEN}"
+    CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
+    CMAKE_ARGS
+        -DJUST_INSTALL_CEREAL=on
+        "-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
+    BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj
+    INSTALL_COMMAND ""
+)
+
+
 ExternalProject_Add(dep_nlopt
     EXCLUDE_FROM_ALL 1
     URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"

+ 12 - 1
doc/How to build - Mac OS.md

@@ -1,7 +1,15 @@
 
 # Building Slic3r++ on Mac OS
 
-To build Slic3r++ on Mac OS, you will need to install XCode, [CMake](https://cmake.org/) (available on Brew) and possibly git.
+To build Slic3r++ on Mac OS, you will need the following software:
+
+- XCode
+- CMake
+- git
+- gettext
+
+XCode is available through Apple's App Store, the other three tools are available on
+[brew](https://brew.sh/) (use `brew install cmake git gettext` to install them).
 
 ### Dependencies
 
@@ -20,6 +28,9 @@ You can also customize the bundle output path using the `-DDESTDIR=<some path>`
 **Warning**: Once the dependency bundle is installed in a destdir, the destdir cannot be moved elsewhere.
 (This is because wxWidgets hardcodes the installation path.)
 
+FIXME The Cereal serialization library needs a tiny patch on some old OSX clang installations
+https://github.com/USCiLab/cereal/issues/339#issuecomment-246166717
+
 
 ### Building Slic3r++
 

+ 6 - 17
doc/How to build - Windows.md

@@ -1,30 +1,19 @@
 
 # Building Slic3r++ on Microsoft Windows
 
-The currently supported way of building Slic3r++ on Windows is with CMake and MS Visual Studio 2013.
-You can use the free [Visual Studio 2013 Community Edition](https://www.visualstudio.com/vs/older-downloads/).
-CMake installer can be downloaded from [the official website](https://cmake.org/download/).
+The currently supported way of building Slic3r++ on Windows is with CMake and MS Visual Studio 2017.
+You can use the free [Visual Studio 2017 Community Edition](https://www.visualstudio.com/vs/older-downloads/).
+CMake installer can be downloaded from [the official website](https://cmake.org/download/).~~
 
-Building with newer versions of MSVS (2015, 2017) may work too as reported by some of our users.
+Building with newer versions of MSVS (2019) may work too as reported by some of our users.
 
-_Note:_ Thanks to [**@supermerill**](https://github.com/supermerill) for testing and inspiration for this guide.
 
 ### Dependencies
 
 On Windows Slic3r++ is built against statically built libraries.
-We provide a prebuilt package of all the needed dependencies. This package only works on Visual Studio 2013, so if you are using a newer version of Visual Studio, you need to compile the dependencies yourself as per [below](#building-the-dependencies-package-yourself).
-The package comes in a several variants:
 
-  - [64 bit, Release mode only](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-64.7z) (41 MB, 578 MB unpacked)
-  - [64 bit, Release and Debug mode](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-64-dev.7z) (88 MB, 1.3 GB unpacked)
-  - [32 bit, Release mode only](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-32.7z) (38 MB, 520 MB unpacked)
-  - [32 bit, Release and Debug mode](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-32-dev.7z) (74 MB, 1.1 GB unpacked)
 
-When unsure, use the _Release mode only_ variant, the _Release and Debug_ variant is only needed for debugging & development.
 
-If you're unsure where to unpack the package, unpack it into `C:\local\` (but it can really be anywhere).
-
-Alternatively you can also compile the dependencies yourself, see below.
 
 ### Building Slic3r++ with Visual Studio
 
@@ -38,9 +27,9 @@ Use these commands to prepare Visual Studio solution file:
 
     mkdir build
     cd build
-    cmake .. -G "Visual Studio 12 Win64" -DCMAKE_PREFIX_PATH="<insert prefix path here>"
+    cmake .. -G "Visual Studio 15 Win64" -DCMAKE_PREFIX_PATH="<insert prefix path here>"
 
-Note that if you're building a 32-bit variant, you will need to change the `"Visual Studio 12 Win64"` to just `"Visual Studio 12"`.
+Note that if you're building a 32-bit variant, you will need to change the `"Visual Studio 15 Win64"` to just `"Visual Studio 15"`.
 
 Conversely, if you're using Visual Studio version other than 2013, the version number will need to be changed accordingly.
 

+ 0 - 1
lib/Slic3r.pm

@@ -50,7 +50,6 @@ use Slic3r::Point;
 use Slic3r::Polygon;
 use Slic3r::Polyline;
 use Slic3r::Print::Object;
-use Slic3r::Print::Simple;
 use Slic3r::Surface;
 our $build = eval "use Slic3r::Build; 1";
 

+ 0 - 104
lib/Slic3r/Print/Simple.pm

@@ -1,104 +0,0 @@
-# A simple wrapper to quickly print a single model without a GUI.
-# Used by the command line slic3r.pl, by command line utilities pdf-slic3s.pl and view-toolpaths.pl,
-# and by the quick slice menu of the Slic3r GUI.
-#
-# It creates and owns an instance of Slic3r::Print  to perform the slicing
-# and it accepts an instance of Slic3r::Model from the outside.
-
-package Slic3r::Print::Simple;
-use Moo;
-
-use Slic3r::Geometry qw(X Y);
-
-has '_print' => (
-    is      => 'ro',
-    default => sub { Slic3r::Print->new },
-    handles => [qw(apply_config_perl_tests_only extruders output_filepath
-                    total_used_filament total_extruded_volume
-                    placeholder_parser process)],
-);
-
-has 'duplicate' => (
-    is      => 'rw',
-    default => sub { 1 },
-);
-
-has 'scale' => (
-    is      => 'rw',
-    default => sub { 1 },
-);
-
-has 'rotate' => (
-    is      => 'rw',
-    default => sub { 0 },
-);
-
-has 'duplicate_grid' => (
-    is      => 'rw',
-    default => sub { [1,1] },
-);
-
-has 'print_center' => (
-    is      => 'rw',
-    default => sub { Slic3r::Pointf->new(100,100) },
-);
-
-has 'dont_arrange' => (
-    is      => 'rw',
-    default => sub { 0 },
-);
-
-has 'output_file' => (
-    is      => 'rw',
-);
-
-sub set_model {
-    # $model is of type Slic3r::Model
-    my ($self, $model) = @_;
-    
-    # make method idempotent so that the object is reusable
-    $self->_print->clear_objects;
-    
-    # make sure all objects have at least one defined instance
-    my $need_arrange = $model->add_default_instances && ! $self->dont_arrange;
-    
-    # apply scaling and rotation supplied from command line if any
-    foreach my $instance (map @{$_->instances}, @{$model->objects}) {
-        $instance->set_scaling_factor($instance->scaling_factor * $self->scale);
-        $instance->set_rotation($instance->rotation + $self->rotate);
-    }
-    
-    if ($self->duplicate_grid->[X] > 1 || $self->duplicate_grid->[Y] > 1) {
-        $model->duplicate_objects_grid($self->duplicate_grid->[X], $self->duplicate_grid->[Y], $self->_print->config->duplicate_distance);
-    } elsif ($need_arrange) {
-        $model->duplicate_objects($self->duplicate, $self->_print->config->min_object_distance);
-    } elsif ($self->duplicate > 1) {
-        # if all input objects have defined position(s) apply duplication to the whole model
-        $model->duplicate($self->duplicate, $self->_print->config->min_object_distance);
-    }
-    $_->translate(0,0,-$_->bounding_box->z_min) for @{$model->objects};
-    $model->center_instances_around_point($self->print_center) if (! $self->dont_arrange);
-    
-    foreach my $model_object (@{$model->objects}) {
-        $self->_print->auto_assign_extruders($model_object);
-        $self->_print->add_model_object($model_object);
-    }
-}
-
-sub export_gcode {
-    my ($self) = @_;
-    $self->_print->validate;
-    $self->_print->export_gcode($self->output_file // '');
-}
-
-sub export_png {
-    my ($self) = @_;
-    
-    $self->_before_export;
-    
-    $self->_print->export_png(output_file => $self->output_file);
-    
-    $self->_after_export;
-}
-
-1;

Some files were not shown because too many files changed in this diff