Skip to content

Commit

Permalink
Merge pull request #120 from ktbolt/add-vtk-local-path
Browse files Browse the repository at this point in the history
Add vtk local path
  • Loading branch information
ktbolt committed Apr 14, 2023
2 parents bc4469a + b1e4b8b commit 93c38b7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ set(SV_EXTERNALS_ADDITIONAL_CMAKE_ARGS "" CACHE STRING "If more options want to

set(SV_USE_LOCAL_VTK OFF CACHE BOOL "If using an installed VTK version.")

# Add downloading VTK externals.
#
if(NOT ${SV_USE_LOCAL_VTK})
ExternalProject_Add(Externals
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Externals
Expand Down Expand Up @@ -122,6 +124,12 @@ endif()
# svSolver!
set(SV_ADDITIONAL_CMAKE_ARGS "" CACHE STRING "If more options want to be provided to the sv_externals build, they can be with this string")

# Add svsolver project without VTK externals.
#
# Pass two additional SV_USE_LOCAL_VTK and SV_VTK_LOCAL_PATH
# flags to ExternalProject_Add to define CMake variables
# that can be later used in other CMake files.
#
if(${SV_USE_LOCAL_VTK})
ExternalProject_Add(svSolver
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Code
Expand All @@ -140,9 +148,13 @@ if(${SV_USE_LOCAL_VTK})
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
-DSV_USE_LOCAL_VTK:BOOL=${SV_USE_LOCAL_VTK}
-DSV_VTK_LOCAL_PATH::STRING=${SV_VTK_LOCAL_PATH}
${SV_ADDITIONAL_CMAKE_ARGS}
)

# Add svsolver with externals.
#
else()

ExternalProject_Add(svSolver
Expand Down
16 changes: 15 additions & 1 deletion Code/CMake/SimVascularExternals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,21 @@ endif()

#-----------------------------------------------------------------------------
# VTK
if (SV_USE_VTK)
#
# If using a local VTK installation.
#
# The SV_VTK_LOCAL_PATH variable is used to identify a VTK
# install in a location that CMake can't find.
#
if (SV_USE_LOCAL_VTK)

if (SV_VTK_LOCAL_PATH STREQUAL "")
find_package(VTK REQUIRED)
else()
find_package(VTK PATHS ${SV_VTK_LOCAL_PATH} REQUIRED)
endif()

elseif (SV_USE_VTK)
#message("SV_VTK_DIR ${SV_VTK_DIR}")
# If using toplevel dir, foce VTK_DIR to be the SV_VTK_DIR set by the
if(SV_EXTERNALS_USE_TOPLEVEL_DIR)
Expand Down
2 changes: 1 addition & 1 deletion Code/CMake/SimVascularOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
# Set the -std=legacy option to compile code using gcc 8.1 (see svSolver GitHub Issue #32).
if(APPLE AND (Fortran_COMPILER_NAME MATCHES "gfortran.*") AND (COMPILER_MAJOR_VERSION GREATER 7))
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
elseif(COMPILER_MAJOR_VERSION GREATER 11)
elseif(COMPILER_MAJOR_VERSION GREATER 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
endif()
else()
Expand Down

0 comments on commit 93c38b7

Please sign in to comment.