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

CMake Refactor #72

Merged
merged 89 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
6265870
refactor(cmake): use cpm, package-project
Curve Mar 7, 2024
90a76b2
refactor: include structure
Curve Mar 7, 2024
22b2ea6
refactor(tests): modernize cmake, adjust to header changes
Curve Mar 7, 2024
4760399
refactor: remove external
Curve Mar 7, 2024
6106c64
refactor: move `data` -> `assets`
Curve Mar 7, 2024
a11f90f
refactor(cmake): update tooling
Curve Mar 7, 2024
77a1294
Merge commit '7daa53a625072357acfb8755a3ba352938c3d31b' into cmake-re…
Curve Mar 11, 2024
5bd770f
feat(tests): setup environment
Curve Mar 11, 2024
efcbba8
feat(python): refactor cmake
Curve Mar 11, 2024
1372df3
fix(python): adapt new include structure
Curve Mar 11, 2024
aacb7e1
refactor: add python sub-directpry
Curve Mar 11, 2024
4c7d53d
refactor: default switches, dependencies
Curve Mar 14, 2024
337b927
feat: use scikit-build
Curve Mar 14, 2024
4578603
fix: formatting
Curve Mar 14, 2024
5345b5f
refactor(cmake-format): ignore comments
Curve Mar 14, 2024
3363ddd
feat(cmake/python): dynamic link against vtk-python libs
Curve Mar 14, 2024
0007f33
fix(tests): logger
Curve Mar 10, 2024
16f369a
fix: odr
Curve Mar 10, 2024
86b8d32
feat(python-bindings): add windows path
Curve Mar 14, 2024
34d84f2
refactor: merge master
Curve Mar 14, 2024
d632be5
Revert "Temporarily use legacy ViennaRay in GitHub actions"
Curve Mar 14, 2024
394cecf
fix: merge
Curve Mar 14, 2024
f49431d
fix: format
Curve Mar 14, 2024
977f0ee
fix: format mismatch
Curve Mar 14, 2024
7e7a75a
fix: examples
Curve Mar 14, 2024
b1495f6
feat: update application
Curve Mar 16, 2024
542975d
fix(python): includes
Curve Mar 16, 2024
b111fe1
fix: format
Curve Mar 16, 2024
2115938
fix: format
Curve Mar 16, 2024
089b07f
feat: update workflows
Curve Mar 16, 2024
9f04085
refactor(python): use rpath on macos
Curve Mar 16, 2024
68a6de7
chore: update gitignore
Curve Mar 16, 2024
ffed740
fix(workflow): setup action
Curve Mar 16, 2024
7b17d86
fix(workflows): typo
Curve Mar 16, 2024
f01aba1
fix(workflow/python): venv on windows
Curve Mar 16, 2024
d0bbe31
refactor(workflows): test python module
Curve Mar 16, 2024
cfdb11a
refactor(workflows): naming
Curve Mar 16, 2024
3cd4b81
fix(workflows/python): always upload artifact
Curve Mar 16, 2024
48245c1
refactor(workflows): use config switch
Curve Mar 16, 2024
a5330e4
fix(openmp): parallel for should use signed type
Curve Mar 17, 2024
604e856
fix(openmp): use plain int
Curve Mar 17, 2024
b09775d
Revert "fix(openmp): use plain int"
Curve Mar 17, 2024
0ca5473
Revert "fix(openmp): parallel for should use signed type"
Curve Mar 17, 2024
b25cda3
refactor(workflow): add openmp flags
Curve Mar 17, 2024
996ebc4
feat: install required dependencies
Curve Mar 17, 2024
99ceef7
refactor(msvc): set openmp flags from cmake
Curve Mar 17, 2024
7a1ef57
fix: format [skip ci]
Curve Mar 17, 2024
50f2e19
fix(msvc): enable bigobj
Curve Mar 17, 2024
7d2230c
refactor(workflow): print doc, add caching
Curve Mar 17, 2024
f900809
refactor(workflows): caching
Curve Mar 17, 2024
d8c142a
refactor(python): format init py
Curve Mar 17, 2024
a550edd
refactor(cmake/bindings): use macro
Curve Mar 17, 2024
07fcbf0
chore: update gitignore
Curve Mar 17, 2024
5506c17
fix(workflows): typo
Curve Mar 17, 2024
1892f84
fix: format
Curve Mar 17, 2024
75ea99d
fix(workflows): python cache key
Curve Mar 17, 2024
c4c8cc7
feat: add lookup dirs setting [skip ci]
Curve Mar 17, 2024
eb3ba1f
fix: format
Curve Mar 17, 2024
c76e371
docs: update readme
Curve Mar 17, 2024
bc56c0e
refactor(workflows): remove superfluous args [skip ci]
Curve Mar 17, 2024
75f726f
fix(python): windows vtk path
Curve Mar 17, 2024
01f159e
fix(windows): vtk dll paths
Curve Mar 17, 2024
7c0f653
fix: only install libs when required
Curve Mar 17, 2024
9420881
chore(deps): bump dependencies
Curve Mar 17, 2024
8b06c59
chore(deps): bump dependencies
Curve Mar 17, 2024
3ca0d31
fix: install path
Curve Mar 17, 2024
b119b39
fix: missing comma
Curve Mar 17, 2024
1f14e66
fix: soname version behavior
Curve Mar 17, 2024
36c28ef
fix: format
Curve Mar 17, 2024
eb1a549
fix(cmake/python): lib folder naming
Curve Mar 17, 2024
e8764a0
fix(cmake/python): add `viennaps.libs` to rpath
Curve Mar 17, 2024
ceac1da
fix(python): vtk path
Curve Mar 17, 2024
45aa536
refactor(cmake/python): lib folder conditions
Curve Mar 18, 2024
d2f380d
fix(macos): enable rpath at top level
Curve Mar 18, 2024
0aeaaf6
fix(rpath): use `@loader_path` on macos
Curve Mar 18, 2024
7104414
refactor(cmake): only enable macos rpath in bindings
Curve Mar 18, 2024
3a70476
fix(tests, examples): setup tbb env
Curve Mar 18, 2024
7af0f39
fix: target name
Curve Mar 18, 2024
85e133b
fix(cmake): install vtk on macos as well
Curve Mar 18, 2024
bb0c28f
chore(deps): bump viennaray
Curve Mar 19, 2024
5f5651f
fix(cmake/python): also use build path
Curve Mar 21, 2024
c58ddd5
refactor(examples): don't accumulate all binaries in same directory
Curve Mar 21, 2024
ea1fea1
chore: manual merge
Curve Mar 21, 2024
8647401
Merge branch 'master' into cmake-refactor
Curve Mar 21, 2024
c493292
fix: formatting
Curve Mar 21, 2024
81c371a
docs(examples): update readme
Curve Mar 21, 2024
b9ffd27
fix: win32 conditional
Curve Mar 21, 2024
0ff44bc
Update gitignore and readme
tobre1 Mar 22, 2024
5ca6823
Add most recent tags dependencies
tobre1 Mar 22, 2024
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
6 changes: 6 additions & 0 deletions .cmake-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include: ["cmake/.cpm-format"]
format:
line_width: 100

markup:
enable_markup: false
26 changes: 0 additions & 26 deletions .github/actions/cache-check/action.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/actions/cache-delete/action.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 🏗️ Setup Environment
description: Install Dependencies & Deploy Workarounds

inputs:
container:
required: true
description: Build container used

install-vtk:
required: true
description: Wether or not to install VTK as a system dependency

runs:
using: "composite"

steps:
- name: 🩹 Enable Long Paths
shell: bash
if: ${{ inputs.container == 'windows-latest' }}
run: git config --system core.longpaths true

- name: 📋 Install Dependencies
shell: bash
if: ${{ inputs.container == 'ubuntu-latest' }}
run: dnf install -y make automake gcc gcc-c++ kernel-devel cmake git python3 python3-pip python3-devel

- name: 📋 Install OpenMP
shell: bash
if: ${{ inputs.container == 'macos-latest' }}
run: |
brew reinstall --build-from-source --formula ./.github/homebrew/libomp.rb

- name: 📋 Install VTK
shell: bash
if: ${{ inputs.install-vtk == 'true' }}
run: dnf install -y vtk vtk-devel
83 changes: 83 additions & 0 deletions .github/homebrew/libomp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# SPDX-License-Identifier: BSD-2-Clause

class Libomp < Formula
desc "LLVM's OpenMP runtime library"
homepage "https://openmp.llvm.org/"
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/openmp-15.0.7.src.tar.xz"
sha256 "3f168d38e7a37b928dcb94b33ce947f75d81eef6fa6a4f9d16b6dc5511c07358"
license "MIT"

livecheck do
url :stable
regex(/^llvmorg[._-]v?(\d+(?:\.\d+)+)$/i)
end

bottle do
sha256 cellar: :any, arm64_ventura: "8c5c7b912a075e598fb7ae10f2999853343b2662061d92040b1a584cbb3ba7d2"
sha256 cellar: :any, arm64_monterey: "1b1aad07e8677744cdaa264419fade98bd1a852894c77d01985053a96b7d1c7d"
sha256 cellar: :any, arm64_big_sur: "00e04fbe9783ad7751eaa6d2edda92dfbff85131777255a74e364f3217a7a2df"
sha256 cellar: :any, ventura: "762c461db6af3cf78983b1eb58aee62699652b96237abf79469c8ac034b2156b"
sha256 cellar: :any, monterey: "0b944a6bbe8955e7900882b94f1b0b09030d5791191dc5b0c8b3d5d0895f4b12"
sha256 cellar: :any, big_sur: "f92e5b31f86c22c0fe875b50e050c19a89993b36106a9ad2737230ae2cb68069"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d2a16a906c029e8405a11924837417ad1008d41bb1877399f494cb872a179f01"
end

# Ref: https://github.com/Homebrew/homebrew-core/issues/112107
keg_only "it can override GCC headers and result in broken builds"

depends_on "cmake" => :build
depends_on "lit" => :build
uses_from_macos "llvm" => :build

resource "cmake" do
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/cmake-15.0.7.src.tar.xz"
sha256 "8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea"
end

def install
(buildpath/"src").install buildpath.children
(buildpath/"cmake").install resource("cmake")

# Disable LIBOMP_INSTALL_ALIASES, otherwise the library is installed as
# libgomp alias which can conflict with GCC's libgomp.
args = ["-DLIBOMP_INSTALL_ALIASES=OFF"]
args << "-DOPENMP_ENABLE_LIBOMPTARGET=OFF" if OS.linux?

# Build universal binary
ENV.permit_arch_flags
ENV.runtime_cpu_detection
args << "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"

system "cmake", "-S", "src", "-B", "build/shared", *std_cmake_args, *args
system "cmake", "--build", "build/shared"
system "cmake", "--install", "build/shared"

system "cmake", "-S", "src", "-B", "build/static",
"-DLIBOMP_ENABLE_SHARED=OFF",
*std_cmake_args, *args
system "cmake", "--build", "build/static"
system "cmake", "--install", "build/static"
end

test do
(testpath/"test.cpp").write <<~EOS
#include <omp.h>
#include <array>
int main (int argc, char** argv) {
std::array<size_t,2> arr = {0,0};
#pragma omp parallel num_threads(2)
{
size_t tid = omp_get_thread_num();
arr.at(tid) = tid + 1;
}
if(arr.at(0) == 1 && arr.at(1) == 2)
return 0;
else
return 1;
}
EOS
system ENV.cxx, "-Werror", "-Xpreprocessor", "-fopenmp", "test.cpp", "-std=c++11",
"-I#{include}", "-L#{lib}", "-lomp", "-o", "test"
system "./test"
end
end
56 changes: 56 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 🧪 Run Tests

on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
strategy:
fail-fast: false

matrix:
config:
- Debug
- Release
os:
- macos-latest
- ubuntu-latest
- windows-latest

vtk-system: [true, false]

exclude:
- os: macos-latest
vtk-system: true

- os: windows-latest
vtk-system: true

runs-on: ${{ matrix.os }}
container: ${{ matrix.os == 'ubuntu-latest' && 'fedora:38' || null }}

name: '🧪 Test on ${{ matrix.os }} ["${{ matrix.config }}", VTK: "${{ matrix.vtk-system }}"]'

steps:
- name: 📥 Checkout
uses: actions/checkout@v3

- name: 🖥️ Setup Environment
uses: ./.github/actions/setup
with:
container: ${{ matrix.os }}
install-vtk: ${{ matrix.vtk-system }}

- name: 🦥 Cache Dependencies
uses: actions/cache@v3
with:
key: test-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.vtk-system }}
path: build

- name: 🏗️ Compile
run: cmake -DVIENNAPS_BUILD_TESTS=ON -B build && cmake --build build --config ${{ matrix.config }}

- name: 🧪 Test
run: ctest -E "Benchmark|Performance" -C ${{ matrix.config }} --test-dir build
30 changes: 0 additions & 30 deletions .github/workflows/check_source.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 🔍 Check Formatting

on:
push:
pull_request:
workflow_dispatch:

jobs:
check-coding-style:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v3

- name: 📋 Install Dependencies
run: pip install -U cmakelang

- name: 🏗️ Format
run: ./format-project.sh

- name: 🔍 Check changes
run: |
if [[ $(git diff-index --name-only --exit-code HEAD) ]]; then
git diff
exit -1
fi
Loading
Loading