From a9675a3f0b6a3bbbc2658e889c2d6b6dbc03a592 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 8 Nov 2020 18:46:05 +0100 Subject: [PATCH] fix compile --- .github/workflows/ccpp_mac_release.yml | 95 ------------------- .github/workflows/ccpp_ubuntu.yml | 2 +- .github/workflows/ccpp_ubuntu_release.yml | 70 -------------- CMakeLists.txt | 4 +- doc/How to build - Linux et al.md | 10 ++ doc/How to build - Mac OS.md | 11 +++ doc/How to build - Windows.md | 24 ++++- src/CMakeLists.txt | 2 +- src/libslic3r/Fill/FillBase.hpp | 1 - src/libslic3r/GCode/FanMover.cpp | 2 +- src/libslic3r/GCode/FanMover.hpp | 4 +- src/libslic3r/GCode/GCodeProcessor.cpp | 8 +- src/libslic3r/PrintConfig.hpp | 2 +- .../msw/PrusaSlicer-gcodeviewer.rc.in | 2 +- .../{PrusaSlicer.rc.in => SuperSlicer.rc.in} | 0 tests/fff_print/test_data.cpp | 2 +- tests/fff_print/test_model.cpp | 2 +- tests/libslic3r/test_voronoi.cpp | 2 +- 18 files changed, 59 insertions(+), 184 deletions(-) delete mode 100644 .github/workflows/ccpp_mac_release.yml delete mode 100644 .github/workflows/ccpp_ubuntu_release.yml rename src/platform/msw/{PrusaSlicer.rc.in => SuperSlicer.rc.in} (100%) diff --git a/.github/workflows/ccpp_mac_release.yml b/.github/workflows/ccpp_mac_release.yml deleted file mode 100644 index a05147de1..000000000 --- a/.github/workflows/ccpp_mac_release.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: C/C++ CI macos - -on: - release: - types: [published] - -jobs: - build: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v1 - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y%m%d')" - - name: change date in version - run: | - sed "s/+UNKNOWN/_$(date '+%F')/" version.inc > version.date.inc - mv version.date.inc version.inc - - name: mkdir in deps - run: mkdir deps/build - - name: cmake deps - working-directory: ./deps/build - run: cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" - - name: make deps - working-directory: ./deps/build - run: make - - name: clean deps - working-directory: ./deps/build - run: rm -rf dep_* - - name: mkdir build - run: mkdir build - - name: cmake - working-directory: ./build - run: cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DSLIC3R_STATIC=1 - - name: make slic3r - working-directory: ./build - run: make slic3r - - name: update Info.plist - working-directory: ./build/src - run: sed "s/+UNKNOWN/_$(date '+%F')/" Info.plist >Info.date.plist - - name: create directory and copy into it - working-directory: ./build - run: | - mkdir SuperSlicer - mkdir SuperSlicer/SuperSlicer.app - mkdir SuperSlicer/SuperSlicer.app/Contents - mkdir SuperSlicer/SuperSlicer.app/Contents/_CodeSignature - mkdir SuperSlicer/SuperSlicer.app/Contents/Frameworks - mkdir SuperSlicer/SuperSlicer.app/Contents/MacOS - - name: copy resources - working-directory: ./build - run: | - cp -Rf ../resources SuperSlicer/SuperSlicer.app/Contents/resources - cp SuperSlicer/SuperSlicer.app/Contents/resources/icons/slic3r.icns SuperSlicer/SuperSlicer.app/Contents/resources/Slic3r.icns - cp src/Info.date.plist SuperSlicer/SuperSlicer.app/Contents/Info.plist - echo -n -e 'APPL????\x0a' > PkgInfo - cp PkgInfo SuperSlicer/SuperSlicer.app/Contents/PkgInfo -# echo -n -e '\xff\xfeAPPL\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x0a\x00' > PkgInfo - - name: copy bin - working-directory: ./build - run: | - cp -f src/superslicer SuperSlicer/SuperSlicer.app/Contents/MacOS/SuperSlicer - chmod u+x SuperSlicer/SuperSlicer.app/Contents/MacOS/SuperSlicer - tar -zcvf SuperSlicer.tar.gz SuperSlicer - - name: create dmg - working-directory: ./build - run: | - hdiutil create -ov -fs HFS+ -volname "SuperSlicer" -srcfolder "SuperSlicer" temp.dmg - hdiutil convert temp.dmg -format UDZO -o SuperSlicer.dmg -# - name: signing resources (creating CodeResources inside _CodeSignature) -# working-directory: . -# run: codesign -s resources -# maybe i should just try to do that on a separate pc and copy the file here, more secure as a signing process. - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./build/SuperSlicer.tar.gz - asset_name: SuperSlicer_${{ github.event.release.tag_name }}_macos_${{steps.date.outputs.date}}.tar.gz - asset_content_type: application/gzip - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/nightly_macos.dmg - asset_name: SuperSlicer_${{ github.event.release.tag_name }}_macos_${{steps.date.outputs.date}}.dmg - asset_content_type: application/x-apple-diskimage diff --git a/.github/workflows/ccpp_ubuntu.yml b/.github/workflows/ccpp_ubuntu.yml index 9e63e0e70..0549038c6 100644 --- a/.github/workflows/ccpp_ubuntu.yml +++ b/.github/workflows/ccpp_ubuntu.yml @@ -21,7 +21,7 @@ jobs: - name: update apt run: sudo apt update - name: install gtk2 glew - run: sudo apt install libgtk2.0-dev libglew-dev libudev-dev + run: sudo apt install libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev - name: mkdir in deps run: mkdir deps/build - name: cmake deps diff --git a/.github/workflows/ccpp_ubuntu_release.yml b/.github/workflows/ccpp_ubuntu_release.yml deleted file mode 100644 index 9bbee16b5..000000000 --- a/.github/workflows/ccpp_ubuntu_release.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: C/C++ CI ubuntu - -on: - release: - types: [published] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: update clock - run: sudo hwclock -s - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y%m%d')" - - name: change date in version - run: sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc - - name: update apt - run: sudo apt update - - name: install gtk2 glew - run: sudo apt install libgtk2.0-dev libglew-dev libudev-dev - - name: mkdir in deps - run: mkdir deps/build - - name: cmake deps - working-directory: ./deps/build - run: cmake .. - - name: make deps - working-directory: ./deps/build - run: make - - name: clean deps - working-directory: ./deps/build - run: rm -rf dep_* - - name: mkdir build - run: mkdir build - - name: cmake - working-directory: ./build - run: cmake .. -DCMAKE_PREFIX_PATH="/home/runner/work/Slic3r/Slic3r/deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 - - name: make slic3r - working-directory: ./build - run: make slic3r - - name: create directory and copy into it - working-directory: ./build - run: | - mkdir package - mkdir package/bin - - name: copy resources - working-directory: ./build - run: cp -Rf ../resources package/resources - - name: copy bin - working-directory: ./build - run: cp -f src/superslicer package/bin/superslicer - - name: create sh from echo - working-directory: ./build/package - run: | - echo -e '#!/bin/bash\nDIR=$(readlink -f "$0" | xargs dirname)\nexport LD_LIBRARY_PATH="$DIR/bin"\nexec "$DIR/bin/superslicer" "$@"' >SuperSlicer - chmod u+x superslicer - tar -zcvf ../SuperSlicer.tar.gz . - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./build/SuperSlicer.tar.gz - asset_name: SuperSlicer_${{ github.event.release.tag_name }}_ubu64_${{steps.date.outputs.date}}.tar.gz - asset_content_type: application/gzip diff --git a/CMakeLists.txt b/CMakeLists.txt index d1c080a82..bed21f6eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -433,10 +433,10 @@ add_custom_target(gettext_po_to_mo WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMENT "Generate localization po files (binary) from mo files (texts)" ) -file(GLOB L10N_PO_FILES "${L10N_DIR}/*/PrusaSlicer*.po") +file(GLOB L10N_PO_FILES "${L10N_DIR}/*/SuperSlicer*.po") foreach(po_file ${L10N_PO_FILES}) GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY) - SET(mo_file "${po_dir}/PrusaSlicer.mo") + SET(mo_file "${po_dir}/SuperSlicer.mo") add_custom_command( TARGET gettext_po_to_mo PRE_BUILD COMMAND msgfmt ARGS -o ${mo_file} ${po_file} diff --git a/doc/How to build - Linux et al.md b/doc/How to build - Linux et al.md index eaffb3dbd..1db7e2f59 100644 --- a/doc/How to build - Linux et al.md +++ b/doc/How to build - Linux et al.md @@ -17,6 +17,16 @@ where `N` is the number of CPU cores available. Additional CMake flags may be applicable as explained below. +### How to build + +You can follow the [script](https://github.com/supermerill/SuperSlicer/blob/master/.github/workflows/ccpp_ubuntu.yml) the build server use to create the ubuntu release. + +You have to execute each command at the right of the 'run: ' tags, in the directory that is at the right of the previous 'working-directory:' tag. + +You can stop after the `make slic3r` as the rest of the commands are for building the launch script and the appimage. + +# Old doc, not up-to-date: + ### Dependency resolution By default SuperSlicer looks for dependencies the default way CMake looks for them, i.e. in default system locations. diff --git a/doc/How to build - Mac OS.md b/doc/How to build - Mac OS.md index f9fd9a605..b896159ee 100644 --- a/doc/How to build - Mac OS.md +++ b/doc/How to build - Mac OS.md @@ -11,6 +11,17 @@ To build SuperSlicer on Mac OS, you will need the following software: 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). +### How to build + +You can follow the [script](https://github.com/supermerill/SuperSlicer/blob/master/.github/workflows/ccpp_mac.yml) the build server use to create the ubuntu release. + +You have to execute each command at the right of the 'run: ' tags, in the directory that is at the right of the previous 'working-directory:' tag. + +You can stop after the `make slic3r` as the rest of the commands are for building the .dmg + +# Old doc, not up-to-date: + + ### Dependencies SuperSlicer comes with a set of CMake scripts to build its dependencies, it lives in the `deps` directory. diff --git a/doc/How to build - Windows.md b/doc/How to build - Windows.md index 84a215f54..34b557654 100644 --- a/doc/How to build - Windows.md +++ b/doc/How to build - Windows.md @@ -1,12 +1,30 @@ # Building SuperSlicer on Microsoft Windows -The currently supported way of building SuperSlicer 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/). +The currently supported way of building SuperSlicer on Windows is with CMake and [MS Visual Studio 2019](https://visualstudio.microsoft.com/fr/vs). CMake installer can be downloaded from [the official website](https://cmake.org/download/).~~ -Building with newer versions of MSVS (2019) should work too. +Building with [Visual Studio 2017 Community Edition](https://www.visualstudio.com/vs/older-downloads/). should work too. +### How to build + +You have to build the dependancies (in ./deps/build) +``` +cmake .. -G "Visual Studio 16 2019" -A x64 +msbuild /m ALL_BUILD.vcxproj +``` + +and then build superslicer (in ./build): +``` +cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH="PATH_TO_SuperSlicer\deps\destdir\usr\local" +msbuild /m /P:Configuration=Release INSTALL.vcxproj +``` +You can also build it in visual studio, for that open the .sln. +Note that you need to have `libgmp-10.dll` and `libmpfr-4.dll` next to your built superslicer. You can get them from any superslicer release. + +If you want to create the zipped release, you can follow this [script](https://github.com/supermerill/SuperSlicer/blob/master/.github/workflows/ccpp_win.yml). + +# Old doc, not up-to-date: ### Building the dependencies package yourself diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dead65581..3f2e38a6f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -91,7 +91,7 @@ endif() # Create a slic3r executable # Process mainfests for various platforms. -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/PrusaSlicer.rc.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/SuperSlicer.rc.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/PrusaSlicer-gcodeviewer.rc.in ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer-gcodeviewer.rc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/PrusaSlicer.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.manifest @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index 39d0c9a10..02353bab2 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -23,7 +23,6 @@ namespace Slic3r { class ExPolygon; class Surface; -enum InfillPattern : int; namespace FillAdaptive { struct Octree; diff --git a/src/libslic3r/GCode/FanMover.cpp b/src/libslic3r/GCode/FanMover.cpp index 48091dbec..2b9809dbb 100644 --- a/src/libslic3r/GCode/FanMover.cpp +++ b/src/libslic3r/GCode/FanMover.cpp @@ -92,7 +92,7 @@ int16_t get_fan_speed(const std::string &line, GCodeFlavor flavor) { } -void FanMover::_put_in_middle_G1(std::list::iterator &item_to_split, float nb_sec, BufferData &&line_to_write) { +void FanMover::_put_in_middle_G1(std::list::iterator item_to_split, float nb_sec, BufferData &&line_to_write) { //std::cout << "_put_in_middle_G1\n"; assert(item_to_split != m_buffer.end()); if (nb_sec < item_to_split->time * 0.1) { diff --git a/src/libslic3r/GCode/FanMover.hpp b/src/libslic3r/GCode/FanMover.hpp index 50086a8c9..f00c3fcfd 100644 --- a/src/libslic3r/GCode/FanMover.hpp +++ b/src/libslic3r/GCode/FanMover.hpp @@ -73,13 +73,13 @@ private: m_buffer.emplace_back(data); return m_buffer.back(); } - std::list::iterator remove_from_buffer(std::list::iterator& data) { + std::list::iterator remove_from_buffer(std::list::iterator data) { m_buffer_time_size -= data->time; return m_buffer.erase(data); } // Processes the given gcode line void _process_gcode_line(GCodeReader& reader, const GCodeReader::GCodeLine& line); - void _put_in_middle_G1(std::list::iterator& item_to_split, float nb_sec, BufferData&& line_to_write); + void _put_in_middle_G1(std::list::iterator item_to_split, float nb_sec, BufferData&& line_to_write); void _print_in_middle_G1(BufferData& line_to_split, float nb_sec, const std::string& line_to_write); void _remove_slow_fan(int16_t min_speed, float past_sec); }; diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 15a1a758c..62765cc55 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -479,11 +479,13 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename) in.close(); std::error_code err_code; - if (err_code = rename_file(out_path, filename)) - if(copy_file(out_path, filename, (std::string("Failed to rename the output G-code file from ") + out_path + " to " + filename + '\n' + - "Is " + out_path + " locked? (gcp)" + err_code.message() + '\n'), true) != SUCCESS) + if (err_code = rename_file(out_path, filename)) { + std::string err_msg = (std::string("Failed to rename the output G-code file from ") + out_path + " to " + filename + '\n' + + "Is " + out_path + " locked? (gcp)" + err_code.message() + '\n'); + if (copy_file(out_path, filename, err_msg, true) != SUCCESS) throw Slic3r::RuntimeError(std::string("Failed to rename the output G-code file from ") + out_path + " to " + filename + '\n' + "Is " + out_path + " locked? (gcp)" + err_code.message() + '\n'); + } } const std::vector> GCodeProcessor::Producers = { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 042535d3f..9c3028ed3 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -78,7 +78,7 @@ enum AuthorizationType { atKeyPassword, atUserPassword }; -enum InfillPattern { +enum InfillPattern : uint8_t{ ipRectilinear, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb, ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, diff --git a/src/platform/msw/PrusaSlicer-gcodeviewer.rc.in b/src/platform/msw/PrusaSlicer-gcodeviewer.rc.in index eed737cb7..926c57c34 100644 --- a/src/platform/msw/PrusaSlicer-gcodeviewer.rc.in +++ b/src/platform/msw/PrusaSlicer-gcodeviewer.rc.in @@ -22,4 +22,4 @@ PRODUCTVERSION @SLIC3R_RC_VERSION@ } } 2 ICON "@SLIC3R_RESOURCES_DIR@/icons/PrusaSlicer-gcodeviewer.ico" -1 24 "PrusaSlicer.manifest" +1 24 "slic3r.manifest" diff --git a/src/platform/msw/PrusaSlicer.rc.in b/src/platform/msw/SuperSlicer.rc.in similarity index 100% rename from src/platform/msw/PrusaSlicer.rc.in rename to src/platform/msw/SuperSlicer.rc.in diff --git a/tests/fff_print/test_data.cpp b/tests/fff_print/test_data.cpp index 99e850383..ca78a76bb 100644 --- a/tests/fff_print/test_data.cpp +++ b/tests/fff_print/test_data.cpp @@ -175,7 +175,7 @@ void init_print(std::vector &&meshes, Slic3r::Print &print, Slic3r } print.apply(model, config); - model.arrange_objects(model, InfiniteBed{}, ArrangeParams{ scaled(min_object_distance(config))}); + arrange_objects(&print, model, InfiniteBed{}, ArrangeParams{ scaled(print.config().min_object_distance()) }); print.apply(model, config); print.validate(); print.set_status_silent(); diff --git a/tests/fff_print/test_model.cpp b/tests/fff_print/test_model.cpp index ab1b77691..c437a507d 100644 --- a/tests/fff_print/test_model.cpp +++ b/tests/fff_print/test_model.cpp @@ -43,7 +43,7 @@ SCENARIO("Model construction", "[Model]") { } model_object->add_instance(); print.apply(model, config); // apply config for arrange_objects - arrange_objects(print, model, InfiniteBed{scaled(Vec2d(100, 100))}, ArrangeParams{scaled(min_object_distance(config))}); + arrange_objects(&print, model, InfiniteBed{ scaled(Vec2d(100, 100)) }, ArrangeParams{ scaled(print.config().min_object_distance()) }); model_object->ensure_on_bed(); print.auto_assign_extruders(model_object); THEN("Print works?") { diff --git a/tests/libslic3r/test_voronoi.cpp b/tests/libslic3r/test_voronoi.cpp index b847a890b..165984d12 100644 --- a/tests/libslic3r/test_voronoi.cpp +++ b/tests/libslic3r/test_voronoi.cpp @@ -21,7 +21,7 @@ using boost::polygon::voronoi_diagram; using namespace Slic3r; -using VD = Geometry::VoronoiDiagram; +using VD = Slic3r::VoronoiDiagram; // https://svn.boost.org/trac10/ticket/12067 // This bug seems to be confirmed.