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

Switches from bundled to packaged nlohmann-json #343

Merged
merged 1 commit into from
Feb 12, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/cmake-mac-13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
#brew unlink python@3.12 && brew link --overwrite python@3.12 # Hack to prevent brew-installed python from interfering with preinstalled python
# maybe: brew unlink python && brew link --overwrite python # alt hack
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete # Alt hack
brew install libomp glfw armadillo hdf5
brew install libomp glfw armadillo hdf5 nlohmann-json

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake-mac-14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
run: |
brew update
brew install libomp glfw armadillo hdf5
brew install libomp glfw armadillo hdf5 nlohmann-json

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
run: |
brew update
brew install libomp glfw armadillo hdf5
brew install libomp glfw armadillo hdf5 nlohmann-json

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: sudo apt update

- name: Install dependencies
run: sudo apt-get install libgbm-dev freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev
run: sudo apt-get install libgbm-dev freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev nlohmann-json3-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake-ubuntu-2204.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: sudo apt update

- name: Install dependencies
run: sudo apt-get install libgbm-dev freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev
run: sudo apt-get install libgbm-dev freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev nlohmann-json3-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake-ubuntu-2404.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: sudo apt update

- name: Install dependencies
run: sudo apt-get install libgbm-dev freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev
run: sudo apt-get install libgbm-dev freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev nlohmann-json3-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AUTOMOC requires 2.8.6. The CMAKE_CXX_STANDARD variable requires 3.1.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project(morphologica)
# Note that the project version is encoded in morph/version.h and not in this CMakeLists.txt

Expand Down Expand Up @@ -171,6 +170,9 @@ include_directories(${GLFW3_INCLUDE_DIR})
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})

# Use packaged nlohmann json
find_package(nlohmann_json REQUIRED)

# If Qt5 is present, then some optional Qt examples will be compiled
find_package(Qt5 QUIET COMPONENTS Gui Core Widgets)
set(FOUND_QT_AND_HAVE_NO_GLEW 0)
Expand Down
2 changes: 1 addition & 1 deletion README.build.linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To install the visualization dependencies on Ubuntu or Debian Linux:
```sh
sudo apt install build-essential cmake git \
freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev \
libglfw3-dev libfreetype-dev
libglfw3-dev libfreetype-dev nlohmann-json3-dev

```
For the optional dependencies it's:
Expand Down
30 changes: 26 additions & 4 deletions README.build.mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ ports (Option 1, below). This does lead to the installation of a great deal of
additional software, some of which can conflict with Mac system
software (that's libiconv, in particular). However, a clean install of
Mac ports will successfully install the dependencies for
morphologica.
morphologica. Another managed option to to use the brew system (Option 3, below).

I'd advise you to use Option 1: Mac Ports only if you
*already* use Mac Ports, other wise, prefer Option 2: Manual
dependency builds.
I'd advise you to use Option 1: Mac Ports only if you *already* use Mac Ports, and Option 3 if you already use brew.
Otherwise, prefer Option 2: Manual dependency builds.

### Option 1: Mac Ports

Expand Down Expand Up @@ -75,6 +74,15 @@ add these lines to ~/.zprofile so that I can type cmake at the terminal:
export PATH="/Applications/CMake.app/Contents/bin:${PATH}"
```

### Option 3: brew

The morphologica github actions for mac runners use brew to install
dependencies. The command for the basic dependencies is

```sh
brew install libomp glfw armadillo hdf5
```

#### Armadillo

Armadillo is a library for matrix manipulation. The only place it's used in
Expand Down Expand Up @@ -166,6 +174,20 @@ make
sudo make install
```

#### nlohmann json

You'll need a package of nlohmann json.

```sh
sudo brew install nlohmann-json
```
```sh
sudo port install nlohmann-json
```

Or install manually from https://github.com/nlohmann/json


## Build morphologica on Mac

To build morphologica itself, it's the usual CMake process:
Expand Down
1 change: 1 addition & 0 deletions README.cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ find_package(Armadillo REQUIRED) # Only required if you use the Bezier curve c
find_package(OpenGL REQUIRED) # This, glfw3 and Freetype are required for morph::Visual
find_package(glfw3 3.3 REQUIRED)
find_package(Freetype REQUIRED)
find_package(nlohmann-json REQUIRED)

# Define collections of includes for the dependencies
set(MORPH_INC_CORE ${ARMADILLO_INCLUDE_DIR} ${ARMADILLO_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR})
Expand Down
1 change: 0 additions & 1 deletion include/nlohmann/CMakeLists.txt

This file was deleted.

Loading