Skip to content

Commit

Permalink
Package-Project Fixes, VTK-Environment refactor (#104)
Browse files Browse the repository at this point in the history
* refactor: expose `setup_vtk_env`, use generator expressions, fix folder name casing

* fix: formatting

* fix(vtk): use proper target

* chore(vtk): add note

* refactor(tests, examples): remove superfluous command

* fix(python): vtk environment
  • Loading branch information
Curve authored Mar 11, 2024
1 parent c3a6bb4 commit 5ad1bbd
Show file tree
Hide file tree
Showing 111 changed files with 27 additions and 82 deletions.
19 changes: 9 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ endif()
# --------------------------------------------------------------------------------------------------------

target_include_directories(
${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/viennals>
${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/viennals>
$<INSTALL_INTERFACE:include/viennals-${PROJECT_VERSION}>)

# --------------------------------------------------------------------------------------------------------
# Setup Dependencies
# --------------------------------------------------------------------------------------------------------

include("cmake/cpm.cmake")
include("cmake/vtk.cmake")

CPMAddPackage(
NAME PackageProject
Expand All @@ -101,6 +102,10 @@ target_link_libraries(${PROJECT_NAME} INTERFACE OpenMP::OpenMP_CXX ViennaHRLE)

if(VIENNALS_USE_VTK)
enable_language(C)

find_package(VTK QUIET)
set(VIENNALS_SYSTEM_VTK ${VTK_FOUND})

CPMFindPackage(
NAME VTK
# TODO: Change to 9.3.1 as soon as it's released
Expand Down Expand Up @@ -151,12 +156,6 @@ if(VIENNALS_USE_VTK)
VTK::FiltersCore
VTK::FiltersGeneral
VTK::FiltersGeometry)

if(MSVC)
set(VTK_LIBS "${VTK_BINARY_DIR}/bin/$<CONFIG>")
else()
set(VTK_LIBS "${VTK_BINARY_DIR}/lib")
endif()
endif()

# --------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -184,7 +183,7 @@ endif()

if(VIENNALS_BUILD_EXAMPLES)
message(STATUS "[ViennaLS] Building Examples")
add_subdirectory(Examples)
add_subdirectory(examples)
endif()

# --------------------------------------------------------------------------------------------------------
Expand All @@ -195,7 +194,7 @@ if(VIENNALS_BUILD_TESTS)
message(STATUS "[ViennaLS] Building Tests")

enable_testing()
add_subdirectory(Tests)
add_subdirectory(tests)
endif()

# --------------------------------------------------------------------------------------------------------
Expand All @@ -204,7 +203,7 @@ endif()

if(VIENNALS_BUILD_PYTHON)
message(STATUS "[ViennaLS] Building Python Bindings")
add_subdirectory(Python)
add_subdirectory(python)
endif()

# --------------------------------------------------------------------------------------------------------
Expand Down
20 changes: 9 additions & 11 deletions cmake/vtk.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
macro(setup_vtk_env TARGET OUTPUT)
if(NOT WIN32)
message(
STATUS "[ViennaLS] Skipping VTK-Environment setup for ${TARGET} (Only required on Windows)")
else()
message(STATUS "[ViennaLS] Setting up VTK for ${TARGET}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/${OUTPUT}>)
message(STATUS "[ViennaLS] Setting up VTK-Environment for ${TARGET}")

add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${VTK_LIBS} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
# We expect all of the VTK binaries to be present in the same directory to which "vtksys" is
# built. This is currently the case, and has been the case for prior vtk versions - However we
# should keep an eye on this.

add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory $<TARGET_FILE_DIR:vtksys> ${OUTPUT})
endmacro()
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(AirGapDeposition LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
6 changes: 3 additions & 3 deletions Examples/CMakeLists.txt → examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_custom_target(ViennaLS_Examples ALL)

if(NOT VTK_DIR)
include("../cmake/vtk.cmake")
setup_vtk_env(ViennaLS_Examples "examples")
if(WIN32 AND NOT VIENNALS_SYSTEM_VTK)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/examples>)
setup_vtk_env(ViennaLS_Examples ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()

file(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Deposition LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(GeometricAdvection LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(PatternedSubstrate LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(PeriodicBoundary LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(SharedLib LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(SquareEtch LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(VoidEtching LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(VolumeToLevelSets LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
8 changes: 3 additions & 5 deletions Python/CMakeLists.txt → python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ endif()

include("../cmake/vtk.cmake")

if(WIN32 AND NOT VTK_DIR)
setup_vtk_env(${PROJECT_NAME} vtk_env)
set(VTK_DIR "${PROJECT_BINARY_DIR}/vtk_env")
elseif(NOT VTK_DIR)
set(VTK_DIR "${VTK_LIBS}")
if(WIN32 AND NOT VIENNALS_SYSTEM_VTK)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/vtk_env>)
setup_vtk_env(${PROJECT_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()

# --------------------------------------------------------------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Advection LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Advection2D LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(AdvectionBenchmark LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(AdvectionPlane LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(BooleanOperation LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(BooleanOperationExactZero LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(BooleanOperationExactZero1 LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(BoundaryConditions LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
6 changes: 3 additions & 3 deletions Tests/CMakeLists.txt → tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_custom_target(ViennaLS_Tests ALL)

if(NOT VTK_DIR)
include("../cmake/vtk.cmake")
setup_vtk_env(ViennaLS_Tests "tests")
if(WIN32 AND NOT VIENNALS_SYSTEM_VTK)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${PROJECT_BINARY_DIR}/tests>)
setup_vtk_env(ViennaLS_Tests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()

file(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(CalculateCurvatures LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(CalculateNormalVectors LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(ConvexHull LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(ConvexHull3D LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(DiskMesh LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Expand LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Extrude LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(FeatureDetection LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(FileWriter LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(FromMesh LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(GenerateHoleGeometry LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(GeometricAdvect LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(GeometricAdvectMask LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(GeometricAdvectPerformance LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(GeometricAdvectTrench LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(HullMesh LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Make3DSphere LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MakeBox LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MakeGeometry LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MakePlane LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MakeSphere LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MarkVoidPoints LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MultiMaterialAdvection LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(MultiMaterialEtch LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(PeriodicBoundary2D LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(ReadFromFile LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(ReadVolume LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(RemoveStrayPoints LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(RotateMesh LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(Serialize LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(SmartPointer LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(VisualizationMesh LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.14)
project(VoidDetection LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
Expand Down
File renamed without changes.

0 comments on commit 5ad1bbd

Please sign in to comment.