Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMakeLists.txt, macOS guide and refactor .gitignore #492

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
cmake-build-debug/
# Build directories, libraries and binary files
**/myeasylog.log
build/
Build/
BUILD/
bUILD/
Datasets/
.sconsign.dblite
cmake-build-debug/
dist/
lib/
.csv
venv/

# IDE and related files
.cache/
.idea/
.vscode/
**/myeasylog.log
dist
venv

# OS Generated file
**/.DS_Store
25 changes: 20 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0144 NEW)
cmake_minimum_required(VERSION 3.15)
if (POLICY CMP0167)
# deprecated by definition, but we use old behaviour for find_package(Boost) to load CMake's FindBoost module
# TODO: port project to "Modern CMake" https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
cmake_policy(SET CMP0167 OLD)
endif()
if (POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()

Vdaleke marked this conversation as resolved.
Show resolved Hide resolved
project(Desbordante)

option(COPY_PYTHON_EXAMPLES "Copy Python examples" OFF)
Expand Down Expand Up @@ -103,9 +111,16 @@ endif()

# configuring boost
set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost 1.81.0 REQUIRED COMPONENTS container thread graph CONFIG)
include_directories(${Boost_INCLUDE_DIRS})
message(${Boost_INCLUDE_DIRS})

find_package(Boost 1.81.0 REQUIRED COMPONENTS container thread graph)
if (Boost_FOUND)
message(STATUS "Found Boost include dirs: ${Boost_INCLUDE_DIRS}")
include_directories( ${Boost_INCLUDE_DIRS})
message(STATUS "Found Boost library dirs: ${Boost_LIBRARY_DIRS}")
else ()
Vdaleke marked this conversation as resolved.
Show resolved Hide resolved
message(FATAL_ERROR "Boost not found. If boost is installed specify environment"
"variables like \"BOOST_ROOT\" for hint to CMake where to search")
endif()

# providing subdirectories for header inclusion
include_directories(
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ The following instructions were tested on Ubuntu 20.04+ LTS and macOS Sonoma 14.
Prior to cloning the repository and attempting to build the project, ensure that you have the following software:

- GNU GCC, version 10+
- CMake, version 3.13+
- CMake, version 3.15+
- Boost library built with GCC, version 1.81.0+

To use test datasets you will need:
Expand All @@ -256,7 +256,7 @@ To use test datasets you will need:

Run the following commands:
```sh
sudo apt install gcc g++ cmake libboost-all-dev git-lfs
sudo apt install gcc g++ cmake libboost-all-dev git-lfs python3
export CC=gcc
export CXX=g++
```
Expand All @@ -271,31 +271,30 @@ xcode-select --install
```
Follow the prompts to continue.

To install GCC and CMake on macOS we recommend to use [Homebrew](https://brew.sh/) package manager. With Homebrew
To install GCC, CMake and python on macOS we recommend to use [Homebrew](https://brew.sh/) package manager. With Homebrew
installed, run the following commands:
```sh
brew install gcc@14 cmake
brew install gcc@14 cmake python3
```
After installation, check `cmake --version`. If command is not found, then you need to add to environment path to
homebrew installed packages. To do this open `~/.zprofile` (for Zsh) or
`~/.bash_profile` (for Bash) and add to the end of the file the output of `brew shellenv`.
After that, restart the terminal and check the version of CMake again, now it should be displayed.

Then you need to install Boost library built with GCC. Please avoid using Homebrew for this, as the Boost version provided by Homebrew
is built with Clang, which has a different ABI. Instead, download the latest version of Boost from the [official website](https://www.boost.org/users/download/) and unpack the archive to the `/usr/local/` directory or another directory of your choice:
is built with Clang, which has a different ABI. Instead, download the latest version of Boost from the [official website](https://www.boost.org/users/download/), open terminal and run:
```sh
cd /usr/local/
cd ~/Downloads
curl https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.bz2 --output "boost_1_86_0.tar.bz2"
tar xvjf boost_1_86_0.tar.bz2
rm boost_1_86_0.tar.bz2
tar xvjf boost_1_86_0.tar.bz2 && rm boost_1_86_0.tar.bz2
cd boost_1_86_0
```
Navigate to the unpacked Boost directory in the terminal and run the following commands:
```sh
./bootstrap.sh
echo "using darwin : : g++-14 ;" > user-config.jam
./b2 install --user-config=user-config.jam --layout=versioned
export BOOST_ROOT=$(pwd) # export Boost_ROOT=$(pwd) for CMake 3.26 and below.
sudo ./b2 install --user-config=user-config.jam --layout=versioned
export BOOST_ROOT=/usr/local/ # export Boost_ROOT=/usr/local/ for CMake 3.26 and below.
Vdaleke marked this conversation as resolved.
Show resolved Hide resolved
```
You can also add the last export with current path to `~/.zprofile` or `~/.bash_profile` to set this boost path by default.

Expand All @@ -304,10 +303,11 @@ Before building the project you must set locally or in the above-mentioned dotfi
export CC=gcc-14
export CXX=g++-14
export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/
export DYLD_LIBRARY_PATH=/usr/local/lib:${DYLD_LIBRARY_PATH}
```
The first two lines set GCC as the default compiler in CMake. The last export is also necessary due to issues with GCC 14 and
the last MacOSX15.0.sdk used by CMake by default, you can read more about this [here](https://gist.github.com/scivision/d69faebbc56da9714798087b56de925a)
and [here](https://github.com/iains/gcc-14-branch/issues/11).
The first two lines set GCC as the default compiler in CMake. The `SDKROOT` export is also necessary due to issues with GCC 14 and
the last macOS 15 SDK used by CMake by default, you can read more about this [here](https://gist.github.com/scivision/d69faebbc56da9714798087b56de925a)
and [here](https://github.com/iains/gcc-14-branch/issues/11). The last export is the solution for dynamic linking with python module.

### Building the project
#### Building the Python module using pip
Expand Down
Loading