Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(
ViennaPS
LANGUAGES CXX C
VERSION 4.1.3)
VERSION 4.2.0)

# --------------------------------------------------------------------------------------------------------
# Include guards
# --------------------------------------------------------------------------------------------------------

if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif()

# --------------------------------------------------------------------------------------------------------
# Library switches
Expand All @@ -25,7 +36,7 @@ option(VIENNAPS_PACKAGE_PYTHON "Build python bindings with intent to publish whe

set(VIENNAPS_LOOKUP_DIRS
""
CACHE STRING "Directories to account for when searching installed dependencies")
CACHE STRING "Directories to account for when searching installed dependencies (VTK or embree)")

list(APPEND CMAKE_PREFIX_PATH ${VIENNAPS_LOOKUP_DIRS})

Expand Down Expand Up @@ -67,21 +78,14 @@ endif()
add_library(${PROJECT_NAME} INTERFACE)
add_library(ViennaTools::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20)
set_target_properties(
${PROJECT_NAME}
PROPERTIES CXX_STANDARD 17
PROPERTIES CXX_STANDARD 20
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 adopted
# any time soon: https://cppreference.com/w/cpp/numeric/constants

target_compile_definitions(${PROJECT_NAME} INTERFACE _USE_MATH_DEFINES=1)
endif()

# --------------------------------------------------------------------------------------------------------
# Include directories
# --------------------------------------------------------------------------------------------------------
Expand All @@ -101,7 +105,7 @@ include("cmake/cpm.cmake")

CPMAddPackage(
NAME ViennaCore
VERSION 1.8.0
VERSION 1.9.0
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}
OPTIONS "VIENNACORE_USE_GPU ${VIENNAPS_USE_GPU}")
Expand All @@ -111,17 +115,16 @@ CPMAddPackage(
VERSION 1.13.0
GIT_REPOSITORY "https://github.com/TheLartians/PackageProject.cmake")

CPMFindPackage(
CPMAddPackage(
NAME ViennaRay
VERSION 3.9.1
VERSION 3.10.0
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaRay"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}
OPTIONS "VIENNARAY_USE_GPU ${VIENNAPS_USE_GPU}")

CPMFindPackage(
NAME ViennaLS
VERSION 5.3.0
GIT_TAG master
VERSION 5.4.0
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaLS"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON})

Expand Down Expand Up @@ -150,8 +153,7 @@ if(VIENNAPS_PRECOMPILE_HEADERS)

target_link_libraries(${LIB_NAME} PRIVATE ${PROJECT_NAME})
target_compile_definitions(${LIB_NAME} PRIVATE VIENNAPS_USE_PRECOMPILED)
target_sources(${LIB_NAME} PRIVATE "lib/specializationsMain.cpp" "lib/specializationsModels.cpp"
"lib/specializationsGeometries.cpp")
target_sources(${LIB_NAME} PRIVATE "lib/specializations.cpp")

set_target_properties(
${LIB_NAME}
Expand All @@ -174,8 +176,7 @@ endif()
# Setup GPU
# --------------------------------------------------------------------------------------------------------

# If CUDA or OptiX is not found in ViennaCore, VIENNACORE_PTX_DIR is not set
if(VIENNAPS_USE_GPU AND VIENNACORE_PTX_DIR)
if(VIENNAPS_USE_GPU)
message(STATUS "[ViennaPS] Enabled GPU Support")
add_subdirectory(gpu)
else()
Expand Down
28 changes: 10 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To install ViennaPS for Python, simply run:
pip install ViennaPS
```

To use ViennaPS in C++, clone the repository and follow the installation steps below.
To use ViennaPS in C++ follow the CMake instructions below. A ready-to-use CMake template is also available for a quick start: [ViennaPS CMake Template](https://viennatools.github.io/ViennaPS/inst/#cmake-template).

For full documentation, visit [ViennaPS Documentation](https://viennatools.github.io/ViennaPS/).

Expand All @@ -45,17 +45,17 @@ ViennaPS is also available on the [Python Package Index (PyPI)](https://pypi.org

* Linux (g++ / clang)

* macOS (XCode)
* macOS (clang)

* Windows (Visual Studio)

### System Requirements

* C++17 Compiler with OpenMP support
* C++20 Compiler with OpenMP support

### ViennaTools Dependencies (installed automatically)

ViennaPS is part of the ViennaTools ecosystem and depends on several lightweight, header-only ViennaTools libraries. During configuration, CMake will look for them and fetch them automatically as part of the ViennaPS build. No separate installation step is required:
ViennaPS is part of the ViennaTools ecosystem and depends on several lightweight, header-only ViennaTools libraries. During configuration, CMake will look for them and fetch them automatically as part of the ViennaPS build. No separate installation step is required for these dependencies:

* [ViennaCore](https://github.com/ViennaTools/viennacore)
* [ViennaLS](https://github.com/ViennaTools/viennals)
Expand Down Expand Up @@ -85,19 +85,9 @@ Alternatively (or additionally), you can use `CMAKE_PREFIX_PATH` if that better
> [!NOTE]
> __For more detailed installation instructions and troubleshooting tips, have a look at the ViennaPS [documentation](https://viennatools.github.io/ViennaPS/inst/).__

ViennaPS is a header-only library, so no formal installation is required. However, following the steps below helps organize and manage dependencies more effectively:
ViennaPS is a header-only library, so no formal installation is required. To use ViennaPS in your C++ project, refer to the [Integration in CMake projects](#integration-in-cmake-projects) section below.

```bash
git clone https://github.com/ViennaTools/ViennaPS.git
cd ViennaPS

cmake -B build && cmake --build build
cmake --install build --prefix "/path/to/your/custom/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/` on Linux-based systems.

## Building the Python package
## Building the Python package locally

The Python package can be built and installed using the `pip` command:

Expand Down Expand Up @@ -132,7 +122,7 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum

* Installation with CPM
```cmake
CPMAddPackage("gh:viennatools/viennaps@4.1.3")
CPMAddPackage("gh:viennatools/viennaps@4.2.0")
```

* With a local installation
Expand All @@ -145,6 +135,8 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum
target_link_libraries(${PROJECT_NAME} PUBLIC ViennaTools::ViennaPS)
```

> Note: If you installed ViennaPS to a custom location, GPU kernels can not be built, since the CMake configuration does not support this setup. If you need GPU support, please use CPM.cmake.

### Shared Library

In order to save build time during development, dynamically linked shared libraries can be used if ViennaPS was built with them. This is done by precompiling the most common template specialisations. In order to use shared libraries, use
Expand All @@ -157,7 +149,7 @@ If ViennaPS was built with shared libraries and you use ViennaPS in your project

## GPU Acceleration (Experimental)

As of version 3.4.0, ViennaPS supports GPU acceleration for the ray tracing part of the library. This feature is still experimental and may not work on all systems. Details on how to enable GPU functionality can be found in the [documentation](https://viennatools.github.io/ViennaPS/inst/gpu.html).
As of version 3.4.0, ViennaPS supports GPU acceleration for the ray tracing part of the library. This feature is still experimental. Details on how to enable GPU functionality can be found in the [documentation](https://viennatools.github.io/ViennaPS/inst/gpu.html).

## Basic Examples

Expand Down
Binary file added assets/CMake-Example.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions cmake/ViennaPSUtils.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
function(viennaps_add_executable target_name source_file)
add_executable(${target_name} ${source_file})
target_link_libraries(${target_name} PRIVATE ViennaPS)
if(VIENNAPS_USE_GPU)
add_gpu_executable(${target_name} ${source_file})
else()
add_executable(${target_name} ${source_file})
target_link_libraries(${target_name} PRIVATE ViennaPS)
add_dependencies(${target_name} ${VIENNAPS_GPU_DEPENDENCIES})
endif()
endfunction()

Expand Down
160 changes: 0 additions & 160 deletions cmake/generate_ptx.cmake

This file was deleted.

7 changes: 1 addition & 6 deletions examples/DRAMWiggling/DRAMWiggling.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#include <gds/psGDSReader.hpp>
#include <geometries/psMakePlane.hpp>
#include <models/psHBrO2Etching.hpp>
#include <process/psProcess.hpp>
#include <psDomain.hpp>
#include <psUtil.hpp>
#include <viennaps.hpp>

using namespace viennaps;

Expand Down
7 changes: 1 addition & 6 deletions examples/boschProcess/boschProcessEmulate.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#include <geometries/psMakeTrench.hpp>
#include <models/psDirectionalProcess.hpp>
#include <models/psGeometricDistributionModels.hpp>
#include <models/psIsotropicProcess.hpp>
#include <process/psProcess.hpp>
#include <psUtil.hpp>
#include <viennaps.hpp>

using namespace viennaps;
constexpr int D = 2;
Expand Down
7 changes: 1 addition & 6 deletions examples/boschProcess/boschProcessSimulate.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#include <geometries/psMakeTrench.hpp>
#include <models/psIsotropicProcess.hpp>
#include <models/psMultiParticleProcess.hpp>
#include <models/psSingleParticleProcess.hpp>
#include <process/psProcess.hpp>
#include <psUtil.hpp>
#include <viennaps.hpp>

using namespace viennaps;
constexpr int D = 2;
Expand Down
Loading
Loading