Skip to content

Commit

Permalink
Add macOS-GCC CI configuration
Browse files Browse the repository at this point in the history
Add missing steps in install-dependencies action.
Add configuration to core-tests and bindings-tests workflows.
Add --formula flag to `brew install cmake` to disable warning.

Fix missed includes in bind_primitive.h

Set C++ as CMake project language, remove C-compilers exports.
  • Loading branch information
Vdaleke committed Jan 30, 2025
1 parent 50b2ba3 commit c9785d6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
29 changes: 21 additions & 8 deletions .github/composite-actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ runs:
shell: bash
if: env.OS == 'ubuntu'
- name: Install build tools using brew
run: brew install make cmake
run: brew install make cmake --formula
shell: bash
if: env.OS == 'macos'

- name: Install GCC toolset
- name: Install GCC toolset (on Ubuntu)
run: |
sudo apt-get install gcc-10 g++-10 -y
shell: bash
if: inputs.install-toolset == 'true' && inputs.toolset == 'gcc'
- name: Install Clang toolset (on Linux)
if: inputs.install-toolset == 'true' && inputs.toolset == 'gcc' && env.OS == 'ubuntu'
- name: Install Clang toolset (on Ubuntu)
# "all" option is needed to install libc++ and libc++abi
# apt is hardcoded in llvm.sh, so we can't use it everywhere
run: |
Expand All @@ -78,6 +78,11 @@ runs:
sudo ./llvm.sh 17 all
shell: bash
if: inputs.install-toolset == 'true' && inputs.toolset == 'llvm-clang' && env.OS == 'ubuntu'
- name: Install GCC toolset (on macOS)
run: |
brew install gcc@14
shell: bash
if: inputs.install-toolset == 'true' && inputs.toolset == 'gcc' && env.OS == 'macos'
- name: Install LLVM Clang toolset (on macOS)
run: brew install llvm@17
shell: bash
Expand Down Expand Up @@ -139,19 +144,27 @@ runs:
./bootstrap.sh --with-libraries=container,thread,graph
sudo ./b2 install --prefix=/usr
shell: bash
if: inputs.install-boost == 'true' && inputs.toolset == 'gcc'
- name: Install Boost built with Clang (on Linux)
if: inputs.install-boost == 'true' && inputs.toolset == 'gcc' && env.OS == 'ubuntu'
- name: Install Boost built with Clang (on Ubuntu)
run: |
cd lib/boost
./bootstrap.sh
./bootstrap.sh --with-libraries=container,thread,graph
sudo ./b2 install -a --prefix=/usr toolset=clang cxxflags="-stdlib=libc++" \
linkflags="-stdlib=libc++"
shell: bash
if: inputs.install-boost == 'true' && inputs.toolset == 'llvm-clang' && env.OS == 'ubuntu'
- name: Install Boost built with GCC (on macOS)
run: |
cd lib/boost
./bootstrap.sh --with-libraries=container,thread,graph
echo "using darwin : : g++-14 ;" > user-config.jam
sudo ./b2 install -a --user-config=user-config.jam --prefix=/usr/local
shell: bash
if: inputs.install-boost == 'true' && inputs.toolset == 'gcc' && env.OS == 'macos'
- name: Install Boost built with LLVM Clang (on macOS)
run: |
cd lib/boost
./bootstrap.sh
./bootstrap.sh --with-libraries=container,thread,graph
echo "using darwin : : $(brew --prefix llvm@17)/bin/clang++ ;" > user-config.jam
sudo ./b2 install -a --user-config=user-config.jam --prefix=/usr/local \
cxxflags="-std=c++11 -I$(brew --prefix llvm@17)/include" \
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/check-codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ jobs:
download-pybind: true
- name: Generate compile_commands.json
run: |
cmake -DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10 \
cmake -DCMAKE_CXX_COMPILER=g++-10 \
-DCMAKE_BUILD_TYPE=Debug \
-Dgtest_disable_pthreads=OFF \
-DASAN=OFF \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()

project(Desbordante)
project(Desbordante CXX)

option(COPY_PYTHON_EXAMPLES "Copy Python examples" OFF)
option(COMPILE_TESTS "Build tests" ON)
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ To install Desbordante type:
$ pip install desbordante
```

However, as Desbordante core uses C++, additional requirements on the machine are imposed. Therefore this installation option may not work for everyone. Currently, only manylinux2014 (Ubuntu 20.04+, or any other linux distribution with gcc 10+) is supported. If the above does not work for you consider building from sources.
However, as Desbordante core uses C++, additional requirements on the machine are imposed. Therefore this installation option may not work for everyone. Currently, only manylinux2014 (Ubuntu 20.04+, or any other linux distribution with gcc 10+) and macOS 11.0+ (arm64, x86_64) is supported. If the above does not work for you consider building from sources.

## Build instructions

Expand All @@ -265,11 +265,10 @@ Instructions for other supported compilers can be found in [Desbordante wiki](ht

Run the following commands:
```sh
sudo apt install gcc g++ cmake libboost-all-dev git-lfs python3
export CC=gcc
sudo apt install g++ cmake libboost-all-dev git-lfs python3
export CXX=g++
```
The last 2 lines set gcc as CMake compiler in your terminal session.
The last line sets g++ as CMake compiler in your terminal session.
You can also add them to the end of `~/.profile` to set this by default in all sessions.

#### macOS dependencies installation (Apple Clang)
Expand All @@ -292,11 +291,10 @@ After that, restart the terminal and check the version of CMake again, now it sh

Run the following commands:
```sh
export CC=clang
export CXX=clang++
export BOOST_ROOT=$(brew --prefix boost)
```
These commands set Apple Clang as CMake compiler in your terminal session.
These commands set Apple Clang and Homebrew Boost as default in CMake in your terminal session.
You can also add them to the end of `~/.profile` to set this by default in all sessions.

### Building the project
Expand Down
2 changes: 2 additions & 0 deletions src/python_bindings/py_util/bind_primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <array>
#include <cstddef>
#include <sstream>
#include <string>
#include <type_traits>

#include <pybind11/pybind11.h>
Expand Down

0 comments on commit c9785d6

Please sign in to comment.