diff --git a/.cmake-format b/.cmake-format new file mode 100644 index 00000000..d129923e --- /dev/null +++ b/.cmake-format @@ -0,0 +1,6 @@ +include: ["cmake/.cpm-format"] +format: + line_width: 100 + +markup: + enable_markup: false diff --git a/.github/actions/cache-check/action.yml b/.github/actions/cache-check/action.yml deleted file mode 100644 index 57e5e8a9..00000000 --- a/.github/actions/cache-check/action.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check If Cache Item Exists -description: Checks if the the cache item with the provided key exists -inputs: - cache-key: - description: Cache key - required: true - token: - description: The Personal access token for the github API endpoint - required: true - repository: - description: The repository "username/repo" - required: true -outputs: - exists: - description: "Whether the provided key exists or not" - value: ${{ steps.check.outputs.exists }} -runs: - using: composite - steps: - - id: check - shell: bash - run: | - echo exists=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ inputs.token }}" https://api.github.com/repos/${{inputs.repository}}/actions/caches | jq -r '.actions_caches|any(.key == "${{inputs.cache-key}}")') >> $GITHUB_OUTPUT - - - shell: bash - run: echo ${{steps.check.outputs.exists}} diff --git a/.github/actions/cache-delete/action.yml b/.github/actions/cache-delete/action.yml deleted file mode 100644 index f55078b7..00000000 --- a/.github/actions/cache-delete/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Delete Cache entry -description: Deletes a cache entry that matches the provided key -inputs: - cache-key: - description: Cache key - required: true - token: - description: The Personal access token for the github API endpoint - required: true - repository: - description: The repository "username/repo" - required: true -runs: - using: composite - steps: - - id: check - shell: bash - run: | - curl -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ inputs.token }}" https://api.github.com/repos/${{inputs.repository}}/actions/caches?key=${{inputs.cache-key}} diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..4805fbf1 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -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 diff --git a/.github/homebrew/libomp.rb b/.github/homebrew/libomp.rb new file mode 100644 index 00000000..3b63dbee --- /dev/null +++ b/.github/homebrew/libomp.rb @@ -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 + #include + int main (int argc, char** argv) { + std::array 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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..bd1487fe --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/check_source.yml b/.github/workflows/check_source.yml deleted file mode 100644 index f5dad364..00000000 --- a/.github/workflows/check_source.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Check Source - -on: - pull_request: - branches: [master] - workflow_dispatch: - -jobs: - check-coding-style: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install cmake-format - run: pip3 install -U cmakelang - - - name: Apply Formatting Script - run: ./format-project.sh - - - name: Check if code adheres to coding style - # Checks if the source adheres to the coding style by checking whether - # applying the formatting script changed any files - run: | - if [[ $(git diff-index --name-only --exit-code HEAD) ]]; then - git diff - exit -1 - else - echo "Ok" - fi diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..2b20c54f --- /dev/null +++ b/.github/workflows/format.yml @@ -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 diff --git a/.github/workflows/linux_cache.yml b/.github/workflows/linux_cache.yml deleted file mode 100644 index 8cdeda39..00000000 --- a/.github/workflows/linux_cache.yml +++ /dev/null @@ -1,137 +0,0 @@ -name: Build Dependencies on Linux - -on: - push: - branches: [master] - pull_request: - branches: [master] - repository_dispatch: - types: - - viennals-update-linux - - viennaray-update-linux - # Run this workflow every Sunday at 18:30 to refresh caches - schedule: - - cron: "30 18 * * 0" - workflow_dispatch: - -env: - BUILD_TYPE: Debug - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - setup-viennals: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./viennals - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - - name: Checkout ViennaLS - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaLS - ref: legacy - path: ./viennals - - - name: Store cache key in ENV - shell: bash - run: echo "VIENNALS_CACHE_KEY=viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennals/external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV - - - name: Check if cache key exists - uses: ./.github/actions/cache-check - id: cache-check - with: - cache-key: ${{env.VIENNALS_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Clear Cache - if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} - uses: ./.github/actions/cache-delete - with: - cache-key: ${{env.VIENNALS_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Store cache refresh key in ENV - shell: bash - run: echo "VIENNALS_CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV - - - name: Setup Cache for Build Dependencies - uses: actions/cache@v3 - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - id: viennals-dependency-cache - with: - key: ${{env.VIENNALS_CACHE_KEY}} - path: | - ${{github.workspace}}/viennals/dependencies/Source - ${{github.workspace}}/viennals/dependencies/Build - ${{github.workspace}}/viennals/dependencies/Install - - - name: Configure ViennaLS - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - run: cmake -B ${{github.workspace}}/viennals/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build ViennaLS - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - run: cmake --build ${{github.workspace}}/viennals/build - - setup-viennaray: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./viennaray - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - - name: Checkout ViennaRay - uses: actions/checkout@v3 - with: - repository: ViennaTools/ViennaRay - ref: legacy - path: ./viennaray - - - name: Store cache key in ENV - run: echo "VIENNARAY_CACHE_KEY=viennaray-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennaray/external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV - - - name: Check if cache key exists - uses: ./.github/actions/cache-check - id: cache-check - with: - cache-key: ${{env.VIENNARAY_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Clear Cache - if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} - uses: ./.github/actions/cache-delete - with: - cache-key: ${{env.VIENNARAY_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Store cache refresh key in ENV - shell: bash - run: echo "VIENNARAY_CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV - - - name: Setup Cache for Build Dependencies - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - uses: actions/cache@v3 - id: viennaray-dependency-cache - with: - key: ${{env.VIENNARAY_CACHE_KEY}} - path: ${{github.workspace}}/viennaray/dependencies/Install - - - name: Configure ViennaRay - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - run: cmake -B ./build -D CMAKE_BUILD_TYPE=${{env.build_type}} - - - name: Build ViennaRay - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - run: cmake --build ${{github.workspace}}/viennaray/build diff --git a/.github/workflows/linux_test.yml b/.github/workflows/linux_test.yml deleted file mode 100644 index 1e51dd5d..00000000 --- a/.github/workflows/linux_test.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Linux - -on: - workflow_run: - workflows: [Build Dependencies on Linux] - types: - - completed - -env: - BUILD_TYPE: Debug - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-examples: - runs-on: ubuntu-latest - - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - # ViennaLS - - name: Checkout ViennaLS - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaLS - ref: legacy - path: ./viennals - - - name: Restore ViennaLS build cache - uses: actions/cache@v3 - id: viennals-dependency-cache - with: - key: viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennals/external/upstream/**CMakeLists.txt' ) }} - path: | - ${{github.workspace}}/viennals/dependencies/Source - ${{github.workspace}}/viennals/dependencies/Build - ${{github.workspace}}/viennals/dependencies/Install - - - name: Configure ViennaLS - working-directory: ${{github.workspace}}/viennals - run: | - cmake -B ./build \ - -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/viennals/install - - - name: Build ViennaLS - run: cmake --build ${{github.workspace}}/viennals/build - - - name: Install ViennaLS - run: cmake --install ${{github.workspace}}/viennals/build - - # ViennaRay - - name: Checkout ViennaRay - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaRay - ref: legacy - path: ./viennaray - - - name: Restore ViennaRay build cache - uses: actions/cache@v3 - id: viennaray-dependency-cache - with: - key: viennaray-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennaray/external/upstream/**CMakeLists.txt' ) }} - path: | - ${{github.workspace}}/viennaray/dependencies/Install - - - name: Configure ViennaRay - working-directory: ${{github.workspace}}/viennaray - run: | - cmake -B ./build \ - -D CMAKE_BUILD_TYPE=${{env.build_type}} \ - -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/viennaray/install - - - name: Build ViennaRay - run: cmake --build ${{github.workspace}}/viennaray/build - - - name: Install ViennaRay - run: cmake --install ${{github.workspace}}/viennaray/build - - # ViennaPS - - name: Configure CMake - run: | - cmake -B ./build \ - -D ViennaLS_DIR=${{github.workspace}}/viennals/install/lib/cmake/ViennaLS/ \ - -D ViennaRay_DIR=${{github.workspace}}/viennaray/install/lib/cmake/ViennaRay/ \ - -D VIENNAPS_BUILD_EXAMPLES=ON \ - -D VIENNAPS_BUILD_APPLICATION=ON \ - -D VIENNAPS_BUILD_TESTS=ON - - - name: Build Examples - run: cmake --build ./build --target buildExamples - - - name: Build Application - run: cmake --build ./build --target buildApplication - - - name: Build Tests - run: cmake --build ./build --target buildTests - - - name: Run Tests - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - run: ctest -C ${{env.BUILD_TYPE}} diff --git a/.github/workflows/macos_cache.yml b/.github/workflows/macos_cache.yml deleted file mode 100644 index 5586bca1..00000000 --- a/.github/workflows/macos_cache.yml +++ /dev/null @@ -1,152 +0,0 @@ -name: Build Dependencies on macOS - -on: - push: - branches: [master] - pull_request: - branches: [master] - repository_dispatch: - types: - - viennals-update-macos - - viennaray-update-macos - # Run this workflow every Sunday at 18:30 to refresh caches - schedule: - - cron: "30 18 * * 0" - workflow_dispatch: - -env: - BUILD_TYPE: Debug - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - setup-viennals: - runs-on: macos-latest - defaults: - run: - working-directory: ./viennals - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - - name: Checkout ViennaLS - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaLS - ref: legacy - path: ./viennals - - - name: Store cache key in ENV - shell: bash - run: echo "VIENNALS_CACHE_KEY=viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennals/external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV - - - name: Check if cache key exists - uses: ./.github/actions/cache-check - id: cache-check - with: - cache-key: ${{env.VIENNALS_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Clear Cache - if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} - uses: ./.github/actions/cache-delete - with: - cache-key: ${{env.VIENNALS_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Store cache refresh key in ENV - shell: bash - run: echo "VIENNALS_CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV - - - name: Setup Cache for Build Dependencies - uses: actions/cache@v3 - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - id: viennals-dependency-cache - with: - key: ${{env.VIENNALS_CACHE_KEY}} - path: | - ${{github.workspace}}/viennals/dependencies/Source - ${{github.workspace}}/viennals/dependencies/Build - ${{github.workspace}}/viennals/dependencies/Install - - - name: Configure ViennaLS - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - run: | - cmake -B ./build \ - -D OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_C_LIB_NAMES="omp" \ - -D OpenMP_CXX_LIB_NAMES="omp" \ - -D OpenMP_omp_LIBRARY="$(brew --prefix libomp)/lib/libomp.a" \ - -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build ViennaLS - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - run: cmake --build ${{github.workspace}}/viennals/build - - setup-viennaray: - runs-on: macos-latest - defaults: - run: - working-directory: ./viennaray - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - - name: Checkout ViennaRay - uses: actions/checkout@v3 - with: - repository: ViennaTools/ViennaRay - ref: legacy - path: ./viennaray - - - name: Store cache key in ENV - shell: bash - run: echo "VIENNARAY_CACHE_KEY=viennaray-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennaray/external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV - - - name: Check if cache key exists - uses: ./.github/actions/cache-check - id: cache-check - with: - cache-key: ${{env.VIENNARAY_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Clear Cache - if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} - uses: ./.github/actions/cache-delete - with: - cache-key: ${{env.VIENNARAY_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Store cache refresh key in ENV - shell: bash - run: echo "VIENNARAY_CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV - - - name: Setup Cache for Build Dependencies - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - uses: actions/cache@v3 - id: viennaray-dependency-cache - with: - key: ${{env.VIENNARAY_CACHE_KEY}} - path: ${{github.workspace}}/viennaray/dependencies/Install - - - name: Configure ViennaRay - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - run: | - cmake -B ./build \ - -D CMAKE_BUILD_TYPE=${{env.build_type}} \ - -D OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_C_LIB_NAMES="omp" \ - -D OpenMP_CXX_LIB_NAMES="omp" \ - -D OpenMP_omp_LIBRARY="$(brew --prefix libomp)/lib/libomp.a" - - - name: Build ViennaRay - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - run: cmake --build ${{github.workspace}}/viennaray/build diff --git a/.github/workflows/macos_test.yml b/.github/workflows/macos_test.yml deleted file mode 100644 index 866ee0e7..00000000 --- a/.github/workflows/macos_test.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: macOS - -on: - workflow_run: - workflows: [Build Dependencies on macOS] - types: - - completed - -env: - BUILD_TYPE: Debug - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-examples: - runs-on: macos-latest - - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - # ViennaLS - - name: Checkout ViennaLS - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaLS - ref: legacy - path: ./viennals - - - name: Setup Cache for Build Dependencies - uses: actions/cache@v3 - id: viennals-dependency-cache - with: - key: viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennals/external/upstream/**CMakeLists.txt' ) }} - path: | - ${{github.workspace}}/viennals/dependencies/Source - ${{github.workspace}}/viennals/dependencies/Build - ${{github.workspace}}/viennals/dependencies/Install - - - name: Configure ViennaLS - working-directory: ${{github.workspace}}/viennals - run: | - cmake -B ./build \ - -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/viennals/install \ - -D OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_C_LIB_NAMES="omp" \ - -D OpenMP_CXX_LIB_NAMES="omp" \ - -D OpenMP_omp_LIBRARY="$(brew --prefix libomp)/lib/libomp.a" - - - name: Build ViennaLS - if: ${{steps.cache-check.outputs.cache-hit == false}} - run: cmake --build ${{github.workspace}}/viennals/build - - - name: Install ViennaLS - run: cmake --install ${{github.workspace}}/viennals/build - - # ViennaRay - - name: Checkout ViennaRay - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaRay - ref: legacy - path: ./viennaray - - - name: Restore ViennaRay build cache - uses: actions/cache@v3 - id: viennaray-dependency-cache - with: - key: viennaray-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennaray/external/upstream/**CMakeLists.txt' ) }} - path: | - ${{github.workspace}}/viennaray/dependencies/Install - - - name: Configure ViennaRay - working-directory: ${{github.workspace}}/viennaray - run: | - cmake -B ./build \ - -D CMAKE_BUILD_TYPE=${{env.build_type}} \ - -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/viennaray/install \ - -D OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_C_LIB_NAMES="omp" \ - -D OpenMP_CXX_LIB_NAMES="omp" \ - -D OpenMP_omp_LIBRARY="$(brew --prefix libomp)/lib/libomp.a" - - - name: Build ViennaRay - run: cmake --build ${{github.workspace}}/viennaray/build - - - name: Install ViennaRay - run: cmake --install ${{github.workspace}}/viennaray/build - - # ViennaPS - - name: Configure CMake - run: | - cmake -B ./build \ - -D ViennaLS_DIR=${{github.workspace}}/viennals/install/lib/cmake/ViennaLS/ \ - -D ViennaRay_DIR=${{github.workspace}}/viennaray/install/lib/cmake/ViennaRay/ \ - -D OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ - -D OpenMP_C_LIB_NAMES="omp" \ - -D OpenMP_CXX_LIB_NAMES="omp" \ - -D OpenMP_omp_LIBRARY="$(brew --prefix libomp)/lib/libomp.a" \ - -D VIENNAPS_BUILD_EXAMPLES=ON \ - -D VIENNAPS_BUILD_APPLICATION=ON \ - -D VIENNAPS_BUILD_TESTS=ON - - - name: Build Examples - run: cmake --build ./build --target buildExamples - - - name: Build Application - run: cmake --build ./build --target buildApplication - - - name: Build Tests - run: cmake --build ./build --target buildTests - - - name: Run Tests - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - run: ctest -C ${{env.BUILD_TYPE}} diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 00000000..272677b2 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,56 @@ +name: ๐Ÿ Build Bindings + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + bindings: + strategy: + fail-fast: false + + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + runs-on: ${{ matrix.os }} + container: ${{ matrix.os == 'ubuntu-latest' && 'fedora:38' || null }} + + name: "๐Ÿ Build Bindings on ${{ matrix.os }}" + + steps: + - name: ๐Ÿ“ฅ Checkout + uses: actions/checkout@v3 + + - name: ๐Ÿ–ฅ๏ธ Setup Environment + uses: ./.github/actions/setup + with: + install-vtk: false + container: ${{ matrix.os }} + + - name: ๐Ÿฆฅ Cache Dependencies + uses: actions/cache@v3 + with: + key: python-${{ matrix.os }} + path: build + + - name: ๐Ÿ Build and check Python Module (Windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + python3 -m venv venv + ./venv/Scripts/pip install . + ./venv/Scripts/python -c "import viennaps2d; print(viennaps2d.__doc__)" + + - name: ๐Ÿ Build and check Python Module (Other) + if: ${{ matrix.os != 'windows-latest' }} + run: | + python3 -m venv venv + ./venv/bin/pip install . + ./venv/bin/python -c "import viennaps2d; print(viennaps2d.__doc__)" + + - name: ๐Ÿ“ฆ Upload Artifact + if: always() + uses: actions/upload-artifact@v3 + with: + name: Pre-Built (${{ matrix.os }}) + path: venv diff --git a/.github/workflows/windows_cache.yml b/.github/workflows/windows_cache.yml deleted file mode 100644 index 4a9658ba..00000000 --- a/.github/workflows/windows_cache.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Build Dependencies on Windows - -on: - push: - branches: [master] - pull_request: - branches: [master] - repository_dispatch: - types: - - viennals-update-windows - - viennaray-update-windows - # Run this workflow every Sunday at 18:30 to refresh caches - schedule: - - cron: "30 18 * * 0" - workflow_dispatch: - -env: - BUILD_TYPE: Debug - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - setup-viennals: - runs-on: windows-latest - defaults: - run: - working-directory: ./viennals - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - - name: Checkout ViennaLS - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaLS - ref: legacy - path: ./viennals - - - name: Store cache key in ENV - shell: bash - run: echo "VIENNALS_CACHE_KEY=viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennals/external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV - - - name: Check if cache key exists - uses: ./.github/actions/cache-check - id: cache-check - with: - cache-key: ${{env.VIENNALS_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Clear Cache - if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} - uses: ./.github/actions/cache-delete - with: - cache-key: ${{env.VIENNALS_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Store cache refresh key in ENV - shell: bash - run: echo "VIENNALS_CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV - - - name: Setup Cache for Build Dependencies - uses: actions/cache@v3 - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - id: viennals-dependency-cache - with: - key: ${{env.VIENNALS_CACHE_KEY}} - path: | - ${{github.workspace}}/viennals/dependencies/Source - ${{github.workspace}}/viennals/dependencies/Build - ${{github.workspace}}/viennals/dependencies/Install - - - name: Configure ViennaLS - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - run: cmake -B ${{github.workspace}}/viennals/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/viennals/install - - - name: Build ViennaLS - if: ${{ env.VIENNALS_CACHE_REFRESH == 'true' }} - run: cmake --build ${{github.workspace}}/viennals/build - - setup-viennaray: - runs-on: windows-latest - defaults: - run: - working-directory: ./viennaray - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - - name: Checkout ViennaRay - uses: actions/checkout@v3 - with: - repository: ViennaTools/ViennaRay - ref: legacy - path: ./viennaray - - - name: Store cache key in ENV - shell: bash - run: echo "VIENNARAY_CACHE_KEY=viennaray-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennaray/external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV - - - name: Check if cache key exists - uses: ./.github/actions/cache-check - id: cache-check - with: - cache-key: ${{env.VIENNARAY_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Clear Cache - if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} - uses: ./.github/actions/cache-delete - with: - cache-key: ${{env.VIENNARAY_CACHE_KEY}} - token: ${{ secrets.PAT_CACHE }} - repository: ${{github.repository_owner}}/ViennaPS - - - name: Store cache refresh key in ENV - shell: bash - run: echo "VIENNARAY_CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV - - - name: Setup Cache for Build Dependencies - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - uses: actions/cache@v3 - id: viennaray-dependency-cache - with: - key: ${{env.VIENNARAY_CACHE_KEY}} - path: ${{github.workspace}}/viennaray/dependencies/Install - - - name: Configure ViennaRay - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - run: cmake -B ${{github.workspace}}/viennaray/build -DCMAKE_BUILD_TYPE=${{env.build_type}} - - - name: Build ViennaRay - if: ${{ env.VIENNARAY_CACHE_REFRESH == 'true' }} - run: cmake --build ${{github.workspace}}/viennaray/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/windows_test.yml b/.github/workflows/windows_test.yml deleted file mode 100644 index 5f6eaf75..00000000 --- a/.github/workflows/windows_test.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Windows - -on: - workflow_run: - workflows: [Build Dependencies on Windows] - types: - - completed - -env: - BUILD_TYPE: Debug - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-examples: - runs-on: windows-latest - - steps: - - name: Checkout ViennaPS - uses: actions/checkout@v3 - - # ViennaLS - - name: Checkout ViennaLS - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaLS - ref: legacy - path: ./viennals - - - name: Restore ViennaLS build cache - uses: actions/cache@v3 - id: viennals-dependency-cache - with: - key: viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennals/external/upstream/**CMakeLists.txt' ) }} - path: | - ${{github.workspace}}/viennals/dependencies/Source - ${{github.workspace}}/viennals/dependencies/Build - ${{github.workspace}}/viennals/dependencies/Install - - - name: Configure ViennaLS - working-directory: ${{github.workspace}}/viennals - run: cmake -B ${{github.workspace}}/viennals/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/viennals/install - - - name: Add VTK to PATH - run: echo "${{github.workspace}}\viennals\dependencies\Build\vtk_external\bin\${{env.BUILD_TYPE}}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - name: Build ViennaLS - run: cmake --build ${{github.workspace}}/viennals/build - - - name: Install ViennaLS - run: cmake --install ${{github.workspace}}/viennals/build --config ${{env.BUILD_TYPE}} - - # ViennaRay - - name: Checkout ViennaRay - uses: actions/checkout@v3 - with: - repository: ${{github.repository_owner}}/ViennaRay - ref: legacy - path: ./viennaray - - - name: Restore ViennaRay build cache - uses: actions/cache@v3 - id: viennaray-dependency-cache - with: - key: viennaray-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './viennaray/external/upstream/**CMakeLists.txt' ) }} - path: | - ${{github.workspace}}/viennaray/dependencies/Install - - - name: Configure ViennaRay - working-directory: ${{github.workspace}}/viennaray - run: | - cmake -B ${{github.workspace}}/viennaray/build -DCMAKE_BUILD_TYPE=${{env.build_type}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/viennaray/install - - - name: Add embree to PATH - run: echo "${{github.workspace}}\embree\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - name: Build ViennaRay - run: cmake --build ${{github.workspace}}/viennaray/build --config ${{env.BUILD_TYPE}} - - - name: Install ViennaRay - run: cmake --install ${{github.workspace}}/viennaray/build --config ${{env.BUILD_TYPE}} - - # ViennaPS - - name: Configure ViennaPS - run: | - cmake -B ${{github.workspace}}/build -DViennaLS_DIR=${{github.workspace}}/viennals/install/lib/cmake/ViennaLS/ -DViennaRay_DIR=${{github.workspace}}/viennaray/install/lib/cmake/ViennaRay/ -D CMAKE_CXX_FLAGS="-openmp:llvm" -D VIENNAPS_BUILD_EXAMPLES=ON -D VIENNAPS_BUILD_APPLICATION=ON -D VIENNAPS_BUILD_TESTS=ON - - - name: Build ViennaPS Examples - run: cmake --build ${{github.workspace}}/build/examples --config ${{env.BUILD_TYPE}} - - - name: Build ViennaPS Application - run: cmake --build ${{github.workspace}}/build/app --config ${{env.BUILD_TYPE}} - - - name: Build ViennaPS Tests - run: cmake --build ${{github.workspace}}/build/tests --config ${{env.BUILD_TYPE}} - - - name: Run Tests - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - run: ctest -C ${{env.BUILD_TYPE}} \ No newline at end of file diff --git a/.gitignore b/.gitignore index fef10701..51c239f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,16 @@ -build* +build/ +venv/ + +.vscode +.vs + old_* *a.out install* *.vtk *.vtu *.vtp -*.vscode -.vs CMakeSettings.json -docs/doxygen/*.txt -dependencies/ -!docs/doxygen/doxygen_template.txt *.so *.py[cod] *.egg-info diff --git a/CMakeLists.txt b/CMakeLists.txt index 11b029cc..88ed8d57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,213 +1,149 @@ -cmake_minimum_required(VERSION 3.14 FATAL_ERROR) +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) +project( + ViennaPS + LANGUAGES CXX + VERSION 2.0.0) -project(ViennaPS VERSION 1.3.1) +# -------------------------------------------------------------------------------------------------------- +# Library switches +# -------------------------------------------------------------------------------------------------------- -# Store version in cache -set(VIENNAPS_VERSION - ${PROJECT_VERSION} - CACHE STRING "The version of ViennaPS" FORCE) +option(VIENNAPS_USE_DOUBLE "Use double precision floating point numbers in application" OFF) +option(VIENNAPS_BUILD_APPLICATION "Build application" OFF) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_CXX_STANDARD "17") +option(VIENNAPS_BUILD_PYTHON "Build python bindings" OFF) +option(VIENNAPS_BUILD_EXAMPLES "Build examples" OFF) +option(VIENNAPS_BUILD_TESTS "Build tests" OFF) -add_definitions(-DVIENNAPS_VERSION=${PROJECT_VERSION}) +# -------------------------------------------------------------------------------------------------------- +# Library options +# -------------------------------------------------------------------------------------------------------- -include(GNUInstallDirs) +set(VIENNAPS_LOOKUP_DIRS + "" + CACHE STRING "Directories to account for when searching installed dependencies") -# Setup of default build type -set(DEFAULT_BUILD_TYPE "Release") -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") - set(CMAKE_BUILD_TYPE - "${DEFAULT_BUILD_TYPE}" - CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" - "RelWithDebInfo") -endif() - -# Tell VS to export all symbols to its dll files -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS - TRUE - CACHE BOOL "Export all symbols" FORCE) - add_compile_definitions(_USE_MATH_DEFINES) -endif() +list(APPEND CMAKE_PREFIX_PATH ${VIENNAPS_LOOKUP_DIRS}) -# ################################################################################################## -# CONFIGURATION OPTIONS -# ################################################################################################## - -# Build the included examples -option(VIENNAPS_BUILD_EXAMPLES "Build examples." OFF) - -# Build the application binary -option(VIENNAPS_BUILD_APPLICATION "Build ViennaPS application." OFF) - -# Build the included tests -option(VIENNAPS_BUILD_TESTS "Build tests." OFF) - -# ################################################################################################## -# AUTOMATIC DEPENDENCY PREPARATION -# ################################################################################################## - -# With the stampfile mechanism, cmake automatically retriggers the configure step after the -# buildDependencies targed has been executed. Thus all dependencies that were built with -# buildDependencies should then be made available by the find_package calls. -set(STAMPFILE ${CMAKE_BINARY_DIR}/target.stamp) -# When the buildDependencies target is executed, the stamp file is touched -add_custom_target(buildDependencies COMMAND ${CMAKE_COMMAND} -E touch ${STAMPFILE}) - -# Include the external dependencies -include(ExternalProject) -if(NOT DEFINED VIENNAPS_DEPENDENCIES_DIR) - set(DEPENDENCIES_DIR ${CMAKE_SOURCE_DIR}/dependencies) -else() - set(DEPENDENCIES_DIR - ${VIENNAPS_DEPENDENCIES_DIR} - CACHE PATH "Directory for downloading, building and installing external dependencies") -endif() -add_subdirectory(external/upstream) - -# Create the initial stamp file -file(TOUCH ${STAMPFILE}) -# Include the stamp file, so that cmake is forced to re-run once the file has been touched -include(${STAMPFILE}) - -# Binary store the binary directory for use in subprojects -set(ViennaPS_BINARY_DIR - ${PROJECT_BINARY_DIR} - CACHE PATH "Path to local ViennaPS installation" FORCE) - -# ################################################################################################## -# DEPENDENCY CHECKS -# ################################################################################################## -set(DEPENDENCIES_FOUND TRUE) - -list(APPEND VIENNAPS_DEPENDENCIES "viennals_external") -find_package(ViennaLS QUIET CONFIG PATHS ${ViennaLS_DIR} NO_DEFAULT_PATH) -if(NOT ViennaLS_FOUND) - set(DEPENDENCIES_FOUND FALSE) -endif() - -list(APPEND VIENNAPS_DEPENDENCIES "viennaray_external") -find_package(ViennaRay QUIET CONFIG PATHS ${ViennaRay_DIR} NO_DEFAULT_PATH) -if(NOT ViennaRay_FOUND) - set(DEPENDENCIES_FOUND FALSE) -endif() +# -------------------------------------------------------------------------------------------------------- +# Global CMake Configuration +# โ”” We depend on the vtk python package for our python build and re-use +# their existing vtk libraries, which are not versioned. Because we (possibly) pull in VTK ourselves +# during build time though, we disable the soname versioning so that we can easily set the rpath to +# link against the vtk-python libs +# -------------------------------------------------------------------------------------------------------- if(VIENNAPS_BUILD_PYTHON) - list(APPEND VIENNAPS_DEPENDENCIES "pybind11_external") - find_package(pybind11 QUIET PATHS ${pybind11_DIR} NO_DEFAULT_PATH) - if(NOT pybind11_FOUND) - set(DEPENDENCIES_FOUND FALSE) - endif() + set(CMAKE_PLATFORM_NO_VERSIONED_SONAME ON) endif() -if(DEPENDENCIES_FOUND) - # Remove the buildDependencies target from the ALL target to prevent unnecessary re-builds - set_target_properties(buildDependencies PROPERTIES EXCLUDE_FROM_ALL true) -else() - message(WARNING "Not all dependencies were found. Execute buildDependencies target first.") - # Add the buildDependencies target to the ALL target - set_target_properties(buildDependencies PROPERTIES EXCLUDE_FROM_ALL false) +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp:llvm /bigobj") endif() -# ################################################################################################## -# DIRECTORY CONFIGURATIONS -# ################################################################################################## +# -------------------------------------------------------------------------------------------------------- +# Setup Library +# -------------------------------------------------------------------------------------------------------- -# install config files locations are provided by GNUInstallDirs add_library(${PROJECT_NAME} INTERFACE) +add_library(ViennaTools::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/") +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) +set_target_properties( + ${PROJECT_NAME} + PROPERTIES CXX_STANDARD 17 + CXX_EXTENSIONS OFF + CXX_STANDARD_REQUIRED ON + WINDOWS_EXPORT_ALL_SYMBOLS ON) + +if(MSVC) + # https://learn.microsoft.com/cpp/c-runtime-library/math-constants TODO: In case C++20 is adpoted + # any time soon: https://cppreference.com/w/cpp/numeric/constants + + target_compile_definitions(${PROJECT_NAME} INTERFACE _USE_MATH_DEFINES=1) endif() -set(LOCAL_CONFIG_DIR "lib/cmake/${PROJECT_NAME}") -# This variable is used by the example, test, python and precompiled library target, since those are -# compiled before the project is installed in its proper install location. -set(VIENNAPS_BUILD_INCLUDE_DIRS "${${PROJECT_NAME}_SOURCE_DIR}/include") +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- -# Adding the install interface generator expression makes sure that the include files are installed -# to the proper location (provided by GNUInstallDirs) target_include_directories( - ${PROJECT_NAME} INTERFACE $ - $) -target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) - -# ################################################################################################## -# CMAKE CONFIG FILE SETUP -# ################################################################################################## -include(CMakePackageConfigHelpers) -write_basic_package_version_file( - "${PROJECT_NAME}ConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion) + ${PROJECT_NAME} INTERFACE $ + $) -configure_package_config_file( - "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" - "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" INSTALL_DESTINATION ${LOCAL_CONFIG_DIR}) +# -------------------------------------------------------------------------------------------------------- +# Setup Dependencies +# -------------------------------------------------------------------------------------------------------- -# ################################################################################################## -# BUILD EXAMPLES -# ################################################################################################## -if(VIENNAPS_BUILD_EXAMPLES AND DEPENDENCIES_FOUND) - add_subdirectory(examples) -endif() +include("cmake/cpm.cmake") + +CPMAddPackage( + NAME PackageProject + VERSION 1.11.1 + GIT_REPOSITORY "https://github.com/TheLartians/PackageProject.cmake") + +CPMFindPackage( + NAME ViennaRay + GIT_TAG v2.0.2 + GIT_REPOSITORY "https://github.com/ViennaTools/ViennaRay" + EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}) -# ################################################################################################## -# BUILD VIENNAPS APPLICATION -# ################################################################################################## -if(VIENNAPS_BUILD_APPLICATION AND DEPENDENCIES_FOUND) +CPMFindPackage( + NAME ViennaLS + GIT_TAG v3.1.0 + GIT_REPOSITORY "https://github.com/ViennaTools/ViennaLS" + EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}) + +target_link_libraries(${PROJECT_NAME} INTERFACE ViennaTools::ViennaRay ViennaTools::ViennaLS) + +# -------------------------------------------------------------------------------------------------------- +# Setup Application +# -------------------------------------------------------------------------------------------------------- + +if(VIENNAPS_BUILD_APPLICATION) + message(STATUS "[ViennaPS] Building Application") add_subdirectory(app) endif() -# ################################################################################################## -# BUILD TESTS (Smaller examples for testing) -# ################################################################################################## -if(VIENNAPS_BUILD_TESTS AND DEPENDENCIES_FOUND) +# -------------------------------------------------------------------------------------------------------- +# Setup Examples +# -------------------------------------------------------------------------------------------------------- + +if(VIENNAPS_BUILD_EXAMPLES) + message(STATUS "[ViennaPS] Building Examples") + add_subdirectory(examples) +endif() + +# -------------------------------------------------------------------------------------------------------- +# Setup Tests +# -------------------------------------------------------------------------------------------------------- + +if(VIENNAPS_BUILD_TESTS) + message(STATUS "[ViennaPS] Building Tests") + enable_testing() add_subdirectory(tests) endif() -# ################################################################################################## -# BUILD VIENNAPS PYTHON BINDINGS -# ################################################################################################## -# Build Python bindings -option(VIENNAPS_BUILD_PYTHON "Build for python3.x." OFF) -if(VIENNAPS_BUILD_PYTHON AND DEPENDENCIES_FOUND) +# -------------------------------------------------------------------------------------------------------- +# Setup Python Bindings +# -------------------------------------------------------------------------------------------------------- + +if(VIENNAPS_BUILD_PYTHON) + message(STATUS "[ViennaPS] Building Python Bindings") add_subdirectory(python) + return() endif() -# ################################################################################################## -# INSTALL -# ################################################################################################## -install( - TARGETS ${PROJECT_NAME} - EXPORT ${PROJECT_NAME}_Targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - -install( - EXPORT ${PROJECT_NAME}_Targets - FILE ${PROJECT_NAME}Targets.cmake - DESTINATION ${LOCAL_CONFIG_DIR}) - -install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" - DESTINATION ${LOCAL_CONFIG_DIR}) - -# Install include files -file(GLOB_RECURSE HEADER_FILES "${PROJECT_SOURCE_DIR}/include/*.hpp") -install(FILES ${HEADER_FILES} DESTINATION include) - -# uninstall target -if(NOT TARGET uninstall) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) - - add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P - ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) -endif() +# -------------------------------------------------------------------------------------------------------- +# Install Target +# -------------------------------------------------------------------------------------------------------- + +packageProject( + NAME ${PROJECT_NAME} NAMESPACE ViennaTools + VERSION ${PROJECT_VERSION} + BINARY_DIR ${PROJECT_BINARY_DIR} + INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include/viennaps + INCLUDE_DESTINATION include/viennaps-${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + DEPENDENCIES "ViennaLS;ViennaRay") diff --git a/README.md b/README.md index 2d72685e..1fe7f72b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@
-![](data/images/logo.png) +![](assets/logo.png)

ViennaPS - Process Simulation Library

-[![Linux](https://github.com/ViennaTools/ViennaPS/actions/workflows/linux_test.yml/badge.svg)](https://github.com/ViennaTools/ViennaPS/actions/workflows/linux_test.yml) -[![macOS](https://github.com/ViennaTools/ViennaPS/actions/workflows/macos_test.yml/badge.svg)](https://github.com/ViennaTools/ViennaPS/actions/workflows/macos_test.yml) -[![Windows](https://github.com/ViennaTools/ViennaPS/actions/workflows/windows_test.yml/badge.svg)](https://github.com/ViennaTools/ViennaPS/actions/workflows/windows_test.yml) +[![๐Ÿ Build Bindings](https://github.com/ViennaTools/ViennaPS/actions/workflows/python.yml/badge.svg)](https://github.com/ViennaTools/ViennaPS/actions/workflows/python.yml) +[![๐Ÿงช Run Tests](https://github.com/ViennaTools/ViennaPS/actions/workflows/build.yml/badge.svg)](https://github.com/ViennaTools/ViennaPS/actions/workflows/build.yml)
@@ -48,15 +47,12 @@ The CMake configuration automatically checks if the dependencies are installed. ```bash git clone https://github.com/ViennaTools/ViennaPS.git cd ViennaPS -mkdir build && cd build -cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/your/custom/install/ -make buildDependencies # this will install all dependencies and might take a while -make install -``` -This will install the necessary headers and CMake files to the specified path. If `CMAKE_INSTALL_PREFIX` is not specified, it will be installed to the standard path for your system, usually `/usr/local/` . +cmake -B build && cmake --build build +cmake --install build --prefix "/path/to/your/custom/install/" +``` -If one wants to use a specific installation of one or more of the dependencies, just pass the corresponding _*_DIR_ variable as a configuration option (e.g. -DViennaLS_DIR=/path/to/viennals/install -DViennaRay_DIR=/path/to/viennaray/install). +This will install the necessary headers and CMake files to the specified path. If `--prefix` is not specified, it will be installed to the standard path for your system, usually `/usr/local/` . ## Building the Python package @@ -65,6 +61,7 @@ The Python package can be built and installed using the `pip` command: ```bash git clone https://github.com/ViennaTools/ViennaPS.git cd ViennaPS + pip install --user . ``` @@ -85,15 +82,22 @@ import viennaps3d as vps ## Integration in CMake projects -In order to use this library in your CMake project, add the following lines to the CMakeLists.txt of your project: +We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consume this library. + +* Installation with CPM + ```cmake + CPMAddPackage("gh:viennatools/viennaps@2.0.0") + ``` + +* With a local installation + > In case you have ViennaPS installed in a custom directory, make sure to properly specify the [`CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/latest/envvar/CMAKE_PREFIX_PATH.html#envvar:CMAKE_PREFIX_PATH). + + ```cmake + list(APPEND CMAKE_PREFIX_PATH "/your/local/installation") -```CMake -set(ViennaPS_DIR "/path/to/your/custom/install/") -find_package(ViennaPS REQUIRED) -add_executable(${PROJECT_NAME} ...) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${VIENNAPS_LIBRARIES}) -``` + find_package(ViennaPS) + target_link_libraries(${PROJECT_NAME} PUBLIC ViennaTools::ViennaPS) + ``` ## Basic Examples @@ -103,15 +107,18 @@ The examples can be built using CMake: > __Important__: Make sure all dependencies are installed and have been built previously ```bash -mkdir build && cd build -cmake .. -DVIENNAPS_BUILD_EXAMPLES=ON -make buildExamples +git clone https://github.com/ViennaTools/ViennaPS.git +cd ViennaPS + +cmake -B build -DVIENNAPS_BUILD_EXAMPLES=ON +cmake --build build ``` The examples can then be executed in their respective build folders with the config files, e.g.: ```bash cd examples/exampleName -./ExampleName config.txt +./ExampleName.bat config.txt # (Windows) +./ExampleName config.txt # (Other) ``` Individual examples can also be build by calling `make` in their respective build folder. An equivalent Python script, using the ViennaPS Python bindings, is also given for each example. @@ -119,21 +126,24 @@ Individual examples can also be build by calling `make` in their respective buil ### Trench Deposition This example focuses on a particle deposition process within a trench geometry. By default, the simulation presents a 2D representation of the trench. Nevertheless, users have the flexibility to conduct 3D simulations by adjusting the value of the constant _D_ in __trenchDeposition.cpp__ to 3. Customization of process and geometry parameters is achieved through the __config.txt__ file. The accompanying image illustrates instances of the trench deposition process, showcasing variations in the particle sticking probability _s_. +
- +
### SF6O2 Hole Etching This example demonstrates a hole etching process with a SF6O2 plasma etching chemistry with ion bombardment. The process and geometry parameters can be varied in the __config.txt__ file. Below the results after 10, 20, and 30 seconds of etching are shown. +
- +
By changing the dimension of the hole etching example (_D = 2_), we can easily simulate the profile of a trench etching process with the same plasma chemistry. Here we can, for example, vary the mask tapering angle to observe increased micro-trenching, as shown below. +
- +
### Anisotropic Processes @@ -141,43 +151,48 @@ By changing the dimension of the hole etching example (_D = 2_), we can easily s In the anisotropic process model, the etch or deposition rates are dependent on the crystallographic directions of the surface. This enables the accurate modeling of intricate processes like epitaxial growth or anisotropic wet etching. Basic examples, illustrating these processes are provided with the library and shown below.
- +
### Redeposition During Selective Etching This example demonstrates capturing etching byproducts and the subsequent redeposition during a selective etching process in a Si3N4/SiO2 stack. The etching byproducts are captured in a cell set description of the etching plasma. To model the dynamics of these etching byproducts, a convection-diffusion equation is solved on the cell set using finite differences. The redeposition is then captured by adding up the byproducts in every step and using this information to generate a velocity field on the etched surface. +
- +
## Tests ViennaPS uses CTest to run its tests. In order to check whether ViennaPS runs without issues on your system, you can run: -> __Important__: Make sure all dependencies are installed and have been built previously ```bash -mkdir build && cd build -cmake .. -DVIENNAPS_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=DEBUG -make buildTests -ctest -C Debug +git clone https://github.com/ViennaTools/ViennaPS.git +cd ViennaPS + +cmake -B build -DVIENNAPS_BUILD_TESTS=ON +cmake --build build +ctest -E "Benchmark|Performance" --test-dir build ``` ## Application -> __Deprecation Warning__: The ViennaPS application is no longer updated with new functionalities added to ViennaPS after release 1.2.0. Please use the Python bindings instead. +> [!WARNING] +> The ViennaPS application is no longer updated with new functionalities added to ViennaPS after release 1.2.0. Please use the Python bindings instead. It is also possible to build an application which can parse a custom configuration file and execute pre-defined processes. The application can be built using CMake: -> __Important__: Make sure all dependencies are installed and have been built previously + ```bash -mkdir build && cd build -cmake .. -DVIENNAPS_BUILD_APPLICATION=ON -make buildApplication +git clone https://github.com/ViennaTools/ViennaPS.git +cd ViennaPS + +cmake -B build -DVIENNAPS_BUILD_APPLICATION=ON +cmake --build build ``` -This creates 2 executables `ViennaPS2D` and `ViennaPS3D` which run processes in 2 or 3 dimensions respectively. Every configuration file can be run in 2D or 3D mode. -The configuration file must obey a certain structure in order to be parsed correctly. An example for a configuration file can be seen in _SampleConfig.txt_. The configuration file is parsed line by line and each successfully parsed line is executed immediately. A detailed documentation for the configuration file can be found in **app/README.md**. +This creates 2 executables `ViennaPS2D` and `ViennaPS3D` which run processes in 2 or 3 dimensions respectively. Every configuration file can be run in 2D or 3D mode. +The configuration file must obey a certain structure in order to be parsed correctly. An example for a configuration file can be seen in `SampleConfig.txt`. The configuration file is parsed line by line and each successfully parsed line is executed immediately. A detailed documentation for the configuration file can be found in the [app readme](app/README.md). ## Contributing @@ -185,7 +200,7 @@ If you want to contribute to ViennaPS, make sure to follow the [LLVM Coding guid ## Authors -Current contributors: Tobias Reiter, Julius Piso +Current contributors: Tobias Reiter, Noah Karnel, Julius Piso Contact us via: viennatools@iue.tuwien.ac.at diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 0b10a1b5..169cf4b1 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,50 +1,13 @@ -cmake_minimum_required(VERSION 3.8 FATAL_ERROR) - -project(ViennaPSApplication) - -find_package(ViennaPS CONFIG PATHS ${ViennaPS_BINARY_DIR}) -if(NOT ViennaPS_FOUND) - message( - FATAL_ERROR - "One of the dependencies hasn't been built yet and thus can't be used by the buildExamples target.\n\ - Try the following steps to fix the problem:\n\ - 1. Turn off the buildExamples target by disabling the VIENNAPS_BUILD_EXAMPLES option when configuring the project\n\ - (e.g. with the `-D VIENNAPS_BUILD_EXAMPLES=OFF` flag)\n\ - 2. Build the dependencies target: e.g. `make buildDependencies` when using Makefiles\n\ - 3. Turn on the buildExamples target again by re-enabling the VIENNAPS_BUILD_EXAMPLES option\n\ - (e.g. with the `-D VIENNAPS_BUILD_EXAMPLES=ON` flag)\n\ - 4. Now the configure step should pick up the built dependencies and proceed as intended.") -endif() - -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}) - -# Add subfolders to the include directories, since during installation the directory structure is -# flattened, but in the source tree - which we are using here - it is not. -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}/cellSet - ${VIENNAPS_BUILD_INCLUDE_DIRS}/geometries ${VIENNAPS_BUILD_INCLUDE_DIRS}/models - ${VIENNAPS_BUILD_INCLUDE_DIRS}/compact) +project(ViennaPSApplication LANGUAGES CXX) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -option(VIENNAPS_USE_DOUBLE "Use double precision floating point numbers in application." OFF) -if(VIENNAPS_USE_DOUBLE) - add_compile_definitions(VIENNAPS_USE_DOUBLE) -endif(VIENNAPS_USE_DOUBLE) - -set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE) - -add_custom_target(buildApplication) - -add_executable(ViennaPS2D ${PROJECT_SOURCE_DIR}/application.cpp) +add_executable(ViennaPS2D "application.cpp") +target_link_libraries(ViennaPS2D PRIVATE ViennaPS) target_compile_definitions(ViennaPS2D PRIVATE VIENNAPS_APP_DIM=2) -target_include_directories(ViennaPS2D PUBLIC ${VIENNAPS_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}) -target_link_libraries(ViennaPS2D ${VIENNAPS_LIBRARIES}) -add_dependencies(buildApplication ViennaPS2D) -add_executable(ViennaPS3D ${PROJECT_SOURCE_DIR}/application.cpp) +add_executable(ViennaPS3D "application.cpp") +target_link_libraries(ViennaPS3D PRIVATE ViennaPS) target_compile_definitions(ViennaPS3D PRIVATE VIENNAPS_APP_DIM=3) -target_include_directories(ViennaPS3D PUBLIC ${VIENNAPS_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}) -target_link_libraries(ViennaPS3D ${VIENNAPS_LIBRARIES}) -add_dependencies(buildApplication ViennaPS3D) -configure_file(sampleConfig.txt ${CMAKE_BINARY_DIR}/sampleConfig.txt COPYONLY) +configure_file(sampleConfig.txt ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sampleConfig.txt COPYONLY) diff --git a/app/application.hpp b/app/application.hpp index de754ec6..5c625165 100644 --- a/app/application.hpp +++ b/app/application.hpp @@ -5,30 +5,28 @@ #include -// #include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include #include #include #include #include "applicationParameters.hpp" #include "applicationParser.hpp" -#include "interrupt.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include template class Application { psSmartPointer> geometry = nullptr; @@ -556,9 +554,8 @@ template class Application { std::cout << "Writing volume ...\n"; const std::string suffix = ".vtu"; // check if string ends with .vtu - if (!outFileName.size() >= suffix.size() && - 0 == outFileName.compare(outFileName.size() - suffix.size(), - suffix.size(), suffix)) { + if (outFileName.size() > suffix.size() && + std::equal(suffix.rbegin(), suffix.rend(), suffix.rbegin())) { outFileName.erase(outFileName.length() - 4); } geometry->saveVolumeMesh(outFileName); @@ -642,9 +639,9 @@ template class Application { return "Dielectric"; case psMaterial::Cu: return "Cu"; + default: + return "Unknown material"; } - - return "Unknown material"; } std::string intSchemeString(lsIntegrationSchemeEnum scheme) { @@ -673,4 +670,4 @@ template class Application { return "Invalid integration scheme"; } -}; \ No newline at end of file +}; diff --git a/app/interrupt.hpp b/app/interrupt.hpp deleted file mode 100644 index 300329b7..00000000 --- a/app/interrupt.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include -#include - -class InterruptException : public std::exception { -public: - InterruptException(int s) : S(s) {} - int S; -}; - -void sig_to_exception(int s) { throw InterruptException(s); } \ No newline at end of file diff --git a/data/images/anisotropic_process.svg b/assets/anisotropic_process.svg similarity index 100% rename from data/images/anisotropic_process.svg rename to assets/anisotropic_process.svg diff --git a/data/images/deposition.svg b/assets/deposition.svg similarity index 100% rename from data/images/deposition.svg rename to assets/deposition.svg diff --git a/data/images/hole_etching.svg b/assets/hole_etching.svg similarity index 100% rename from data/images/hole_etching.svg rename to assets/hole_etching.svg diff --git a/data/images/logo.png b/assets/logo.png similarity index 100% rename from data/images/logo.png rename to assets/logo.png diff --git a/data/images/redeposition.gif b/assets/redeposition.gif similarity index 100% rename from data/images/redeposition.gif rename to assets/redeposition.gif diff --git a/data/images/sidewall_tapering.svg b/assets/sidewall_tapering.svg similarity index 100% rename from data/images/sidewall_tapering.svg rename to assets/sidewall_tapering.svg diff --git a/cmake/.cpm-format b/cmake/.cpm-format new file mode 100644 index 00000000..284c984c --- /dev/null +++ b/cmake/.cpm-format @@ -0,0 +1,69 @@ +parse: + additional_commands: + cpmaddpackage: + pargs: + nargs: '*' + flags: [] + spelling: CPMAddPackage + kwargs: &cpmaddpackagekwargs + NAME: 1 + FORCE: 1 + VERSION: 1 + GIT_TAG: 1 + DOWNLOAD_ONLY: 1 + GITHUB_REPOSITORY: 1 + GITLAB_REPOSITORY: 1 + GIT_REPOSITORY: 1 + SVN_REPOSITORY: 1 + SVN_REVISION: 1 + SOURCE_DIR: 1 + DOWNLOAD_COMMAND: 1 + FIND_PACKAGE_ARGUMENTS: 1 + NO_CACHE: 1 + GIT_SHALLOW: 1 + URL: 1 + URL_HASH: 1 + URL_MD5: 1 + DOWNLOAD_NAME: 1 + DOWNLOAD_NO_EXTRACT: 1 + HTTP_USERNAME: 1 + HTTP_PASSWORD: 1 + EXCLUDE_FROM_ALL: 1 + SYSTEM: 1 + SOURCE_SUBDIR: 1 + OPTIONS: + + cpmfindpackage: + pargs: + nargs: '*' + flags: [] + spelling: CPMFindPackage + kwargs: *cpmaddpackagekwargs + cpmdeclarepackage: + pargs: + nargs: '*' + flags: [] + spelling: CPMDeclarePackage + kwargs: *cpmaddpackagekwargs + packageproject: + pargs: + nargs: '*' + flags: [] + spelling: packageProject + kwargs: + NAME: 1 + VERSION: 1 + INCLUDE_DIR: 1 + INCLUDE_DESTINATION: 1 + BINARY_DIR: 1 + COMPATIBILITY: 1 + VERSION_HEADER: 1 + DEPENDENCIES: + + cpmusepackagelock: + pargs: 1 + spelling: CPMUsePackageLock + cpmregisterpackage: + pargs: 1 + spelling: CPMRegisterPackage + cpmgetpackageversion: + pargs: 2 + spelling: CPMGetPackageVersion diff --git a/cmake/ViennaPSConfig.cmake.in b/cmake/ViennaPSConfig.cmake.in deleted file mode 100644 index 354e77fb..00000000 --- a/cmake/ViennaPSConfig.cmake.in +++ /dev/null @@ -1,38 +0,0 @@ -@PACKAGE_INIT@ - -include(CMakeFindDependencyMacro) - -# ViennaPS requires C++17 -set(CMAKE_CXX_STANDARD "17") - -# ################################################################################################## -# compiler dependent settings for ViennaPS -# ################################################################################################## -find_dependency(OpenMP) -list(APPEND VIENNAPS_LIBRARIES OpenMP::OpenMP_CXX) - -# compiler dependent settings -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # disable-new-dtags sets RPATH which searches for libs recursively, instead of RUNPATH which does - # not needed for g++ to link correctly - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags") -elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp /wd\"4267\" /wd\"4244\"") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd\"4267\" /wd\"4244\"") -endif() - -set(VIENNAPS_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@") - -set(ViennaLS_DIR @ViennaLS_DIR@) -set(ViennaRay_DIR @ViennaRay_DIR@) - -find_dependency(ViennaLS PATHS ${ViennaLS_DIR} NO_DEFAULT_PATH) -find_dependency(ViennaRay PATHS ${ViennaRay_DIR} NO_DEFAULT_PATH) - -list(APPEND VIENNAPS_INCLUDE_DIRS ${VIENNALS_INCLUDE_DIRS} ${VIENNARAY_INCLUDE_DIRS}) -list(APPEND VIENNAPS_LIBRARIES ${VIENNALS_LIBRARIES} ${VIENNARAY_LIBRARIES}) - -message(STATUS "ViennaLS found at: ${ViennaLS_DIR}") -message(STATUS "ViennaRay found at: ${ViennaRay_DIR}") - -check_required_components("@PROJECT_NAME@") diff --git a/cmake/bat.cmake b/cmake/bat.cmake new file mode 100644 index 00000000..6cfc0586 --- /dev/null +++ b/cmake/bat.cmake @@ -0,0 +1,12 @@ +macro(setup_windows_bat TARGET LIB_FOLDER) + if(NOT WIN32) + return() + endif() + + message(STATUS "[ViennaPS] Generating Bat file for ${TARGET}") + + file( + GENERATE + OUTPUT "$/${TARGET}.bat" + CONTENT "set \"PATH=${LIB_FOLDER};%PATH%\"\n${TARGET}.exe %*") +endmacro() diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in deleted file mode 100644 index ed3b3eeb..00000000 --- a/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,22 +0,0 @@ -# cmake uninstall command -if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") -endif() - -file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) -string(REGEX REPLACE "\n" ";" files "${files}") -foreach(file ${files}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS - "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif() - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif() -endforeach() diff --git a/cmake/cpm.cmake b/cmake/cpm.cmake new file mode 100644 index 00000000..3ca29064 --- /dev/null +++ b/cmake/cpm.cmake @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: MIT +# +# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors + +set(CPM_DOWNLOAD_VERSION 0.38.6) +set(CPM_HASH_SUM "11c3fa5f1ba14f15d31c2fb63dbc8628ee133d81c8d764caad9a8db9e0bacb07") + +if(CPM_SOURCE_CACHE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +# Expand relative path. This is important if the provided path contains a tilde (~) +get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) + +file(DOWNLOAD + https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}) + +include(${CPM_DOWNLOAD_LOCATION}) diff --git a/cmake/prepare.cmake b/cmake/prepare.cmake deleted file mode 100644 index aab312d0..00000000 --- a/cmake/prepare.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Enable Clang sanitizer for debug builds -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS_DEBUG - "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fsanitize=memory" - CACHE STRING "") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG - "${CMAKE_EXE_LINKER_FLAGS_DEBUGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fsanitize=memory" - CACHE STRING "") -endif() - -macro(SUBDIRLIST result curdir) - file( - GLOB children - RELATIVE ${curdir} - ${curdir}/*) - set(dirlist "") - foreach(child ${children}) - if(IS_DIRECTORY ${curdir}/${child}) - if(NOT ${child} STREQUAL "build") - list(APPEND dirlist ${child}) - endif() - endif() - endforeach() - set(${result} ${dirlist}) -endmacro() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 76d6de4a..3d18b819 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,39 +1,31 @@ -cmake_minimum_required(VERSION 3.8 FATAL_ERROR) - -project(ViennaPSExamples) - -include("${CMAKE_SOURCE_DIR}/cmake/prepare.cmake") - -find_package(ViennaPS CONFIG PATHS ${ViennaPS_BINARY_DIR} NO_DEFAULT_PATH) -if(NOT ViennaPS_FOUND) - message( - FATAL_ERROR - "One of the dependencies hasn't been built yet and thus can't be used by the buildExamples target.\n\ - Try the following steps to fix the problem:\n\ - 1. Turn off the buildExamples target by disabling the VIENNAPS_BUILD_EXAMPLES option when configuring the project\n\ - (e.g. with the `-D VIENNAPS_BUILD_EXAMPLES=OFF` flag)\n\ - 2. Build the dependencies target: e.g. `make buildDependencies` when using Makefiles\n\ - 3. Turn on the buildExamples target again by re-enabling the VIENNAPS_BUILD_EXAMPLES option\n\ - (e.g. with the `-D VIENNAPS_BUILD_EXAMPLES=ON` flag)\n\ - 4. Now the configure step should pick up the built dependencies and proceed as intended.") -endif() +add_custom_target(ViennaPS_Examples ALL) + +include("../cmake/bat.cmake") + +set(VIENNAPS_EXAMPLES_LIB $<1:${PROJECT_BINARY_DIR}/example-libs>) -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}) +if(WIN32 AND NOT VIENNARAY_SYSTEM_EMBREE) + setup_embree_env(ViennaPS_Examples ${VIENNAPS_EXAMPLES_LIB}) +endif() -# Add subfolders to the include directories, since during installation the directory structure is -# flattened, but in the source tree - which we are using here - it is not. -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}/cellSet - ${VIENNAPS_BUILD_INCLUDE_DIRS}/geometries ${VIENNAPS_BUILD_INCLUDE_DIRS}/models - ${VIENNAPS_BUILD_INCLUDE_DIRS}/compact) +if(WIN32 AND NOT VIENNARAY_SYSTEM_TBB) + setup_tbb_env(ViennaPS_Examples ${VIENNAPS_EXAMPLES_LIB}) +endif() -# Exclude the buildExamples target from the `all` target -set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE) +if(WIN32 AND NOT VIENNALS_SYSTEM_VTK) + setup_vtk_env(ViennaPS_Examples ${VIENNAPS_EXAMPLES_LIB}) +endif() -add_custom_target(buildExamples) +file( + GLOB entries + LIST_DIRECTORIES true + "*") -subdirlist(EXAMPLE_DIRS ${CMAKE_CURRENT_LIST_DIR}) +foreach(entry ${entries}) + if(NOT IS_DIRECTORY ${entry}) + continue() + endif() -# add all examples -foreach(subdir ${EXAMPLE_DIRS}) - add_subdirectory(${subdir}) + message(STATUS "[ViennaPS] Adding Example ${entry}") + add_subdirectory(${entry}) endforeach() diff --git a/examples/GDSReader/CMakeLists.txt b/examples/GDSReader/CMakeLists.txt index c68807cd..c97294cc 100644 --- a/examples/GDSReader/CMakeLists.txt +++ b/examples/GDSReader/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(GDSReader LANGUAGES CXX) -project("GDSReader") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(GDSReader.py ${CMAKE_CURRENT_BINARY_DIR}/GDSReader.py COPYONLY) configure_file(mask.gds ${CMAKE_CURRENT_BINARY_DIR}/mask.gds COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/KDTreeBenchmark/CMakeLists.txt b/examples/KDTreeBenchmark/CMakeLists.txt index bb5fc59d..11b55842 100644 --- a/examples/KDTreeBenchmark/CMakeLists.txt +++ b/examples/KDTreeBenchmark/CMakeLists.txt @@ -1,17 +1,7 @@ -cmake_minimum_required(VERSION 3.4) +project(KDTreeBenchmark LANGUAGES CXX) -project("KDTreeBenchmark") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -if(MSVC) - # warning level 4 - add_compile_options(/W4) -else() - # lots of warnings - add_compile_options(-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion) -endif() - -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/KDTreeBenchmark/KDTreeBenchmark.cpp b/examples/KDTreeBenchmark/KDTreeBenchmark.cpp index 763f6e3b..043bd9e5 100644 --- a/examples/KDTreeBenchmark/KDTreeBenchmark.cpp +++ b/examples/KDTreeBenchmark/KDTreeBenchmark.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -7,7 +6,7 @@ #include #endif -#include +#include #include inline double getTime() { diff --git a/examples/TEOSTrenchDeposition/CMakeLists.txt b/examples/TEOSTrenchDeposition/CMakeLists.txt index 937718f7..23f2be00 100644 --- a/examples/TEOSTrenchDeposition/CMakeLists.txt +++ b/examples/TEOSTrenchDeposition/CMakeLists.txt @@ -1,19 +1,19 @@ -cmake_minimum_required(VERSION 3.4) +project(TEOSTrenchDeposition LANGUAGES CXX) -project("TEOSTrenchDeposition") +add_executable(singleTEOS "singleTEOS.cpp") +target_link_libraries(singleTEOS PRIVATE ViennaPS) -add_executable(singleTEOS singleTEOS.cpp) -target_include_directories(singleTEOS PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(singleTEOS PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(singleTEOS.py ${CMAKE_CURRENT_BINARY_DIR}/singleTEOS.py COPYONLY) configure_file(singleTEOS_config.txt ${CMAKE_CURRENT_BINARY_DIR}/singleTEOS_config.txt COPYONLY) -add_dependencies(buildExamples singleTEOS) +add_dependencies(ViennaPS_Examples singleTEOS) +setup_windows_bat(singleTEOS ${VIENNAPS_EXAMPLES_LIB}) + +add_executable(multiTEOS "multiTEOS.cpp") +target_link_libraries(multiTEOS PRIVATE ViennaPS) -add_executable(multiTEOS multiTEOS.cpp) -target_include_directories(multiTEOS PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(multiTEOS PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(multiTEOS.py ${CMAKE_CURRENT_BINARY_DIR}/multiTEOS.py COPYONLY) configure_file(multiTEOS_config.txt ${CMAKE_CURRENT_BINARY_DIR}/multiTEOS_config.txt COPYONLY) -add_dependencies(buildExamples multiTEOS) +add_dependencies(ViennaPS_Examples multiTEOS) +setup_windows_bat(multiTEOS ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/TEOSTrenchDeposition/multiTEOS.cpp b/examples/TEOSTrenchDeposition/multiTEOS.cpp index fe5ba3ce..4befd71b 100644 --- a/examples/TEOSTrenchDeposition/multiTEOS.cpp +++ b/examples/TEOSTrenchDeposition/multiTEOS.cpp @@ -1,9 +1,9 @@ +#include +#include + #include -#include #include -#include - #include "parameters.hpp" int main(int argc, char **argv) { @@ -56,4 +56,4 @@ int main(int argc, char **argv) { if constexpr (D == 2) geometry->saveVolumeMesh("MulitTEOS_final"); -} \ No newline at end of file +} diff --git a/examples/TEOSTrenchDeposition/singleTEOS.cpp b/examples/TEOSTrenchDeposition/singleTEOS.cpp index 5a0d22c9..47ff0bfd 100644 --- a/examples/TEOSTrenchDeposition/singleTEOS.cpp +++ b/examples/TEOSTrenchDeposition/singleTEOS.cpp @@ -1,9 +1,9 @@ +#include +#include + #include -#include #include -#include - #include "parameters.hpp" int main(int argc, char **argv) { @@ -54,4 +54,4 @@ int main(int argc, char **argv) { if constexpr (D == 2) geometry->saveVolumeMesh("SingleTEOS_final"); -} \ No newline at end of file +} diff --git a/examples/atomicLayerDeposition/CMakeLists.txt b/examples/atomicLayerDeposition/CMakeLists.txt index 5abd92c0..75ba316b 100644 --- a/examples/atomicLayerDeposition/CMakeLists.txt +++ b/examples/atomicLayerDeposition/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 3.4) +project(atomicLayerDeposition LANGUAGES CXX) -project("atomicLayerDeposition") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) configure_file(atomicLayerDeposition.py ${CMAKE_CURRENT_BINARY_DIR}/atomicLayerDeposition.py COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/atomicLayerDeposition/atomicLayerDeposition.cpp b/examples/atomicLayerDeposition/atomicLayerDeposition.cpp index 994d5b75..6a845999 100644 --- a/examples/atomicLayerDeposition/atomicLayerDeposition.cpp +++ b/examples/atomicLayerDeposition/atomicLayerDeposition.cpp @@ -1,8 +1,9 @@ -#include -#include -#include +#include +#include +#include +#include + #include -#include #include #include "geometry.hpp" @@ -80,4 +81,4 @@ int main(int argc, char *argv[]) { model.setReactionOrder(params.get("reactionOrder")); model.apply(); -} \ No newline at end of file +} diff --git a/examples/atomicLayerDeposition/geometry.hpp b/examples/atomicLayerDeposition/geometry.hpp index ad53291e..f5a1f3a8 100644 --- a/examples/atomicLayerDeposition/geometry.hpp +++ b/examples/atomicLayerDeposition/geometry.hpp @@ -2,8 +2,9 @@ #include #include + +#include #include -#include #include template @@ -71,4 +72,4 @@ void makeLShape(psSmartPointer> domain, domain->applyBooleanOperation(horiBox, lsBooleanOperationEnum::RELATIVE_COMPLEMENT); } -} \ No newline at end of file +} diff --git a/examples/cantileverWetEtching/CMakeLists.txt b/examples/cantileverWetEtching/CMakeLists.txt index b65c0c77..f1a8bfa5 100644 --- a/examples/cantileverWetEtching/CMakeLists.txt +++ b/examples/cantileverWetEtching/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(cantileverWetEtching LANGUAGES CXX) -project("cantileverWetEtching") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(cantileverWetEtching.py ${CMAKE_CURRENT_BINARY_DIR}/cantileverWetEtching.py COPYONLY) configure_file(cantilever_mask.gds ${CMAKE_CURRENT_BINARY_DIR}/cantilever_mask.gds COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/cantileverWetEtching/cantileverWetEtching.cpp b/examples/cantileverWetEtching/cantileverWetEtching.cpp index d6092d6d..68857153 100644 --- a/examples/cantileverWetEtching/cantileverWetEtching.cpp +++ b/examples/cantileverWetEtching/cantileverWetEtching.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include int main(int argc, char **argv) { using NumericType = double; @@ -83,4 +83,4 @@ int main(int argc, char **argv) { } geometry->saveSurfaceMesh("finalGeometry.vtp"); -} \ No newline at end of file +} diff --git a/examples/exampleProcess/CMakeLists.txt b/examples/exampleProcess/CMakeLists.txt index bdf8ea01..024731cc 100644 --- a/examples/exampleProcess/CMakeLists.txt +++ b/examples/exampleProcess/CMakeLists.txt @@ -1,9 +1,7 @@ -cmake_minimum_required(VERSION 3.4) +project(exampleProcess LANGUAGES CXX) -project("exampleProcess") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/exampleProcess/exampleProcess.cpp b/examples/exampleProcess/exampleProcess.cpp index 66cae547..4c5fc04b 100644 --- a/examples/exampleProcess/exampleProcess.cpp +++ b/examples/exampleProcess/exampleProcess.cpp @@ -1,6 +1,6 @@ +#include #include -#include #include #include #include @@ -101,4 +101,4 @@ int main() { domain->saveSurfaceMesh("ExampleProcess.vtp"); return 0; -} \ No newline at end of file +} diff --git a/examples/holeEtching/CMakeLists.txt b/examples/holeEtching/CMakeLists.txt index 2271ce47..a1bca1cb 100644 --- a/examples/holeEtching/CMakeLists.txt +++ b/examples/holeEtching/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(holeEtching LANGUAGES CXX) -project("holeEtching") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(holeEtching.py ${CMAKE_CURRENT_BINARY_DIR}/holeEtching.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/holeEtching/holeEtching.cpp b/examples/holeEtching/holeEtching.cpp index 1722023e..60aa3e13 100644 --- a/examples/holeEtching/holeEtching.cpp +++ b/examples/holeEtching/holeEtching.cpp @@ -1,6 +1,7 @@ -#include +#include +#include + #include -#include #include #include #include diff --git a/examples/interpolationDemo/CMakeLists.txt b/examples/interpolationDemo/CMakeLists.txt index 2900a20e..8f959797 100644 --- a/examples/interpolationDemo/CMakeLists.txt +++ b/examples/interpolationDemo/CMakeLists.txt @@ -1,13 +1,11 @@ -cmake_minimum_required(VERSION 3.4) +project(interpolationDemo LANGUAGES CXX) -project("interpolationDemo") - -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) configure_file(griddata.csv ${CMAKE_CURRENT_BINARY_DIR}/griddata.csv COPYONLY) configure_file(scatterdata.csv ${CMAKE_CURRENT_BINARY_DIR}/scatterdata.csv COPYONLY) configure_file(plot.py ${CMAKE_CURRENT_BINARY_DIR}/plot.py COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/interpolationDemo/interpolationDemo.cpp b/examples/interpolationDemo/interpolationDemo.cpp index c4534131..ea442174 100644 --- a/examples/interpolationDemo/interpolationDemo.cpp +++ b/examples/interpolationDemo/interpolationDemo.cpp @@ -10,12 +10,13 @@ #include #include -#include -#include -#include -#include +#include +#include -#include +#include +#include + +#include namespace fs = std::filesystem; diff --git a/examples/oxideRegrowth/CMakeLists.txt b/examples/oxideRegrowth/CMakeLists.txt index 1b990b55..b2b40678 100644 --- a/examples/oxideRegrowth/CMakeLists.txt +++ b/examples/oxideRegrowth/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(oxideRegrowth LANGUAGES CXX) -project("oxideRegrowth") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(oxideRegrowth.py ${CMAKE_CURRENT_BINARY_DIR}/oxideRegrowth.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/oxideRegrowth/oxideRegrowth.cpp b/examples/oxideRegrowth/oxideRegrowth.cpp index f6963831..7f663a2a 100644 --- a/examples/oxideRegrowth/oxideRegrowth.cpp +++ b/examples/oxideRegrowth/oxideRegrowth.cpp @@ -1,7 +1,7 @@ -#include +#include #include -#include +#include #include "parameters.hpp" @@ -78,4 +78,4 @@ int main(int argc, char **argv) { process.apply(); domain->saveVolumeMesh("finalStack"); -} \ No newline at end of file +} diff --git a/examples/selectiveEpitaxy/CMakeLists.txt b/examples/selectiveEpitaxy/CMakeLists.txt index b1a5e673..42272e2e 100644 --- a/examples/selectiveEpitaxy/CMakeLists.txt +++ b/examples/selectiveEpitaxy/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(selectiveEpitaxy LANGUAGES CXX) -project("selectiveEpitaxy") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(selectiveEpitaxy.py ${CMAKE_CURRENT_BINARY_DIR}/selectiveEpitaxy.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/stackEtching/CMakeLists.txt b/examples/stackEtching/CMakeLists.txt index 0e2ee3ba..ccdb9dd6 100644 --- a/examples/stackEtching/CMakeLists.txt +++ b/examples/stackEtching/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(stackEtching LANGUAGES CXX) -project("stackEtching") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(stackEtching.py ${CMAKE_CURRENT_BINARY_DIR}/stackEtching.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/stackEtching/stackEtching.cpp b/examples/stackEtching/stackEtching.cpp index 84e12ecd..3ee2a017 100644 --- a/examples/stackEtching/stackEtching.cpp +++ b/examples/stackEtching/stackEtching.cpp @@ -1,6 +1,7 @@ +#include +#include + #include -#include -#include #include #include "parameters.hpp" @@ -66,4 +67,4 @@ int main(int argc, char *argv[]) { extruded->saveSurfaceMesh("surface.vtp"); geometry->saveVolumeMesh("final_extruded"); -} \ No newline at end of file +} diff --git a/examples/trenchDeposition/CMakeLists.txt b/examples/trenchDeposition/CMakeLists.txt index f1dc9f75..17ccec0a 100644 --- a/examples/trenchDeposition/CMakeLists.txt +++ b/examples/trenchDeposition/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(trenchDeposition LANGUAGES CXX) -project("trenchDeposition") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(trenchDeposition.py ${CMAKE_CURRENT_BINARY_DIR}/trenchDeposition.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/trenchDeposition/trenchDeposition.cpp b/examples/trenchDeposition/trenchDeposition.cpp index d63c1d5f..fad60933 100644 --- a/examples/trenchDeposition/trenchDeposition.cpp +++ b/examples/trenchDeposition/trenchDeposition.cpp @@ -1,6 +1,7 @@ #include +#include + #include -#include #include #include "parameters.hpp" diff --git a/examples/trenchDepositionGeometric/CMakeLists.txt b/examples/trenchDepositionGeometric/CMakeLists.txt index 67b96537..a2ae284f 100644 --- a/examples/trenchDepositionGeometric/CMakeLists.txt +++ b/examples/trenchDepositionGeometric/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 3.4) +project(trenchDepositionGeometric LANGUAGES CXX) -project("trenchDepositionGeometric") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(trenchDepositionGeometric.py ${CMAKE_CURRENT_BINARY_DIR}/trenchDepositionGeometric.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/trenchDepositionGeometric/trenchDepositionGeometric.cpp b/examples/trenchDepositionGeometric/trenchDepositionGeometric.cpp index b3d49e5c..8b02ba7c 100644 --- a/examples/trenchDepositionGeometric/trenchDepositionGeometric.cpp +++ b/examples/trenchDepositionGeometric/trenchDepositionGeometric.cpp @@ -1,5 +1,6 @@ #include -#include +#include + #include #include diff --git a/examples/volumeModel/CMakeLists.txt b/examples/volumeModel/CMakeLists.txt index 0a5b66ba..dec39ae1 100644 --- a/examples/volumeModel/CMakeLists.txt +++ b/examples/volumeModel/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +project(volumeModel LANGUAGES CXX) -project("volumeModel") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) configure_file(volumeModel.py ${CMAKE_CURRENT_BINARY_DIR}/volumeModel.py COPYONLY) configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) -add_dependencies(buildExamples ${PROJECT_NAME}) +add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) +setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/volumeModel/volumeModel.cpp b/examples/volumeModel/volumeModel.cpp index 497abebc..1f636bec 100644 --- a/examples/volumeModel/volumeModel.cpp +++ b/examples/volumeModel/volumeModel.cpp @@ -1,5 +1,6 @@ #include -#include +#include + #include #include "parameters.hpp" diff --git a/external/upstream/CMakeLists.txt b/external/upstream/CMakeLists.txt deleted file mode 100644 index 5dc073da..00000000 --- a/external/upstream/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# external project base directory for all projects in this hierarchy -set_property(DIRECTORY PROPERTY EP_BASE ${DEPENDENCIES_DIR}) - -add_subdirectory(viennals) - -add_subdirectory(viennaray) - -if(VIENNAPS_BUILD_PYTHON) - add_subdirectory(pybind11) -endif() diff --git a/external/upstream/pybind11/CMakeLists.txt b/external/upstream/pybind11/CMakeLists.txt deleted file mode 100644 index 198229aa..00000000 --- a/external/upstream/pybind11/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -# ################################################################################################## -# Check pybind11 Dependency -# ################################################################################################## -# If the path to an installation was provided by the user -if(DEFINED pybind11_DIR AND NOT DEFINED CACHE{pybind11_DIR}) - # Required for windows to convert backslashes to forward slashes - file(TO_CMAKE_PATH "${pybind11_DIR}" pybind11_DIR) - set(pybind11_DIR - "${pybind11_DIR}" - CACHE PATH "Path to pybind11 installation" FORCE) - find_package(pybind11 REQUIRED PATHS ${pybind11_FOUND} NO_DEFAULT_PATH) - message(STATUS "pybind11_DIR: ${pybind11_DIR}") - add_library(pybind11_external INTERFACE) # dummy target -else() - find_package(pybind11 QUIET) - if(pybind11_FOUND) - message(STATUS "Found pybind11 at ${pybind11_DIR}.") - add_library(pybind11_external INTERFACE) # dummy target - else() - message( - STATUS - "Couldn't find pybind11. Dependency will be built with the buildDependencies target (e.g. `make buildDependencies`)." - ) - - # Get the number of cores - include(ProcessorCount) - ProcessorCount(NPROC) - - ExternalProject_Add( - pybind11_external - GIT_REPOSITORY https://github.com/pybind/pybind11.git - # Hash of tags/v2.6.2 - GIT_TAG # v2.6.2 - 8de7772cc72daca8e947b79b83fea46214931604 - # GIT_SHALLOW 1 - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - # -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} - -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} - # -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF - BUILD_COMMAND ${CMAKE_COMMAND} --build . --parallel ${NPROC} - # # No install needed INSTALL_COMMAND - INSTALL_COMMAND ${CMAKE_COMMAND} --install . - # "cmake --install build" - UPDATE_COMMAND "" - USES_TERMINAL_DOWNLOAD 1 - USES_TERMINAL_UPDATE 1 - GIT_PROGRESS 1) - - # Get install and build directory - ExternalProject_Get_Property(pybind11_external INSTALL_DIR BINARY_DIR) - set(pybind11_DIR "${INSTALL_DIR}") - # add to buildDependencies target - add_dependencies(buildDependencies pybind11_external) - - endif() - set(pybind11_DIR - "${pybind11_DIR}" - CACHE PATH "Path to pybind11 installation" FORCE) -endif() diff --git a/external/upstream/viennals/CMakeLists.txt b/external/upstream/viennals/CMakeLists.txt deleted file mode 100644 index 495e84df..00000000 --- a/external/upstream/viennals/CMakeLists.txt +++ /dev/null @@ -1,75 +0,0 @@ -# Check if the variable is a cache variable -get_property( - is_cached - CACHE ViennaLS_DIR - PROPERTY TYPE) -# If it is not from cache and defined at this point, the variable was passed as a -D command line -# argument -if("${is_cached}" STREQUAL "" AND DEFINED ViennaLS_DIR) - # Required for windows to convert backslashes to forward slashes - file(TO_CMAKE_PATH "${ViennaLS_DIR}" ViennaLS_DIR) - set(ViennaLS_DIR - "${ViennaLS_DIR}" - CACHE PATH "Path to ViennaLS installation" FORCE) - # Now look for the package at the provided location - find_package(ViennaLS REQUIRED PATHS ${ViennaLS_DIR} NO_DEFAULT_PATH) - if(ViennaLS_FOUND AND NOT ${VIENNALS_USE_VTK}) - message(FATAL_ERROR "ViennaLS was built without VTK support!") - endif() - message(STATUS "Found ViennaLS at ${ViennaLS_DIR}") - add_library(viennals_external INTERFACE) # dummy target -else() - # First try to locate any local build - find_package(ViennaLS QUIET PATHS "${DEPENDENCIES_DIR}/Install/viennals_external" NO_DEFAULT_PATH) - - # If that fails look for a system installation - if(NOT ViennaLS_FOUND) - find_package(ViennaLS QUIET) - endif() - - if(ViennaLS_FOUND AND NOT ${VIENNALS_USE_VTK}) - set(ViennaLS_FOUND FALSE) - message( - STATUS "An installation of ViennaLS was found, but it was built without support for VTK.") - endif() - if(ViennaLS_FOUND) - message(STATUS "Found ViennaLS at ${ViennaLS_DIR}.") - add_library(viennals_external INTERFACE) # dummy target - else() - message( - STATUS - "Couldn't find ViennaLS. Dependency will be built with the buildDependencies target (e.g. `make buildDependencies`)." - ) - ExternalProject_Add( - viennals_external - GIT_REPOSITORY https://github.com/ViennaTools/ViennaLS.git - GIT_SHALLOW 1 - GIT_TAG legacy - INSTALL_DIR "${DEPENDENCIES_DIR}/Install/viennals_external" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} - -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} - -DVIENNALS_BUILD_EXAMPLES=OFF - -DVIENNALS_BUILD_TESTS=OFF - -DVIENNALS_USE_VTK=ON - BUILD_COMMAND ${CMAKE_COMMAND} --build . --target buildDependencies all - USES_TERMINAL_DOWNLOAD 1 - USES_TERMINAL_UPDATE 1 - GIT_PROGRESS 1 - EXCLUDE_FROM_ALL TRUE) - - # Get install and build directory - ExternalProject_Get_Property(viennals_external INSTALL_DIR) - - set(ViennaLS_DIR "${INSTALL_DIR}") - - # add to buildDependencies target - add_dependencies(buildDependencies viennals_external) - endif() - set(ViennaLS_DIR - ${ViennaLS_DIR} - CACHE PATH "Path to ViennaLS installation" FORCE) -endif() diff --git a/external/upstream/viennaray/CMakeLists.txt b/external/upstream/viennaray/CMakeLists.txt deleted file mode 100644 index 575951dc..00000000 --- a/external/upstream/viennaray/CMakeLists.txt +++ /dev/null @@ -1,66 +0,0 @@ -# Check if the variable is a cache variable -get_property( - is_cached - CACHE ViennaRay_DIR - PROPERTY TYPE) -# If it is not from cache and defined at this point, the variable was passed as a -D command line -# argument -if("${is_cached}" STREQUAL "" AND DEFINED ViennaRay_DIR) - # Required for windows to convert backslashes to forward slashes - file(TO_CMAKE_PATH "${ViennaRay_DIR}" ViennaRay_DIR) - set(ViennaRay_DIR - "${ViennaRay_DIR}" - CACHE PATH "Path to ViennaRay installation" FORCE) - find_package(ViennaRay REQUIRED PATHS ${ViennaRay_DIR} NO_DEFAULT_PATH) - message(STATUS "Found ViennaRay at ${ViennaRay_DIR}") - add_library(viennaray_external INTERFACE) # dummy target -else() - # First try to locate any local build - find_package(ViennaRay QUIET PATHS "${DEPENDENCIES_DIR}/Install/viennaray_external" - NO_DEFAULT_PATH) - - # If that fails look for a system installation - if(NOT ViennaRay_FOUND) - find_package(ViennaRay QUIET) - endif() - - if(ViennaRay_FOUND) - message(STATUS "Found ViennaRay at ${ViennaRay_DIR}.") - add_library(viennaray_external INTERFACE) # dummy target - else() - message( - STATUS - "Couldn't find ViennaRay. Dependency will be built with the buildDependencies target (e.g. `make buildDependencies`)." - ) - ExternalProject_Add( - viennaray_external - GIT_REPOSITORY https://github.com/ViennaTools/ViennaRay.git - GIT_SHALLOW 1 - GIT_TAG legacy - INSTALL_DIR "${DEPENDENCIES_DIR}/Install/viennaray_external" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} - -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} - -DVIENNARAY_BUILD_EXAMPLES=OFF - -DVIENNARAY_BUILD_TESTS=OFF - BUILD_COMMAND ${CMAKE_COMMAND} --build . --target buildDependencies all - USES_TERMINAL_DOWNLOAD 1 - USES_TERMINAL_UPDATE 1 - GIT_PROGRESS 1 - EXCLUDE_FROM_ALL TRUE) - - # Get install and build directory - ExternalProject_Get_Property(viennaray_external INSTALL_DIR) - - set(ViennaRay_DIR "${INSTALL_DIR}") - - # add to buildDependencies target - add_dependencies(buildDependencies viennaray_external) - endif() - set(ViennaRay_DIR - "${ViennaRay_DIR}" - CACHE PATH "Path to ViennaRay installation" FORCE) -endif() diff --git a/format-project.sh b/format-project.sh index f2525336..47da0b03 100755 --- a/format-project.sh +++ b/format-project.sh @@ -3,10 +3,11 @@ # note: if you aliased clang-format, invoke this script using # bash -i format-project.sh -find . -type d \( -path ./dependencies -o -path ./build* \) -prune -false -o -name "*.hpp" -o -name "*.cpp" | while read -r i; do echo $i; clang-format -i "$i"; done +find . -type d \( -path ./dependencies -o -path "./build*" \) -prune -false -o -name "*.hpp" -o -name "*.cpp" | while read -r i; do echo "$i"; clang-format -i "$i"; done # cmake-format can be installed with `pip install --upgrade cmake-format` + if command -v cmake-format &> /dev/null then - find . -type d \( -path ./dependencies -o -path ./build* \) -prune -false -o -name *.cmake -o -name CMakeLists.txt -o -name *.cmake.in | while read -r i; do echo $i; cmake-format --line-width 100 -i "$i"; done -fi \ No newline at end of file + find . -type d \( -path ./dependencies -o -path "./build*" \) -prune -false -o -name "*.cmake" -o -name CMakeLists.txt -o -name "*.cmake.in" | while read -r i; do echo "$i"; cmake-format -i "$i"; done +fi diff --git a/include/cellSet/csBVH.hpp b/include/viennaps/cellSet/csBVH.hpp similarity index 96% rename from include/cellSet/csBVH.hpp rename to include/viennaps/cellSet/csBVH.hpp index e06bce98..835763b7 100644 --- a/include/cellSet/csBVH.hpp +++ b/include/viennaps/cellSet/csBVH.hpp @@ -1,7 +1,6 @@ #pragma once -#include - +#include "csBoundingVolume.hpp" #include /// Helper class to quickly determine the cell in which a given point resides @@ -34,4 +33,4 @@ template class csBVH { void clearCellIds() { BV->clear(); } size_t getTotalCellCount() { return BV->getTotalCellCounts(); } -}; \ No newline at end of file +}; diff --git a/include/cellSet/csBoundingVolume.hpp b/include/viennaps/cellSet/csBoundingVolume.hpp similarity index 99% rename from include/cellSet/csBoundingVolume.hpp rename to include/viennaps/cellSet/csBoundingVolume.hpp index 200dbef8..f3a9d6e5 100644 --- a/include/cellSet/csBoundingVolume.hpp +++ b/include/viennaps/cellSet/csBoundingVolume.hpp @@ -1,11 +1,11 @@ #pragma once -#include - -#include - +#include "csUtil.hpp" #include +#include +#include + template class csBoundingVolume { private: using BVPtrType = lsSmartPointer>; diff --git a/include/cellSet/csDenseCellSet.hpp b/include/viennaps/cellSet/csDenseCellSet.hpp similarity index 99% rename from include/cellSet/csDenseCellSet.hpp rename to include/viennaps/cellSet/csDenseCellSet.hpp index f4f9be27..093f91d6 100644 --- a/include/cellSet/csDenseCellSet.hpp +++ b/include/viennaps/cellSet/csDenseCellSet.hpp @@ -1,22 +1,22 @@ -#ifndef DENSE_CELL_SET -#define DENSE_CELL_SET +#pragma once -#include -#include -#include +#include "csBVH.hpp" +#include "csTracePath.hpp" +#include "csUtil.hpp" + +#include "../psLogger.hpp" +#include "../psMaterials.hpp" +#include "../psSmartPointer.hpp" +#include "../psVTKWriter.hpp" #include #include #include #include #include - #include -#include -#include -#include -#include +#include /** This class represents a cell-based voxel implementation of a volume. The @@ -775,5 +775,3 @@ template class csDenseCellSet { return onBoundary; } }; - -#endif \ No newline at end of file diff --git a/include/cellSet/csMeanFreePath.hpp b/include/viennaps/cellSet/csMeanFreePath.hpp similarity index 96% rename from include/cellSet/csMeanFreePath.hpp rename to include/viennaps/cellSet/csMeanFreePath.hpp index e886fefb..43b48b17 100644 --- a/include/cellSet/csMeanFreePath.hpp +++ b/include/viennaps/cellSet/csMeanFreePath.hpp @@ -1,9 +1,7 @@ #pragma once -#include -#include -#include -#include +#include "psDomain.hpp" +#include "psLogger.hpp" #include @@ -83,8 +81,10 @@ template class csMeanFreePath { alignas(128) auto rayHit = RTCRayHit{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#if VIENNARAY_EMBREE_VERSION < 4 auto rtcContext = RTCIntersectContext{}; rtcInitIntersectContext(&rtcContext); +#endif #pragma omp for for (unsigned idx = 0; idx < numCells; ++idx) { @@ -126,8 +126,12 @@ template class csMeanFreePath { rayHit.hit.instID[0] = RTC_INVALID_GEOMETRY_ID; rayHit.hit.geomID = RTC_INVALID_GEOMETRY_ID; +#if VIENNARAY_EMBREE_VERSION < 4 // Run the intersection rtcIntersect1(rtcScene, &rtcContext, &rayHit); +#else + rtcIntersect1(rtcScene, &rayHit); +#endif /* -------- No hit -------- */ if (rayHit.hit.geomID == RTC_INVALID_GEOMETRY_ID) { @@ -175,4 +179,4 @@ template class csMeanFreePath { NumericType maxLambda = 0.; long numRaysPerCell = 100; psMaterial material = psMaterial::GAS; -}; \ No newline at end of file +}; diff --git a/include/cellSet/csPointSource.hpp b/include/viennaps/cellSet/csPointSource.hpp similarity index 98% rename from include/cellSet/csPointSource.hpp rename to include/viennaps/cellSet/csPointSource.hpp index c80c98f8..9027d6f8 100644 --- a/include/cellSet/csPointSource.hpp +++ b/include/viennaps/cellSet/csPointSource.hpp @@ -1,6 +1,7 @@ #pragma once -#include +#include "csUtil.hpp" + #include template diff --git a/include/cellSet/csSegmentCells.hpp b/include/viennaps/cellSet/csSegmentCells.hpp similarity index 98% rename from include/cellSet/csSegmentCells.hpp rename to include/viennaps/cellSet/csSegmentCells.hpp index 0370e6b5..7ed1b616 100644 --- a/include/cellSet/csSegmentCells.hpp +++ b/include/viennaps/cellSet/csSegmentCells.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "csDenseCellSet.hpp" template class csSegmentCells { psSmartPointer> cellSet = nullptr; @@ -52,4 +52,4 @@ template class csSegmentCells { } } } -}; \ No newline at end of file +}; diff --git a/include/cellSet/csSurfaceCellSet.hpp b/include/viennaps/cellSet/csSurfaceCellSet.hpp similarity index 93% rename from include/cellSet/csSurfaceCellSet.hpp rename to include/viennaps/cellSet/csSurfaceCellSet.hpp index c896f6e4..ddf3c193 100644 --- a/include/cellSet/csSurfaceCellSet.hpp +++ b/include/viennaps/cellSet/csSurfaceCellSet.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "../psDomain.hpp" +#include "csDenseCellSet.hpp" template class cellBase { std::array center; @@ -44,7 +44,7 @@ template > class csSurfaceCellSet { auto cellIds = BVH->getCellIds(point); if (!cellIds) { psLogger::getInstance() - .addError("Point " + csUtil::arrayToString(point) + + .addError("Point " + psUtils::arrayToString(point) + " not in domain. BVH failure.") .print(); } else { @@ -56,15 +56,16 @@ template > class csSurfaceCellSet { } } - std::vector getNeighbors(const cellType &cell) { - std::vector neighbors; - auto cellSet = domain->getCellSet(); + // What happened here? + // std::vector getNeighbors(const cellType &cell) { + // std::vector neighbors; + // auto cellSet = domain->getCellSet(); - return neighbors; - } + // return neighbors; + // } psLogger::getInstance() - .addError("Point " + csUtil::arrayToString(point) + " not in domain") + .addError("Point " + psUtils::arrayToString(point) + " not in domain") .print(); return surfaceCells[0]; } @@ -220,4 +221,4 @@ template > class csSurfaceCellSet { } return true; } -}; \ No newline at end of file +}; diff --git a/include/cellSet/csTracePath.hpp b/include/viennaps/cellSet/csTracePath.hpp similarity index 97% rename from include/cellSet/csTracePath.hpp rename to include/viennaps/cellSet/csTracePath.hpp index dd33e65a..52bb55d9 100644 --- a/include/cellSet/csTracePath.hpp +++ b/include/viennaps/cellSet/csTracePath.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include template class csTracePath { private: @@ -37,4 +38,4 @@ template class csTracePath { data.clear(); gridData.clear(); } -}; \ No newline at end of file +}; diff --git a/include/cellSet/csTracing.hpp b/include/viennaps/cellSet/csTracing.hpp similarity index 98% rename from include/cellSet/csTracing.hpp rename to include/viennaps/cellSet/csTracing.hpp index 40731537..ba9db410 100644 --- a/include/cellSet/csTracing.hpp +++ b/include/viennaps/cellSet/csTracing.hpp @@ -1,14 +1,11 @@ #pragma once -#include - -#include -#include -#include -#include +#include "csDenseCellSet.hpp" +#include "csPointSource.hpp" +#include "csTracingKernel.hpp" +#include "csTracingParticle.hpp" #include - #include #include #include diff --git a/include/cellSet/csTracingKernel.hpp b/include/viennaps/cellSet/csTracingKernel.hpp similarity index 97% rename from include/cellSet/csTracingKernel.hpp rename to include/viennaps/cellSet/csTracingKernel.hpp index 9ef9326e..bd37bcca 100644 --- a/include/cellSet/csTracingKernel.hpp +++ b/include/viennaps/cellSet/csTracingKernel.hpp @@ -1,17 +1,16 @@ #pragma once -#include +#include "csDenseCellSet.hpp" +#include "csTracePath.hpp" +#include "csTracingParticle.hpp" +#include #include #include #include #include #include -#include -#include -#include - template class csTracingKernel { public: csTracingKernel(RTCDevice &pDevice, rayGeometry &pRTCGeometry, @@ -73,8 +72,10 @@ template class csTracingKernel { // if (!traceOnPath) path.useGridData(myCellSet->getNumberOfCells()); +#if VIENNARAY_EMBREE_VERSION < 4 auto rtcContext = RTCIntersectContext{}; rtcInitIntersectContext(&rtcContext); +#endif #pragma omp for schedule(dynamic) for (long long idx = 0; idx < mNumRays; ++idx) { @@ -97,8 +98,12 @@ template class csTracingKernel { rayHit.hit.instID[0] = RTC_INVALID_GEOMETRY_ID; rayHit.hit.geomID = RTC_INVALID_GEOMETRY_ID; +#if VIENNARAY_EMBREE_VERSION < 4 // Run the intersection rtcIntersect1(rtcScene, &rtcContext, &rayHit); +#else + rtcIntersect1(rtcScene, &rayHit); +#endif /* -------- No hit -------- */ if (rayHit.hit.geomID == RTC_INVALID_GEOMETRY_ID) { diff --git a/include/cellSet/csTracingParticle.hpp b/include/viennaps/cellSet/csTracingParticle.hpp similarity index 98% rename from include/cellSet/csTracingParticle.hpp rename to include/viennaps/cellSet/csTracingParticle.hpp index 5cddf40f..bc391ced 100644 --- a/include/cellSet/csTracingParticle.hpp +++ b/include/viennaps/cellSet/csTracingParticle.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "csUtil.hpp" #include #include diff --git a/include/cellSet/csUtil.hpp b/include/viennaps/cellSet/csUtil.hpp similarity index 99% rename from include/cellSet/csUtil.hpp rename to include/viennaps/cellSet/csUtil.hpp index 63bf3cd6..da078a55 100644 --- a/include/cellSet/csUtil.hpp +++ b/include/viennaps/cellSet/csUtil.hpp @@ -3,11 +3,9 @@ #include #include #include -#include #include #include #include -#include template using csPair = std::array; diff --git a/include/compact/psCSVDataSource.hpp b/include/viennaps/compact/psCSVDataSource.hpp similarity index 95% rename from include/compact/psCSVDataSource.hpp rename to include/viennaps/compact/psCSVDataSource.hpp index 744252d3..3d202e2c 100644 --- a/include/compact/psCSVDataSource.hpp +++ b/include/viennaps/compact/psCSVDataSource.hpp @@ -1,18 +1,17 @@ -#ifndef PS_CSV_DATA_SOURCE_HPP -#define PS_CSV_DATA_SOURCE_HPP +#pragma once -#include #include #include #include #include #include -#include -#include -#include -#include -#include +#include "psCSVReader.hpp" +#include "psCSVWriter.hpp" +#include "psDataSource.hpp" + +#include "../psLogger.hpp" +#include "../psUtils.hpp" template class psCSVDataSource : public psDataSource { @@ -169,5 +168,3 @@ class psCSVDataSource : public psDataSource { return namedParameters; } }; - -#endif \ No newline at end of file diff --git a/include/compact/psCSVReader.hpp b/include/viennaps/compact/psCSVReader.hpp similarity index 95% rename from include/compact/psCSVReader.hpp rename to include/viennaps/compact/psCSVReader.hpp index ccc3a78c..ea767619 100644 --- a/include/compact/psCSVReader.hpp +++ b/include/viennaps/compact/psCSVReader.hpp @@ -1,18 +1,14 @@ -#ifndef PS_CSV_READER_HPP -#define PS_CSV_READER_HPP +#pragma once -#include #include #include #include #include #include -#include #include -#include -#include -#include +#include "../psLogger.hpp" +#include "../psUtils.hpp" // Simple class for reading CSV files template class psCSVReader { @@ -126,5 +122,3 @@ template class psCSVReader { } } }; - -#endif \ No newline at end of file diff --git a/include/compact/psCSVWriter.hpp b/include/viennaps/compact/psCSVWriter.hpp similarity index 96% rename from include/compact/psCSVWriter.hpp rename to include/viennaps/compact/psCSVWriter.hpp index 914b8164..744a53ba 100644 --- a/include/compact/psCSVWriter.hpp +++ b/include/viennaps/compact/psCSVWriter.hpp @@ -1,15 +1,12 @@ -#ifndef PS_CSV_WRITER_HPP -#define PS_CSV_WRITER_HPP +#pragma once -#include #include #include #include #include #include -#include -#include +#include "../psLogger.hpp" template std::string join(Iterator begin, Iterator end, @@ -137,4 +134,3 @@ template class psCSVWriter { file.close(); } }; -#endif diff --git a/include/compact/psDataScaler.hpp b/include/viennaps/compact/psDataScaler.hpp similarity index 96% rename from include/compact/psDataScaler.hpp rename to include/viennaps/compact/psDataScaler.hpp index 343733d8..e980adee 100644 --- a/include/compact/psDataScaler.hpp +++ b/include/viennaps/compact/psDataScaler.hpp @@ -1,14 +1,10 @@ -#ifndef PS_DATA_SCALER_HPP -#define PS_DATA_SCALER_HPP +#pragma once #include -#include #include #include #include -#include - // Base class for data scalers template class psDataScaler { protected: @@ -126,5 +122,3 @@ class psMedianDistanceScaler : public psDataScaler { } } }; - -#endif \ No newline at end of file diff --git a/include/compact/psDataSource.hpp b/include/viennaps/compact/psDataSource.hpp similarity index 95% rename from include/compact/psDataSource.hpp rename to include/viennaps/compact/psDataSource.hpp index 352710f5..550eca2d 100644 --- a/include/compact/psDataSource.hpp +++ b/include/viennaps/compact/psDataSource.hpp @@ -1,13 +1,11 @@ -#ifndef PS_DATA_SOURCE_HPP -#define PS_DATA_SOURCE_HPP +#pragma once -#include #include #include #include -#include -#include +#include "../psLogger.hpp" +#include "../psSmartPointer.hpp" template class psDataSource { public: @@ -100,5 +98,3 @@ template class psDataSource { // modified (i.e. whether the append function has been called) bool modified = false; }; - -#endif \ No newline at end of file diff --git a/include/compact/psKDTree.hpp b/include/viennaps/compact/psKDTree.hpp similarity index 96% rename from include/compact/psKDTree.hpp rename to include/viennaps/compact/psKDTree.hpp index 001fc407..d7ea58e4 100644 --- a/include/compact/psKDTree.hpp +++ b/include/viennaps/compact/psKDTree.hpp @@ -1,5 +1,4 @@ -#ifndef PS_KDTREE_HPP -#define PS_KDTREE_HPP +#pragma once // Inspired by the implementation of a parallelized kD-Tree by Francesco // Andreuzzi (https://github.com/fAndreuzzi/parallel-kd-tree) @@ -30,9 +29,8 @@ #include #include -#include +#include #include -#include #include #include @@ -40,8 +38,8 @@ #include #endif -#include -#include +#include "../psLogger.hpp" +#include "psQueues.hpp" template > class psKDTree { @@ -451,5 +449,3 @@ class psKDTree { } }; }; - -#endif \ No newline at end of file diff --git a/include/compact/psNearestNeighborsInterpolation.hpp b/include/viennaps/compact/psNearestNeighborsInterpolation.hpp similarity index 93% rename from include/compact/psNearestNeighborsInterpolation.hpp rename to include/viennaps/compact/psNearestNeighborsInterpolation.hpp index 57b86fb8..6eedd1e2 100644 --- a/include/compact/psNearestNeighborsInterpolation.hpp +++ b/include/viennaps/compact/psNearestNeighborsInterpolation.hpp @@ -1,18 +1,15 @@ -#ifndef PS_NEAREST_NEIGHBORS_INTERPOLATION_HPP -#define PS_NEAREST_NEIGHBORS_INTERPOLATION_HPP +#pragma once -#include #include -#include #include #include #include -#include -#include -#include -#include -#include +#include "psDataScaler.hpp" +#include "psKDTree.hpp" + +#include "../psSmartPointer.hpp" +#include "psValueEstimator.hpp" template auto extractInputData(psSmartPointer data, SizeType InputDim, @@ -152,5 +149,3 @@ class psNearestNeighborsInterpolation return {{result, minDistance}}; } }; - -#endif \ No newline at end of file diff --git a/include/compact/psQueues.hpp b/include/viennaps/compact/psQueues.hpp similarity index 98% rename from include/compact/psQueues.hpp rename to include/viennaps/compact/psQueues.hpp index 718d7804..c9677153 100644 --- a/include/compact/psQueues.hpp +++ b/include/viennaps/compact/psQueues.hpp @@ -1,5 +1,4 @@ -#ifndef PS_QUEUES_HPP -#define PS_QUEUES_HPP +#pragma once /** * File: psQueues.hpp @@ -122,4 +121,3 @@ struct psClampedPQueue { : mmap.rbegin()->first; } }; -#endif \ No newline at end of file diff --git a/include/compact/psRectilinearGridInterpolation.hpp b/include/viennaps/compact/psRectilinearGridInterpolation.hpp similarity index 97% rename from include/compact/psRectilinearGridInterpolation.hpp rename to include/viennaps/compact/psRectilinearGridInterpolation.hpp index a1977097..7e4ed48d 100644 --- a/include/compact/psRectilinearGridInterpolation.hpp +++ b/include/viennaps/compact/psRectilinearGridInterpolation.hpp @@ -1,13 +1,11 @@ -#ifndef PS_RECTILINEAR_GRID_INTERPOLATION_HPP -#define PS_RECTILINEAR_GRID_INTERPOLATION_HPP +#pragma once #include -#include #include #include -#include -#include +#include "../psLogger.hpp" +#include "psValueEstimator.hpp" // Class providing linear interpolation on rectilinear data grids template @@ -237,5 +235,3 @@ class psRectilinearGridInterpolation return {{result, isInside}}; } }; - -#endif \ No newline at end of file diff --git a/include/compact/psValueEstimator.hpp b/include/viennaps/compact/psValueEstimator.hpp similarity index 87% rename from include/compact/psValueEstimator.hpp rename to include/viennaps/compact/psValueEstimator.hpp index 37f2cece..7be9e560 100644 --- a/include/compact/psValueEstimator.hpp +++ b/include/viennaps/compact/psValueEstimator.hpp @@ -1,12 +1,10 @@ -#ifndef PS_VALUE_ESTIMATOR_HPP -#define PS_VALUE_ESTIMATOR_HPP +#pragma once #include #include #include -#include -#include +#include "../psSmartPointer.hpp" template class psValueEstimator { @@ -41,5 +39,3 @@ class psValueEstimator { virtual std::optional> estimate(const ItemType &input) = 0; }; - -#endif \ No newline at end of file diff --git a/include/geometries/psMakeFin.hpp b/include/viennaps/geometries/psMakeFin.hpp similarity index 99% rename from include/geometries/psMakeFin.hpp rename to include/viennaps/geometries/psMakeFin.hpp index 11591082..561ddd14 100644 --- a/include/geometries/psMakeFin.hpp +++ b/include/viennaps/geometries/psMakeFin.hpp @@ -1,9 +1,10 @@ #pragma once +#include "../psDomain.hpp" + #include #include #include -#include /// Generates a new fin geometry extending in the z (3D) or y (2D) direction, /// centered at the origin with specified dimensions in the x and y directions. @@ -254,4 +255,4 @@ template class psMakeFin { } } } -}; \ No newline at end of file +}; diff --git a/include/geometries/psMakeHole.hpp b/include/viennaps/geometries/psMakeHole.hpp similarity index 98% rename from include/geometries/psMakeHole.hpp rename to include/viennaps/geometries/psMakeHole.hpp index cf48e212..45e97599 100644 --- a/include/geometries/psMakeHole.hpp +++ b/include/viennaps/geometries/psMakeHole.hpp @@ -1,13 +1,13 @@ #pragma once +#include "../geometries/psMakeTrench.hpp" +#include "../psDomain.hpp" +#include "../psMaterials.hpp" + #include #include #include -#include -#include -#include - /// Generates new a hole geometry in the z direction, which, in 2D mode, /// corresponds to a trench geometry. Positioned at the origin, the hole is /// centered, with the total extent defined in the x and y directions. The diff --git a/include/geometries/psMakePlane.hpp b/include/viennaps/geometries/psMakePlane.hpp similarity index 97% rename from include/geometries/psMakePlane.hpp rename to include/viennaps/geometries/psMakePlane.hpp index 492dc34c..b6e9472c 100644 --- a/include/geometries/psMakePlane.hpp +++ b/include/viennaps/geometries/psMakePlane.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include "../psDomain.hpp" +#include "../psLogger.hpp" +#include "../psMaterials.hpp" /// This class provides a simple way to create a plane in a level set. It can be /// used to create a substrate of any material. The plane can be added to an @@ -115,4 +115,4 @@ template class psMakePlane { } } } -}; \ No newline at end of file +}; diff --git a/include/geometries/psMakeStack.hpp b/include/viennaps/geometries/psMakeStack.hpp similarity index 99% rename from include/geometries/psMakeStack.hpp rename to include/viennaps/geometries/psMakeStack.hpp index 26eb370c..b4c898f8 100644 --- a/include/geometries/psMakeStack.hpp +++ b/include/viennaps/geometries/psMakeStack.hpp @@ -1,11 +1,11 @@ #pragma once +#include "../psDomain.hpp" + #include #include #include -#include - /// Generates a stack of alternating SiO2/Si3N4 layers featuring an optionally /// etched hole (3D) or trench (2D) at the center. The stack emerges in the /// positive z direction (3D) or y direction (2D) and is centered around the @@ -303,4 +303,4 @@ template class psMakeStack { lsDomain::BoundaryType::INFINITE_BOUNDARY; } } -}; \ No newline at end of file +}; diff --git a/include/geometries/psMakeTrench.hpp b/include/viennaps/geometries/psMakeTrench.hpp similarity index 99% rename from include/geometries/psMakeTrench.hpp rename to include/viennaps/geometries/psMakeTrench.hpp index ea0a0cfd..b9458bf5 100644 --- a/include/geometries/psMakeTrench.hpp +++ b/include/viennaps/geometries/psMakeTrench.hpp @@ -1,12 +1,12 @@ #pragma once +#include "../psDomain.hpp" + #include #include #include #include -#include - /// Generates new a trench geometry extending in the z (3D) or y (2D) direction, /// centrally positioned at the origin with the total extent specified in the x /// and y directions. The trench configuration may include periodic boundaries @@ -230,4 +230,4 @@ template class psMakeTrench { domain->insertNextLevelSetAsMaterial(substrate, material, false); } } -}; \ No newline at end of file +}; diff --git a/include/models/psAnisotropicProcess.hpp b/include/viennaps/models/psAnisotropicProcess.hpp similarity index 98% rename from include/models/psAnisotropicProcess.hpp rename to include/viennaps/models/psAnisotropicProcess.hpp index 30df6163..95c65b9b 100644 --- a/include/models/psAnisotropicProcess.hpp +++ b/include/viennaps/models/psAnisotropicProcess.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "../psMaterials.hpp" +#include "../psProcessModel.hpp" #include @@ -157,4 +157,4 @@ class psAnisotropicProcess : public psProcessModel { NumericType r311 = 0.0300166666667; std::vector> materials; -}; \ No newline at end of file +}; diff --git a/include/models/psAtomicLayerProcess.hpp b/include/viennaps/models/psAtomicLayerProcess.hpp similarity index 99% rename from include/models/psAtomicLayerProcess.hpp rename to include/viennaps/models/psAtomicLayerProcess.hpp index cef9f75c..389937b4 100644 --- a/include/models/psAtomicLayerProcess.hpp +++ b/include/viennaps/models/psAtomicLayerProcess.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "psDomain.hpp" +#include "psLogger.hpp" #include @@ -322,4 +322,4 @@ template class psAtomicLayerProcess { std::vector *lambda; std::vector *cellType; std::vector *depoProb; -}; \ No newline at end of file +}; diff --git a/include/models/psDirectionalEtching.hpp b/include/viennaps/models/psDirectionalEtching.hpp similarity index 98% rename from include/models/psDirectionalEtching.hpp rename to include/viennaps/models/psDirectionalEtching.hpp index 05b17db7..855858da 100644 --- a/include/models/psDirectionalEtching.hpp +++ b/include/viennaps/models/psDirectionalEtching.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "../psMaterials.hpp" +#include "../psProcessModel.hpp" namespace DirectionalEtchingImplementation { template @@ -95,4 +95,4 @@ class psDirectionalEtching : public psProcessModel { this->setVelocityField(velField); this->setProcessName("DirectionalEtching"); } -}; \ No newline at end of file +}; diff --git a/include/models/psFluorocarbonEtching.hpp b/include/viennaps/models/psFluorocarbonEtching.hpp similarity index 96% rename from include/models/psFluorocarbonEtching.hpp rename to include/viennaps/models/psFluorocarbonEtching.hpp index 2912858d..372f1b0b 100644 --- a/include/models/psFluorocarbonEtching.hpp +++ b/include/viennaps/models/psFluorocarbonEtching.hpp @@ -2,9 +2,9 @@ #include -#include -#include -#include +#include "../psLogger.hpp" +#include "../psMaterials.hpp" +#include "../psProcessModel.hpp" #include #include @@ -598,4 +598,4 @@ class psFluorocarbonEtching : public psProcessModel { this->insertNextParticleType(etchant); this->insertNextParticleType(poly); } -}; \ No newline at end of file +}; diff --git a/include/models/psGeometricDistributionModels.hpp b/include/viennaps/models/psGeometricDistributionModels.hpp similarity index 96% rename from include/models/psGeometricDistributionModels.hpp rename to include/viennaps/models/psGeometricDistributionModels.hpp index 2fb03ec3..a1df97df 100644 --- a/include/models/psGeometricDistributionModels.hpp +++ b/include/viennaps/models/psGeometricDistributionModels.hpp @@ -5,9 +5,9 @@ #include #include -#include -#include -#include +#include "../psGeometricModel.hpp" +#include "../psProcessModel.hpp" +#include "../psSmartPointer.hpp" // Simple geometric model that implements a template diff --git a/include/models/psIsotropicProcess.hpp b/include/viennaps/models/psIsotropicProcess.hpp similarity index 95% rename from include/models/psIsotropicProcess.hpp rename to include/viennaps/models/psIsotropicProcess.hpp index 376347a7..a41f6f30 100644 --- a/include/models/psIsotropicProcess.hpp +++ b/include/viennaps/models/psIsotropicProcess.hpp @@ -1,9 +1,9 @@ #pragma once -#include -#include -#include -#include +#include "../psMaterials.hpp" +#include "../psProcessModel.hpp" +#include "../psSurfaceModel.hpp" +#include "../psVelocityField.hpp" namespace IsotropicImplementation { template @@ -80,4 +80,4 @@ class psIsotropicProcess : public psProcessModel { this->setVelocityField(velField); this->setProcessName("IsotropicProcess"); } -}; \ No newline at end of file +}; diff --git a/include/viennaps/models/psModelParameters.hpp b/include/viennaps/models/psModelParameters.hpp new file mode 100644 index 00000000..b2859721 --- /dev/null +++ b/include/viennaps/models/psModelParameters.hpp @@ -0,0 +1,75 @@ +#pragma once + +#include + +namespace psParameters { + +static constexpr double kB = 8.617333262 * 1e-5; // eV / K +static constexpr double roomTemperature = 300.; // K + +namespace Si { + +// sputtering coefficients in Ar +static constexpr double Eth_sp_Ar = 20.; // eV +static constexpr double Eth_sp_Ar_sqrt = 4.47213595499958; +static constexpr double A_sp = 0.0337; +static constexpr double B_sp = 9.3; + +// chemical etching +static constexpr double K = 0.029997010728956663; +static constexpr double E_a = 0.108; // eV + +// density +static constexpr double rho = 5.02; // 1e22 atoms/cmยณ + +} // namespace Si + +namespace SiO2 { + +// sputtering coefficients in Ar +static constexpr double Eth_sp_Ar = 18.; // eV +static constexpr double Eth_sp_Ar_sqrt = 4.242640687119285; +static constexpr double A_sp = 0.0139; + +// chemical etching +static constexpr double K = 0.002789491704544977; +static constexpr double E_a = 0.168; // eV + +// density +static constexpr double rho = 2.3; // 1e22 atoms/cmยณ + +} // namespace SiO2 + +namespace Polymer { +// density +static constexpr double rho = 2; // 1e22 atoms/cmยณ +} // namespace Polymer + +namespace Si3N4 { +// density +static constexpr double rho = 2.3; // 1e22 atoms/cmยณ +} // namespace Si3N4 + +namespace TiN { +// density +static constexpr double rho = 5.0804; // 1e22 atoms/cmยณ +} // namespace TiN + +namespace Cl { +// density +static constexpr double rho = 0.0042399; // 1e22 atoms/cmยณ +} // namespace Cl + +namespace Mask { +// density +static constexpr double rho = 500.; // 1e22 atoms/cmยณ +} // namespace Mask + +namespace Ion { +static constexpr double inflectAngle = 1.55334303; +static constexpr double n_l = 10.; +static constexpr double A = 1. / (1. + n_l * (M_PI_2 / inflectAngle - 1.)); +static constexpr double minAngle = 1.3962634; +} // namespace Ion + +} // namespace psParameters diff --git a/include/models/psOxideRegrowth.hpp b/include/viennaps/models/psOxideRegrowth.hpp similarity index 98% rename from include/models/psOxideRegrowth.hpp rename to include/viennaps/models/psOxideRegrowth.hpp index f3ef8566..765aa266 100644 --- a/include/models/psOxideRegrowth.hpp +++ b/include/viennaps/models/psOxideRegrowth.hpp @@ -1,13 +1,12 @@ #pragma once -#include +#include "../cellSet/csDenseCellSet.hpp" -#include +#include "../psAdvectionCallback.hpp" +#include "../psProcessModel.hpp" +#include "../psToDiskMesh.hpp" -#include -#include -#include -#include +#include namespace OxideRegrowthImplementation { template @@ -336,4 +335,4 @@ class psOxideRegrowth : public psProcessModel { this->setAdvectionCallback(dynamics); this->setProcessName("OxideRegrowth"); } -}; \ No newline at end of file +}; diff --git a/include/models/psPlasmaDamage.hpp b/include/viennaps/models/psPlasmaDamage.hpp similarity index 98% rename from include/models/psPlasmaDamage.hpp rename to include/viennaps/models/psPlasmaDamage.hpp index 961e3510..ba6161a7 100644 --- a/include/models/psPlasmaDamage.hpp +++ b/include/viennaps/models/psPlasmaDamage.hpp @@ -1,7 +1,8 @@ -#include -#include +#pragma once -#include +#include "../cellSet/csTracing.hpp" +#include "../cellSet/csTracingParticle.hpp" +#include "../psProcessModel.hpp" #include diff --git a/include/models/psSF6O2Etching.hpp b/include/viennaps/models/psSF6O2Etching.hpp similarity index 99% rename from include/models/psSF6O2Etching.hpp rename to include/viennaps/models/psSF6O2Etching.hpp index fa79c94e..10e44852 100644 --- a/include/models/psSF6O2Etching.hpp +++ b/include/viennaps/models/psSF6O2Etching.hpp @@ -4,10 +4,10 @@ #include #include -#include -#include -#include -#include +#include "../psLogger.hpp" +#include "../psProcessModel.hpp" +#include "../psSurfaceModel.hpp" +#include "../psVelocityField.hpp" namespace SF6O2Implementation { @@ -461,4 +461,4 @@ class psSF6O2Etching : public psProcessModel { } SF6O2Implementation::Parameters params; -}; \ No newline at end of file +}; diff --git a/include/models/psSingleParticleProcess.hpp b/include/viennaps/models/psSingleParticleProcess.hpp similarity index 98% rename from include/models/psSingleParticleProcess.hpp rename to include/viennaps/models/psSingleParticleProcess.hpp index f794d73a..719126dc 100644 --- a/include/models/psSingleParticleProcess.hpp +++ b/include/viennaps/models/psSingleParticleProcess.hpp @@ -1,11 +1,11 @@ #pragma once +#include "../psMaterials.hpp" +#include "../psProcessModel.hpp" + #include #include -#include -#include - namespace SingleParticleImplementation { template class SurfaceModel : public psSurfaceModel { @@ -127,4 +127,4 @@ class psSingleParticleProcess : public psProcessModel { this->insertNextParticleType(depoParticle); this->setProcessName("SingleParticleProcess"); } -}; \ No newline at end of file +}; diff --git a/include/models/psTEOSDeposition.hpp b/include/viennaps/models/psTEOSDeposition.hpp similarity index 97% rename from include/models/psTEOSDeposition.hpp rename to include/viennaps/models/psTEOSDeposition.hpp index bf49d96c..a3d91260 100644 --- a/include/models/psTEOSDeposition.hpp +++ b/include/viennaps/models/psTEOSDeposition.hpp @@ -1,6 +1,7 @@ #pragma once -#include +#include "../psProcessModel.hpp" + #include namespace TEOSDepositionImplementation { @@ -230,4 +231,4 @@ class psTEOSDeposition : public psProcessModel { this->setProcessName("MultiParticleTEOS"); } } -}; \ No newline at end of file +}; diff --git a/include/psAdvectionCallback.hpp b/include/viennaps/psAdvectionCallback.hpp similarity index 88% rename from include/psAdvectionCallback.hpp rename to include/viennaps/psAdvectionCallback.hpp index 08c53bcf..b4d7c657 100644 --- a/include/psAdvectionCallback.hpp +++ b/include/viennaps/psAdvectionCallback.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "psDomain.hpp" +#include "psSmartPointer.hpp" template class psAdvectionCallback { protected: diff --git a/include/psDomain.hpp b/include/viennaps/psDomain.hpp similarity index 98% rename from include/psDomain.hpp rename to include/viennaps/psDomain.hpp index b7a48261..f5f1c2e5 100644 --- a/include/psDomain.hpp +++ b/include/viennaps/psDomain.hpp @@ -1,5 +1,12 @@ #pragma once +#include "cellSet/csDenseCellSet.hpp" + +#include "psMaterials.hpp" +#include "psSmartPointer.hpp" +#include "psSurfacePointValuesToLevelSet.hpp" +#include "psVTKWriter.hpp" + #include #include #include @@ -10,13 +17,6 @@ #include #include -#include - -#include -#include -#include -#include - /** This class represents all materials in the simulation domain. It contains Level-Sets for an accurate surface representation diff --git a/include/psExtrude.hpp b/include/viennaps/psExtrude.hpp similarity index 99% rename from include/psExtrude.hpp rename to include/viennaps/psExtrude.hpp index 9a7c33be..61a6e611 100644 --- a/include/psExtrude.hpp +++ b/include/viennaps/psExtrude.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "psDomain.hpp" #include #include @@ -92,4 +92,4 @@ template class psExtrude { } } } -}; \ No newline at end of file +}; diff --git a/include/psGDSGeometry.hpp b/include/viennaps/psGDSGeometry.hpp similarity index 99% rename from include/psGDSGeometry.hpp rename to include/viennaps/psGDSGeometry.hpp index 88f89306..c7518c7f 100644 --- a/include/psGDSGeometry.hpp +++ b/include/viennaps/psGDSGeometry.hpp @@ -1,14 +1,15 @@ #pragma once +#include "psGDSUtils.hpp" +#include "psLogger.hpp" +#include "psSmartPointer.hpp" + #include #include #include #include #include - -#include -#include -#include +#include template class psGDSGeometry { using structureLayers = @@ -586,4 +587,4 @@ template class psGDSGeometry { static inline NumericType deg2rad(const NumericType angleDeg) { return angleDeg * rayInternal::PI / 180.; } -}; \ No newline at end of file +}; diff --git a/include/psGDSReader.hpp b/include/viennaps/psGDSReader.hpp similarity index 99% rename from include/psGDSReader.hpp rename to include/viennaps/psGDSReader.hpp index eb9dadd9..af55fd0f 100644 --- a/include/psGDSReader.hpp +++ b/include/viennaps/psGDSReader.hpp @@ -1,12 +1,11 @@ #pragma once -#include -#include +#include +#include #include -#include -#include -#include +#include "psGDSGeometry.hpp" +#include "psGDSUtils.hpp" #ifndef endian_swap_long #define endian_swap_long(w) \ @@ -666,4 +665,4 @@ template class psGDSReader { } } } -}; \ No newline at end of file +}; diff --git a/include/psGDSUtils.hpp b/include/viennaps/psGDSUtils.hpp similarity index 98% rename from include/psGDSUtils.hpp rename to include/viennaps/psGDSUtils.hpp index fefd0726..6973bdf9 100644 --- a/include/psGDSUtils.hpp +++ b/include/viennaps/psGDSUtils.hpp @@ -2,6 +2,9 @@ #include #include +#include +#include +#include #include #include diff --git a/include/psGeometricModel.hpp b/include/viennaps/psGeometricModel.hpp similarity index 84% rename from include/psGeometricModel.hpp rename to include/viennaps/psGeometricModel.hpp index e677424f..57fc44ca 100644 --- a/include/psGeometricModel.hpp +++ b/include/viennaps/psGeometricModel.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "psDomain.hpp" +#include "psSmartPointer.hpp" template class psGeometricModel { protected: diff --git a/include/psLogger.hpp b/include/viennaps/psLogger.hpp similarity index 97% rename from include/psLogger.hpp rename to include/viennaps/psLogger.hpp index 8dcbaa70..af175d7b 100644 --- a/include/psLogger.hpp +++ b/include/viennaps/psLogger.hpp @@ -1,8 +1,8 @@ #pragma once -#include +#include "psUtils.hpp" -#include +#include // verbosity levels: // 0 errors @@ -145,4 +145,4 @@ class psLogger { }; // initialize static member of logger -psLogLevel psLogger::logLevel = psLogLevel::INFO; +inline psLogLevel psLogger::logLevel = psLogLevel::INFO; diff --git a/include/psMaterials.hpp b/include/viennaps/psMaterials.hpp similarity index 97% rename from include/psMaterials.hpp rename to include/viennaps/psMaterials.hpp index 2389da2c..226189af 100644 --- a/include/psMaterials.hpp +++ b/include/viennaps/psMaterials.hpp @@ -1,8 +1,9 @@ #pragma once +#include "psLogger.hpp" +#include "psSmartPointer.hpp" + #include -#include -#include enum class psMaterial : int { None = -1, diff --git a/include/psMeanFreePath.hpp b/include/viennaps/psMeanFreePath.hpp similarity index 98% rename from include/psMeanFreePath.hpp rename to include/viennaps/psMeanFreePath.hpp index 62d5fec4..272a2c0c 100644 --- a/include/psMeanFreePath.hpp +++ b/include/viennaps/psMeanFreePath.hpp @@ -1,9 +1,10 @@ #pragma once -#include -#include -#include -#include +#include "compact/psKDTree.hpp" + +#include "psDomain.hpp" +#include "psLogger.hpp" +#include "psUtils.hpp" #include #include diff --git a/include/psPlanarize.hpp b/include/viennaps/psPlanarize.hpp similarity index 97% rename from include/psPlanarize.hpp rename to include/viennaps/psPlanarize.hpp index 5732a404..5fbd89f2 100644 --- a/include/psPlanarize.hpp +++ b/include/viennaps/psPlanarize.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "psDomain.hpp" #include #include diff --git a/include/psPointData.hpp b/include/viennaps/psPointData.hpp similarity index 100% rename from include/psPointData.hpp rename to include/viennaps/psPointData.hpp diff --git a/include/psProcess.hpp b/include/viennaps/psProcess.hpp similarity index 99% rename from include/psProcess.hpp rename to include/viennaps/psProcess.hpp index a5c7167e..3aa81b42 100644 --- a/include/psProcess.hpp +++ b/include/viennaps/psProcess.hpp @@ -1,18 +1,14 @@ #pragma once +#include "psLogger.hpp" +#include "psProcessModel.hpp" +#include "psTranslationField.hpp" + #include #include #include #include -#include -#include -#include -#include -#include -#include -#include - #include #include diff --git a/include/psProcessModel.hpp b/include/viennaps/psProcessModel.hpp similarity index 95% rename from include/psProcessModel.hpp rename to include/viennaps/psProcessModel.hpp index ed740dc0..3a78bc4c 100644 --- a/include/psProcessModel.hpp +++ b/include/viennaps/psProcessModel.hpp @@ -1,10 +1,10 @@ #pragma once -#include -#include -#include -#include -#include +#include "psAdvectionCallback.hpp" +#include "psGeometricModel.hpp" +#include "psSmartPointer.hpp" +#include "psSurfaceModel.hpp" +#include "psVelocityField.hpp" #include diff --git a/include/psProcessParams.hpp b/include/viennaps/psProcessParams.hpp similarity index 96% rename from include/psProcessParams.hpp rename to include/viennaps/psProcessParams.hpp index 1d47f0a8..c647a27f 100644 --- a/include/psProcessParams.hpp +++ b/include/viennaps/psProcessParams.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include "psLogger.hpp" + #include template class psProcessParams { diff --git a/include/psSmartPointer.hpp b/include/viennaps/psSmartPointer.hpp similarity index 100% rename from include/psSmartPointer.hpp rename to include/viennaps/psSmartPointer.hpp diff --git a/include/psSurfaceModel.hpp b/include/viennaps/psSurfaceModel.hpp similarity index 92% rename from include/psSurfaceModel.hpp rename to include/viennaps/psSurfaceModel.hpp index ffec3a31..6dc04078 100644 --- a/include/psSurfaceModel.hpp +++ b/include/viennaps/psSurfaceModel.hpp @@ -1,8 +1,9 @@ #pragma once -#include -#include -#include +#include "psPointData.hpp" +#include "psProcessParams.hpp" +#include "psSmartPointer.hpp" + #include template class psSurfaceModel { diff --git a/include/psSurfacePointValuesToLevelSet.hpp b/include/viennaps/psSurfacePointValuesToLevelSet.hpp similarity index 97% rename from include/psSurfacePointValuesToLevelSet.hpp rename to include/viennaps/psSurfacePointValuesToLevelSet.hpp index fa99b9df..2baad090 100644 --- a/include/psSurfacePointValuesToLevelSet.hpp +++ b/include/viennaps/psSurfacePointValuesToLevelSet.hpp @@ -1,11 +1,11 @@ #pragma once -#include +#include "compact/psKDTree.hpp" +#include "psSmartPointer.hpp" #include - -#include -#include +#include +#include template class psSurfacePointValuesToLevelSet { using lsDomainType = psSmartPointer>; @@ -99,4 +99,4 @@ template class psSurfacePointValuesToLevelSet { } } } -}; \ No newline at end of file +}; diff --git a/include/psTestAssert.hpp b/include/viennaps/psTestAssert.hpp similarity index 100% rename from include/psTestAssert.hpp rename to include/viennaps/psTestAssert.hpp diff --git a/include/psToDiskMesh.hpp b/include/viennaps/psToDiskMesh.hpp similarity index 98% rename from include/psToDiskMesh.hpp rename to include/viennaps/psToDiskMesh.hpp index e35b8f4a..49eddac6 100644 --- a/include/psToDiskMesh.hpp +++ b/include/viennaps/psToDiskMesh.hpp @@ -1,8 +1,8 @@ #pragma once -#include +#include "psDomain.hpp" -#include +#include template class psToDiskMesh { using translatorType = diff --git a/include/psToSurfaceMesh.hpp b/include/viennaps/psToSurfaceMesh.hpp similarity index 96% rename from include/psToSurfaceMesh.hpp rename to include/viennaps/psToSurfaceMesh.hpp index 5b67e763..b8644914 100644 --- a/include/psToSurfaceMesh.hpp +++ b/include/viennaps/psToSurfaceMesh.hpp @@ -1,7 +1,8 @@ #pragma once +#include "psDomain.hpp" + #include -#include template class psToSurfaceMesh { private: diff --git a/include/psTranslationField.hpp b/include/viennaps/psTranslationField.hpp similarity index 97% rename from include/psTranslationField.hpp rename to include/viennaps/psTranslationField.hpp index 6ea62628..732accf8 100644 --- a/include/psTranslationField.hpp +++ b/include/viennaps/psTranslationField.hpp @@ -1,9 +1,10 @@ #pragma once -#include +#include "compact/psKDTree.hpp" +#include "psMaterials.hpp" +#include "psVelocityField.hpp" + #include -#include -#include template class psTranslationField : public lsVelocityField { diff --git a/include/psUtils.hpp b/include/viennaps/psUtils.hpp similarity index 97% rename from include/psUtils.hpp rename to include/viennaps/psUtils.hpp index 64828c20..6bfde820 100644 --- a/include/psUtils.hpp +++ b/include/viennaps/psUtils.hpp @@ -33,7 +33,7 @@ template struct Timer { }; // Small function to print a progress bar () -void printProgress(size_t i, size_t finalCount = 100) { +inline void printProgress(size_t i, size_t finalCount = 100) { float progress = static_cast(i) / static_cast(finalCount); int barWidth = 70; @@ -52,7 +52,7 @@ void printProgress(size_t i, size_t finalCount = 100) { } // Checks if a string starts with a - or not -bool isSigned(const std::string &s) { +inline bool isSigned(const std::string &s) { auto pos = s.find_first_not_of(' '); if (pos == s.npos) return false; @@ -114,7 +114,7 @@ template std::optional safeConvert(const std::string &s) { return {value}; } -std::unordered_map +inline std::unordered_map parseConfigStream(std::istream &input) { // Regex to find trailing and leading whitespaces const auto wsRegex = std::regex("^ +| +$|( ) +"); @@ -150,7 +150,7 @@ parseConfigStream(std::istream &input) { } // Opens a file and forwards its stream to the config stream parser. -std::unordered_map +inline std::unordered_map readConfigFile(const std::string &filename) { std::ifstream f(filename); if (!f.is_open()) { diff --git a/include/psVTKWriter.hpp b/include/viennaps/psVTKWriter.hpp similarity index 57% rename from include/psVTKWriter.hpp rename to include/viennaps/psVTKWriter.hpp index 8fe107eb..689c6c1b 100644 --- a/include/psVTKWriter.hpp +++ b/include/viennaps/psVTKWriter.hpp @@ -1,5 +1,6 @@ #pragma once +#include // TODO: ViennaLS is missing this include. #include template using psVTKWriter = lsVTKWriter; diff --git a/include/psVelocityField.hpp b/include/viennaps/psVelocityField.hpp similarity index 98% rename from include/psVelocityField.hpp rename to include/viennaps/psVelocityField.hpp index 911fd595..493bd72d 100644 --- a/include/psVelocityField.hpp +++ b/include/viennaps/psVelocityField.hpp @@ -1,6 +1,7 @@ #pragma once -#include +#include "psSmartPointer.hpp" + #include template class psVelocityField { diff --git a/include/psWriteVisualizationMesh.hpp b/include/viennaps/psWriteVisualizationMesh.hpp similarity index 97% rename from include/psWriteVisualizationMesh.hpp rename to include/viennaps/psWriteVisualizationMesh.hpp index 61bb344a..d4e71097 100644 --- a/include/psWriteVisualizationMesh.hpp +++ b/include/viennaps/psWriteVisualizationMesh.hpp @@ -1,5 +1,7 @@ #pragma once +#include "psDomain.hpp" + #include #include diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d7495edd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["scikit-build-core", "pybind11"] +build-backend = "scikit_build_core.build" + +[project] +version = "2.0.0" +name = "ViennaPS_Python" +readme = "README.md" +license = {file = "LICENSE"} +description = "Semiconductor fabrication process simulation library" +dependencies = ['vtk >= 9.0.0, < 10'] + +[project.urls] +Homepage = "https://viennatools.github.io/ViennaPS/" +Documentation = "https://viennatools.github.io/ViennaPS/" +Repository = "https://github.com/ViennaTools/ViennaPS" +Issues = "https://github.com/ViennaTools/ViennaPS/issues" + +[tool.scikit-build] +build-dir = "build" +cmake.args = ["-DVIENNAPS_BUILD_PYTHON=ON"] diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 22ac8bf3..8d9e747b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,60 +1,97 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) +project(ViennaPS_Python LANGUAGES CXX) -project(ViennaPSPython) +add_custom_target(${PROJECT_NAME} ALL) -include("${CMAKE_SOURCE_DIR}/cmake/prepare.cmake") +# -------------------------------------------------------------------------------------------------------- +# Global CMake Configuration +# โ”” As mentioned earlier we re-use the vtk python package libs, to do so we +# set the rpath for our python modules to point to the vtkmodules folder. +# -------------------------------------------------------------------------------------------------------- -# Point find_package to the binary directory instead of the install location -find_package(ViennaPS REQUIRED PATHS ${ViennaPS_BINARY_DIR} NO_DEFAULT_PATH) +set(CMAKE_MACOSX_RPATH ON) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}) +if(NOT APPLE) + list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN") + list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../vtkmodules") + list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../viennaps.libs") +else() + list(APPEND CMAKE_INSTALL_RPATH "@loader_path") + list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../vtkmodules") + list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../viennaps.libs") +endif() -# Add subfolders to the include directories, since during installation the directory structure is -# flattened, but in the source tree - which we are using here - it is not. -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}/cellSet - ${VIENNAPS_BUILD_INCLUDE_DIRS}/geometries ${VIENNAPS_BUILD_INCLUDE_DIRS}/models - ${VIENNAPS_BUILD_INCLUDE_DIRS}/compact) +# -------------------------------------------------------------------------------------------------------- +# Setup Dependencies +# -------------------------------------------------------------------------------------------------------- -message(STATUS "ViennaPS version: ${VIENNAPS_VERSION}") +include("../cmake/cpm.cmake") -set(PYBIND11_PYTHON_VERSION - 3 - CACHE STRING "Python version") +set(PYBIND11_FINDPYTHON ON) -find_package(pybind11 REQUIRED PATHS ${pybind11_DIR} NO_DEFAULT_PATH) +CPMFindPackage( + NAME pybind11 + VERSION 2.11.1 + GIT_REPOSITORY "https://github.com/pybind/pybind11") + +# -------------------------------------------------------------------------------------------------------- +# Constants +# -------------------------------------------------------------------------------------------------------- -set(VIENNAPS_PYTHON_SOURCE pyWrap.cpp) set(VIENNAPS_PYTHON_MODULE_NAME "viennaps") -set(VIENNAPS_LIBRARY_OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - -# ################################################################################################## -# BUILD 2D PYTHON LIBRARY -# ################################################################################################## -set(VIENNAPS_PYTHON_MODULE_NAME_2D "_${VIENNAPS_PYTHON_MODULE_NAME}2d") - -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${VIENNAPS_LIBRARY_OUTPUT_DIR}/viennaps2d) -pybind11_add_module(${VIENNAPS_PYTHON_MODULE_NAME_2D} ${VIENNAPS_PYTHON_SOURCE}) -target_include_directories(${VIENNAPS_PYTHON_MODULE_NAME_2D} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${VIENNAPS_PYTHON_MODULE_NAME_2D} PRIVATE ${VIENNAPS_LIBRARIES}) -target_compile_definitions( - ${VIENNAPS_PYTHON_MODULE_NAME_2D} - PRIVATE -DVIENNAPS_PYTHON_DIMENSION=2 -DVIENNAPS_MODULE_NAME=${VIENNAPS_PYTHON_MODULE_NAME_2D}) - -set(MODULE_NAME ${VIENNAPS_PYTHON_MODULE_NAME_2D}) -configure_file(__init__.py.in ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py) - -# ################################################################################################## -# BUILD 3D PYTHON LIBRARY -# ################################################################################################## -set(VIENNAPS_PYTHON_MODULE_NAME_3D "_${VIENNAPS_PYTHON_MODULE_NAME}3d") - -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${VIENNAPS_LIBRARY_OUTPUT_DIR}/viennaps3d) -pybind11_add_module(${VIENNAPS_PYTHON_MODULE_NAME_3D} ${VIENNAPS_PYTHON_SOURCE}) -target_include_directories(${VIENNAPS_PYTHON_MODULE_NAME_3D} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${VIENNAPS_PYTHON_MODULE_NAME_3D} PRIVATE ${VIENNAPS_LIBRARIES}) -target_compile_definitions( - ${VIENNAPS_PYTHON_MODULE_NAME_3D} - PRIVATE -DVIENNAPS_PYTHON_DIMENSION=3 -DVIENNAPS_MODULE_NAME=${VIENNAPS_PYTHON_MODULE_NAME_3D}) - -set(MODULE_NAME ${VIENNAPS_PYTHON_MODULE_NAME_3D}) -configure_file(__init__.py.in ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py) +set(VIENNAPS_LIBRARY_OUTPUT_DIR ${CMAKE_BINARY_DIR}) + +if(CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(VIENNAPS_LIBRARY_OUTPUT_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + message(STATUS "[ViennaPS] Using Library Output Directory for bindings") +endif() + +# -------------------------------------------------------------------------------------------------------- +# Binding macro +# -------------------------------------------------------------------------------------------------------- + +macro(setup_binding NAME FLAGS) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${VIENNAPS_LIBRARY_OUTPUT_DIR}/${NAME}) + set(MODULE_NAME "_${NAME}") + + pybind11_add_module("${MODULE_NAME}" "pyWrap.cpp") + add_dependencies(${PROJECT_NAME} ${MODULE_NAME}) + + target_link_libraries(${MODULE_NAME} PUBLIC ViennaPS) + target_compile_definitions(${MODULE_NAME} PRIVATE ${FLAGS} -DVIENNAPS_MODULE_NAME=${MODULE_NAME}) + + configure_file(__init__.py.in ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py) + + install(TARGETS ${MODULE_NAME} LIBRARY DESTINATION ${NAME}) + install(DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/" DESTINATION ${NAME}) +endmacro() + +# -------------------------------------------------------------------------------------------------------- +# Setup Bindings +# -------------------------------------------------------------------------------------------------------- + +setup_binding(viennaps2d -DVIENNAPS_PYTHON_DIMENSION=2) +setup_binding(viennaps3d -DVIENNAPS_PYTHON_DIMENSION=3) + +set(VIENNAPS_LIB_FOLDER "${VIENNAPS_LIBRARY_OUTPUT_DIR}/viennaps.libs") +set(VIENNAPS_USE_LIB_FOLDER OFF) + +if(NOT VIENNARAY_SYSTEM_EMBREE) + set(VIENNAPS_USE_LIB_FOLDER ON) + setup_embree_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") +endif() + +if(NOT VIENNARAY_SYSTEM_TBB) + set(VIENNAPS_USE_LIB_FOLDER ON) + setup_tbb_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") +endif() + +if((APPLE OR WIN32) AND NOT VIENNALS_SYSTEM_VTK) + set(VIENNAPS_USE_LIB_FOLDER ON) + setup_vtk_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") +endif() + +if(VIENNAPS_USE_LIB_FOLDER) + install(DIRECTORY "${VIENNAPS_LIB_FOLDER}" DESTINATION .) +endif() diff --git a/python/__init__.py.in b/python/__init__.py.in index 573a563b..e953aeb1 100644 --- a/python/__init__.py.in +++ b/python/__init__.py.in @@ -8,16 +8,38 @@ a ray tracer, and physical models for the simulation of microelectronic fabrication processes. """ +import sys + +def _windows_dll_path(): + + import os + import vtk + + vtk_path = vtk.__path__[0] + + additional_paths = [ + vtk_path, + os.path.join(os.path.dirname(vtk_path), 'vtk.libs'), + os.path.join(os.path.dirname(os.path.dirname(__file__)), 'viennaps.libs') + ] + + for path in additional_paths: + os.add_dll_directory(path) + os.environ["PATH"] = path + os.pathsep + os.environ["PATH"] + +if sys.platform == "win32": + _windows_dll_path() + from .@MODULE_NAME@ import * -#Config file reader helper function -def ReadConfigFile(fileName : str): +# Config file reader helper function +def ReadConfigFile(fileName: str): """Read a config file in the ViennaPS standard config file format. Parameters ---------- - fileName : str - Name of the config file. + fileName: str + Name of the config file. Returns ------- @@ -42,4 +64,4 @@ def ReadConfigFile(fileName : str): par_dict[par_name] = val - return par_dict \ No newline at end of file + return par_dict diff --git a/python/pyWrap.cpp b/python/pyWrap.cpp index bf9f9c4f..6e9d8ac6 100644 --- a/python/pyWrap.cpp +++ b/python/pyWrap.cpp @@ -33,11 +33,11 @@ #include // geometries -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // model framework #include @@ -47,17 +47,17 @@ #include // models -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // visualization #include @@ -65,11 +65,11 @@ #include // CellSet -#include -#include +#include +#include // Compact -#include +#include // other #include @@ -1588,4 +1588,4 @@ PYBIND11_MODULE(VIENNAPS_MODULE_NAME, module) { "totalDuration", &psUtils::Timer::totalDuration, "Get the total duration of the timer in nanoseconds."); -} \ No newline at end of file +} diff --git a/setup.py b/setup.py deleted file mode 100644 index 922274bd..00000000 --- a/setup.py +++ /dev/null @@ -1,257 +0,0 @@ -# Original Copyright Notice: -# -# Copyright (c) 2016 The Pybind Development Team, All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# You are under no obligation whatsoever to provide any bug fixes, patches, or -# upgrades to the features, functionality or performance of the source code -# ("Enhancements") to anyone; however, if you choose to make your Enhancements -# available either publicly, or directly to the author of this software, without -# imposing a separate written license agreement for such Enhancements, then you -# hereby grant the following license: a non-exclusive, royalty-free perpetual -# license to install, use, modify, prepare derivative works, incorporate into -# other computer software, distribute, and sublicense such enhancements or -# derivative works thereof, in binary and source code form. - -import os -import re -import shutil -import subprocess -import sys -from pathlib import Path - -from setuptools import Extension, setup -from setuptools.command.build_ext import build_ext - -# Convert distutils Windows platform specifiers to CMake -A arguments -PLAT_TO_CMAKE = { - "win32": "Win32", - "win-amd64": "x64", - "win-arm32": "ARM", - "win-arm64": "ARM64", -} - - -# A CMakeExtension needs a sourcedir instead of a file list. -# The name must be the _single_ output extension from the CMake build. -# If you need multiple extensions, see scikit-build. -class CMakeExtension(Extension): - def __init__(self, name: str) -> None: - super().__init__(name, sources=[]) - self.sourcedir = os.fspath(Path("").resolve()) - - -class CMakeBuild(build_ext): - def build_extension(self, ext: CMakeExtension) -> None: - # Must be in this form due to bug in .resolve() only fixed in Python 3.10+ - ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name) - extdir = ext_fullpath.parent.resolve() - - # Using this requires trailing slash for auto-detection & inclusion of - # auxiliary "native" libs - - debug = int(os.environ.get("DEBUG", 0)) if self.debug is None else self.debug - cfg = "Debug" if debug else "Release" - - # CMake lets you override the generator - we need to check this. - # Can be set with Conda-Build, for example. - cmake_generator = os.environ.get("CMAKE_GENERATOR", "") - - # Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON - # EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code - # from Python. - cmake_args = [ - f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}", - f"-DPYTHON_EXECUTABLE={sys.executable}", - f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm - "-DVIENNAPS_BUILD_PYTHON=ON", - ] - - build_args = [] - # Adding CMake arguments set as environment variable - # (needed e.g. to build for ARM OSx on conda-forge) - if "CMAKE_ARGS" in os.environ: - cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item] - - if self.compiler.compiler_type != "msvc": - # Using Ninja-build since it a) is available as a wheel and b) - # multithreads automatically. MSVC would require all variables be - # exported for Ninja to pick it up, which is a little tricky to do. - # Users can override the generator with CMAKE_GENERATOR in CMake - # 3.15+. - if not cmake_generator or cmake_generator == "Ninja": - try: - import ninja - - ninja_executable_path = Path(ninja.BIN_DIR) / "ninja" - cmake_args += [ - "-GNinja", - f"-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_executable_path}", - ] - except ImportError: - pass - - else: - # Single config generators are handled "normally" - single_config = any(x in cmake_generator for x in {"NMake", "Ninja"}) - - # CMake allows an arch-in-generator style for backward compatibility - contains_arch = any(x in cmake_generator for x in {"ARM", "Win64"}) - - # Specify the arch if using MSVC generator, but only if it doesn't - # contain a backward-compatibility arch spec already in the - # generator name. - if not single_config and not contains_arch: - cmake_args += ["-A", PLAT_TO_CMAKE[self.plat_name]] - - # Multi-config generators have a different way to specify configs - if not single_config: - cmake_args += [ - f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{cfg.upper()}={extdir}" - ] - build_args += ["--config", cfg] - - if sys.platform.startswith("darwin"): - # Cross-compile support for macOS - respect ARCHFLAGS if set - archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", "")) - if archs: - cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))] - for var in os.environ: - if var.startswith("OpenMP_"): - cmake_args += [f"-D{var}='{os.environ[var]}'"] - - # Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level - # across all generators. - if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ: - # self.parallel is a Python 3 only way to set parallel jobs by hand - # using -j in the build_ext call, not supported by pip or PyPA-build. - if hasattr(self, "parallel") and self.parallel: - # CMake 3.12+ only. - build_args += [f"-j{self.parallel}"] - - build_temp = Path(self.build_temp) / ext.name - if not build_temp.exists(): - build_temp.mkdir(parents=True) - - # Configure the project - subprocess.run( - ["cmake", ext.sourcedir, *cmake_args], cwd=build_temp, check=True - ) - - # Build dependencies if necessary - subprocess.run( - ["cmake", "--build", ".", *build_args], cwd=build_temp, check=True - ) - - # Build python bindings - subprocess.run( - ["cmake", "--build", ".", *build_args], cwd=build_temp, check=True - ) - - # On windows move the generated pyd (dll in disguise) files to the corresponding - # folders. Ideally this should be done in CMake, but we have not yet implemented - # this. - if sys.platform == "win32": - pyd_files = [f for f in os.listdir(extdir) if f.endswith(".pyd")] - for f in pyd_files: - if f.startswith("_viennaps2d"): - shutil.move( - src=os.path.join(extdir, f), - dst=os.path.join(extdir, "viennaps2d", f), - ) - elif f.startswith("_viennaps3d"): - shutil.move( - src=os.path.join(extdir, f), - dst=os.path.join(extdir, "viennaps3d", f), - ) - - # Generate stubs (*.pyi files) for autocompletion and type hints - try: - import mypy.stubgen as stubgen - - # Make sure that the extdir is in sys.path so that - # stubgen can be run on packages defined there. - sys.path.insert(0, str(extdir)) - - # Don't create __pycache__ directory - sys.dont_write_bytecode = True - - # Initialize the stubgen parser options - options = stubgen.parse_options( - [ - "-o", - str(os.path.abspath(extdir)), - "-p", - "viennaps2d", - "-p", - "viennaps3d", - ] - ) - - # Generate the stubs - stubgen.generate_stubs(options) - - # Remove mypy_cache, if it exists - if os.path.exists(os.path.join(extdir, ".mypy_cache")): - shutil.rmtree(os.path.join(extdir, ".mypy_cache")) - - except ModuleNotFoundError: - pass - except ImportError: - pass - - # Check if the ViennaLS Python bindings are installed on the system - try: - import viennals3d - except ModuleNotFoundError: - print( - "ViennaLS Python bindings not found. " - "Please also build the ViennaLS Python module to " - " use all functionalities of ViennaPS." - ) - - -setup( - name="ViennaPS", - version="1.3.1", - author="Institute for Microelectronics", - author_email="viennatools@iue.tuwien.ac.at", - license="MIT", - url="https://github.com/ViennaTools/ViennaPS", - description="Semiconductor fabrication process simulation library.", - long_description="ViennaPS is a header-only C++ process simulation library," - "which includes surface and volume representations," - "a ray tracer, and physical models for the simulation of" - "microelectronic fabrication processes..", - ext_modules=[CMakeExtension("viennaps")], - cmdclass={"build_ext": CMakeBuild}, - zip_safe=False, - setup_requires=[ - "mypy", - ], - python_requires=">=3.7", -) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index be28d5be..a4279060 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,27 +1,29 @@ -cmake_minimum_required(VERSION 3.14) +add_custom_target(ViennaPS_Tests ALL) -project(ViennaPSTests) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/tests-bin>) -include("${CMAKE_SOURCE_DIR}/cmake/prepare.cmake") +if(WIN32 AND NOT VIENNARAY_SYSTEM_EMBREE) + setup_embree_env(ViennaPS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +endif() -# Point find_package to the binary directory instead of the install location -find_package(ViennaPS REQUIRED CONFIG PATHS ${ViennaPS_BINARY_DIR} NO_DEFAULT_PATH) +if(WIN32 AND NOT VIENNARAY_SYSTEM_TBB) + setup_tbb_env(ViennaPS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +endif() -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}) +if(WIN32 AND NOT VIENNALS_SYSTEM_VTK) + setup_vtk_env(ViennaPS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +endif() -# Add subfolders to the include directories, since during installation the directory structure is -# flattened, but in the source tree - which we are using here - it is not. -list(PREPEND VIENNAPS_INCLUDE_DIRS ${VIENNAPS_BUILD_INCLUDE_DIRS}/cellSet - ${VIENNAPS_BUILD_INCLUDE_DIRS}/geometries ${VIENNAPS_BUILD_INCLUDE_DIRS}/models - ${VIENNAPS_BUILD_INCLUDE_DIRS}/compact) +file( + GLOB entries + LIST_DIRECTORIES true + "*") -set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE) +foreach(entry ${entries}) + if(NOT IS_DIRECTORY ${entry}) + continue() + endif() -add_custom_target(buildTests DEPENDS ${VIENNAPS_DEPENDENCIES}) - -subdirlist(TEST_DIRS ${CMAKE_CURRENT_LIST_DIR}) - -# add all tests -foreach(subdir ${TEST_DIRS}) - add_subdirectory(${subdir}) + message(STATUS "[ViennaPS] Adding Test ${entry}") + add_subdirectory(${entry}) endforeach() diff --git a/tests/directionalEtch/CMakeLists.txt b/tests/directionalEtch/CMakeLists.txt index d0429cd7..45ed16d6 100644 --- a/tests/directionalEtch/CMakeLists.txt +++ b/tests/directionalEtch/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(directionalEtch LANGUAGES CXX) -project("directionalEtch") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "RegressionTest") diff --git a/tests/directionalEtch/directionalEtch.cpp b/tests/directionalEtch/directionalEtch.cpp index ccc2d36f..d64c869f 100644 --- a/tests/directionalEtch/directionalEtch.cpp +++ b/tests/directionalEtch/directionalEtch.cpp @@ -1,6 +1,7 @@ -#include +#include +#include + #include -#include #include #include @@ -55,4 +56,4 @@ template void psRunTest() { } } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/domain/CMakeLists.txt b/tests/domain/CMakeLists.txt index ed37b5a5..bb004a18 100644 --- a/tests/domain/CMakeLists.txt +++ b/tests/domain/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(domain LANGUAGES CXX) -project("domain") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/fin/CMakeLists.txt b/tests/fin/CMakeLists.txt index 1e92d514..66fd5647 100644 --- a/tests/fin/CMakeLists.txt +++ b/tests/fin/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(fin LANGUAGES CXX) -project("fin") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/fin/fin.cpp b/tests/fin/fin.cpp index 8ddf7ae9..16ea1e42 100644 --- a/tests/fin/fin.cpp +++ b/tests/fin/fin.cpp @@ -1,5 +1,5 @@ +#include #include -#include #include template void psRunTest() { @@ -17,4 +17,4 @@ template void psRunTest() { LSTEST_ASSERT_VALID_LS(domain->getLevelSets()->back(), NumericType, D); } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/hole/CMakeLists.txt b/tests/hole/CMakeLists.txt index 4bbc0fc2..d18c867d 100644 --- a/tests/hole/CMakeLists.txt +++ b/tests/hole/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(hole LANGUAGES CXX) -project("hole") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/hole/hole.cpp b/tests/hole/hole.cpp index fe6dd382..2d8d3ea8 100644 --- a/tests/hole/hole.cpp +++ b/tests/hole/hole.cpp @@ -1,5 +1,5 @@ +#include #include -#include #include template void psRunTest() { @@ -17,4 +17,4 @@ template void psRunTest() { LSTEST_ASSERT_VALID_LS(domain->getLevelSets()->back(), NumericType, D); } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/isotropicProcess/CMakeLists.txt b/tests/isotropicProcess/CMakeLists.txt index c1ed43fc..1b30bbca 100644 --- a/tests/isotropicProcess/CMakeLists.txt +++ b/tests/isotropicProcess/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(isotropicProcess LANGUAGES CXX) -project("isotropicProcess") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "RegressionTest") diff --git a/tests/isotropicProcess/isotropicProcess.cpp b/tests/isotropicProcess/isotropicProcess.cpp index b8410915..9f9cd92c 100644 --- a/tests/isotropicProcess/isotropicProcess.cpp +++ b/tests/isotropicProcess/isotropicProcess.cpp @@ -1,6 +1,7 @@ +#include +#include + #include -#include -#include #include #include @@ -51,4 +52,4 @@ template void psRunTest() { } } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/logger/CMakeLists.txt b/tests/logger/CMakeLists.txt index a973d19f..0b91f706 100644 --- a/tests/logger/CMakeLists.txt +++ b/tests/logger/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(logger LANGUAGES CXX) -project("logger") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/logger/logger.cpp b/tests/logger/logger.cpp index da2f695b..7ab35a83 100644 --- a/tests/logger/logger.cpp +++ b/tests/logger/logger.cpp @@ -4,30 +4,36 @@ int main() { psLogger &logger = psLogger::getInstance(); - // Redirect std::cout to a stringstream to capture logger output std::stringstream ss; - std::streambuf *oldCoutStreamBuf = std::cout.rdbuf(); - - std::cout.rdbuf(ss.rdbuf()); // redirect cout to ss logger.setLogLevel(psLogLevel::TIMING); PSTEST_ASSERT(logger.getLogLevel() == 3); logger.setLogLevel(psLogLevel::DEBUG); logger.addDebug("Debug message"); + logger.print(ss); + PSTEST_ASSERT(ss.str() == " DEBUG: Debug message\n"); + ss.str(""); logger.setLogLevel(psLogLevel::TIMING); logger.addTiming("Timing message", 1.23); - PSTEST_ASSERT(ss.str() == " Timing message: 1.23 s \n"); + logger.print(ss); + + PSTEST_ASSERT(ss.str().find(" Timing message: 1.23") == 0); + ss.str(""); logger.setLogLevel(psLogLevel::INFO); logger.addInfo("Info message"); + logger.print(ss); + PSTEST_ASSERT(ss.str() == " Info message\n"); + ss.str(""); logger.setLogLevel(psLogLevel::WARNING); logger.addWarning("Warning message"); - PSTEST_ASSERT(ss.str() == "\n WARNING: Warning message\n"); + logger.print(ss); - std::cout.rdbuf(oldCoutStreamBuf); // redirect cout back to old buffer + PSTEST_ASSERT(ss.str() == "\n WARNING: Warning message\n"); + ss.str(""); } diff --git a/tests/materialMap/CMakeLists.txt b/tests/materialMap/CMakeLists.txt index e15133c7..47423900 100644 --- a/tests/materialMap/CMakeLists.txt +++ b/tests/materialMap/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(materialMap LANGUAGES CXX) -project("materialMap") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/plane/CMakeLists.txt b/tests/plane/CMakeLists.txt index 5cee902c..7cf68a85 100644 --- a/tests/plane/CMakeLists.txt +++ b/tests/plane/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(plane LANGUAGES CXX) -project("plane") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/plane/plane.cpp b/tests/plane/plane.cpp index 75e81212..d2ff3b5c 100644 --- a/tests/plane/plane.cpp +++ b/tests/plane/plane.cpp @@ -1,5 +1,5 @@ +#include #include -#include #include template void psRunTest() { @@ -21,4 +21,4 @@ template void psRunTest() { LSTEST_ASSERT_VALID_LS(domain->getLevelSets()->back(), NumericType, D); } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/process/CMakeLists.txt b/tests/process/CMakeLists.txt index 5baefa3a..c040fbd5 100644 --- a/tests/process/CMakeLists.txt +++ b/tests/process/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(process LANGUAGES CXX) -project("process") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/processModel/CMakeLists.txt b/tests/processModel/CMakeLists.txt index adbe7a62..0269e3ce 100644 --- a/tests/processModel/CMakeLists.txt +++ b/tests/processModel/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.14) +project(processModel LANGUAGES CXX) -project("processModel") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) endif() -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/processModel/processModel.cpp b/tests/processModel/processModel.cpp index 2cd7b22b..4a72f70a 100644 --- a/tests/processModel/processModel.cpp +++ b/tests/processModel/processModel.cpp @@ -1,16 +1,16 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include template void psRunTest() { // default constructors @@ -95,4 +95,4 @@ template void psRunTest() { } } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/singleParticleProcess/CMakeLists.txt b/tests/singleParticleProcess/CMakeLists.txt index c6636d31..d5169225 100644 --- a/tests/singleParticleProcess/CMakeLists.txt +++ b/tests/singleParticleProcess/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(singleParticleProcess LANGUAGES CXX) -project("singleParticleProcess") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "RegressionTest") diff --git a/tests/singleParticleProcess/singleParticleProcess.cpp b/tests/singleParticleProcess/singleParticleProcess.cpp index 7d370f06..37b98bed 100644 --- a/tests/singleParticleProcess/singleParticleProcess.cpp +++ b/tests/singleParticleProcess/singleParticleProcess.cpp @@ -1,7 +1,8 @@ +#include +#include + #include -#include #include -#include #include template void psRunTest() { @@ -55,4 +56,4 @@ template void psRunTest() { } } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/stack/CMakeLists.txt b/tests/stack/CMakeLists.txt index 5510a7e2..e8f01420 100644 --- a/tests/stack/CMakeLists.txt +++ b/tests/stack/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(stack LANGUAGES CXX) -project("stack") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/stack/stack.cpp b/tests/stack/stack.cpp index d2d42f74..6a214e99 100644 --- a/tests/stack/stack.cpp +++ b/tests/stack/stack.cpp @@ -1,5 +1,5 @@ +#include #include -#include #include template void psRunTest() { @@ -16,4 +16,4 @@ template void psRunTest() { LSTEST_ASSERT_VALID_LS(domain->getLevelSets()->back(), NumericType, D); } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS } diff --git a/tests/trench/CMakeLists.txt b/tests/trench/CMakeLists.txt index 4caac2d9..3c1bf8fc 100644 --- a/tests/trench/CMakeLists.txt +++ b/tests/trench/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.14) +project(trench LANGUAGES CXX) -project("trench") +add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") +target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC ${VIENNAPS_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${VIENNAPS_LIBRARIES}) - -add_dependencies(buildTests ${PROJECT_NAME}) +add_dependencies(ViennaPS_Tests ${PROJECT_NAME}) add_test(NAME ${PROJECT_NAME} COMMAND $) -set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UnitTest") diff --git a/tests/trench/trench.cpp b/tests/trench/trench.cpp index bb75606a..2b47d48a 100644 --- a/tests/trench/trench.cpp +++ b/tests/trench/trench.cpp @@ -1,5 +1,5 @@ +#include #include -#include #include template void psRunTest() { @@ -17,4 +17,4 @@ template void psRunTest() { LSTEST_ASSERT_VALID_LS(domain->getLevelSets()->back(), NumericType, D); } -int main() { PSRUN_ALL_TESTS } \ No newline at end of file +int main() { PSRUN_ALL_TESTS }