-
Notifications
You must be signed in to change notification settings - Fork 47
macOS Developer Setup
Pablo Hoch edited this page May 12, 2021
·
3 revisions
The steps to build the MOTIS distribution you can also download can found be here.
Requirements:
- 64-bit Intel CPU
- macOS 10.14 or newer
- Command Line Tools for Xcode or Xcode:
xcode-select --install
or manual download - Clang 11 (or newer)
- CMake 3.17 (or newer)
- Ninja
- Git
Note: Unix Makefiles are not working. Please use Ninja to build.
Note: If you want to use clang-tidy, use Clang 11 from Homebrew.
This requires a recent macOS (10.15 or newer) and Xcode (latest version). Install Homebrew, then install the required tools:
xcode-select --install
brew install git cmake ninja clang-format
To build motis
:
git clone [email protected]:motis-project/motis.git
cd motis
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
ninja
Optional toolchain file (e.g. $HOME/toolchains/apple-clang-toolchain.cmake
):
# apple-clang-toolchain.cmake
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_C_FLAGS_INIT "-fcolor-diagnostics")
set(CMAKE_CXX_FLAGS_INIT "-fcolor-diagnostics -fvisibility=hidden")
cmake -DCMAKE_TOOLCHAIN_FILE=$HOME/toolchains/apple-clang-toolchain.cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
Install Homebrew, then install the required tools:
brew install git cmake ninja llvm@11 clang-format
Create a toolchain file for the Clang 11 compiler installed via Homebrew, for example in $HOME/toolchains/clang11-toolchain.cmake
:
# clang11-toolchain.cmake
set(CMAKE_C_COMPILER /usr/local/opt/llvm@11/bin/clang)
set(CMAKE_CXX_COMPILER /usr/local/opt/llvm@11/bin/clang++)
set(CMAKE_C_FLAGS_INIT "-fcolor-diagnostics")
set(CMAKE_CXX_FLAGS_INIT "-fcolor-diagnostics -stdlib=libc++ -fvisibility=hidden")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-L/usr/local/opt/llvm@11/lib -Wl,-rpath,/usr/local/opt/llvm@11/lib")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-L/usr/local/opt/llvm@11/lib -Wl,-rpath,/usr/local/opt/llvm@11/lib")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-L/usr/local/opt/llvm@11/lib -Wl,-rpath,/usr/local/opt/llvm@11/lib")
set(MOTIS_CLANG_TIDY_COMMAND /usr/local/opt/llvm@11/bin/clang-tidy)
This assumes that Homebrew is installed in /usr/local
(which is the default).
To build motis
:
git clone [email protected]:motis-project/motis.git
cd motis
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$HOME/toolchains/clang11-toolchain.cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
ninja