diff --git a/.github/workflows/build/linux/action.yml b/.github/workflows/build/linux/action.yml index 9cb69d4..63e164a 100644 --- a/.github/workflows/build/linux/action.yml +++ b/.github/workflows/build/linux/action.yml @@ -5,7 +5,6 @@ runs: using: "composite" steps: - - name: Install nix uses: cachix/install-nix-action@v27 diff --git a/.github/workflows/build/osx/action.yml b/.github/workflows/build/osx/action.yml index 1f88f20..c0fac9f 100644 --- a/.github/workflows/build/osx/action.yml +++ b/.github/workflows/build/osx/action.yml @@ -1,40 +1,87 @@ name: Build description: Build OSX artifacts +inputs: + qtVersion: + type: string + default: 6.4.2 + cacheOnly: + type: boolean + default: false + runs: using: "composite" steps: - - name: Install Prerequisites + + # - name: Install Homebrew Dependencies + # if: ${{ inputs.cacheOnly == 'false' }} + # shell: bash + # run: | + + # set -ex + # brew update-reset + # brew install ftgl ninja + + - name: Install Python Dependencies shell: bash run: | - set -ex - sudo pip3 install conan aqtinstall - aqt install-qt --outputdir /tmp/qt mac desktop ${{ env.qtVersion }} -m qt3d + pip3 install aqtinstall conan==1.* --break-system-packages - - name: Build + - name: Retrieve Qt Cache + id: cache-qt + uses: actions/cache@v4 + with: + key: osx-qt-${{ inputs.qtVersion }} + path: ${{ runner.temp }}/qt + + - name: Install Qt + if: ${{ steps.cache-qt.outputs.cache-hit != 'true' }} shell: bash run: | - set -ex - Qt6_DIR=/tmp/qt/${{ env.qtVersion }}/macos/lib/cmake/Qt6 - QT_BASE_DIR=/tmp/qt/${{ env.qtVersion }}/macos - QTVER=${{ env.qtVersion }} - mkdir build - cd build - cmake ../ -DBUILD_EXAMPLES:bool=true -DQT_BASE_DIR=$QT_BASE_DIR -DCMAKE_INSTALL_PREFIX:path=./QuickPlot-osx - make - make install - - - name: Create Zip + export PATH="$(python3 -m site --user-base)/bin:$PATH" + aqt install-qt --outputdir ${{ runner.temp }}/qt mac desktop ${{ inputs.qtVersion }} -m qt3d qtquick3d qtshadertools + + # + # Main Build + # + + - name: Retrieve Conan Cache + id: cache-conan + uses: actions/cache@v4 + with: + key: osx-${{ runner.arch }}-conan-${{ env.conanHash }} + path: | + ~/.conan + ~/.conancache + + - name: Build + if: ${{ inputs.cacheOnly == 'false' }} shell: bash run: | set -ex - mkdir packages - cd build - zip -9rv ../packages/QuickPlot-osx.zip QuickPlot-osx + + # Setup paths + export PATH="$(python3 -m site --user-base)/bin:$PATH" + Qt6_DIR=${{ runner.temp }}/qt/${{ inputs.qtVersion }}/macos/lib/cmake/Qt6 + QT_BASE_DIR=${{ runner.temp }}/qt/${{ inputs.qtVersion }}/macos + + # Set conan cache location + conan config set storage.download_cache="${GITHUB_WORKSPACE}/.conancache" + + # Set minimum deployment target version + export MACOSX_DEPLOYMENT_TARGET=10.15 + + # Build + mkdir build && cd build + cmake -DQT_BASE_DIR=$QT_BASE_DIR ../ + cmake --build . --config Release - name: Upload Raw Build Artifacts - uses: actions/upload-artifact@v3 + if: ${{ inputs.cacheOnly == 'false' }} + uses: actions/upload-artifact@v4 with: - name: packages - path: ${{ github.workspace }}/packages + name: osx-${{ runner.arch }}-build-artifacts + path: | + ${{ github.workspace }}/build + retention-days: 1 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9dce344..465b0d0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: # os: [ubuntu-latest, windows-latest, macos-latest] - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout diff --git a/CMakeLists.txt b/CMakeLists.txt index 31bad2e..5e2efa3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,11 +43,6 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -# Set policy for automatic linkage of Qt libs to project -cmake_policy(SET CMP0020 NEW) - -# Perform platform-specific setup # - # -- Windows if(WIN32) # Add defines for Windows systems - NOMINMAX to prevent conflicts with @@ -65,10 +60,10 @@ endif(UNIX) if(APPLE) # Set some specific C++11 related options here (set_property below does not # seem to persist) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") - set(CMAKE_OSX_ARCHITECTURES "x86_64") - add_definitions(-D_MAC) + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") + + # add_definitions(-D_MAC) endif(APPLE) set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/flake.lock b/flake.lock index 1094d48..4a51963 100644 --- a/flake.lock +++ b/flake.lock @@ -51,22 +51,6 @@ "type": "indirect" } }, - "future": { - "locked": { - "lastModified": 1716948383, - "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nix-bundle": { "inputs": { "nixpkgs": "nixpkgs" @@ -165,16 +149,16 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1715668745, - "narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=", + "lastModified": 1718437845, + "narHash": "sha256-ZT7Oc1g4I4pHVGGjQFnewFVDRLH5cIZhEzODLz9YXeY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843", + "rev": "752c634c09ceb50c45e751f8791cb45cb3d46c9e", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } @@ -183,7 +167,6 @@ "inputs": { "bundlers": "bundlers", "flake-utils": "flake-utils_2", - "future": "future", "nixGL-src": "nixGL-src", "nixpkgs": "nixpkgs_4" } diff --git a/flake.nix b/flake.nix index b8986a9..bd9c918 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,12 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; - future.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + # future.url = "github:NixOS/nixpkgs/nixos-unstable"; # qt-idaaas.url = "github:disorderedmaterials/qt-idaaas"; nixGL-src.url = "github:guibou/nixGL"; nixGL-src.flake = false; }; - outputs = { self, nixpkgs, future, flake-utils, bundlers, nixGL-src }: + outputs = { self, nixpkgs, flake-utils, bundlers, nixGL-src }: let version = "0.1"; @@ -26,11 +26,10 @@ ]; check_libs = pkgs: with pkgs; [ gtest ]; - in flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: + in flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - next = import future { inherit system; }; nixGL = import nixGL-src { inherit pkgs; }; qt = pkgs.qt6; # qt-idaaas.packages.${system}; in { @@ -56,7 +55,7 @@ cmake-language-server distcc gdb - next.git-cliff + git-cliff nixfmt valgrind ]); @@ -83,47 +82,5 @@ QML_IMPORT_PATH = "${qt.qtdeclarative}/lib/qt-6/qml/:${qt.qt3d}/lib/qt-6/qml/:${qt.qtquick3d}/lib/qt-6/qml/"; }; - - apps = { - default = - flake-utils.lib.mkApp { drv = self.packages.${system}.library; }; - }; - - packages = { - library = pkgs.stdenv.mkDerivation ({ - inherit version; - pname = "mildred"; - src = ./.; - buildInputs = base_libs pkgs ++ (gui_libs { - inherit pkgs; - q = qt; - }); - nativeBuildInputs = [ pkgs.wrapGAppsHook ]; - - cmakeFlags = [ "-G Ninja -DBUILD_EXAMPLES:bool=true" ]; - installPhase = '' - mkdir -p $out/bin - mv ./$out/bin/groups $out/bin/ - ''; - - meta = with pkgs.lib; { - description = "Plot lib for 2D/3D"; - homepage = "https://github.com/disorderedmaterials/plot"; - license = licenses.gpl3; - maintainers = with maintainers; [ rprospero ]; - }; - }); - - singularity = - nixpkgs.legacyPackages.${system}.singularity-tools.buildImage { - name = "mildred-${version}"; - diskSize = 1024 * 250; - memSize = 1024 * 2; - contents = [ self.packages.${system}.library ]; - runScript = "${nixGL.nixGLIntel}/bin/nixGLIntel ${ - self.packages.${system}.library - }/bin/groups $@"; - }; - }; }); } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf14853..067b435 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,15 +25,15 @@ qt_add_qml_module( ScatterModel.qml) target_include_directories( - unnamed PRIVATE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib - ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Quick3D_INCLUDE_DIRS}) + unnamed PUBLIC ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib + ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Quick3D_INCLUDE_DIRS}) target_link_libraries( unnamed PUBLIC ${WHOLE_ARCHIVE_FLAG} - PRIVATE # External libs - Qt6::Widgets Qt6::Core Qt6::3DCore Qt6::3DRender Qt6::3DExtras - Qt6::Quick) + PUBLIC # External libs + Qt6::Widgets Qt6::Core Qt6::3DCore Qt6::3DRender Qt6::3DExtras + Qt6::Quick) set_target_properties(unnamed PROPERTIES PUBLIC_HEADER lineGeometry.h) @@ -42,11 +42,11 @@ install(TARGETS unnamed) # Main target add_executable(demo main.cpp ${demo_MOC_SRCS}) -target_include_directories(demo PRIVATE ${PROJECT_SOURCE_DIR}/src - ${PROJECT_BINARY_DIR}/src) +target_include_directories(demo PUBLIC ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src) -target_link_libraries(demo PRIVATE unnamed Qt6::Widgets Qt6::Gui Qt6::Qml - Qt6::Core Qt6::Quick3D) +target_link_libraries(demo PUBLIC unnamed Qt6::Widgets Qt6::Gui Qt6::Qml + Qt6::Core Qt6::Quick3D) set_target_properties(demo PROPERTIES RUNTIME demo) diff --git a/src/logAxis.h b/src/logAxis.h index df9641e..a57ccf1 100644 --- a/src/logAxis.h +++ b/src/logAxis.h @@ -14,7 +14,7 @@ class LogAxis : public Axis LogAxis(); std::vector convert(QList values) const override; double tickCoord(int index) const override; - void nudge(double delta); + void nudge(double delta) override; private: void updateTicks_() override;