-
-
Save fujin/78e3ebda0f6c39d23ce1bb2a904db83c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
# For `nproc` | |
brew install coreutils | |
# this is 2019_U6, but the cmake script doesn't find it - specify TBB_LIBRARIES_RELEASE as an arg to cmake, with `-D` | |
brew install tbb | |
# The BOOST_REQUIRED_VERSION in PrusaSlicer is 1.64, but that is quite old, | |
# and has been removed from the homebrew-core formula repo. | |
# I took the old 1.64 formula from here: https://github.com/Homebrew/homebrew-core/blob/3df9cdfc25f796ec8d3ffd0a0a12476cf6d413d5/Formula/boost.rb | |
# and put it on a Gist to streamline the install process. | |
# | |
# Be sure to read the homebrew formula if you are concerned. | |
brew install https://gist.github.com/fujin/8f791d879901586b683fff655655425a/raw/fc63d3df397f9340f06a358a8644cff0ba108637/boost.rb | |
# the version 3.0.4 is too old, so remove the old one, and install from Git repository HEAD (compile - takes 11min.) | |
brew uninstall wxwidgets && \ | |
brew install wxwidgets --HEAD |
#!/usr/bin/env bash | |
mkdir build | |
cd build | |
# Fetch some non-brew deps, build them, point cmake at TBB, and an macOS specific compiler flag requirement. | |
# If you want to build a DEBUG build, specify -DTBB_LIBRARIES_DEBUG. | |
# Note that COMPILE_FLAGS is not used for the actual build; but one of the tests cmake performs. | |
cmake .. -DTBB_LIBRARIES_RELEASE=/usr/local/Cellar/tbb/2019_U6/lib/libtbb.dylib -DCMAKE_PREFIX_PATH="${PWD}/../deps/build/destdir/usr/local" -DCOMPILE_FLAGS="-fdeclspec" | |
# Build/download deps etc, non-parallel. | |
time make | |
# Alternatively, for parallel compilation | |
# time make -j $(nproc) |
Thanks for the feedback. Editing it now :)
Could you please make a note of the sequence that these scripts should be run in, and indicate the commands needed to run cmake on both the deps and the main source?
adding the j1 to the second call to make in deps.sh resulted in an error for me. I removed it.
Compiling continued but now I'm getting the following errors:
This should be all of the steps.
Build
git clone https://github.com/prusa3d/PrusaSlicer.git
cd PrusaSlicer
brew install wget # or use cURL, or your browser
wget https://gist.githubusercontent.com/fujin/78e3ebda0f6c39d23ce1bb2a904db83c/raw/79d3cb708187c688451d120748a7fadaaa02c109/brew.sh
wget https://gist.githubusercontent.com/fujin/78e3ebda0f6c39d23ce1bb2a904db83c/raw/79d3cb708187c688451d120748a7fadaaa02c109/deps.sh
bash brew.sh # 15 minutes
bash deps.sh # 12:25.88 total on '19 MBA (4x parallelism)
Check bin
file src/prusa-slicer
Output should be:
src/prusa-slicer: Mach-O 64-bit executable x86_64
To run:
./src/prusa-slicer
Not sure if they have cmake/make targets set up for packaging into a .app
or anything like that.
don't forget to mark the two downloaded scripts as executable
chmod +x deps.sh
chmod +x brew.sh
To run them you will need to preface them with a dot and a forward slash ie:
./brew.sh
./deps.sh
You should not need to give execute permissions (+x) or ./
if run with bash foo.sh
, but that way is also fine :-)
I have not tracked down the source of that wxwidgets issue yet. It looks like SetWidth() was deprecated in 3.1.2 - between the version of wxwidgets that is too old (in brew, 3.0.4), and the HEAD version, from Git: https://docs.wxwidgets.org/trunk/classwx_bitmap.html#a82c54a43db80f31c9ff70b0e18a1d972
I think we will need to look at the CMakeList to figure out the exact version of wxwidgets that is required, then find or modify the formula for wxwidgets to suit. Will get back to you on that 👍
Looks like it should be 3.1: https://github.com/prusa3d/PrusaSlicer/blob/6136fe7d92e386f1a6a6ab227f49c7d6a68abbb3/src/CMakeLists.txt#L49
the nproc variable wasn't set so I hardcoded the last line to "time make -j1" (it will be slower that way, but I didn't feel like looking up how many processors I had allocated.)
The way the -j
options works with the deps build is a bit whimsical at the moment. If you specify -jN
at the top level, the downloads will be parallelized and some of the dependencies builds will be paralellized too but in a different way / by default. You can notice at the top of the deps/CMakeLists.txt
file there's a call to ProcessorCount()
which should be cross-platform. This number is then forwarded to boost build and autotools-based builds. As for CMake builds, I'm not sure, honestly, I'm not doing any custom settings on those. On Linux, it apperas the top-level -j
option is forwarded to CMake builds via MAKEFLAGS
, but I'm not sure if this is the case on Mac OS too.
I should probably fix this.
You should not need to give execute permissions (+x) or
./
if run withbash foo.sh
, but that way is also fine :-)
Apologies, I could have sworn that there was no "bash" on that line. And the part about permissions not being required when invoking .sh scripts that way? Yeah, I didn't know that. Thanks!
I had to change code in BonjourDialog.cpp to get it compiled, I got this error
PrusaSlicer/src/slic3r/GUI/BonjourDialog.cpp:111:15: error: no matching constructor for initialization of 'wxTimerEvent'
wxTimerEvent evt_dummy;
I have to change
wxTimerEvent evt_dummy;
to
wxTimerEvent evt_dummy(*timer);
any idea, why?
also, my TBB is 2019_U8, not 2019_U6
First of all, I love you. I have been working on this for 3 days.
Secondly, a couple of issues prevented this from working right away for me, both in deps.sh (which needs to be located in and run from the deps folder BTW)
-DTBB_LIBRARIRES_RELEASE contains a typo, should be -DTBB_LIBRARIES_RELEASE
The continuation slashes at the ends of the long cmake lines also didn't work for me - I made that into one long line and then it finally found everything and began compiling
the nproc variable wasn't set so I hardcoded the last line to "time make -j1" (it will be slower that way, but I didn't feel like looking up how many processors I had allocated.)
Again, thank you!!! I think this might actually work.