Skip to content

Commit

Permalink
Fix CMakeLists.txt and refactor .gitignore
Browse files Browse the repository at this point in the history
Increase CMake minimum required version to 3.15 due to incompatibilities
with scikit-build-core. Update README.md.

Add POLICY checks to avoid errors on policy-unsupported versions.

Change CMP0167 policy of Boost searching to OLD due to non-compliance
with "Modern CMake" development patterns. Add "TODO" to fix this later.
Add useful logs to understand what Boost libraries were found by CMake.

Refactor .gitignore to improve readability:
Remove legacy unused files and directories;
Add .DS_Store, which is generated in macOS directories;
Add .cache, which is generated by clangd plugin in IDE.
  • Loading branch information
Vdaleke committed Dec 9, 2024
1 parent 98ee1d3 commit d4cf129
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
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()

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 ()
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
6 changes: 3 additions & 3 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 Down Expand Up @@ -303,9 +303,9 @@ 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
export DYLD_LIBRARY_PATH=/usr/local/lib:${DYLD_LIBRARY_PATH}
```
The first two lines set GCC as the default compiler in CMake. The 3rd export is also necessary due to issues with GCC 14 and
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.

Expand Down

0 comments on commit d4cf129

Please sign in to comment.