From 0443b97a68875f31992091a1e8607b2a6e100535 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Sat, 26 Apr 2025 21:42:59 +0100 Subject: [PATCH 01/38] Created a nix development to try --- .envrc | 1 + CMakeLists.txt | 4 ++-- flake.lock | 25 +++++++++++++++++++++++++ flake.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/CMakeLists.txt b/CMakeLists.txt index d8f491c16..6d3223b46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the wa cmake_policy(SET CMP0167 NEW) # Use the new boost configuration endif() -set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) +#set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) project(DynamO) #Project name enable_testing() #Enable build of test executables and 'make test' command @@ -96,7 +96,7 @@ endif() ######### Dependencies ###################################################################### -set(Boost_USE_STATIC_LIBS ON) +#set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.70.0 REQUIRED system filesystem program_options unit_test_framework) diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..1d0fc8626 --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1739736696, + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", + "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", + "revCount": 754461, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.754461%2Brev-d74a2335ac9c133d6bbec9fc98d91a77f1604c1f/01951426-5a87-7b75-8413-1a0d9ec5ff04/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..6908895d6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,45 @@ +{ + description = "A Nix-flake-based C/C++ development environment"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + extraOutputsToInstall = [ "dev" ]; + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell.override + { + # Override stdenv in order to change compiler: + #stdenv = pkgs.clangStdenv; + } + { + packages = with pkgs; [ + clang + clang-tools + cmake + ninja + doxygen + vcpkg + vcpkg-tool + boost.dev + eigen + bzip2.dev + python3 + gtkmm3.dev + ffmpeg.dev + freeglut + glew + cairomm + pkg-config + ] ++ (if system == "aarch64-darwin" then [ ] else [ gdb ]); + }; + }); + }; +} + From cec7b5a0e3552cb524c140d03d9fbea4a6472304 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 28 Apr 2025 22:21:12 +0100 Subject: [PATCH 02/38] Enabled VScode build on nix for now --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d3223b46..de7f0a9f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,8 @@ if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the wa cmake_policy(SET CMP0167 NEW) # Use the new boost configuration endif() -#set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) +set(VCPKG_BOOTSTRAP_OPTIONS "-musl") +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) project(DynamO) #Project name enable_testing() #Enable build of test executables and 'make test' command From e692969ccb91d301fb0e0d57acf4d612deb7aa1a Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 29 Apr 2025 05:56:37 +0100 Subject: [PATCH 03/38] A fix for MSVC --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de7f0a9f2..1b933c98d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,12 @@ if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the wa cmake_policy(SET CMP0167 NEW) # Use the new boost configuration endif() -set(VCPKG_BOOTSTRAP_OPTIONS "-musl") + +if(NOT MSVC) + # To make this compile on NixOS, we need to use the static linked MSVC + # But this is not available on windows + set(VCPKG_BOOTSTRAP_OPTIONS "-musl") +endif() set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) project(DynamO) #Project name From 902d325a6e6c7cab51da371bfbbdf8f0dceda7ef Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 29 Apr 2025 06:18:40 +0100 Subject: [PATCH 04/38] Another fix for MSVC --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b933c98d..5ab6e7f51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,7 +102,7 @@ endif() ######### Dependencies ###################################################################### -#set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.70.0 REQUIRED system filesystem program_options unit_test_framework) From 2aa1feca7217dff13d95263a3b56c158d76cd41c Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 12 May 2025 11:54:04 +0100 Subject: [PATCH 05/38] Removed vcpkg as we move to nix --- .gitmodules | 3 --- CMakeLists.txt | 13 +++++++------ derivation.nix | 37 +++++++++++++++++++++++++++++++++++++ extern/vcpkg | 1 - shell.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 derivation.nix delete mode 160000 extern/vcpkg create mode 100644 shell.nix diff --git a/.gitmodules b/.gitmodules index 499547f6f..1d2c96bf4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "extern/stator"] path = extern/stator url = https://github.com/toastedcrumpets/stator.git -[submodule "vcpkg"] - path = extern/vcpkg - url = https://github.com/microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ab6e7f51..e89210568 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,13 @@ if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the wa endif() -if(NOT MSVC) - # To make this compile on NixOS, we need to use the static linked MSVC - # But this is not available on windows - set(VCPKG_BOOTSTRAP_OPTIONS "-musl") -endif() -set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) +# Disabled VCPKG as we move to nix +#if(NOT MSVC) +# # To make this compile on NixOS, we need to use the static linked MSVC +# # But this is not available on windows +# set(VCPKG_BOOTSTRAP_OPTIONS "-musl") +#endif() +#set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) project(DynamO) #Project name enable_testing() #Enable build of test executables and 'make test' command diff --git a/derivation.nix b/derivation.nix new file mode 100644 index 000000000..158769589 --- /dev/null +++ b/derivation.nix @@ -0,0 +1,37 @@ +{ + pkgs ? import {} +}: +pkgs.stdenv.mkDerivation rec { + pname = "dynamomd"; + version = "1.6.0"; + src = pkgs.fetchgit { + url = "https://github.com/dynamomd/dynamo"; + rev = "refs/heads/nix"; + sha256 = "sha256-p8+OoNBW7VABgIWXme6iLWEkiPe7v9yZqPveN4A+hKY="; + }; + + buildInputs = [ + pkgs.cmake + pkgs.git + pkgs.ninja + pkgs.gcc + pkgs.pkg-config + pkgs.bzip2.dev + ((pks: pks.python3.withPackages (ps: with ps; [ + numpy + ])) pkgs) + ]; + + configurePhase = '' + cmake . + ''; + + buildPhase = '' + cmake --build . + ''; + + installPhase = '' + mkdir -p $out/bin + mv chord $out/bin + ''; +} diff --git a/extern/vcpkg b/extern/vcpkg deleted file mode 160000 index b02e341c9..000000000 --- a/extern/vcpkg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b02e341c927f16d991edbd915d8ea43eac52096c diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..d4336d1af --- /dev/null +++ b/shell.nix @@ -0,0 +1,42 @@ +{ pkgs ? import { + config.allowUnfree = true; +} }: +let + envname = "platformio-fhs"; +in +(pkgs.buildFHSUserEnv { + name = envname; + targetPkgs = pkgs: (with pkgs; [ + bashInteractive # Needed to fix shell in vscode + git + ((pks: pks.python3.withPackages (ps: with ps; [ + numpy + ])) pkgs) + + # Basic build dependencies + cmake + + # VSCode with all the extensions I use + (vscode-with-extensions.override { + vscodeExtensions = with pkgs.vscode-extensions; [ + tuttieee.emacs-mcx + ms-vscode.cpptools + ms-vscode.cpptools-extension-pack + xaver.clang-format + ms-vscode.cmake-tools + #brobeson.ctest-lab + batisteo.vscode-django + grapecity.gc-excelviewer + github.vscode-github-actions + github.copilot + ms-vscode.live-server + #elagil.pre-commit-helper + ms-python.python + ms-python.debugpy + ms-vscode-remote.remote-ssh + dbaeumer.vscode-eslint + tomoki1207.pdf + ]; + }) + ]); +}).env From 31324ef5949270f8763bd21f8aa982a9f6ee5886 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 12 May 2025 21:41:57 +0100 Subject: [PATCH 06/38] Trying to build the derivation --- CMakeLists.txt | 2 +- derivation.nix => default.nix | 35 ++++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) rename derivation.nix => default.nix (56%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e89210568..fe38beacd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,7 @@ endif() ######### Dependencies ###################################################################### -set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.70.0 REQUIRED system filesystem program_options unit_test_framework) diff --git a/derivation.nix b/default.nix similarity index 56% rename from derivation.nix rename to default.nix index 158769589..ae8581ac4 100644 --- a/derivation.nix +++ b/default.nix @@ -10,16 +10,34 @@ pkgs.stdenv.mkDerivation rec { sha256 = "sha256-p8+OoNBW7VABgIWXme6iLWEkiPe7v9yZqPveN4A+hKY="; }; - buildInputs = [ - pkgs.cmake - pkgs.git - pkgs.ninja - pkgs.gcc - pkgs.pkg-config - pkgs.bzip2.dev + buildInputs = with pkgs; [ + # Basic build dependencies + cmake + git + ninja + gcc + pkg-config + bzip2.dev + boost.dev + clang-tools + eigen ((pks: pks.python3.withPackages (ps: with ps; [ numpy + #alive-progress + uncertainties + pandas + scipy + freud + networkx ])) pkgs) + + # Visualiser + gtkmm3.dev + ffmpeg.dev + freeglut + glew + cairomm + libpng ]; configurePhase = '' @@ -31,7 +49,6 @@ pkgs.stdenv.mkDerivation rec { ''; installPhase = '' - mkdir -p $out/bin - mv chord $out/bin + cmake --install . ''; } From 212f40aee1b5b1c1803f41bdc6cf3980750fbb30 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 12 May 2025 22:17:52 +0100 Subject: [PATCH 07/38] Package works but dynavis does not --- default.nix | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/default.nix b/default.nix index ae8581ac4..d876bdd4c 100644 --- a/default.nix +++ b/default.nix @@ -3,18 +3,19 @@ }: pkgs.stdenv.mkDerivation rec { pname = "dynamomd"; - version = "1.6.0"; - src = pkgs.fetchgit { - url = "https://github.com/dynamomd/dynamo"; - rev = "refs/heads/nix"; - sha256 = "sha256-p8+OoNBW7VABgIWXme6iLWEkiPe7v9yZqPveN4A+hKY="; - }; + version = "1.7.0"; + #src = pkgs.fetchgit { + # url = "https://github.com/dynamomd/dynamo"; + # rev = "f1fd582cd9ed09b52b7c99cdbf00cd1cebb3958c"; # "refs/heads/nix"; + # sha256 = "sha256-S3D15QD4NTVSM6PR7xqRQj7yvpq2MQj4WmHzspDKzTI="; + #}; + src = ./.; + buildInputs = with pkgs; [ # Basic build dependencies cmake git - ninja gcc pkg-config bzip2.dev @@ -40,15 +41,15 @@ pkgs.stdenv.mkDerivation rec { libpng ]; - configurePhase = '' - cmake . - ''; - - buildPhase = '' - cmake --build . - ''; - - installPhase = '' - cmake --install . - ''; + #configurePhase = '' + # cmake . + #''; + # + #buildPhase = '' + # cmake --build . -j32 + #''; + # + #installPhase = '' + # cmake --install . + #''; } From 51d6371aa4a82a53d88058080c15f317e67ad321 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 12:34:01 +0100 Subject: [PATCH 08/38] Got a build and install working, not sure about python packaging yet --- default.nix | 57 ++------------------------------------------------ derivation.nix | 46 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 45 --------------------------------------- pyproject.toml | 2 +- shell.nix | 42 ------------------------------------- 5 files changed, 49 insertions(+), 143 deletions(-) create mode 100644 derivation.nix delete mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/default.nix b/default.nix index d876bdd4c..469c3f9b1 100644 --- a/default.nix +++ b/default.nix @@ -1,55 +1,2 @@ -{ - pkgs ? import {} -}: -pkgs.stdenv.mkDerivation rec { - pname = "dynamomd"; - version = "1.7.0"; - #src = pkgs.fetchgit { - # url = "https://github.com/dynamomd/dynamo"; - # rev = "f1fd582cd9ed09b52b7c99cdbf00cd1cebb3958c"; # "refs/heads/nix"; - # sha256 = "sha256-S3D15QD4NTVSM6PR7xqRQj7yvpq2MQj4WmHzspDKzTI="; - #}; - - src = ./.; - - buildInputs = with pkgs; [ - # Basic build dependencies - cmake - git - gcc - pkg-config - bzip2.dev - boost.dev - clang-tools - eigen - ((pks: pks.python3.withPackages (ps: with ps; [ - numpy - #alive-progress - uncertainties - pandas - scipy - freud - networkx - ])) pkgs) - - # Visualiser - gtkmm3.dev - ffmpeg.dev - freeglut - glew - cairomm - libpng - ]; - - #configurePhase = '' - # cmake . - #''; - # - #buildPhase = '' - # cmake --build . -j32 - #''; - # - #installPhase = '' - # cmake --install . - #''; -} +{ pkgs ? import {} }: +pkgs.callPackage ./derivation.nix {} diff --git a/derivation.nix b/derivation.nix new file mode 100644 index 000000000..6b6a59118 --- /dev/null +++ b/derivation.nix @@ -0,0 +1,46 @@ +# see https://unix.stackexchange.com/questions/717168/how-to-package-my-software-in-nix-or-write-my-own-package-derivation-for-nixpkgs +{ pkgs, python3 }: +python3.pkgs.buildPythonPackage rec { + name = "dynamomd"; + src = ./.; + pyproject = true; + + dontUseCmakeConfigure = true; + + propagatedBuildInputs = with python3.pkgs; [ + scikit-build-core + numpy + alive-progress + uncertainties + pandas + scipy + freud + networkx + pytest + ]; + + nativeBuildInputs = with pkgs; [ + cmake + ninja + git + gcc + pkg-config + clang-tools + wrapGAppsHook3 + ] ++ propagatedBuildInputs; + + buildInputs = with pkgs; [ + # Basic build dependencies + bzip2.dev + boost.dev + eigen + + # Visualiser + gtkmm3.dev + ffmpeg.dev + freeglut + glew + cairomm.dev + libpng + ]; +} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 6908895d6..000000000 --- a/flake.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - description = "A Nix-flake-based C/C++ development environment"; - - inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; - - outputs = { self, nixpkgs }: - let - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit system; }; - }); - extraOutputsToInstall = [ "dev" ]; - in - { - devShells = forEachSupportedSystem ({ pkgs }: { - default = pkgs.mkShell.override - { - # Override stdenv in order to change compiler: - #stdenv = pkgs.clangStdenv; - } - { - packages = with pkgs; [ - clang - clang-tools - cmake - ninja - doxygen - vcpkg - vcpkg-tool - boost.dev - eigen - bzip2.dev - python3 - gtkmm3.dev - ffmpeg.dev - freeglut - glew - cairomm - pkg-config - ] ++ (if system == "aarch64-darwin" then [ ] else [ gdb ]); - }; - }); - }; -} - diff --git a/pyproject.toml b/pyproject.toml index df39c0331..52c7e8ed8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -dependencies = ["alive-progress", "pandas", "scipy", "uncertainties", "freud", "networkx"] +dependencies = ["alive-progress", "pandas", "scipy", "uncertainties", "networkx"] [tool.scikit-build] cmake.build-type = "Release" diff --git a/shell.nix b/shell.nix deleted file mode 100644 index d4336d1af..000000000 --- a/shell.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ pkgs ? import { - config.allowUnfree = true; -} }: -let - envname = "platformio-fhs"; -in -(pkgs.buildFHSUserEnv { - name = envname; - targetPkgs = pkgs: (with pkgs; [ - bashInteractive # Needed to fix shell in vscode - git - ((pks: pks.python3.withPackages (ps: with ps; [ - numpy - ])) pkgs) - - # Basic build dependencies - cmake - - # VSCode with all the extensions I use - (vscode-with-extensions.override { - vscodeExtensions = with pkgs.vscode-extensions; [ - tuttieee.emacs-mcx - ms-vscode.cpptools - ms-vscode.cpptools-extension-pack - xaver.clang-format - ms-vscode.cmake-tools - #brobeson.ctest-lab - batisteo.vscode-django - grapecity.gc-excelviewer - github.vscode-github-actions - github.copilot - ms-vscode.live-server - #elagil.pre-commit-helper - ms-python.python - ms-python.debugpy - ms-vscode-remote.remote-ssh - dbaeumer.vscode-eslint - tomoki1207.pdf - ]; - }) - ]); -}).env From 5e63f1aac9b144e4a9639fdb8690a22c002d4cc6 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 13:11:34 +0100 Subject: [PATCH 09/38] Fix python package name --- derivation.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/derivation.nix b/derivation.nix index 6b6a59118..2788724ae 100644 --- a/derivation.nix +++ b/derivation.nix @@ -1,7 +1,7 @@ # see https://unix.stackexchange.com/questions/717168/how-to-package-my-software-in-nix-or-write-my-own-package-derivation-for-nixpkgs { pkgs, python3 }: python3.pkgs.buildPythonPackage rec { - name = "dynamomd"; + name = "pydynamo"; src = ./.; pyproject = true; From 5367ecc01a043a0038564e849d14efca98f83c32 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 13:32:21 +0100 Subject: [PATCH 10/38] Testing a new CI workflow using nix --- .github/workflows/ci.yaml | 109 +++++++++++++------------------------- derivation.nix | 3 ++ 2 files changed, 40 insertions(+), 72 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9db15845c..70b41bd76 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,93 +6,58 @@ on: - push - pull_request jobs: - build-project: + nix-build: name: ${{ matrix.os }}-${{ github.workflow }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-15, windows-2022] - env: - # Indicates the location of the vcpkg as a Git submodule of the project repository. - # Not using "VCPKG_ROOT" because a variable with the same name is defined in the VS's - # Developer Command Prompt environment in VS 2022 17.6, which would override this one - # if it had the same name. - _VCPKG_: ${{ github.workspace }}/vcpkg - # Tells vcpkg where binary packages are stored. - VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache - # Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + os: [ubuntu-22.04, ubuntu-24.04, macos-15] #windows-2022 steps: - - uses: actions/github-script@v7 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/checkout@v4 with: submodules: true - - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" - run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE - shell: bash - - # Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. - - uses: lukka/get-cmake@latest - - # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching - # when it is being run afterwards by CMake. - - name: Restore vcpkg - uses: actions/cache@v4 + - name: Install Nix + uses: cachix/install-nix-action@v31 with: - # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the - # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. - path: | - ${{ env._VCPKG_ }} - !${{ env._VCPKG_ }}/buildtrees - !${{ env._VCPKG_ }}/packages - !${{ env._VCPKG_ }}/downloads - !${{ env._VCPKG_ }}/installed - # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. - key: | - ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} - - # On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. - # As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. - - uses: ilammy/msvc-dev-cmd@v1 - - # Run CMake to generate Ninja project files. - - name: Configure the build system - run: | - cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release + nix_path: nixpkgs=channel:nixos-stable + extra_nix_config: | + experimental-features = nix-command flakes + allow-import-from-derivation = true + sandbox = false + + - name: Build the nix package + run: nix-build + + hand-build: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, ubuntu-24.04, macos-15] #windows-2022 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install Nix + uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-stable + extra_nix_config: | + experimental-features = nix-command flakes + allow-import-from-derivation = true + sandbox = false + + - name: Configure the project + run: nix-shell --run "cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release" - name: Check code formatting if: runner.os == 'Linux' - run: | - cmake --build ${{github.workspace}}/build -j4 -t check-src-format --config Release - - # Build (Release configuration only) the whole project with Ninja (which is spawn by CMake). - - name: Build (Release configuration) - run: | - cmake --build ${{github.workspace}}/build -j4 --config Release + run: nix-shell --run "cmake --build ${{github.workspace}}/build -j4 -t check-src-format --config Release" # Test the whole project with CTest - name: Test (Release configuration) working-directory: ${{github.workspace}}/build - run: | - ctest -j 4 --output-on-failure -C Release - - - name: Package the project (python packages include more) - run: | - cmake --build ${{github.workspace}}/build -j4 -t package --config Release - - - name: Upload packages as artifacts - uses: actions/upload-artifact@v4 - with: - name: dynamo-${{ matrix.os }} - path: | - ${{ github.workspace }}/build/*.deb - ${{ github.workspace }}/build/*.sh - ${{ github.workspace }}/build/*.tar.gz - ${{ github.workspace }}/build/*.exe + run: nix-shell --run "ctest -j 4 --output-on-failure -C Release" \ No newline at end of file diff --git a/derivation.nix b/derivation.nix index 2788724ae..e6a6a7f6c 100644 --- a/derivation.nix +++ b/derivation.nix @@ -1,4 +1,7 @@ # see https://unix.stackexchange.com/questions/717168/how-to-package-my-software-in-nix-or-write-my-own-package-derivation-for-nixpkgs +# To install `nix-env -u -f default.nix` +# To develop `nix-shell` (will build the shell with dependencies) +# To test build `nix-build` { pkgs, python3 }: python3.pkgs.buildPythonPackage rec { name = "pydynamo"; From bb1395468639f182283d5e1a68dfc01f4c093912 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 13:44:25 +0100 Subject: [PATCH 11/38] Fixed nix channel --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 70b41bd76..b68c8e3bd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v31 with: - nix_path: nixpkgs=channel:nixos-stable + nix_path: nixpkgs=channel:nixos-24.11 extra_nix_config: | experimental-features = nix-command flakes allow-import-from-derivation = true @@ -44,7 +44,7 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v31 with: - nix_path: nixpkgs=channel:nixos-stable + nix_path: nixpkgs=channel:nixos-24.11 extra_nix_config: | experimental-features = nix-command flakes allow-import-from-derivation = true From aff4c0d4dbdd698d9fb3937e364b9550de460be7 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 13:48:37 +0100 Subject: [PATCH 12/38] Made CI recursively checkout submodules --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b68c8e3bd..07a15bcd6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: recursive - name: Install Nix uses: cachix/install-nix-action@v31 @@ -40,7 +40,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: recursive - name: Install Nix uses: cachix/install-nix-action@v31 with: From efd84d8b697c2fd170c6d1c7e29bcf50f8600d80 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 14:58:38 +0100 Subject: [PATCH 13/38] More fixes for nix CI --- .github/workflows/ci.yaml | 12 ++++++------ .github/workflows/python_wheels.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 07a15bcd6..e1c1e00b5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,9 +38,6 @@ jobs: matrix: os: [ubuntu-22.04, ubuntu-24.04, macos-15] #windows-2022 steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - name: Install Nix uses: cachix/install-nix-action@v31 with: @@ -49,15 +46,18 @@ jobs: experimental-features = nix-command flakes allow-import-from-derivation = true sandbox = false - + + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Configure the project run: nix-shell --run "cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release" - name: Check code formatting - if: runner.os == 'Linux' run: nix-shell --run "cmake --build ${{github.workspace}}/build -j4 -t check-src-format --config Release" # Test the whole project with CTest - name: Test (Release configuration) working-directory: ${{github.workspace}}/build - run: nix-shell --run "ctest -j 4 --output-on-failure -C Release" \ No newline at end of file + run: nix-shell --run ${{github.workspace}} "ctest -j 4 --output-on-failure -C Release" \ No newline at end of file diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 9dd96f492..06d86d5bd 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: recursive - uses: actions/setup-python@v5 with: From 887ef6720707699067309ee6567cfbd563b2c063 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 15:07:03 +0100 Subject: [PATCH 14/38] Another attempt to fix CI for nix --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e1c1e00b5..2dfcdde89 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,12 +52,12 @@ jobs: submodules: recursive - name: Configure the project - run: nix-shell --run "cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release" + run: nix-shell ${{github.workspace}} --run "cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release" - name: Check code formatting - run: nix-shell --run "cmake --build ${{github.workspace}}/build -j4 -t check-src-format --config Release" + run: nix-shell ${{github.workspace}} --run "cmake --build ${{github.workspace}}/build -j4 -t check-src-format --config Release" # Test the whole project with CTest - name: Test (Release configuration) working-directory: ${{github.workspace}}/build - run: nix-shell --run ${{github.workspace}} "ctest -j 4 --output-on-failure -C Release" \ No newline at end of file + run: nix-shell ${{github.workspace}} --run "ctest -j 4 --output-on-failure -C Release" \ No newline at end of file From 29ba81635bb044ed9ca39b3b0708fa1b496f4109 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 15:12:52 +0100 Subject: [PATCH 15/38] Add missing build step to nix CI --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2dfcdde89..eb15061f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,6 +54,9 @@ jobs: - name: Configure the project run: nix-shell ${{github.workspace}} --run "cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release" + - name: Build the project + run: nix-shell ${{github.workspace}} --run "cmake --build ${{github.workspace}}/build -j4 --config Release" + - name: Check code formatting run: nix-shell ${{github.workspace}} --run "cmake --build ${{github.workspace}}/build -j4 -t check-src-format --config Release" From c0c203df97bd379a30616aea46e38c15d016f4af Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 15:36:18 +0100 Subject: [PATCH 16/38] Added libGL dependency --- derivation.nix | 1 + flake.lock | 25 ------------------------- 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 flake.lock diff --git a/derivation.nix b/derivation.nix index e6a6a7f6c..0f5870721 100644 --- a/derivation.nix +++ b/derivation.nix @@ -39,6 +39,7 @@ python3.pkgs.buildPythonPackage rec { eigen # Visualiser + libGL.dev gtkmm3.dev ffmpeg.dev freeglut diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 1d0fc8626..000000000 --- a/flake.lock +++ /dev/null @@ -1,25 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1739736696, - "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", - "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", - "revCount": 754461, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.754461%2Brev-d74a2335ac9c133d6bbec9fc98d91a77f1604c1f/01951426-5a87-7b75-8413-1a0d9ec5ff04/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} From 6cf114419a2f15a0a880b607be11abd631daf940 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 15:57:13 +0100 Subject: [PATCH 17/38] Removing macos builds for now too. --- .github/workflows/ci.yaml | 4 ++-- src/magnet/magnet/GL/context.hpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eb15061f1..719d4fde9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-15] #windows-2022 + os: [ubuntu-22.04, ubuntu-24.04] #windows-2022, macos-15 steps: - uses: actions/checkout@v4 with: @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-15] #windows-2022 + os: [ubuntu-22.04, ubuntu-24.04] #windows-2022, macos-15 steps: - name: Install Nix uses: cachix/install-nix-action@v31 diff --git a/src/magnet/magnet/GL/context.hpp b/src/magnet/magnet/GL/context.hpp index 12b12d826..615fe6516 100644 --- a/src/magnet/magnet/GL/context.hpp +++ b/src/magnet/magnet/GL/context.hpp @@ -24,6 +24,9 @@ #ifdef _WIN32 #include typedef HGLRC ContextKey; +#elif +#include +typedef ContextKey; #else #include typedef GLXContext ContextKey; @@ -74,6 +77,8 @@ class Context { inline static ContextKey getCurrentContextKey() { #ifdef _WIN32 ContextKey key = wglGetCurrentContext(); +#elif __APPLE__ + ContextKey key = CGLGetCurrentContext(); #else ContextKey key = glXGetCurrentContext(); #endif From 20151c20e492f8af243c8d0a4d40d4bd9586adeb Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 16:00:32 +0100 Subject: [PATCH 18/38] Fix for GL --- src/magnet/magnet/GL/context.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magnet/magnet/GL/context.hpp b/src/magnet/magnet/GL/context.hpp index 615fe6516..abd372266 100644 --- a/src/magnet/magnet/GL/context.hpp +++ b/src/magnet/magnet/GL/context.hpp @@ -24,7 +24,7 @@ #ifdef _WIN32 #include typedef HGLRC ContextKey; -#elif +#elif __APPLE__ #include typedef ContextKey; #else From 00986738cefd31b154fc751c882c8a95bcc45f6e Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 16:10:27 +0100 Subject: [PATCH 19/38] Added build dependencies to CIBW --- .github/workflows/python_wheels.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 06d86d5bd..a101a13f6 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -32,8 +32,11 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse env: - CIBW_ARCHS_LINUX: auto64 # Seems 32 bit vcpkg dependencies are missing, so force 64 bit on linux - CIBW_SKIP: "*-musllinux_* pp*" # Skip musllinux builds for now as they fail, and skip pypy builds as they'll be disabled in cibuildwheel 3 anyway + #CIBW_ARCHS_LINUX: auto64 # Seems 32 bit vcpkg dependencies are missing, so force 64 bit on linux + #CIBW_SKIP: "*-musllinux_* pp*" # Skip musllinux builds for now as they fail, and skip pypy builds as they'll be disabled in cibuildwheel 3 anyway + CIBW_BEFORE_ALL_LINUX : sudo apt-get update && sudo apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev + + - uses: actions/upload-artifact@v4 with: From 47e697cb0acbd2846c2af31de12dbe704a1e2450 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 16:20:28 +0100 Subject: [PATCH 20/38] Another attempt to build wheels --- .github/workflows/python_wheels.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index a101a13f6..2decbd949 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -33,11 +33,9 @@ jobs: run: python -m cibuildwheel --output-dir wheelhouse env: #CIBW_ARCHS_LINUX: auto64 # Seems 32 bit vcpkg dependencies are missing, so force 64 bit on linux - #CIBW_SKIP: "*-musllinux_* pp*" # Skip musllinux builds for now as they fail, and skip pypy builds as they'll be disabled in cibuildwheel 3 anyway - CIBW_BEFORE_ALL_LINUX : sudo apt-get update && sudo apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev + CIBW_SKIP: "pp*" # Skip pypy builds as they'll be disabled in cibuildwheel 3 anyway (Might need to disable *-musllinux_* too) + CIBW_BEFORE_ALL_LINUX : yum install -y boost-devel bzip2-devel eigen3-devel || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev - - - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} From 1b660efa54d820dc449d8a1d004d2b26d9c67dd0 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 16:53:44 +0100 Subject: [PATCH 21/38] Bumped cibuildwheel, but no solution for out of date boost yet --- .github/workflows/python_wheels.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 2decbd949..e9468388e 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -27,7 +27,7 @@ jobs: python-version: 3.11 - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.23.2 + run: python -m pip install cibuildwheel==2.23.3 - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse From c4bd263e6a7a8be4abd8325e1f50abb3be9b45e6 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Tue, 13 May 2025 22:15:55 +0100 Subject: [PATCH 22/38] Trying to use vcpkg on cibuildwheels --- pyproject.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 52c7e8ed8..8d995af4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,12 @@ minimum-version = "build-system.requires" #testpaths = ["tests"] # # -#[tool.cibuildwheel] + +[tool.cibuildwheel] +# Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json +before-all = "(yum install -y boost-devel bzip2-devel eigen3-devel zip unzip || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +# Skip the pypy builds (they're deprecated anyhoo) +skip = "pp*" #build-frontend = "build[uv]" #test-command = "pytest {project}/tests" #test-extras = ["test"] From 353063cda548b227a339c0c0a89d9915254bde71 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Fri, 16 May 2025 15:00:22 +0100 Subject: [PATCH 23/38] Fixed cibuildwheels to use vcpkg --- .github/workflows/python_wheels.yaml | 9 +++------ CMakeLists.txt | 12 +++++------- pyproject.toml | 2 ++ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index e9468388e..3ed55c990 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -11,9 +11,9 @@ jobs: matrix: os: [ ubuntu-latest, - #ubuntu-24.04-arm, + ubuntu-24.04-arm, windows-latest, - #macos-13, + macos-13, macos-latest, ] @@ -31,12 +31,9 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse - env: - #CIBW_ARCHS_LINUX: auto64 # Seems 32 bit vcpkg dependencies are missing, so force 64 bit on linux - CIBW_SKIP: "pp*" # Skip pypy builds as they'll be disabled in cibuildwheel 3 anyway (Might need to disable *-musllinux_* too) - CIBW_BEFORE_ALL_LINUX : yum install -y boost-devel bzip2-devel eigen3-devel || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl +f \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index fe38beacd..70eb0f130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,14 +4,12 @@ if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the wa cmake_policy(SET CMP0167 NEW) # Use the new boost configuration endif() - # Disabled VCPKG as we move to nix -#if(NOT MSVC) -# # To make this compile on NixOS, we need to use the static linked MSVC -# # But this is not available on windows -# set(VCPKG_BOOTSTRAP_OPTIONS "-musl") -#endif() -#set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake) +if(DEFINED ENV{VCPKG_ROOT}) + message(STATUS "VCPKG_ROOT is set to $ENV{VCPKG_ROOT}") + set(VCPKG_ROOT $ENV{VCPKG_ROOT}) + set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) +endif() project(DynamO) #Project name enable_testing() #Enable build of test executables and 'make test' command diff --git a/pyproject.toml b/pyproject.toml index 8d995af4e..a5b9be446 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,8 @@ minimum-version = "build-system.requires" [tool.cibuildwheel] # Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json before-all = "(yum install -y boost-devel bzip2-devel eigen3-devel zip unzip || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +# We enable dynamo VCPKG integration using the environment variable. +environment = {VCPKG_ROOT="/opt/vcpkg/"} # Skip the pypy builds (they're deprecated anyhoo) skip = "pp*" #build-frontend = "build[uv]" From 7aebda46be09bfb13034244b18c416599dcd2c76 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Fri, 16 May 2025 15:01:24 +0100 Subject: [PATCH 24/38] Typo fix --- .github/workflows/python_wheels.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 3ed55c990..09a650448 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -35,5 +35,4 @@ jobs: - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl -f \ No newline at end of file + path: ./wheelhouse/*.whl \ No newline at end of file From 28168d18aecedaaa4fe93aa9f828a74f2420d3cf Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Sat, 17 May 2025 07:15:41 +0100 Subject: [PATCH 25/38] Update pyproject.toml Removed eigen3-devel as it's missing on some wheel systems --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a5b9be446..06c13ad53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ minimum-version = "build-system.requires" [tool.cibuildwheel] # Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json -before-all = "(yum install -y boost-devel bzip2-devel eigen3-devel zip unzip || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +before-all = "(yum install -y boost-devel bzip2-devel zip unzip || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" # We enable dynamo VCPKG integration using the environment variable. environment = {VCPKG_ROOT="/opt/vcpkg/"} # Skip the pypy builds (they're deprecated anyhoo) From 1fa6cc2cad24a621eaf44ae2f02654ec49468b99 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Sat, 17 May 2025 09:06:50 +0100 Subject: [PATCH 26/38] Update pyproject.toml Another fix for normal wheels --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 06c13ad53..458c575ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ minimum-version = "build-system.requires" [tool.cibuildwheel] # Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json -before-all = "(yum install -y boost-devel bzip2-devel zip unzip || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +before-all = "(yum install -y boost-devel bzip2-devel zip unzip ninja || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev ninja zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" # We enable dynamo VCPKG integration using the environment variable. environment = {VCPKG_ROOT="/opt/vcpkg/"} # Skip the pypy builds (they're deprecated anyhoo) From daac80d9fadcdd8fb1927ec16a51e063b877e7f6 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Sat, 17 May 2025 15:05:11 +0100 Subject: [PATCH 27/38] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 458c575ca..2da95811d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ minimum-version = "build-system.requires" [tool.cibuildwheel] # Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json -before-all = "(yum install -y boost-devel bzip2-devel zip unzip ninja || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev ninja zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +before-all = "(yum install -y boost-devel bzip2-devel zip unzip ninja-build || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev ninja zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" # We enable dynamo VCPKG integration using the environment variable. environment = {VCPKG_ROOT="/opt/vcpkg/"} # Skip the pypy builds (they're deprecated anyhoo) From 7ae4428a1d97a96d467d1074073991aeb4ab78bb Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Sat, 17 May 2025 18:49:21 +0100 Subject: [PATCH 28/38] Added make instead of ninja --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2da95811d..b14134a19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ minimum-version = "build-system.requires" [tool.cibuildwheel] # Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json -before-all = "(yum install -y boost-devel bzip2-devel zip unzip ninja-build || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev ninja zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +before-all = "(yum install -y boost-devel bzip2-devel zip unzip make || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev ninja zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" # We enable dynamo VCPKG integration using the environment variable. environment = {VCPKG_ROOT="/opt/vcpkg/"} # Skip the pypy builds (they're deprecated anyhoo) From ae196f5094310cd5178be96ed5e85f9637d71ba4 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 08:47:24 +0100 Subject: [PATCH 29/38] Another patch for musllinux compilation --- .gitignore | 3 ++- CMakeLists.txt | 7 +++---- pyproject.toml | 27 +++++++++++++++++---------- src/dynamo/programs/dynahist_rw.cpp | 2 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 5f6d4b286..9f98cc17f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ __pycache__ Testing/Temporary/CTestCostData.txt .eggs -wheelhouse \ No newline at end of file +wheelhouse +vcpkg_installed \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 70eb0f130..2b31294d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,10 +5,9 @@ if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the wa endif() # Disabled VCPKG as we move to nix -if(DEFINED ENV{VCPKG_ROOT}) - message(STATUS "VCPKG_ROOT is set to $ENV{VCPKG_ROOT}") - set(VCPKG_ROOT $ENV{VCPKG_ROOT}) - set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) +if(DEFINED ENV{DYNAMO_VCPKG_ROOT}) + message(STATUS "DYNAMO_VCPKG_ROOT is set to $ENV{DYNAMO_VCPKG_ROOT}, enabling VCPKG") + set(CMAKE_TOOLCHAIN_FILE $ENV{DYNAMO_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) endif() project(DynamO) #Project name diff --git a/pyproject.toml b/pyproject.toml index b14134a19..b8d382aee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,9 @@ [build-system] -requires = ["scikit-build-core>=0.10", "numpy", "pytest"] +requires = [ + "scikit-build-core>=0.10", + "numpy", + "pytest", +] build-backend = "scikit_build_core.build" @@ -49,12 +53,15 @@ minimum-version = "build-system.requires" # [tool.cibuildwheel] -# Here we install desired libraries for their build dependencies, then use vcpkg to update to latest files from vcpkg.json -before-all = "(yum install -y boost-devel bzip2-devel zip unzip make || apt-get install -y libboost-all-dev libbz2-dev libeigen3-dev ninja zip unzip) && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" -# We enable dynamo VCPKG integration using the environment variable. -environment = {VCPKG_ROOT="/opt/vcpkg/"} -# Skip the pypy builds (they're deprecated anyhoo) -skip = "pp*" -#build-frontend = "build[uv]" -#test-command = "pytest {project}/tests" -#test-extras = ["test"] +# Skip the pypy builds (they're deprecated anyhoo), and the 32bit builds due to issues with build tools +skip = "pp* *-manylinux_i686" +# Setup install of vcpkg, to download c++ dependencies +before-all = "yum install -y zip unzip make && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" +environment = {DYNAMO_VCPKG_ROOT="/opt/vcpkg/"} +build-frontend = "build[uv]" + +[[tool.cibuildwheel.overrides]] +# musllinux uses apk instead of yum +select = "*-musllinux*" +#install ninja-is-really-ninja, as the ninja package is a link to samurai which is incompatible with vcpkg it seems +before-all = "apk add zip unzip ninja-is-really-ninja && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -musl -disableMetrics && /opt/vcpkg/vcpkg install" \ No newline at end of file diff --git a/src/dynamo/programs/dynahist_rw.cpp b/src/dynamo/programs/dynahist_rw.cpp index 96ed251f4..c5089857f 100644 --- a/src/dynamo/programs/dynahist_rw.cpp +++ b/src/dynamo/programs/dynahist_rw.cpp @@ -520,7 +520,7 @@ int main(int argc, char *argv[]) { << "under certain conditions. See the licence you obtained with\n" << "the code\n"; -#if !defined(__APPLE__) && !defined(_WIN32) +#ifdef __GLIBC__ // This is so the program crashes out when floating point errors occur feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW); #endif From 43c843fd0691be1c55a160a1b5f7f9c3f0f11c3a Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 09:17:28 +0100 Subject: [PATCH 30/38] Got x86_64 builds working --- pyproject.toml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b8d382aee..07da6ae32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,8 +53,9 @@ minimum-version = "build-system.requires" # [tool.cibuildwheel] -# Skip the pypy builds (they're deprecated anyhoo), and the 32bit builds due to issues with build tools -skip = "pp* *-manylinux_i686" +# Skip the pypy builds (they're deprecated anyhoo) +# Skip 32bit builds due to issues with build tools +skip = "pp* *i686" # Setup install of vcpkg, to download c++ dependencies before-all = "yum install -y zip unzip make && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" environment = {DYNAMO_VCPKG_ROOT="/opt/vcpkg/"} @@ -64,4 +65,10 @@ build-frontend = "build[uv]" # musllinux uses apk instead of yum select = "*-musllinux*" #install ninja-is-really-ninja, as the ninja package is a link to samurai which is incompatible with vcpkg it seems -before-all = "apk add zip unzip ninja-is-really-ninja && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -musl -disableMetrics && /opt/vcpkg/vcpkg install" \ No newline at end of file +before-all = "apk add zip unzip ninja-is-really-ninja && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -musl -disableMetrics && /opt/vcpkg/vcpkg install" + +[[tool.cibuildwheel.overrides]] +# arm linux is tempermental with vcpkg +select = "*-aarch64" +before-all = "apk add zip unzip ninja-is-really-ninja && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -musl -disableMetrics && /opt/vcpkg/vcpkg install" + From 5de88720260c9f6df969a55fd2fbf77b08abfd49 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 10:04:21 +0100 Subject: [PATCH 31/38] Moved away from vcpkg in the wheels --- .github/workflows/python_wheels.yaml | 2 +- CMakeLists.txt | 7 +++--- pyproject.toml | 33 +++++++++++++++++++--------- src/magnet/CMakeLists.txt | 2 +- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 09a650448..557a5207e 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -12,7 +12,7 @@ jobs: os: [ ubuntu-latest, ubuntu-24.04-arm, - windows-latest, + # windows-latest, macos-13, macos-latest, ] diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b31294d9..19e095b68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.28) -if(POLICY CMP0167) # Must be before project otherwise VCPKG hooks trigger the warning - cmake_policy(SET CMP0167 NEW) # Use the new boost configuration +# We want to set this to new, but the python wheels need boost 1.70 minimum before this can happen +if(POLICY CMP0167) + cmake_policy(SET CMP0167 OLD) endif() # Disabled VCPKG as we move to nix @@ -103,7 +104,7 @@ endif() # set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) -find_package(Boost 1.70.0 REQUIRED system filesystem program_options unit_test_framework) +find_package(Boost 1.66.0 REQUIRED system filesystem program_options unit_test_framework) add_subdirectory(src/magnet) find_package(Eigen3) diff --git a/pyproject.toml b/pyproject.toml index 07da6ae32..88df45cdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,22 +53,35 @@ minimum-version = "build-system.requires" # [tool.cibuildwheel] -# Skip the pypy builds (they're deprecated anyhoo) +# Skip the pypy builds (they're deprecated and use an old toolchain) # Skip 32bit builds due to issues with build tools -skip = "pp* *i686" -# Setup install of vcpkg, to download c++ dependencies -before-all = "yum install -y zip unzip make && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install" -environment = {DYNAMO_VCPKG_ROOT="/opt/vcpkg/"} +skip = "pp* *i686 *win32" +# More modern install/build with uv build-frontend = "build[uv]" +# For future reference on a windows build +# To use VCPKG, add the environment variable +#environment = {DYNAMO_VCPKG_ROOT="/opt/vcpkg/"} +# And add this to before-all to download vcpkg +#&& git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && /opt/vcpkg/vcpkg install + + +[tool.cibuildwheel.linux] +# We switch to the 2025 default images now +manylinux-x86_64-image = "manylinux_2_28" +manylinux-aarch64-image = "manylinux_2_28" +musllinux-x86_64-image = "musllinux_1_2" +musllinux-aarch64-image = "musllinux_1_2" +before-all = "yum install -y zip unzip make boost-devel eigen3-devel bzip2-devel" + [[tool.cibuildwheel.overrides]] # musllinux uses apk instead of yum select = "*-musllinux*" #install ninja-is-really-ninja, as the ninja package is a link to samurai which is incompatible with vcpkg it seems -before-all = "apk add zip unzip ninja-is-really-ninja && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -musl -disableMetrics && /opt/vcpkg/vcpkg install" +before-all = "apk add zip unzip ninja-is-really-ninja boost-dev eigen-dev bzip2-dev" + + +[tool.cibuildwheel.macos] +before-all = "brew install cmake boost bzip2 eigen" -[[tool.cibuildwheel.overrides]] -# arm linux is tempermental with vcpkg -select = "*-aarch64" -before-all = "apk add zip unzip ninja-is-really-ninja && git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh -musl -disableMetrics && /opt/vcpkg/vcpkg install" diff --git a/src/magnet/CMakeLists.txt b/src/magnet/CMakeLists.txt index 98cf98fcc..9fecb218d 100644 --- a/src/magnet/CMakeLists.txt +++ b/src/magnet/CMakeLists.txt @@ -1,6 +1,6 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DMAGNET_DEBUG") -find_package(Boost 1.70.0 REQUIRED) +find_package(Boost 1.66.0 REQUIRED) add_library(magnet INTERFACE) target_include_directories(magnet INTERFACE From a95a6004cdb7d249c5abebbaa93ea41e5630c36b Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 10:12:15 +0100 Subject: [PATCH 32/38] A fix for macos now --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 88df45cdd..1da6d3c7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,8 @@ minimum-version = "build-system.requires" # Skip 32bit builds due to issues with build tools skip = "pp* *i686 *win32" # More modern install/build with uv -build-frontend = "build[uv]" +# Doesn't work on macos github actions! Need to install it using brew? +#build-frontend = "build[uv]" # For future reference on a windows build # To use VCPKG, add the environment variable @@ -80,7 +81,6 @@ select = "*-musllinux*" #install ninja-is-really-ninja, as the ninja package is a link to samurai which is incompatible with vcpkg it seems before-all = "apk add zip unzip ninja-is-really-ninja boost-dev eigen-dev bzip2-dev" - [tool.cibuildwheel.macos] before-all = "brew install cmake boost bzip2 eigen" From 70368425fa77b3bc1aed4d83a39ecf9f79810b4e Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 11:27:18 +0100 Subject: [PATCH 33/38] Another patch for macos --- .github/workflows/python_wheels.yaml | 11 ++++++++++- pyproject.toml | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 557a5207e..453a7e480 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -12,9 +12,9 @@ jobs: os: [ ubuntu-latest, ubuntu-24.04-arm, - # windows-latest, macos-13, macos-latest, + # windows-latest, # Needs a way to install the build dependencies (or VCPKG) ] steps: @@ -29,6 +29,15 @@ jobs: - name: Install cibuildwheel run: python -m pip install cibuildwheel==2.23.3 + - name: Install boost on macos + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' + uses: MarkusJx/install-boost@v2 + id: install-boost + with: + # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json + boost_version: 1.71.0 + platform_version: 10.15 #Using this to allow for older macos versions in the wheel + - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse diff --git a/pyproject.toml b/pyproject.toml index 1da6d3c7f..33022941b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,6 @@ classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GPL License", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -55,6 +53,7 @@ minimum-version = "build-system.requires" [tool.cibuildwheel] # Skip the pypy builds (they're deprecated and use an old toolchain) # Skip 32bit builds due to issues with build tools +# Dropping some older python versions too skip = "pp* *i686 *win32" # More modern install/build with uv # Doesn't work on macos github actions! Need to install it using brew? @@ -82,6 +81,7 @@ select = "*-musllinux*" before-all = "apk add zip unzip ninja-is-really-ninja boost-dev eigen-dev bzip2-dev" [tool.cibuildwheel.macos] -before-all = "brew install cmake boost bzip2 eigen" +# Dont install boost, need system compiled for older mac versions +before-all = "brew install cmake eigen" From 83d1cb41e03a1439956d657bafed166fe9939c7c Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 11:37:57 +0100 Subject: [PATCH 34/38] Trying to build boost from source on macos to enable portable wheels --- .github/workflows/python_wheels.yaml | 9 --------- pyproject.toml | 3 +-- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/python_wheels.yaml b/.github/workflows/python_wheels.yaml index 453a7e480..1ac1591ad 100644 --- a/.github/workflows/python_wheels.yaml +++ b/.github/workflows/python_wheels.yaml @@ -28,15 +28,6 @@ jobs: - name: Install cibuildwheel run: python -m pip install cibuildwheel==2.23.3 - - - name: Install boost on macos - if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' - uses: MarkusJx/install-boost@v2 - id: install-boost - with: - # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json - boost_version: 1.71.0 - platform_version: 10.15 #Using this to allow for older macos versions in the wheel - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse diff --git a/pyproject.toml b/pyproject.toml index 33022941b..2fc68ba7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,6 @@ select = "*-musllinux*" before-all = "apk add zip unzip ninja-is-really-ninja boost-dev eigen-dev bzip2-dev" [tool.cibuildwheel.macos] -# Dont install boost, need system compiled for older mac versions -before-all = "brew install cmake eigen" +before-all = "brew install cmake eigen && brew install --build-from-source boost" From d27d1f69287d13b5db867f058a5475c38cddfc8b Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 11:58:16 +0100 Subject: [PATCH 35/38] Trying static boost --- CMakeLists.txt | 2 +- pyproject.toml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19e095b68..5dfb86c2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,7 +101,7 @@ endif() ######### Dependencies ###################################################################### -# set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.66.0 REQUIRED system filesystem program_options unit_test_framework) diff --git a/pyproject.toml b/pyproject.toml index 2fc68ba7e..776d4ab19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,4 @@ select = "*-musllinux*" before-all = "apk add zip unzip ninja-is-really-ninja boost-dev eigen-dev bzip2-dev" [tool.cibuildwheel.macos] -before-all = "brew install cmake eigen && brew install --build-from-source boost" - - +before-all = "brew install cmake eigen boost" \ No newline at end of file From 83c081dc7e0d3f3fe374fd857c0a9ed1efd18674 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 12:14:22 +0100 Subject: [PATCH 36/38] Trying boost static --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 776d4ab19..51e3f380a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,13 +72,13 @@ manylinux-x86_64-image = "manylinux_2_28" manylinux-aarch64-image = "manylinux_2_28" musllinux-x86_64-image = "musllinux_1_2" musllinux-aarch64-image = "musllinux_1_2" -before-all = "yum install -y zip unzip make boost-devel eigen3-devel bzip2-devel" +before-all = "yum install -y zip unzip make boost-devel boost-static eigen3-devel bzip2-devel" [[tool.cibuildwheel.overrides]] # musllinux uses apk instead of yum select = "*-musllinux*" #install ninja-is-really-ninja, as the ninja package is a link to samurai which is incompatible with vcpkg it seems -before-all = "apk add zip unzip ninja-is-really-ninja boost-dev eigen-dev bzip2-dev" +before-all = "apk add zip unzip ninja-is-really-ninja boost-dev boost-static eigen-dev bzip2-dev" [tool.cibuildwheel.macos] before-all = "brew install cmake eigen boost" \ No newline at end of file From 25f72aea61cfdc91aa5198d996df02461c130e7c Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 12:22:40 +0100 Subject: [PATCH 37/38] Setup Prefer boost static, to allow wheel build on all platforms supported. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dfb86c2a..eacc8ab17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,12 @@ endif() set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) -find_package(Boost 1.66.0 REQUIRED system filesystem program_options unit_test_framework) +find_package(Boost 1.66.0 COMPONENTS system filesystem program_options unit_test_framework) +if(NOT Boost_FOUND) + message(WARNING "Static Boost not found, trying shared Boost") + set(Boost_USE_STATIC_LIBS OFF) + find_package(Boost 1.66.0 REQUIRED COMPONENTS system filesystem program_options unit_test_framework) +endif() add_subdirectory(src/magnet) find_package(Eigen3) From 7738983d777d9d72b4f15bf1720f0ee5dd92f9b1 Mon Sep 17 00:00:00 2001 From: Marcus Bannerman Date: Mon, 19 May 2025 22:09:59 +0100 Subject: [PATCH 38/38] Update src/magnet/magnet/GL/context.hpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/magnet/magnet/GL/context.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magnet/magnet/GL/context.hpp b/src/magnet/magnet/GL/context.hpp index abd372266..5d4241d0e 100644 --- a/src/magnet/magnet/GL/context.hpp +++ b/src/magnet/magnet/GL/context.hpp @@ -26,7 +26,7 @@ typedef HGLRC ContextKey; #elif __APPLE__ #include -typedef ContextKey; +typedef CGLContextObj ContextKey; #else #include typedef GLXContext ContextKey;