Skip to content

Instantly share code, notes, and snippets.

@fujin
Last active July 22, 2019 08:38
Show Gist options
  • Save fujin/78e3ebda0f6c39d23ce1bb2a904db83c to your computer and use it in GitHub Desktop.
Save fujin/78e3ebda0f6c39d23ce1bb2a904db83c to your computer and use it in GitHub Desktop.
PrusaSlicer build steps (macOS - 11/06/2019)
#!/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)
@fujin
Copy link
Author

fujin commented Jun 11, 2019

@vojtechkral
Copy link

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.

@domesticatedviking
Copy link

You should not need to give execute permissions (+x) or ./ if run with bash 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!

@kenjichanhkg
Copy link

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?

@kenjichanhkg
Copy link

also, my TBB is 2019_U8, not 2019_U6

@kenjichanhkg
Copy link

and the GL view is not working
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment