From 13ef560dea979500958f874035a67d8736e586b0 Mon Sep 17 00:00:00 2001 From: updega2 Date: Mon, 9 Jan 2017 10:58:14 -0800 Subject: [PATCH 1/2] DEV: Including svsolver thirdparty --- Code/FlowSolvers/CMakeLists.txt | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/Code/FlowSolvers/CMakeLists.txt b/Code/FlowSolvers/CMakeLists.txt index 67cd432e..0f230a1f 100644 --- a/Code/FlowSolvers/CMakeLists.txt +++ b/Code/FlowSolvers/CMakeLists.txt @@ -28,6 +28,79 @@ # #=========================================================================# set(INDENTS "${INDENTS} ") +set(SV_FLOWSOLVERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +macro(svsolver_third_party _pkg) + string(TOLOWER "${_pkg}" _lower) + string(TOUPPER "${_pkg}" _upper) + + set(options OPTIONAL VERSION_EXACT + DOWNLOADABLE SYSTEM_DEFAULT + SVEXTERN_CONFIG ADD_INSTALL + ) + set(oneValueArgs VERSION) + set(multiValueArgs PATHS HINTS COMPONENTS) + + CMAKE_PARSE_ARGUMENTS("svsolver_third_party" + "${options}" + "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + set(${_upper}_SUBDIR ThirdParty/${_pkg}) + if(svsolver_third_party_SYSTEM_DEFAULT) + option(SV_USE_SYSTEM_${_upper} "Use system ${_pkg}" ON) + else() + option(SV_USE_SYSTEM_${_upper} "Use system ${_pkg}" OFF) + endif() + + mark_as_advanced(SV_USE_SYSTEM_${_upper}) + + configure_file(${SV_FLOWSOLVERS_DIR}/../${${_upper}_SUBDIR}/simvascular_${_lower}.h.in + ${SV_BINARY_DIR}/${${_upper}_SUBDIR}/simvascular_${_lower}.h) + include_directories(BEFORE ${SV_BINARY_DIR}/../${${_upper}_SUBDIR} ${SV_FLOWSOLVERS_DIR}/${${_upper}_SUBDIR}) + if(SV_USE_SYSTEM_${_upper}) + set(${_upper}_LIBRARIES) + set(${_upper}_LIBRARY) + else() + set(${_upper}_LIBRARY_NAME _simvascular_thirdparty_${_lower}) + include(${SV_FLOWSOLVERS_DIR}/${${_upper}_SUBDIR}/simvascular_${_lower}) + endif() +endmacro() + +option(SV_USE_SPARSE "Use sparse Library" ON) +option(SV_USE_METIS "Use metis Library" ON) +option(SV_USE_NSPCG "Use nspcg Library" ON) +#----------------------------------------------------------------------------- +# Add libraries for flowsolver +if(SV_USE_SPARSE) + SET(USE_SPARSE ON) + svsolver_third_party(sparse) + if(NOT SV_USE_SYSTEM_SPARSE) + set(SPARSE_LIBRARY ${SV_LIB_THIRDPARTY_SPARSE_NAME}) + else() + find_package(SPARSE) + endif() +endif() + +if(SV_USE_METIS) + SET(USE_METIS ON) + svsolver_third_party(metis) + if(NOT SV_USE_SYSTEM_METIS) + set(METIS_LIBRARY ${SV_LIB_THIRDPARTY_METIS_NAME}) + else() + find_package(METIS) + endif() +endif() + +if(SV_USE_NSPCG) + SET(USE_NSPCG ON) + svsolver_third_party(nspcg) + if(NOT SV_USE_SYSTEM_NSPCG) + set(NSPCG_LIBRARY ${SV_LIB_THIRDPARTY_NSPCG_NAME}) + else() + find_package(NSPCG) + endif() +endif() + + if(SV_SUPERBUILD) RETURN() ###### RETURN_SUPERBUILD ###### From 1f47fe58426fdaaca50d0d35c158d829e8225f4a Mon Sep 17 00:00:00 2001 From: updega2 Date: Mon, 9 Jan 2017 11:12:15 -0800 Subject: [PATCH 2/2] BUILD: Update to svsolver cmake to include svsolver thirdparty libs --- Code/FlowSolvers/CMakeLists.txt | 4 ++-- Code/FlowSolvers/ThreeDSolver/CMakeLists.txt | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Code/FlowSolvers/CMakeLists.txt b/Code/FlowSolvers/CMakeLists.txt index 0f230a1f..bc11818f 100644 --- a/Code/FlowSolvers/CMakeLists.txt +++ b/Code/FlowSolvers/CMakeLists.txt @@ -55,13 +55,13 @@ macro(svsolver_third_party _pkg) configure_file(${SV_FLOWSOLVERS_DIR}/../${${_upper}_SUBDIR}/simvascular_${_lower}.h.in ${SV_BINARY_DIR}/${${_upper}_SUBDIR}/simvascular_${_lower}.h) - include_directories(BEFORE ${SV_BINARY_DIR}/../${${_upper}_SUBDIR} ${SV_FLOWSOLVERS_DIR}/${${_upper}_SUBDIR}) + include_directories(BEFORE ${SV_BINARY_DIR}/${${_upper}_SUBDIR} ${SV_FLOWSOLVERS_DIR}/../${${_upper}_SUBDIR}) if(SV_USE_SYSTEM_${_upper}) set(${_upper}_LIBRARIES) set(${_upper}_LIBRARY) else() set(${_upper}_LIBRARY_NAME _simvascular_thirdparty_${_lower}) - include(${SV_FLOWSOLVERS_DIR}/${${_upper}_SUBDIR}/simvascular_${_lower}) + add_subdirectory(${SV_FLOWSOLVERS_DIR}/../${${_upper}_SUBDIR}/simvascular_${_lower} ${SV_BINARY_DIR}/${${_upper}_SUBDIR}/simvascular_${lower}) endif() endmacro() diff --git a/Code/FlowSolvers/ThreeDSolver/CMakeLists.txt b/Code/FlowSolvers/ThreeDSolver/CMakeLists.txt index cc171f58..83785d33 100644 --- a/Code/FlowSolvers/ThreeDSolver/CMakeLists.txt +++ b/Code/FlowSolvers/ThreeDSolver/CMakeLists.txt @@ -29,7 +29,6 @@ #=========================================================================# # Include Flowsolver Configuration File -include(flowsolverConfig) set(INDENTS "${INDENTS} ") # Include svLS Folder #include_directories(${SVLS_INCLUDE_DIR}) @@ -44,11 +43,6 @@ if(SV_THREEDSOLVER_USE_SVPOST) set(SV_THREEDSOLVER_USE_SOLVERIO ON) endif() -#----------------------------------------------------------------------------- -# SolverIO -if(SV_THREEDSOLVER_USE_SOLVERIO) - set(FLOWSOLVER_SUBDIRS ${FLOWSOLVER_SUBDIRS} SolverIO) -endif() #----------------------------------------------------------------------------- # Presolver if(SV_THREEDSOLVER_USE_SVPRE)