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

test: Mac build on CI #28

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion .github/workflows/build/linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ runs:
using: "composite"
steps:


- name: Install nix
uses: cachix/install-nix-action@v27

Expand Down
91 changes: 69 additions & 22 deletions .github/workflows/build/osx/action.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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})
Expand Down
25 changes: 4 additions & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 5 additions & 48 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 {
Expand All @@ -56,7 +55,7 @@
cmake-language-server
distcc
gdb
next.git-cliff
git-cliff
nixfmt
valgrind
]);
Expand All @@ -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 $@";
};
};
});
}
18 changes: 9 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/logAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LogAxis : public Axis
LogAxis();
std::vector<float> convert(QList<double> values) const override;
double tickCoord(int index) const override;
void nudge(double delta);
void nudge(double delta) override;

private:
void updateTicks_() override;
Expand Down
Loading