diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..822b866 --- /dev/null +++ b/.clang-format @@ -0,0 +1,236 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseColons: false +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAfterAttributes: Never +BreakAfterJavaFieldAnnotations: false +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: "^ IWYU pragma:" +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: ".*" + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: "(Test)?$" +IncludeIsMainSourceRegex: "" +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: false +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequiresClause: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLinesAtEOF: false +LambdaBodyIndentation: Signature +LineEnding: DeriveLF +MacroBlockBegin: "" +MacroBlockEnd: "" +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer +ReflowComments: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: Never +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false +SpacesInSquareBrackets: false +Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE +--- + diff --git a/.cmake-format b/.cmake-format deleted file mode 100644 index d129923..0000000 --- a/.cmake-format +++ /dev/null @@ -1,6 +0,0 @@ -include: ["cmake/.cpm-format"] -format: - line_width: 100 - -markup: - enable_markup: false diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 4805fbf..bd4ad42 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -2,13 +2,9 @@ name: ๐Ÿ—๏ธ Setup Environment description: Install Dependencies & Deploy Workarounds inputs: - container: + os: required: true - description: Build container used - - install-vtk: - required: true - description: Wether or not to install VTK as a system dependency + description: Operating System used runs: using: "composite" @@ -16,21 +12,15 @@ runs: steps: - name: ๐Ÿฉน Enable Long Paths shell: bash - if: ${{ inputs.container == 'windows-latest' }} + if: ${{ inputs.os == '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: ๐Ÿ–ฅ๏ธ Enable MSVC Dev Console + uses: ilammy/msvc-dev-cmd@v1 - name: ๐Ÿ“‹ Install OpenMP shell: bash - if: ${{ inputs.container == 'macos-latest' }} + if: ${{ inputs.os == '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 + echo "OpenMP_ROOT=$(brew --prefix)/opt/libomp" >> $GITHUB_ENV diff --git a/.github/homebrew/libomp.rb b/.github/homebrew/libomp.rb index 3b63dbe..77b03af 100644 --- a/.github/homebrew/libomp.rb +++ b/.github/homebrew/libomp.rb @@ -1,83 +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; + 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; } - EOS - system ENV.cxx, "-Werror", "-Xpreprocessor", "-fopenmp", "test.cpp", "-std=c++11", - "-I#{include}", "-L#{lib}", "-lomp", "-o", "test" - system "./test" - end + 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 index bd1487f..0180065 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,41 +12,39 @@ jobs: matrix: config: - - Debug - Release + - Debug + os: - macos-latest - - ubuntu-latest - windows-latest - vtk-system: [true, false] - - exclude: - - os: macos-latest - vtk-system: true - - - os: windows-latest - vtk-system: true + include: + - os: ubuntu-latest + config: Release + container: ghcr.io/viennatools/vienna-builder:vtk + - os: ubuntu-latest + config: Debug + container: ghcr.io/viennatools/vienna-builder:vtk runs-on: ${{ matrix.os }} - container: ${{ matrix.os == 'ubuntu-latest' && 'fedora:38' || null }} + container: ${{ matrix.container }} - name: '๐Ÿงช Test on ${{ matrix.os }} ["${{ matrix.config }}", VTK: "${{ matrix.vtk-system }}"]' + name: "๐Ÿงช Test on ${{ matrix.os }} (โš™๏ธ: ${{ matrix.config }}, ๐Ÿ’ฟ: ${{ matrix.container || matrix.os }})" steps: - name: ๐Ÿ“ฅ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: ๐Ÿ–ฅ๏ธ Setup Environment uses: ./.github/actions/setup with: - container: ${{ matrix.os }} - install-vtk: ${{ matrix.vtk-system }} + os: ${{ matrix.os }} - name: ๐Ÿฆฅ Cache Dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: - key: test-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.vtk-system }} + key: test-${{ matrix.os }}-${{ matrix.config }} path: build - name: ๐Ÿ—๏ธ Compile diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2b20c54..ff16447 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,23 +4,35 @@ on: push: pull_request: workflow_dispatch: + inputs: + debug: + type: boolean + description: Enable Debugging jobs: check-coding-style: runs-on: ubuntu-latest + container: ghcr.io/viennatools/vienna-builder:vtk-python + steps: - name: ๐Ÿ“ฅ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + set-safe-directory: true - - name: ๐Ÿ“‹ Install Dependencies - run: pip install -U cmakelang + - name: ๐Ÿ“‹ Install additional dependencies + if: ${{ github.event.inputs.debug == 'true' }} + run: apk add tmate - - name: ๐Ÿ—๏ธ Format - run: ./format-project.sh + - name: ๐Ÿ› Debug Issues + if: ${{ github.event.inputs.debug == 'true' }} + uses: mxschmitt/action-tmate@v3 + with: + install-dependencies: false + limit-access-to-actor: true - - name: ๐Ÿ” Check changes + - name: ๐Ÿ” Check Format run: | - if [[ $(git diff-index --name-only --exit-code HEAD) ]]; then - git diff - exit -1 - fi + git config --global --add safe.directory $(pwd) # "set-safe-directory" seems bugged in actions/checkout@v4 + cmake -B build + cmake --build build --target format-check diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 272677b..1688334 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,4 +1,4 @@ -name: ๐Ÿ Build Bindings +name: ๐Ÿ Bindings on: push: @@ -6,30 +6,33 @@ on: workflow_dispatch: jobs: - bindings: + test-bindings: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: ubuntu-latest + container: ghcr.io/viennatools/vienna-builder:vtk-python + - os: windows-latest + - os: macos-latest runs-on: ${{ matrix.os }} - container: ${{ matrix.os == 'ubuntu-latest' && 'fedora:38' || null }} + container: ${{ matrix.container }} - name: "๐Ÿ Build Bindings on ${{ matrix.os }}" + name: "๐Ÿ Test Bindings on ${{ matrix.os }}" steps: - name: ๐Ÿ“ฅ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: ๐Ÿ–ฅ๏ธ Setup Environment uses: ./.github/actions/setup with: - install-vtk: false - container: ${{ matrix.os }} + os: ${{ matrix.os }} - name: ๐Ÿฆฅ Cache Dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: key: python-${{ matrix.os }} path: build @@ -37,20 +40,78 @@ jobs: - 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__)" + python -m venv venv + ./venv/Scripts/activate.bat + pip install . + 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 . + python -m venv venv + CMAKE_ARGS=-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF ./venv/bin/pip install . # Alpine does not like LTO ./venv/bin/python -c "import viennaps2d; print(viennaps2d.__doc__)" - name: ๐Ÿ“ฆ Upload Artifact - if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Pre-Built (${{ matrix.os }}) path: venv + + package: + strategy: + fail-fast: false + + matrix: + include: + - os: ubuntu-latest + container: ghcr.io/viennatools/vienna-builder:python + - os: windows-latest + - os: macos-latest + + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + + name: "๐Ÿ Package Bindings on ${{ matrix.os }}" + + steps: + - name: ๐Ÿ“ฅ Checkout + uses: actions/checkout@v4 + + - name: ๐Ÿ–ฅ๏ธ Setup Environment + uses: ./.github/actions/setup + with: + os: ${{ matrix.os }} + + - name: ๐Ÿ›ž CIBuildWheel + run: pip install cibuildwheel==2.17.0 --break-system-packages + + - name: ๐Ÿ› ๏ธ Build VTK (Windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + sed -i 's/\(DVIENNAPS_BUILD_PYTHON=ON"\)/\1,"-DVIENNAPS_PACKAGE_PYTHON=ON","-DVIENNAPS_IS_CI=ON"/g' pyproject.toml + type pyproject.toml + + - name: ๐Ÿ› ๏ธ Build VTK (MacOs) + if: ${{ matrix.os == 'macos-latest' }} + run: | + sed -i .bak 's/\(DVIENNAPS_BUILD_PYTHON=ON"\)/\1,"-DVIENNAPS_PACKAGE_PYTHON=ON","-DVIENNAPS_IS_CI=ON"/g' pyproject.toml + cat pyproject.toml + + - name: ๐Ÿ› ๏ธ Use VTK-Python Libs + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + sed -i 's/\(DVIENNAPS_BUILD_PYTHON=ON"\)/\1,"-DVIENNAPS_PACKAGE_PYTHON=ON","-DVIENNAPS_IS_CI=ON"/g' pyproject.toml + cat pyproject.toml + + - name: ๐Ÿ—๏ธ Build Wheels + run: python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-*" + CIBW_ARCHS_WINDOWS: auto64 + + - name: ๐Ÿ“ฆ Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: Wheels (${{ matrix.os }}) + path: ./wheelhouse/*.whl diff --git a/CMakeLists.txt b/CMakeLists.txt index 13ce30d..a85fc4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,10 +38,15 @@ list(APPEND CMAKE_PREFIX_PATH ${VIENNAPS_LOOKUP_DIRS}) if(VIENNAPS_PACKAGE_PYTHON) message( STATUS - "[ViennaPS] Skipping system dependencies due to 'VIENNALS_PACKAGE_PYTHON', the build will take a long time!" + "[ViennaPS] Using remote packages due to 'VIENNAPS_PACKAGE_PYTHON', the build will take a long time!" ) - set(CPM_DOWNLOAD_ALL ON) + # CIBUILDWHEEL is absolutely cursed and won't work when this is turned on. + # I don't know why... + if(NOT VIENNAPS_IS_CI) + set(CPM_DOWNLOAD_ALL ON) + endif() + set(VIENNAPS_BUILD_PYTHON ON) endif() @@ -85,12 +90,10 @@ target_include_directories( # -------------------------------------------------------------------------------------------------------- # Check whether or not dependencies are installed on the system -# โ”” VTK requires C Language support (HDF5) +# โ”” VTK/OpenMP require C Language support # -------------------------------------------------------------------------------------------------------- -if(NOT APPLE) - enable_language(C) -endif() +enable_language(C) find_package(ViennaRay QUIET) find_package(ViennaLS QUIET) @@ -109,6 +112,11 @@ set(VIENNAPS_SYSTEM_VIENNALS include("cmake/cpm.cmake") +CPMAddPackage( + NAME Core + GIT_TAG main # TODO: Create Tag + GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore") + CPMAddPackage( NAME PackageProject VERSION 1.11.1 diff --git a/cmake/.cpm-format b/cmake/.cpm-format deleted file mode 100644 index 284c984..0000000 --- a/cmake/.cpm-format +++ /dev/null @@ -1,69 +0,0 @@ -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/bat.cmake b/cmake/bat.cmake deleted file mode 100644 index 6cfc058..0000000 --- a/cmake/bat.cmake +++ /dev/null @@ -1,12 +0,0 @@ -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/examples/CMakeLists.txt b/examples/CMakeLists.txt index 02a978a..b20975f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,37 +1,8 @@ add_custom_target(ViennaPS_Examples ALL) -include("../cmake/bat.cmake") - -set(VIENNAPS_EXAMPLES_LIB $<1:${PROJECT_BINARY_DIR}/example-libs>) - -if(WIN32 - AND NOT VIENNAPS_SYSTEM_VIENNARAY - AND NOT VIENNARAY_SYSTEM_EMBREE) - setup_embree_env(ViennaPS_Examples ${VIENNAPS_EXAMPLES_LIB}) -endif() - -if(WIN32 - AND NOT VIENNAPS_SYSTEM_VIENNARAY - AND NOT VIENNARAY_SYSTEM_TBB) - setup_tbb_env(ViennaPS_Examples ${VIENNAPS_EXAMPLES_LIB}) +if(WIN32) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/examples>) + setup_vtk_env(ViennaLS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endif() -if(WIN32 - AND NOT VIENNAPS_SYSTEM_VIENNALS - AND NOT VIENNALS_SYSTEM_VTK) - setup_vtk_env(ViennaPS_Examples ${VIENNAPS_EXAMPLES_LIB}) -endif() - -file( - GLOB entries - LIST_DIRECTORIES true - "*") - -foreach(entry ${entries}) - if(NOT IS_DIRECTORY ${entry}) - continue() - endif() - - message(STATUS "[ViennaPS] Adding Example ${entry}") - add_subdirectory(${entry}) -endforeach() +viennacore_add_subdirs(${CMAKE_CURRENT_LIST_DIR}) diff --git a/examples/GDSReader/CMakeLists.txt b/examples/GDSReader/CMakeLists.txt index c97294c..10044e8 100644 --- a/examples/GDSReader/CMakeLists.txt +++ b/examples/GDSReader/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(GDSReader.py ${CMAKE_CURRENT_BINARY_DIR}/GDSReader.py COPYONLY) configure_file(mask.gds ${CMAKE_CURRENT_BINARY_DIR}/mask.gds COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/KDTreeBenchmark/CMakeLists.txt b/examples/KDTreeBenchmark/CMakeLists.txt index 11b5584..148f092 100644 --- a/examples/KDTreeBenchmark/CMakeLists.txt +++ b/examples/KDTreeBenchmark/CMakeLists.txt @@ -4,4 +4,4 @@ add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/KDTreeBenchmark/KDTreeBenchmark.cpp b/examples/KDTreeBenchmark/KDTreeBenchmark.cpp index 6af5d1c..727c996 100644 --- a/examples/KDTreeBenchmark/KDTreeBenchmark.cpp +++ b/examples/KDTreeBenchmark/KDTreeBenchmark.cpp @@ -94,8 +94,8 @@ int main(int argc, char *argv[]) { std::cout << "Finding Nearest Neighbors...\n"; startTime = getTime(); for (unsigned i = 0; i < repetitions; ++i) { - for (const auto &pt : testPoints) - [[maybe_unused]] auto result = tree->findNearest(pt); + for (const auto &pt : testPoints) [[maybe_unused]] + auto result = tree->findNearest(pt); } endTime = getTime(); diff --git a/examples/TEOSTrenchDeposition/CMakeLists.txt b/examples/TEOSTrenchDeposition/CMakeLists.txt index 23f2be0..426732d 100644 --- a/examples/TEOSTrenchDeposition/CMakeLists.txt +++ b/examples/TEOSTrenchDeposition/CMakeLists.txt @@ -7,7 +7,7 @@ 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(ViennaPS_Examples singleTEOS) -setup_windows_bat(singleTEOS ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(singleTEOS ${VIENNAPS_EXAMPLES_LIB}) add_executable(multiTEOS "multiTEOS.cpp") target_link_libraries(multiTEOS PRIVATE ViennaPS) @@ -16,4 +16,4 @@ 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(ViennaPS_Examples multiTEOS) -setup_windows_bat(multiTEOS ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(multiTEOS ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/atomicLayerDeposition/CMakeLists.txt b/examples/atomicLayerDeposition/CMakeLists.txt index 75ba316..895f924 100644 --- a/examples/atomicLayerDeposition/CMakeLists.txt +++ b/examples/atomicLayerDeposition/CMakeLists.txt @@ -8,4 +8,4 @@ configure_file(atomicLayerDeposition.py ${CMAKE_CURRENT_BINARY_DIR}/atomicLayerD COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/cantileverWetEtching/CMakeLists.txt b/examples/cantileverWetEtching/CMakeLists.txt index f1a8bfa..cbbe29e 100644 --- a/examples/cantileverWetEtching/CMakeLists.txt +++ b/examples/cantileverWetEtching/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(cantileverWetEtching.py ${CMAKE_CURRENT_BINARY_DIR}/cantileverWet configure_file(cantilever_mask.gds ${CMAKE_CURRENT_BINARY_DIR}/cantilever_mask.gds COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/exampleProcess/CMakeLists.txt b/examples/exampleProcess/CMakeLists.txt index 024731c..b286ba8 100644 --- a/examples/exampleProcess/CMakeLists.txt +++ b/examples/exampleProcess/CMakeLists.txt @@ -4,4 +4,4 @@ add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") target_link_libraries(${PROJECT_NAME} PRIVATE ViennaPS) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/holeEtching/CMakeLists.txt b/examples/holeEtching/CMakeLists.txt index a1bca1c..b904b52 100644 --- a/examples/holeEtching/CMakeLists.txt +++ b/examples/holeEtching/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(holeEtching.py ${CMAKE_CURRENT_BINARY_DIR}/holeEtching.py COPYONL configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/interpolationDemo/CMakeLists.txt b/examples/interpolationDemo/CMakeLists.txt index 8f95979..2993152 100644 --- a/examples/interpolationDemo/CMakeLists.txt +++ b/examples/interpolationDemo/CMakeLists.txt @@ -8,4 +8,4 @@ configure_file(scatterdata.csv ${CMAKE_CURRENT_BINARY_DIR}/scatterdata.csv COPYO configure_file(plot.py ${CMAKE_CURRENT_BINARY_DIR}/plot.py COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/oxideRegrowth/CMakeLists.txt b/examples/oxideRegrowth/CMakeLists.txt index b2b4067..57ec877 100644 --- a/examples/oxideRegrowth/CMakeLists.txt +++ b/examples/oxideRegrowth/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(oxideRegrowth.py ${CMAKE_CURRENT_BINARY_DIR}/oxideRegrowth.py COP configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/selectiveEpitaxy/CMakeLists.txt b/examples/selectiveEpitaxy/CMakeLists.txt index 42272e2..8680210 100644 --- a/examples/selectiveEpitaxy/CMakeLists.txt +++ b/examples/selectiveEpitaxy/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(selectiveEpitaxy.py ${CMAKE_CURRENT_BINARY_DIR}/selectiveEpitaxy. configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/stackEtching/CMakeLists.txt b/examples/stackEtching/CMakeLists.txt index ccdb9dd..d4434fd 100644 --- a/examples/stackEtching/CMakeLists.txt +++ b/examples/stackEtching/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(stackEtching.py ${CMAKE_CURRENT_BINARY_DIR}/stackEtching.py COPYO configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/trenchDeposition/CMakeLists.txt b/examples/trenchDeposition/CMakeLists.txt index 17ccec0..8e87b38 100644 --- a/examples/trenchDeposition/CMakeLists.txt +++ b/examples/trenchDeposition/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(trenchDeposition.py ${CMAKE_CURRENT_BINARY_DIR}/trenchDeposition. configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/trenchDepositionGeometric/CMakeLists.txt b/examples/trenchDepositionGeometric/CMakeLists.txt index a2ae284..21fdda5 100644 --- a/examples/trenchDepositionGeometric/CMakeLists.txt +++ b/examples/trenchDepositionGeometric/CMakeLists.txt @@ -8,4 +8,4 @@ configure_file(trenchDepositionGeometric.py configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/examples/volumeModel/CMakeLists.txt b/examples/volumeModel/CMakeLists.txt index dec39ae..ccfc611 100644 --- a/examples/volumeModel/CMakeLists.txt +++ b/examples/volumeModel/CMakeLists.txt @@ -7,4 +7,4 @@ configure_file(volumeModel.py ${CMAKE_CURRENT_BINARY_DIR}/volumeModel.py COPYONL configure_file(config.txt ${CMAKE_CURRENT_BINARY_DIR}/config.txt COPYONLY) add_dependencies(ViennaPS_Examples ${PROJECT_NAME}) -setup_windows_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) +viennacore_setup_bat(${PROJECT_NAME} ${VIENNAPS_EXAMPLES_LIB}) diff --git a/pyproject.toml b/pyproject.toml index d7495ed..cbf9ee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ name = "ViennaPS_Python" readme = "README.md" license = {file = "LICENSE"} description = "Semiconductor fabrication process simulation library" -dependencies = ['vtk >= 9.0.0, < 10'] +# dependencies = ['vtk >= 9.0.0, < 10'] [project.urls] Homepage = "https://viennatools.github.io/ViennaPS/" diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 96cc0a9..1e23d27 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -17,12 +17,10 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) if(NOT APPLE) list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN") list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../vtkmodules") - list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../viennals.libs") 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/../viennals.libs") list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../viennaps.libs") endif() @@ -36,7 +34,7 @@ set(PYBIND11_FINDPYTHON ON) CPMFindPackage( NAME pybind11 - VERSION 2.11.1 + VERSION 2.12.0 GIT_REPOSITORY "https://github.com/pybind/pybind11") # -------------------------------------------------------------------------------------------------------- @@ -52,45 +50,31 @@ if(CMAKE_LIBRARY_OUTPUT_DIRECTORY) endif() # -------------------------------------------------------------------------------------------------------- -# Binding macro +# Setup Bindings # -------------------------------------------------------------------------------------------------------- -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}) +viennacore_setup_binding(viennaps2d ${VIENNAPS_LIBRARY_OUTPUT_DIR}) +viennacore_setup_binding(viennaps3d ${VIENNAPS_LIBRARY_OUTPUT_DIR}) - target_link_libraries(${MODULE_NAME} PUBLIC ViennaPS) - target_compile_definitions(${MODULE_NAME} PRIVATE ${FLAGS} -DVIENNAPS_MODULE_NAME=${MODULE_NAME}) +target_link_libraries(viennaps2d PRIVATE ViennaPS) +target_link_libraries(viennaps3d PRIVATE ViennaPS) - 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() +target_compile_definitions(viennaps2d PRIVATE -DVIENNAPS_PYTHON_DIMENSION=2 + -DVIENNAPS_MODULE_NAME=viennaps2d) +target_compile_definitions(viennaps3d PRIVATE -DVIENNAPS_PYTHON_DIMENSION=3 + -DVIENNAPS_MODULE_NAME=viennaps3d) # -------------------------------------------------------------------------------------------------------- -# Setup Bindings +# Setup Lib-Folder # -------------------------------------------------------------------------------------------------------- -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(VIENNAPS_PACKAGE_PYTHON OR (NOT VIENNAPS_SYSTEM_VIENNARAY AND NOT VIENNARAY_SYSTEM_EMBREE)) - set(VIENNAPS_USE_LIB_FOLDER ON) - setup_embree_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") +if(NOT VIENNAPS_PACKAGE_PYTHON) + return() endif() -if(VIENNAPS_PACKAGE_PYTHON OR (NOT VIENNAPS_SYSTEM_VIENNARAY AND NOT VIENNARAY_SYSTEM_TBB)) - set(VIENNAPS_USE_LIB_FOLDER ON) - setup_tbb_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") -endif() +setup_embree_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") +setup_tbb_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}") -if(VIENNAPS_USE_LIB_FOLDER) - install(DIRECTORY "${VIENNAPS_LIB_FOLDER}" DESTINATION .) -endif() +install(DIRECTORY "${VIENNAPS_LIB_FOLDER}" DESTINATION .) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7e05197..67a91d8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,35 +1,8 @@ add_custom_target(ViennaPS_Tests ALL) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/tests-bin>) - -if(WIN32 - AND NOT VIENNAPS_SYSTEM_VIENNARAY - AND NOT VIENNARAY_SYSTEM_EMBREE) - setup_embree_env(ViennaPS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -endif() - -if(WIN32 - AND NOT VIENNAPS_SYSTEM_VIENNARAY - AND NOT VIENNARAY_SYSTEM_TBB) - setup_tbb_env(ViennaPS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +if(WIN32) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/tests>) + setup_vtk_env(ViennaLS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endif() -if(WIN32 - AND NOT VIENNAPS_SYSTEM_VIENNALS - AND NOT VIENNALS_SYSTEM_VTK) - setup_vtk_env(ViennaPS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -endif() - -file( - GLOB entries - LIST_DIRECTORIES true - "*") - -foreach(entry ${entries}) - if(NOT IS_DIRECTORY ${entry}) - continue() - endif() - - message(STATUS "[ViennaPS] Adding Test ${entry}") - add_subdirectory(${entry}) -endforeach() +viennacore_add_subdirs(${CMAKE_CURRENT_LIST_DIR})