From ec3724c1db41f5258cf4d8eacd4a49efa1cb1089 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Tue, 14 May 2024 21:20:13 -0700 Subject: [PATCH] Change CMake and fix code problems with new Qt and MITK versions. --- CMakeLists.txt | 34 +- .../usFunctionAddResources.cmake | 5 + .../usFunctionAddResources.cmake.modified | 159 + Code/CMake/Externals/Qt5.cmake | 2 + Code/CMake/Externals/Qt6.cmake | 199 + .../CMake/FindCppMicroServices.cmake.modified | 260 + Code/CMake/FindMITK.cmake | 11 +- Code/CMake/FindMITK.cmake.modified | 489 + Code/CMake/SimVascularDependentOptions.cmake | 21 +- Code/CMake/SimVascularExternalsVersions.cmake | 115 +- Code/CMake/SimVascularInstallQt.cmake | 24 +- Code/CMake/SimVascularMacros.cmake | 58 +- Code/CMake/SimVascularOptions.cmake | 2 +- Code/CMake/SimVascularUseExternals.cmake | 72 +- Code/CMakeLists.txt | 6 + Code/Source/Include/sv_IOstream.h | 2 +- Code/Source/Include/sv_VTK.h | 4 +- .../GeometryBlendOptions_PyClass.cxx | 3 +- .../GeometryLoftNurbsOptions_PyClass.cxx | 6 +- .../PythonAPI/GeometryLoftOptions_PyClass.cxx | 3 +- Code/Source/PythonAPI/Geometry_PyModule.cxx | 9 +- .../MeshingMeshSimOptions_PyClass.cxx | 6 +- .../PythonAPI/MeshingMeshSim_PyClass.cxx | 8 +- .../MeshingTetGenAdaptOptions_PyClass.cxx | 2 +- .../MeshingTetGenOptions_PyClass.cxx | 7 +- .../PythonAPI/PathPlanningPath_PyClass.cxx | 6 +- Code/Source/PythonAPI/PyUtils.cxx | 26 +- .../SegmentationSplinePolygon_PyClass.cxx | 7 +- .../PythonAPI/SimulationROM_PyClass.cxx | 6 +- Code/Source/PythonAPI/Vmtk_PyModule.cxx | 4 +- Code/Source/sv/Geometry/sv_sys_geom.cxx | 2 +- .../Mesh/MMGMeshUtils/sv_mmg_mesh_utils.cxx | 2 +- .../TetGenMeshObject/sv_TetGenMeshObject.cxx | 2 +- .../sv/Mesh/VMTKUtils/sv_vmtk_utils.cxx | 6 +- .../OCCTSolidModel/sv_OCCTSolidModel.cxx | 2 +- .../sv_polydatasolid_utils.cxx | 2 +- Code/Source/sv3/Path/sv3_PathUtils.cxx | 4 +- .../Modules/Common/sv4gui_StringUtils.cxx | 2 + .../Modules/Common/sv4gui_StringUtils.h | 21 + .../Modules/MachineLearning/sv4gui_json.hxx | 31718 +++++++++------- .../MachineLearning/sv4gui_json.hxx.orig | 20406 ++++++++++ .../Mesh/Common/sv4gui_MeshLegacyIO.cxx | 6 +- .../Model/Common/sv4gui_ModelLegacyIO.cxx | 15 +- .../Model/Common/sv4gui_ModelUtils.cxx | 2 +- .../Modules/Path/sv4gui_PathLegacyIO.cxx | 30 +- .../sv4gui_ProjectManager.cxx | 11 +- .../QtWidgets/sv4gui_ResliceSlider.cxx | 62 +- .../sv4gui_SegmentationLegacyIO.cxx | 60 +- .../sv4gui/Modules/svFSI/sv4gui_svFSIJob.cxx | 4 +- .../org.sv.gui.qt.datamanager/CMakeLists.txt | 2 + ...sv4gui_QmitkDataManagerHotkeysPrefPage.cxx | 39 +- .../sv4gui_QmitkDataManagerHotkeysPrefPage.h | 4 +- .../sv4gui_QmitkDataManagerPreferencePage.cxx | 9 +- .../sv4gui_QmitkDataManagerPreferencePage.h | 5 +- .../sv4gui_QmitkDataManagerView.cxx | 23 +- .../sv4gui_QmitkDataManagerView.h | 9 +- .../sv4gui_QmitkFunctionality.cxx | 50 +- .../sv4gui_QmitkFunctionality.h | 3 +- .../sv4gui_QmitkInfoDialog.h | 2 +- .../sv4gui_QmitkNodeTableViewKeyFilter.cxx | 22 +- .../sv4gui_QmitkNodeTableViewKeyFilter.h | 7 +- .../sv4gui_LoftingPreferencePage.cxx | 14 +- .../sv4gui_LoftingPreferencePage.h | 4 +- .../sv4gui_ModelEdit.cxx | 3 + .../sv4gui_ModelFaceInfoExportAction.cxx | 19 +- .../sv4gui_ModelLegacySaveAction.cxx | 21 +- .../sv4gui_ModelLoadAction.cxx | 24 +- .../sv4gui_CapBCWidgetROM.cxx | 54 +- .../sv4gui_ConvertProcessHandlerROM.cxx | 4 +- .../sv4gui_ConvertProcessHandlerROM.h | 2 +- .../sv4gui_ProcessHandlerROM.cxx | 4 +- .../sv4gui_ProcessHandlerROM.h | 2 +- .../sv4gui_ROMSimJobExportAction.cxx | 19 +- .../sv4gui_ROMSimulationLinesContainer.cxx | 4 +- .../sv4gui_ROMSimulationPreferencePage.cxx | 8 +- .../sv4gui_ROMSimulationPreferencePage.h | 7 +- .../sv4gui_ROMSimulationView.cxx | 125 +- .../sv4gui_ROMSimulationView.h | 4 +- .../sv4gui_SolverProcessHandlerROM.cxx | 4 +- .../sv4gui_SolverProcessHandlerROM.h | 2 +- .../sv4gui_SplitBCWidgetROM.cxx | 7 +- .../sv4gui_LoftingUtils.cxx | 30 +- .../sv4gui_Seg2DEdit.cxx | 25 +- .../sv4gui_Seg2DEdit.h | 3 +- .../sv4gui_SegmentationLegacyLoadAction.cxx | 30 +- .../sv4gui_SegmentationLegacySaveAction.cxx | 24 +- .../sv4gui_SegmentationLoadAction.cxx | 34 +- .../sv4gui_ProcessHandler.h | 2 +- .../Source/vtkSV/Common/vtkSVGeneralUtils.cxx | 4 +- .../vtkSVLoopBooleanPolyDataFilter.cxx | 8 +- .../Modules/Misc/vtkSVGetSphereRegions.cxx | 2 +- .../vtkvmtkPolyDataCenterlineSections.cxx | 9 +- .../vtkvmtkSimplifyVoronoiDiagram.cxx | 6 +- Externals/CMake/FREETYPE.cmake | 1 + Externals/CMake/GDCM.cmake | 6 + Externals/CMake/ITK.cmake | 1 + Externals/CMake/MITK.cmake | 17 +- Externals/CMake/ML.cmake | 1 + Externals/CMake/MMG.cmake | 1 + Externals/CMake/OpenCASCADE.cmake | 1 + Externals/CMake/PYTHON.cmake | 1 + Externals/CMake/QT.cmake | 7 + Externals/CMake/SvExtOptions.cmake | 22 +- Externals/CMake/SvExtVersions.cmake | 116 +- Externals/CMake/VTK.cmake | 1 + Externals/CMakeLists.txt | 14 + Python/site-packages/svZeroDSolver | 2 +- compile.sh | 10 +- 108 files changed, 40431 insertions(+), 14366 deletions(-) create mode 100644 Code/CMake/CppMicroServices/usFunctionAddResources.cmake.modified create mode 100644 Code/CMake/Externals/Qt6.cmake create mode 100644 Code/CMake/FindCppMicroServices.cmake.modified create mode 100644 Code/CMake/FindMITK.cmake.modified create mode 100644 Code/Source/sv4gui/Modules/MachineLearning/sv4gui_json.hxx.orig diff --git a/CMakeLists.txt b/CMakeLists.txt index e964839f8..e71487c76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,13 +37,21 @@ #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- -cmake_minimum_required(VERSION 3.10.0) +cmake_minimum_required(VERSION 3.24.0) +#cmake_minimum_required(VERSION 3.10.0) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- Project(SV_TOP) #----------------------------------------------------------------------------- +message(STATUS "========== SimVascular/CMakeLists ==========") + +set(CMAKE_CXX_STANDARD 17) + +cmake_policy(SET CMP0135 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0135 NEW) + #----------------------------------------------------------------------------- # CMake module path inside of true simvascular source set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Code/CMake" @@ -81,7 +89,8 @@ option(SV_USE_MITK_SEGMENTATION "Enable building the MITK segmentation plugin" O #----------------------------------------------------------------------------- # Externals! -set(SV_EXTERNALS_VERSION_NUMBER "2022.10" CACHE STRING "SimVascular Externals Release Version") +set(SV_EXTERNALS_VERSION_NUMBER "2024.05" CACHE STRING "SimVascular Externals Release Version") +#set(SV_EXTERNALS_VERSION_NUMBER "2022.10" CACHE STRING "SimVascular Externals Release Version") mark_as_advanced(SV_EXTERNALS_VERSION_NUMBER) # Distribution @@ -90,11 +99,16 @@ option(SV_ENABLE_DISTRIBUTION "Enable Installer Build for SimVascular" OFF) # sv4gui option(SV_USE_SV4_GUI "Enable SV MITK/Qt Based GUI" ON) +# Set using pre-built Qt6 install. +# if(APPLE) - option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt5" OFF) - set(SV_EXTERNALS_PREBUILT_QT_PATH "" CACHE PATH "Qt5 Cmake Config File Path" FORCE) + option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt6" OFF) + set(SV_EXTERNALS_PREBUILT_QT_PATH "/usr/local/opt/qt/lib/cmake/Qt6" CACHE PATH "Qt6 Cmake Config File Path" FORCE) + #set(SV_EXTERNALS_PREBUILT_QT_PATH "" CACHE PATH "Qt6 Cmake Config File Path" FORCE) + elseif(LINUX) - option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt5" OFF) + option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt6" OFF) + if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") set(SV_EXTERNALS_PREBUILT_QT_PATH "/opt/Qt5.4.2/5.4/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5 Cmake Config File Path" FORCE) elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") @@ -106,6 +120,7 @@ elseif(LINUX) else() set(SV_EXTERNALS_PREBUILT_QT_PATH "" FORCE) endif() + elseif(WIN32) option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt5" OFF) if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") @@ -121,6 +136,9 @@ elseif(WIN32) endif() endif() +message(STATUS "[SimVascular/CMakeLists] SV_EXTERNALS_USE_PREBUILT_QT: ${SV_EXTERNALS_USE_PREBUILT_QT}") +message(STATUS "[SimVascular/CMakeLists] SV_EXTERNALS_PREBUILT_QT_PATH: ${SV_EXTERNALS_PREBUILT_QT_PATH}") + mark_as_advanced(SV_EXTERNALS_USE_PREBUILT_QT) mark_as_advanced(SV_EXTERNALS_PREBUILT_QT_PATH) @@ -156,7 +174,7 @@ ExternalProject_Add(Externals -DSV_EXTERNALS_VERSION_NUMBER:STRING=${SV_EXTERNALS_VERSION_NUMBER} -DSV_EXTERNALS_USE_PREBUILT_QT:BOOL=${SV_EXTERNALS_USE_PREBUILT_QT} -DSV_EXTERNALS_PREBUILT_QT_PATH:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH} - -DQt5_DIR:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH} + -DQt6_DIR:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH} -DSV_EXTERNALS_TOPLEVEL_BIN_DIR:PATH=${SV_EXTERNALS_TOPLEVEL_BIN_DIR} ${SV_EXTERNALS_ADDITIONAL_CMAKE_ARGS} ) @@ -204,7 +222,7 @@ ExternalProject_Add(SimVascular -DSV_USE_MPICH2:BOOL=OFF -DSV_USE_OpenCASCADE:BOOL=ON -DSV_USE_PYTHON:BOOL=ON - -DSV_USE_Qt5:BOOL=ON + -DSV_USE_Qt6:BOOL=ON -DSV_USE_QT:BOOL=ON -DSV_USE_SV4_GUI:BOOL=${SV_USE_SV4_GUI} -DSV_USE_MITK_SEGMENTATION:BOOL=${SV_USE_MITK_SEGMENTATION} @@ -217,7 +235,7 @@ ExternalProject_Add(SimVascular -DSV_EXTERNALS_USE_PREBUILT_QT:BOOL=${SV_EXTERNALS_USE_PREBUILT_QT} -DSV_EXTERNALS_PREBUILT_QT_PATH:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH} -DSV_EXTERNALS_VERSION_NUMBER:STRING=${SV_EXTERNALS_VERSION_NUMBER} - -DQt5_DIR:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH} + -DQt6_DIR:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH} ${SV_ADDITIONAL_CMAKE_ARGS} ) #----------------------------------------------------------------------------- diff --git a/Code/CMake/CppMicroServices/usFunctionAddResources.cmake b/Code/CMake/CppMicroServices/usFunctionAddResources.cmake index 5d3333f22..c20f3cc30 100644 --- a/Code/CMake/CppMicroServices/usFunctionAddResources.cmake +++ b/Code/CMake/CppMicroServices/usFunctionAddResources.cmake @@ -45,6 +45,9 @@ #! function(usFunctionAddResources) + message(STATUS " ") + message(STATUS "================ usFunctionAddResources ============== ") + cmake_parse_arguments(US_RESOURCE "" "TARGET;MODULE_NAME;WORKING_DIRECTORY;COMPRESSION_LEVEL" "FILES;ZIP_ARCHIVES" ${ARGN}) if(NOT US_RESOURCE_TARGET) @@ -75,6 +78,8 @@ function(usFunctionAddResources) endif() set(resource_compiler ${US_RCC_EXECUTABLE}) + message(STATUS "[usFunctionAddResources] US_RCC_EXECUTABLE: ${US_RCC_EXECUTABLE}") + if(TARGET ${US_RCC_EXECUTABLE_NAME}) set(resource_compiler ${US_RCC_EXECUTABLE_NAME}) elseif(NOT resource_compiler) diff --git a/Code/CMake/CppMicroServices/usFunctionAddResources.cmake.modified b/Code/CMake/CppMicroServices/usFunctionAddResources.cmake.modified new file mode 100644 index 000000000..c20f3cc30 --- /dev/null +++ b/Code/CMake/CppMicroServices/usFunctionAddResources.cmake.modified @@ -0,0 +1,159 @@ +#! \ingroup MicroServicesCMake +#! \brief Add resources to a library or executable. +#! +#! This CMake function uses an external command line program to generate a ZIP archive +#! containing data from external resources such as text files or images or other ZIP +#! archives. The created archive file can be appended or linked into the target file +#! using the usFunctionEmbedResources macro. +#! +#! Each module can call this function to add resources and make them available at +#! runtime through the Module class. Multiple calls to this function append the +#! input files. +#! +#! In the case of linking static modules which contain resources to the target module, +#! adding the static module target name to the ZIP_ARCHIVES list will merge its +#! resources into the target module. +#! +#! Example usage: +#! \code{.cmake} +#! set(module_srcs ) +#! usFunctionAddResources(TARGET mylib +#! MODULE_NAME org_me_mylib +#! FILES config.properties logo.png +#! ) +#! \endcode +#! +#! \param TARGET (required) The target to which the resource files are added. +#! \param MODULE_NAME (required/optional) The module name of the target, as specified in +#! the \c US_MODULE_NAME pre-processor definition of that target. This parameter +#! is optional if a target property with the name US_MODULE_NAME exists, containing +#! the required module name. +#! \param COMPRESSION_LEVEL (optional) The zip compression level (0-9). Defaults to the default zip +#! level. Level 0 disables compression. +#! \param WORKING_DIRECTORY (optional) The root path for all resource files listed after the +#! FILES argument. If no or a relative path is given, it is considered relativ to the +#! current CMake source directory. +#! \param FILES (optional) A list of resource files (paths to external files in the file system) +#! relative to the current working directory. +#! \param ZIP_ARCHIVES (optional) A list of zip archives (relative to the current working directory +#! or absolute file paths) whose contents is merged into the target module. If a list entry +#! is a valid target name and that target is a static library, its absolute file path is +#! used instead. +#! +#! \sa usFunctionEmbedResources +#! \sa \ref MicroServices_Resources +#! +function(usFunctionAddResources) + + message(STATUS " ") + message(STATUS "================ usFunctionAddResources ============== ") + + cmake_parse_arguments(US_RESOURCE "" "TARGET;MODULE_NAME;WORKING_DIRECTORY;COMPRESSION_LEVEL" "FILES;ZIP_ARCHIVES" ${ARGN}) + + if(NOT US_RESOURCE_TARGET) + message(SEND_ERROR "TARGET argument not specified.") + endif() + + if(NOT US_RESOURCE_MODULE_NAME) + get_target_property(US_RESOURCE_MODULE_NAME ${US_RESOURCE_TARGET} US_MODULE_NAME) + if(NOT US_RESOURCE_MODULE_NAME) + message(SEND_ERROR "Either the MODULE_NAME argument or the US_MODULE_NAME target property is required.") + endif() + endif() + + if(NOT US_RESOURCE_FILES AND NOT US_RESOURCE_ZIP_ARCHIVES) + message(WARNING "No resources specified. Skipping resource processing.") + return() + endif() + + if(NOT US_RESOURCE_WORKING_DIRECTORY) + set(US_RESOURCE_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + if(NOT IS_ABSOLUTE ${US_RESOURCE_WORKING_DIRECTORY}) + set(US_RESOURCE_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${US_RESOURCE_WORKING_DIRECTORY}") + endif() + + if(US_RESOURCE_COMPRESSION_LEVEL) + set(cmd_line_args -${US_RESOURCE_COMPRESSION_LEVEL}) + endif() + + set(resource_compiler ${US_RCC_EXECUTABLE}) + message(STATUS "[usFunctionAddResources] US_RCC_EXECUTABLE: ${US_RCC_EXECUTABLE}") + + if(TARGET ${US_RCC_EXECUTABLE_NAME}) + set(resource_compiler ${US_RCC_EXECUTABLE_NAME}) + elseif(NOT resource_compiler) + message(FATAL_ERROR "The CppMicroServices resource compiler was not found. Check the US_RCC_EXECUTABLE CMake variable.") + endif() + + set(_cmd_deps ) + foreach(_file ${US_RESOURCE_FILES}) + if(IS_ABSOLUTE ${_file}) + list(APPEND _cmd_deps ${_file}) + else() + list(APPEND _cmd_deps ${US_RESOURCE_WORKING_DIRECTORY}/${_file}) + endif() + endforeach() + + set(_zip_args ) + if(US_RESOURCE_ZIP_ARCHIVES) + foreach(_zip_archive ${US_RESOURCE_ZIP_ARCHIVES}) + if(TARGET ${_zip_archive}) + get_target_property(_is_static_lib ${_zip_archive} TYPE) + if(_is_static_lib STREQUAL "STATIC_LIBRARY") + list(APPEND _cmd_deps ${_zip_archive}) + list(APPEND _zip_args $) + endif() + else() + if(IS_ABSOLUTE ${_zip_archive}) + list(APPEND _cmd_deps ${_zip_archive}) + else() + list(APPEND _cmd_deps ${US_RESOURCE_WORKING_DIRECTORY}/${_zip_archive}) + endif() + list(APPEND _zip_args ${_zip_archive}) + endif() + endforeach() + endif() + + if(NOT US_RESOURCE_FILES AND NOT _zip_args) + return() + endif() + + if(US_RESOURCE_FILES) + set(_file_args -a ${US_RESOURCE_FILES}) + endif() + if(_zip_args) + set(_zip_args -m ${_zip_args}) + endif() + + get_target_property(_counter ${US_RESOURCE_TARGET} _us_resource_counter) + if((NOT ${_counter} EQUAL 0) AND NOT _counter) + set(_counter 0) + else() + math(EXPR _counter "${_counter} + 1") + endif() + + set(_res_zip "${CMAKE_CURRENT_BINARY_DIR}/us_${US_RESOURCE_TARGET}/res_${_counter}.zip") + + add_custom_command( + OUTPUT ${_res_zip} + COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/us_${US_RESOURCE_TARGET}" + COMMAND ${resource_compiler} ${cmd_line_args} ${_res_zip} ${US_RESOURCE_MODULE_NAME} ${_file_args} ${_zip_args} + WORKING_DIRECTORY ${US_RESOURCE_WORKING_DIRECTORY} + DEPENDS ${_cmd_deps} ${resource_compiler} + COMMENT "Checking resource dependencies for ${US_RESOURCE_TARGET}" + VERBATIM + ) + + get_target_property(_res_zips ${US_RESOURCE_TARGET} _us_resource_zips) + if(NOT _res_zips) + set(_res_zips ) + endif() + list(APPEND _res_zips ${_res_zip}) + + set_target_properties(${US_RESOURCE_TARGET} PROPERTIES + _us_resource_counter "${_counter}" + _us_resource_zips "${_res_zips}" + ) + +endfunction() diff --git a/Code/CMake/Externals/Qt5.cmake b/Code/CMake/Externals/Qt5.cmake index 34c63e5bf..6d3faf412 100644 --- a/Code/CMake/Externals/Qt5.cmake +++ b/Code/CMake/Externals/Qt5.cmake @@ -32,6 +32,8 @@ # Qt set(proj Qt5) +message(FATAL_ERROR "====================== Qt5.cmake ==========") + if(SV_USE_${proj}) if(SV_EXTERNALS_USE_PREBUILT_QT) set(Qt5_DIR ${SV_EXTERNALS_PREBUILT_QT_PATH} CACHE PATH "Force ${proj} dir to prebuilt Qt" FORCE) diff --git a/Code/CMake/Externals/Qt6.cmake b/Code/CMake/Externals/Qt6.cmake new file mode 100644 index 000000000..a4be8381d --- /dev/null +++ b/Code/CMake/Externals/Qt6.cmake @@ -0,0 +1,199 @@ +# Copyright (c) Stanford University, The Regents of the University of +# California, and others. +# +# All Rights Reserved. +# +# See Copyright-SimVascular.txt for additional details. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject +# to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#----------------------------------------------------------------------------- +# Qt +set(proj Qt6) + +message(STATUS "====================== Code/CMake/Externals/Qt6.cmake ==========") +message(STATUS "[Code/CMake/Externals/Qt6.cmake] SV_USE_Qt6: ${SV_USE_Qt6}") +message(STATUS "[Code/CMake/Externals/Qt6.cmake] SV_EXTERNALS_USE_PREBUILT_QT: ${SV_EXTERNALS_USE_PREBUILT_QT}") +message(STATUS "[Code/CMake/Externals/Qt6.cmake] SV_EXTERNALS_PREBUILT_QT_PATH: ${SV_EXTERNALS_PREBUILT_QT_PATH}") +message(STATUS "[Code/CMake/Externals/Qt6.cmake] SV_USE_MITK_CONFIG: ${SV_USE_MITK_CONFIG}") + +if(SV_USE_${proj}) + message(STATUS "[Code/CMake/Externals/Qt6.cmake] SV_USE_${proj} true") + if(SV_EXTERNALS_USE_PREBUILT_QT) + set(Qt6_DIR ${SV_EXTERNALS_PREBUILT_QT_PATH} CACHE PATH "Force ${proj} dir to prebuilt Qt" FORCE) + set(SV_Qt6_DIR ${SV_EXTERNALS_PREBUILT_QT_PATH} CACHE PATH "Force ${proj} dir to prebuilt Qt" FORCE) + endif() + + message(STATUS "[Code/CMake/Externals/Qt6.cmake] Qt6_DIR: ${Qt6_DIR}") + message(STATUS "[Code/CMake/Externals/Qt6.cmake] SV_EXTERNALS_USE_TOPLEVEL_BIN_DIR: ${SV_EXTERNALS_USE_TOPLEVEL_BIN_DIR}") + + # If using toplevel dir, foce Qt_DIR to be the SV_Qt_DIR set by the + # simvascular_add_new_external macro + # + if(SV_EXTERNALS_USE_TOPLEVEL_BIN_DIR) + + if(WIN32) + if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") + set(${proj}_DIR "${SV_${proj}_DIR}/msvc2013_64_opengl/lib/cmake/Qt6" CACHE + PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") + set(${proj}_DIR "${SV_${proj}_DIR}/${Qt6_VERSION}/msvc2015_64/lib/cmake/Qt6" CACHE + PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.02") + set(${proj}_DIR "${SV_${proj}_DIR}/${Qt6_VERSION}/msvc2015_64/lib/cmake/Qt6" CACHE + PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_GREATER_EQUAL "2019.06") + set(${proj}_DIR "${SV_${proj}_DIR}/${Qt6_VERSION}/msvc2017_64/lib/cmake/Qt6" CACHE + PATH "Force ${proj} dir to externals" FORCE) + else() + message(FATAL_ERROR "Invalid SV_EXTERNALS_VERSION_NUMBER ${SV_EXTERNALS_VERSION_NUMBER}") + endif() + + elseif(LINUX) + if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.02") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_GREATER_EQUAL "2019.06") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + else() + message(FATAL_ERROR "Invalid SV_EXTERNALS_VERSION_NUMBER ${SV_EXTERNALS_VERSION_NUMBER}") + endif() + + elseif(APPLE) + if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.02") + set(${proj}_DIR ${SV_${proj}_DIR}/${Qt6_VERSION}/clang_64/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_GREATER_EQUAL "2019.06") + set(${proj}_DIR ${SV_${proj}_DIR}/lib/cmake/Qt6 CACHE PATH "Force ${proj} dir to externals" FORCE) + message(STATUS "[Code/CMake/Externals/Qt6.cmake] Set Qt6_DIR from ${SV_${proj}_DIR}/lib/cmake/Qt6") + else() + message(FATAL_ERROR "Invalid SV_EXTERNALS_VERSION_NUMBER ${SV_EXTERNALS_VERSION_NUMBER}") + endif() + + else() + message(FATAL_ERROR "Unknown Platform for Qt6.cmake script") + endif() + + if(SV_EXTERNALS_USE_PREBUILT_QT) + set(Qt6_DIR ${SV_EXTERNALS_PREBUILT_QT_PATH} CACHE PATH "Force ${proj} dir to prebuilt Qt" FORCE) + endif() + + if(WIN32) + get_filename_component(_win32_qt5_top_path "${${proj}_DIR}/../../../" ABSOLUTE) + set(${proj}_DLL_PATH "${_win32_qt5_top_path}/bin" CACHE PATH "Force Qt DLL Path" FORCE) + endif() + + message(STATUS "[Code/CMake/Externals/Qt6.cmake] Qt6_DIR: ${Qt6_DIR}") + message(STATUS "[Code/CMake/Externals/Qt6.cmake] Qt6 version: ${proj}_VERSION") + + set(SV_${proj}_COMPONENTS + Concurrent + Core + Designer + Gui + Help + OpenGL + PrintSupport + #dp Script + Sql + Svg + Widgets + Xml + #dp XmlPatterns + UiTools + Core5Compat + ) + + if(${proj}_VERSION VERSION_EQUAL "5.4.2") + list(APPEND SV_${proj}_COMPONENTS + WebKitWidgets + WebKit + ) + elseif(${proj}_VERSION VERSION_EQUAL "5.6.3") + list(APPEND SV_${proj}_COMPONENTS + WebEngineCore + WebEngineWidgets + WebView + ) + else() + list(APPEND SV_${proj}_COMPONENTS + WebEngineCore + WebEngineWidgets + WebView + ) + endif() + + # Find Qt + message(STATUS "[Code/CMake/Externals/Qt6.cmake] Find Qt6 using simvascular_external ...") + message(STATUS "[Code/CMake/Externals/Qt6.cmake] Qt6 version: ${${proj}_VERSION}") + simvascular_external(${proj} + SHARED_LIB ${SV_USE_${proj}_SHARED} + VERSION ${${proj}_VERSION} + COMPONENTS ${SV_${proj}_COMPONENTS} + REQUIRED + ) + + # Get toplevel Qt dir from location of config file + if(Qt6_DIR) + get_filename_component(_Qt6_DIR "${Qt6_DIR}/../../../" ABSOLUTE) + list(FIND CMAKE_PREFIX_PATH "${_Qt6_DIR}" _result) + if(_result LESS 0) + set(CMAKE_PREFIX_PATH "${_Qt6_DIR};${CMAKE_PREFIX_PATH}" CACHE PATH "" FORCE) + endif() + set(QT_PLUGIN_PATH "${_Qt6_DIR}/plugins") + if(WIN32) + set(${proj}_DLL_PATH "${_Qt6_DIR}/bin" CACHE PATH "Force Qt DLL Path" FORCE) + endif() + endif() + + # Need to set include dirs and libraries of Qt from individual components + # + if(NOT SV_USE_MITK_CONFIG) + set(QT_LIBRARIES "") + set(QT_INCLUDE_DIRS "") + foreach(comp ${SV_Qt6_COMPONENTS}) + if(Qt6${comp}_LIBRARIES) + set(QT_LIBRARIES ${QT_LIBRARIES} ${Qt6${comp}_LIBRARIES}) + endif() + if(Qt6${comp}_INCLUDE_DIRS) + set(QT_INCLUDE_DIRS ${QT_INCLUDE_DIRS} ${Qt6${comp}_INCLUDE_DIRS}) + endif() + endforeach() + + set(QT_LIBRARIES ${QT_LIBRARIES} Qt6::Core5Compat) + include_directories(${QT_INCLUDE_DIRS}) + + endif() + + endif() + +endif() + +#----------------------------------------------------------------------------- diff --git a/Code/CMake/FindCppMicroServices.cmake.modified b/Code/CMake/FindCppMicroServices.cmake.modified new file mode 100644 index 000000000..2fe50cc51 --- /dev/null +++ b/Code/CMake/FindCppMicroServices.cmake.modified @@ -0,0 +1,260 @@ +# Copyright (c) Stanford University, The Regents of the University of +# California, and others. +# +# All Rights Reserved. +# +# See Copyright-SimVascular.txt for additional details. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject +# to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# A package config for CppMicroServices. +# This file loads component specific configuration files and +# sets the following variables which can be used in other +# CMake projects to build and link against CppMicroServices: +# +# US_INCLUDE_DIRS +# US_LIBRARIES +# US_RUNTIME_LIBRARY_DIRS +# +# The following variables are aliases for the ones above: +# +# CppMicroServices_INCLUDE_DIRS +# CppMicroServices_LIBRARIES +# CppMicroServices_RUNTIME_LIBRARY_DIRS +# +# To specify a compatible version for a specific component, +# set the following variable before calling find_package: +# +# US__FIND_VERSION +# +# After find_package returns successfully, the following additional +# variables will be set: +# +# US_FOUND +# CPPMICROSERVICES_FOUND +# +# US_RCC_EXECUTABLE +# +# US_CXX_FLAGS +# US_CXX_FLAGS_RELEASE +# US_CXX_FLAGS_DEBUG +# US_C_FLAGS +# US_C_FLAGS_RELEASE +# US_C_FLAGS_DEBUG +# US_LINK_FLAGS +# US_LINK_FLAGS_RELEASE +# US_LINK_FLAGS_DEBUG +# US_COMPILE_DEFINITIONS +# US_COMPILE_DEFINITIONS_RELEASE +# US_COMPILE_DEFINITIONS_DEBUG +# +# US_VERSION +# US_VERSION_MAJOR +# US_VERSION_MINOR +# US_VERSION_PATCH +# US_VERSION_TWEAK +# US_VERSION_COUNT +# +# Additional component specific variables: +# +# US__FOUND +# +# US__VERSION +# US__VERSION_MAJOR +# US__VERSION_MINOR +# US__VERSION_PATCH +# US__VERSION_TWEAK +# US__VERSION_COUNT +# +# US__CXX_FLAGS +# US__CXX_FLAGS_RELEASE +# US__CXX_FLAGS_DEBUG +# US__C_FLAGS +# US__C_FLAGS_RELEASE +# US__C_FLAGS_DEBUG +# US__LINK_FLAGS +# US__LINK_FLAGS_RELEASE +# US__LINK_FLAGS_DEBUG +# US__COMPILE_DEFINITIONS +# US__COMPILE_DEFINITIONS_RELEASE +# US__COMPILE_DEFINITIONS_DEBUG +# + +message(STATUS " ") +message(STATUS "=============== FindCppMicroServices ===============") +message(STATUS "[FindCppMicroServices] MITK_DIR: ${MITK_DIR}") + +include(FindPackageHandleStandardArgs) +include(CMakeParseArguments) + +set(CppMicroServices_POSSIBLE_US_FILES_PATHS + ${SV_SOURCE_DIR}/CMake/CppMicroServices + ${SimVascular_CMAKE_DIR}/CppMicroServices + ) + +message(STATUS "[FindCppMicroServices] CppMicroServices_POSSIBLE_US_FILES_PATHS: ${CppMicroServices_POSSIBLE_US_FILES_PATHS}") +message(STATUS "[FindCppMicroServices] US_CMAKE_FILES_DIR: ${US_CMAKE_FILES_DIR}") + +find_path(US_CMAKE_FILES_DIR + NAMES + usModuleInit.cpp + PATHS + ${CppMicroServices_POSSIBLE_US_FILES_PATHS} + NO_DEFAULT_PATH + ) + +set(US_RCC_EXECUTABLE_NAME usResourceCompiler) +set(US_MODULE_INIT_TEMPLATE "${US_CMAKE_FILES_DIR}/usModuleInit.cpp") +set(US_RESOURCE_RC_TEMPLATE "${US_CMAKE_FILES_DIR}/us_resources.rc.in") +set(US_CMAKE_RESOURCE_DEPENDENCIES_CPP "${US_CMAKE_FILES_DIR}/usCMakeResourceDependencies.cpp") + +message(STATUS "[FindCppMicroServices] US_RCC_EXECUTABLE_NAME: ${US_RCC_EXECUTABLE_NAME}") + +# The CppMicroServices resource compiler +set(CppMicroServices_POSSIBLE_US_EXECUTABLE_PATHS + "${MITK_DIR}/bin" + "${MITK_DIR}/bin/Release" + "${MITK_DIR}/bin/Debug" + "${MITK_DIR}/bin/RelWithDebInfo" + "${MITK_DIR}/bin/MinSizeRel" + "/Users/parkerda/software/mitk/git-src/build/MITK-build/bin" + ) + +find_program(US_RCC_EXECUTABLE + NAMES + ${US_RCC_EXECUTABLE_NAME} + PATHS + ${CppMicroServices_POSSIBLE_US_EXECUTABLE_PATHS} + NO_DEFAULT_PATH + ) + +mark_as_advanced(US_RCC_EXECUTABLE) + +include("${US_CMAKE_FILES_DIR}/usFunctionGenerateModuleInit.cmake") +include("${US_CMAKE_FILES_DIR}/usFunctionAddResources.cmake") +include("${US_CMAKE_FILES_DIR}/usFunctionCheckCompilerFlags.cmake") +include("${US_CMAKE_FILES_DIR}/usFunctionEmbedResources.cmake") +include("${US_CMAKE_FILES_DIR}/usFunctionCheckResourceLinking.cmake") +include("${US_CMAKE_FILES_DIR}/usFunctionGetResourceSource.cmake") + +usFunctionCheckResourceLinking() + +# Clear variables +set(US_LIBRARIES ) +set(US_RUNTIME_LIBRARY_DIRS ) +set(US_CXX_FLAGS ) +set(US_CXX_FLAGS_RELEASE ) +set(US_CXX_FLAGS_DEBUG ) +set(US_C_FLAGS ) +set(US_C_FLAGS_RELEASE ) +set(US_C_FLAGS_DEBUG ) +set(US_LINK_FLAGS ) +set(US_LINK_FLAGS_RELEASE ) +set(US_LINK_FLAGS_DEBUG ) +set(US_COMPILE_DEFINITIONS ) +set(US_COMPILE_DEFINITIONS_RELEASE ) +set(US_COMPILE_DEFINITIONS_DEBUG ) + +# Components support +set(US_MODULES Core) # ConfigAdmin EventAdmin ... + +set(US_Core_MODULE_DEPS ) + +if(NOT CppMicroServices_FIND_COMPONENTS) + set(CppMicroServices_FIND_COMPONENTS Core) +endif() + +set(US_MODULES_NEEDED ) +foreach(component ${CppMicroServices_FIND_COMPONENTS}) + list(APPEND US_MODULES_NEEDED ${US_${component}_MODULE_DEPS} ${component}) +endforeach() +list(REMOVE_DUPLICATES US_MODULES_NEEDED) + +set(CppMicroServices_FOUND TRUE) +foreach(component ${US_MODULES_NEEDED}) + if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/us${component}Config.cmake") + set(US_${component}_FOUND 0) + set(CppMicroServices_${component}_FOUND 0) + else() + find_package(us${component} ${US_${component}_FIND_VERSION} QUIET REQUIRED + HINTS ${CMAKE_CURRENT_LIST_DIR} + NO_DEFAULT_PATH + ) + mark_as_advanced(us${component}_DIR) + set(US_${component}_FOUND ${us${component}_FOUND}) + set(CppMicroServices_${component}_FOUND ${US_${component}_FOUND}) + endif() + + if(US_${component}_FOUND) + list(APPEND US_INCLUDE_DIRS ${US_${component}_INCLUDE_DIRS}) + list(APPEND US_LIBRARIES ${US_${component}_LIBRARIES}) + list(APPEND US_RUNTIME_LIBRARY_DIRS ${US_${component}_RUNTIME_LIBRARY_DIRS}) + set(US_CXX_FLAGS "${US_CXX_FLAGS} ${US_${component}_CXX_FLAGS}") + set(US_CXX_FLAGS_RELEASE "${US_CXX_FLAGS_RELEASE} ${US_${component}_CXX_FLAGS_RELEASE}") + set(US_CXX_FLAGS_DEBUG "${US_CXX_FLAGS_DEBUG} ${US_${component}_CXX_FLAGS_DEBUG}") + set(US_C_FLAGS "${US_C_FLAGS} ${US_${component}_C_FLAGS}") + set(US_C_FLAGS_RELEASE "${US_C_FLAGS_RELEASE} ${US_${component}_C_FLAGS_RELEASE}") + set(US_C_FLAGS_DEBUG "${US_C_FLAGS_DEBUG} ${US_${component}_C_FLAGS_DEBUG}") + set(US_LINK_FLAGS "${US_LINK_FLAGS} ${US_${component}_LINK_FLAGS}") + set(US_LINK_FLAGS_RELEASE "${US_LINK_FLAGS_RELEASE} ${US_${component}_LINK_FLAGS_RELEASE}") + set(US_LINK_FLAGS_DEBUG "${US_LINK_FLAGS_DEBUG} ${US_${component}_LINK_FLAGS_DEBUG}") + set(US_COMPILE_DEFINITIONS "${US_COMPILE_DEFINITIONS} ${US_${component}_COMPILE_DEFINITIONS}") + set(US_COMPILE_DEFINITIONS_RELEASE "${US_COMPILE_DEFINITIONS_RELEASE} ${US_${component}_COMPILE_DEFINITIONS_RELEASE}") + set(US_COMPILE_DEFINITIONS_DEBUG "${US_COMPILE_DEFINITIONS_DEBUG} ${US_${component}_COMPILE_DEFINITIONS_DEBUG}") + + set(US_${component}_VERSION ${${component}_VERSION}) + set(US_${component}_VERSION_MAJOR ${${component}_VERSION_MAJOR}) + set(US_${component}_VERSION_MINOR ${${component}_VERSION_MINOR}) + set(US_${component}_VERSION_PATCH ${${component}_VERSION_PATCH}) + set(US_${component}_VERSION_TWEAK ${${component}_VERSION_TWEAK}) + set(US_${component}_VERSION_COUNT ${${component}_VERSION_COUNT}) + else() + if(CppMicroServices_FIND_REQUIRED_${component}) + set(CppMicroServices_FOUND FALSE) + endif() + endif() +endforeach() + +if(US_INCLUDE_DIRS) + list(REMOVE_DUPLICATES US_INCLUDE_DIRS) +endif() +if(US_LIBRARIES) + list(REMOVE_DUPLICATES US_LIBRARIES) +endif() +if(US_RUNTIME_LIBRARY_DIRS) + list(REMOVE_DUPLICATES US_RUNTIME_LIBRARY_DIRS) +endif() + +set(CppMicroServices_INCLUDE_DIRS ${US_INCLUDE_DIRS}) +set(CppMicroServices_LIBRARIES ${US_LIBRARIES}) +set(CppMicroServices_RUNTIME_LIBRARY_DIRS ${US_RUNTIME_LIBRARY_DIRS}) + +set(CppMicroServices_CONFIG ${CMAKE_CURRENT_LIST_FILE}) +find_package_handle_standard_args(CppMicroServices + HANDLE_COMPONENTS + CONFIG_MODE +) + +string(TOUPPER "CppMicroServices" CppMicroServices_UPPER) +set(US_FOUND ${${CppMicroServices_UPPER}_FOUND}) diff --git a/Code/CMake/FindMITK.cmake b/Code/CMake/FindMITK.cmake index 389f3562f..089caf650 100644 --- a/Code/CMake/FindMITK.cmake +++ b/Code/CMake/FindMITK.cmake @@ -66,7 +66,7 @@ set(${proj}_LIBNAMES CppMicroServices # CTKVisualizationVTKCore # CTKWidgets # CTKXNATCore - mbilog + # dp mbilog MitkAlgorithmsExt MitkAppUtil MitkCore @@ -80,9 +80,9 @@ set(${proj}_LIBNAMES CppMicroServices MitkSegmentation MitkSegmentationUI MitkSurfaceInterpolation - PythonQt + # dp PythonQt # tinyxml - mbilog + # dp mbilog PocoFoundation PocoUtil dcmjpeg @@ -143,7 +143,8 @@ set(${proj}_HEADERS "ctkAbstractFactory.h" #ctk "ui_QmitkAboutDialogGUI.h" #mitk/QtWidgetsExt "QmitkAboutDialog.h" #mitk/QtWidgetsExt/include "mitkSceneIO.h" #mitk/SceneSerialization/include - "mbilog.h" #mitk/Utilities/mbilog + # dp "mbilog.h" #mitk/Utilities/mbilog + "mitkLog.h" # dp "mitkContourElement.h" #mitk/Modules/ContourModel/DataManagement "usCoreModuleContext_p.h" #mitk/Modules/CppMicroServices/core/src/module "usLDAPExpr_p.h" #mitk/Modules/CppMicroServices/core/src/service @@ -158,7 +159,7 @@ set(${proj}_HEADERS "ctkAbstractFactory.h" #ctk # "QmitkAdaptiveRegionGrowingToolGUI.h" #mitk/Modules/SegmentationUI/Qmitk "mitkSurfaceInterpolationController.h" #mitk/Modules/SurfaceInterpolation "ui_QmitkFileReaderOptionsDialog.h" #mitk/Modules/QtWidgets - "PythonQt.h" #PythonQt + # dp "PythonQt.h" #PythonQt # "tinyxml.h" #tinyxml "mitkIDataStorageService.h" #mitk/plugins/org.mitk.core.services "mitkDataNodeSelection.h" #mitk/plugins/org.mitk.gui.common diff --git a/Code/CMake/FindMITK.cmake.modified b/Code/CMake/FindMITK.cmake.modified new file mode 100644 index 000000000..07d0a5f8e --- /dev/null +++ b/Code/CMake/FindMITK.cmake.modified @@ -0,0 +1,489 @@ +# Copyright (c) Stanford University, The Regents of the University of +# California, and others. +# +# All Rights Reserved. +# +# See Copyright-SimVascular.txt for additional details. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject +# to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# - Find Parasolid Libraries +# +# === Variables === +# +# MITK_LIBRARIES, library search path +# MITK_INCLUDE_DIRS, include search path +# MITK_FOUND, If false, do not try to use this library. + +message(STATUS "=================== FindMITK.cmake ====================") + +set(proj MITK) + +include(CMakeFindFrameworks) +include(FindPackageHandleStandardArgs) +include(GetPrerequisites) + +if(NOT ${proj}_DIR) + set(${proj}_DIR "${proj}_DIR-NOTFOUND" CACHE PATH "Path of toplevel ${proj} dir. Specify this if ${proj} cannot be found.") + message(FATAL_ERROR "${proj}_DIR was not specified. Set ${proj}_DIR to the toplevel ${proj} dir that contains bin, lib, include") +endif() + +message(STATUS "[FindMITK.cmake] proj: ${proj}") + +#----------------------------------------------------------------------------- +# Set what we need to find +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Libraries +message(STATUS "[FindMITK.cmake] set ${proj}_LIBNAMES ... ") +set(${proj}_LIBNAMES CppMicroServices + # CTKCommandLineModulesBackendLocalProcess + # CTKCommandLineModulesCore + # CTKCommandLineModulesFrontendQtGui + # CTKCore + # CTKDICOMCore + # CTKDICOMWidgets + # CTKPluginFramework + # CTKScriptingPythonCore + # CTKScriptingPythonWidgets + # CTKVisualizationVTKCore + # CTKWidgets + # CTKXNATCore + MitkAlgorithmsExt + MitkAppUtil + MitkCore + MitkContourModel + MitkDataTypesExt + MitkMapperExt + MitkQtWidgets + MitkQtWidgetsExt + MitkSceneSerialization + # tinyxml + PocoFoundation + PocoUtil + dcmjpeg + dcmjpls + dcmwlm + dcmpstat + dcmrt + dcmseg + dcmtract + dcmpmap + dcmtls + dcmsr + dcmimage + dcmdsig + dcmqrdb + dcmnet + dcmimgle + dcmfg + dcmiod + dcmdata + ) +if(SV_USE_MITK_SEGMENTATION) + #list(APPEND ${proj}_LIBNAMES MitkMultilabel) +endif() + +message(STATUS "[FindMITK.cmake] set ${proj}_PLUGIN_LIBNAMES ... ") + +set(${proj}_PLUGIN_LIBNAMES org_mitk_core_services + org_mitk_gui_common + org_mitk_gui_qt_application + org_mitk_gui_qt_common + # org_mitk_gui_qt_common_legacy + org_mitk_gui_qt_datamanager + org_mitk_gui_qt_stdmultiwidgeteditor + org_mitk_gui_qt_ext + org_blueberry_ui_qt + org_blueberry_core_runtime) + +# Add requestion components +set(${proj}_LIBNAMES ${${proj}_LIBNAMES} ${${proj}_FIND_COMPONENTS}) + + +#----------------------------------------------------------------------------- +# Find Libraries +#----------------------------------------------------------------------------- +message(STATUS "[FindMITK.cmake] ------------------------------------------------") +message(STATUS "[FindMITK.cmake] Find Libraries ... ") +message(STATUS "[FindMITK.cmake] ------------------------------------------------") +set(${proj}_POSSIBLE_PATHS ${${proj}_DIR}) +set(lib_sub_path "lib") +set(lib64_sub_path "lib64") + +foreach(p ${${proj}_POSSIBLE_PATHS}) + list(APPEND ${proj}_POSSIBLE_LIB_PATHS "${p}/${lib_sub_path}") + list(APPEND ${proj}_POSSIBLE_LIB_PATHS "${p}/${lib64_sub_path}") +endforeach() + +set(${proj}_POSSIBLE_LIB_PATHS ${${proj}_POSSIBLE_LIB_PATHS} + ${${proj}_DIR}; + ${${proj}_DIR}/shared_object; + ${${proj}_DIR}/dll; + ${${proj}_DIR}/lib/${CMAKE_BUILD_TYPE}; + ${${proj}_DIR}/lib64; + ${${proj}_DIR}/lib64/${CMAKE_BUILD_TYPE}; + ) + +if(APPLE) + #message(STATUS "[FindMITK.cmake] Add ${proj}_POSSIBLE_LIB_PATHS: ${${proj}_DIR}/MitkWorkbench.app/Contents/MacOS/") + set(${proj}_POSSIBLE_LIB_PATHS ${${proj}_POSSIBLE_LIB_PATHS} + ${${proj}_DIR}/MitkWorkbench.app/Contents/MacOS/ ) +endif() + +#message(STATUS "[FindMITK.cmake] ${proj}_POSSIBLE_PATHS: ${${proj}_POSSIBLE_PATHS}") +#message(STATUS "[FindMITK.cmake] ${proj}_POSSIBLE_LIB_PATHS: ${${proj}_POSSIBLE_LIB_PATHS}") + +set(${proj}_LIBS_MISSING ${${proj}_LIBNAMES}) +list(REMOVE_DUPLICATES ${proj}_LIBS_MISSING) +set(${proj}_LIBRARIES_WORK "") + +foreach(lib ${${proj}_LIBNAMES}) + message(STATUS "[FindMITK.cmake] Search for lib: ${lib}") + unset(${proj}_${lib}_LIBRARY CACHE) + find_library(${proj}_${lib}_LIBRARY NAMES ${lib} ${lib}d PATHS ${${proj}_POSSIBLE_LIB_PATHS} NO_DEFAULT_PATH) + mark_as_advanced(${proj}_${lib}_LIBRARY) + set(${proj}_LIB_FULLNAMES ${${proj}_LIB_FULLNAMES} ${proj}_${lib}_LIBRARY) + + if(${proj}_${lib}_LIBRARY) + set(${proj}_LIBRARIES_WORK ${${proj}_LIBRARIES_WORK} "${${proj}_${lib}_LIBRARY}") + list(REMOVE_ITEM ${proj}_LIBS_MISSING ${lib}) + else() + message(STATUS "[FindMITK.cmake] **** Can't find lib: ${lib}") + endif() + +endforeach() + +#message("${proj}_LIBRARIES_WORK: ${${proj}_LIBRARIES_WORK}") + +list(LENGTH ${proj}_LIBRARIES_WORK ${proj}_NUMLIBS) +list(LENGTH ${proj}_LIBNAMES ${proj}_NUMLIBS_EXPECTED) +#message("${${proj}_NUMLIBS} ${${proj}_NUMLIBS_EXPECTED}") +if (NOT ${proj}_NUMLIBS EQUAL ${proj}_NUMLIBS_EXPECTED) + set(${proj}_LIBRARIES_WORK "${proj}_LIBRARIES-NOTFOUND") + message(FATAL_ERROR "${proj}_LIBS_MISSING: ${${proj}_LIBS_MISSING}") +endif() + +set(${proj}_LIBRARIES ${${proj}_LIBRARIES_WORK} CACHE STRING + "${proj} libraries to link against" FORCE) + +# Clean up. If all libraries were found remove cache entries. +if(${proj}_LIBRARIES) + foreach(lib ${${proj}_LIBNAMES}) + unset(${proj}_${lib}_LIBRARY CACHE) + endforeach() + if(${proj}_NUMLIBS_EXPECTED EQUAL 1) + set(temp_path ${${proj}_LIBRARIES}) + else() + list(GET ${proj}_LIBRARIES 1 temp_path) + endif() + get_filename_component(${proj}_LIBRARY_DIR ${temp_path} PATH) +endif() + +#----------------------------------------------------------------------------- +# Find Plugins +#----------------------------------------------------------------------------- +message(STATUS "[FindMITK.cmake] ------------------------------------------------") +message(STATUS "[FindMITK.cmake] Find Plugins ... ") +message(STATUS "[FindMITK.cmake] ------------------------------------------------") +set(${proj}_POSSIBLE_PATHS ${${proj}_DIR}) +set(lib_sub_path "lib") + +foreach(p ${${proj}_POSSIBLE_PATHS}) + list(APPEND ${proj}_POSSIBLE_PLUGIN_LIB_PATHS "${p}/${lib_sub_path}/plugins") +endforeach() + +set(${proj}_POSSIBLE_PLUGIN_LIB_PATHS ${${proj}_POSSIBLE_PLUGIN_LIB_PATHS} + ${${proj}_DIR} + ${${proj}_DIR}/shared_object + ${${proj}_DIR}/dll + ${${proj}_DIR}/lib/plugins/RelWithDebInfo + ${${proj}_DIR}/bin/plugins/RelWithDebInfo + ${${proj}_DIR}/lib/plugins/Release + ${${proj}_DIR}/bin/plugins/Release + ${${proj}_DIR}/lib/plugins/Debug + ${${proj}_DIR}/bin/plugins/Debug + ${${proj}_DIR}/lib/plugins/MinSizeRel + ${${proj}_DIR}/bin/plugins/MinSizeRel + ) + +if(APPLE) + #message(STATUS "[FindMITK.cmake] Add ${proj}_POSSIBLE_LIB_PATHS: ${${proj}_DIR}/MitkWorkbench.app/Contents/MacOS/") + set(${proj}_POSSIBLE_PLUGIN_LIB_PATHS ${${proj}_POSSIBLE_PLUGIN_LIB_PATHS} + ${${proj}_DIR}/MitkWorkbench.app/Contents/MacOS/plugins ) +endif() + +set(${proj}_PLUGIN_LIBS_MISSING ${${proj}_PLUGIN_LIBNAMES}) +list(REMOVE_DUPLICATES ${proj}_PLUGIN_LIBS_MISSING) +set(${proj}_PLUGIN_LIBRARIES_WORK "") +foreach(lib ${${proj}_PLUGIN_LIBNAMES}) + #find library + unset(${proj}_${lib}_PLUGIN_LIBRARY CACHE) + find_library(${proj}_${lib}_PLUGIN_LIBRARY + NAMES + ${lib} + PATHS + ${${proj}_POSSIBLE_PLUGIN_LIB_PATHS} + NO_DEFAULT_PATH + ) + + mark_as_advanced(${proj}_${lib}_PLUGIN_LIBRARY) + set(${proj}_PLUGIN_LIB_FULLNAMES ${${proj}_PLUGIN_LIB_FULLNAMES} ${proj}_${lib}_PLUGIN_LIBRARY) + if(${proj}_${lib}_PLUGIN_LIBRARY) + set(${proj}_PLUGIN_LIBRARIES_WORK ${${proj}_PLUGIN_LIBRARIES_WORK} "${${proj}_${lib}_PLUGIN_LIBRARY}") + list(REMOVE_ITEM ${proj}_PLUGIN_LIBS_MISSING ${lib}) + endif() +endforeach() + +#message("${proj}_PLUGIN_LIBRARIES_WORK: ${${proj}_PLUGIN_LIBRARIES_WORK}") + +list(LENGTH ${proj}_PLUGIN_LIBRARIES_WORK ${proj}_NUMPLUGINS) +list(LENGTH ${proj}_PLUGIN_LIBNAMES ${proj}_NUMPLUGINS_EXPECTED) +#message("${${proj}_NUMPLUGINS} ${${proj}_NUMPLUGINS_EXPECTED}") +if (NOT ${proj}_NUMPLUGINS EQUAL ${proj}_NUMPLUGINS_EXPECTED) + set(${proj}_PLUGIN_LIBRARIES_WORK "${proj}_PLUGIN_LIBRARIES-NOTFOUND") + message(FATAL_ERROR "${proj}_PLUGIN_LIBS_MISSING: ${${proj}_PLUGIN_LIBS_MISSING}") +endif() + +set(${proj}_PLUGIN_LIBRARIES ${${proj}_PLUGIN_LIBRARIES_WORK} CACHE STRING + "${proj} libraries to link against" FORCE) + +# Clean up. If all libraries were found remove cache entries. +if(${proj}_PLUGIN_LIBRARIES) + foreach(lib ${${proj}_PLUGIN_LIBNAMES}) + unset(${proj}_${lib}_PLUGIN_LIBRARY CACHE) + endforeach() + if(${proj}_NUMPLUGINS_EXPECTED EQUAL 1) + set(temp_path ${${proj}_PLUGIN_LIBRARIES}) + else() + list(GET ${proj}_PLUGIN_LIBRARIES 1 temp_path) + endif() + get_filename_component(${proj}_PLUGIN_LIBRARY_DIR ${temp_path} PATH) +endif() + +#----------------------------------------------------------------------------- +# Find header files +#----------------------------------------------------------------------------- + +message(STATUS "[FindMITK.cmake] ------------------------------------------------") +message(STATUS "[FindMITK.cmake] Find Headers ... ") +message(STATUS "[FindMITK.cmake] ------------------------------------------------") +set(${proj}_POSSIBLE_PATHS ${${proj}_DIR}) + +set(${proj}_POSSIBLE_INCLUDE_PATHS + "${${proj}_DIR}/*" + "${${proj}_DIR}/include/*" + "${${proj}_DIR}/include/*/*" + "${${proj}_DIR}/include/*/*/*" + "${${proj}_DIR}/include/*/*/*/*" + "${${proj}_DIR}/include/*/*/*/*/*" + "${${proj}_DIR}/include/*/*/*/*/*/*" + ) + +if(APPLE) + set(${proj}_POSSIBLE_INCLUDE_PATHS ${${proj}_POSSIBLE_INCLUDE_PATHS} + /Users/parkerda/software/mitk/git-src/MITK/Modules/AppUtil/include; + /Users/parkerda/software/mitk/git-src/build/MITK-build/Modules/CppMicroServices/include; + /Users/parkerda/software/mitk/git-src/build/MITK-build/Modules/AlgorithmsExt; + /Users/parkerda/software/mitk/git-src/build/MITK-build/Modules/QtWidgetsExt; + /Users/parkerda/software/mitk/git-src/build/MITK-build/Modules/QtWidgets; + + /Users/parkerda/software/mitk/git-src/MITK/Modules/AlgorithmsExt/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Core/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/CppMicroServices/core/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/DataTypesExt/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/MapperExt/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/PlanarFigure/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/QtWidgets/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/QtWidgetsExt/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/SceneSerialization/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Annotation/include; + /Users/parkerda/software/mitk/git-src/MITK/Modules/ContourModel/DataManagement; + /Users/parkerda/software/mitk/git-src/MITK/Modules/CppMicroServices/core/src/module; + /Users/parkerda/software/mitk/git-src/MITK/Modules/CppMicroServices/core/src/service; + /Users/parkerda/software/mitk/git-src/MITK/Modules/CppMicroServices/core/src/util; + /Users/parkerda/software/mitk/git-src/MITK/Modules/ImageDenoising; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Multilabel; + /Users/parkerda/software/mitk/git-src/MITK/Modules/LegacyGL; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Segmentation/Algorithms; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Segmentation/Controllers; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Segmentation/Interactions; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Segmentation/SegmentationUtilities/BooleanOperations; + /Users/parkerda/software/mitk/git-src/MITK/Modules/Segmentation/SegmentationUtilities/MorphologicalOperations; + /Users/parkerda/software/mitk/git-src/MITK/Modules/SegmentationUI/Qmitk; + /Users/parkerda/software/mitk/git-src/MITK/Modules/SurfaceInterpolation; + + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.core.services/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.gui.qt.common/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.gui.common/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.gui.qt.application/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.gui.qt.ext/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.blueberry.core.runtime/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.blueberry.core.runtime/src/application; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.blueberry.core.runtime/src/registry; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.blueberry.ui.qt/src; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.blueberry.ui.qt/src/application; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.blueberry.ui.qt/src/intro; + /Users/parkerda/software/mitk/git-src/MITK/Plugins/org.mitk.gui.qt.segmentation/src; + ) +endif() + +#message(STATUS "[FindMITK.cmake] ${proj}_POSSIBLE_INCLUDE_PATHS: ${${proj}_POSSIBLE_INCLUDE_PATHS}") + +#----------------------------------------------------------------------------- +# Define header files +#----------------------------------------------------------------------------- + +message(STATUS "[FindMITK.cmake] set ${proj}_HEADERS ... ") + +set(${proj}_HEADERS + # dp "ctkAbstractFactory.h" #ctk + # dp "ctkPluginFrameworkLauncher.h" #ctk/PluginFramework + "signature_of_eigen3_matrix_library" #eigen3 + #"mitkVersion.h" #mitk + "usGlobalConfig.h" #mitk/configs + "MitkAlgorithmsExtExports.h" #mitk/exports + "ui_QmitkAboutDialogGUI.h" #mitk/ui_files + "itkIntelligentBinaryClosingFilter.h" #mitk/AlgorithmsExt/include + "mitkBaseApplication.h" #mitk/AppUtil/include + "itkImportMitkImageContainer.h" #mitk/Core/include + "usAny.h" #mitk/CppMicroServices/core/include + "mitkAffineBaseDataInteractor3D.h" #mitk/DataTypesExt/include + "mitkEnhancedPointSetVtkMapper3D.h" #mitk/MapperExt/include + "mitkExtrudePlanarFigureFilter.h" #mitk/PlanarFigure/include + "ui_QmitkFileReaderOptionsDialog.h" #mitk/QtWidgets + "QmitkApplicationCursor.h" #mitk/QtWidgets/include + "ui_QmitkAboutDialogGUI.h" #mitk/QtWidgetsExt + "QmitkAboutDialog.h" #mitk/QtWidgetsExt/include + "mitkSceneIO.h" #mitk/SceneSerialization/include + #dp "mbilog.h" #mitk/Utilities/mbilog + "mitkContourElement.h" #mitk/Modules/ContourModel/DataManagement + "usCoreModuleContext_p.h" #mitk/Modules/CppMicroServices/core/src/module + "usLDAPExpr_p.h" #mitk/Modules/CppMicroServices/core/src/service + "usAtomicInt_p.h" #mitk/Modules/CppMicroServices/core/src/util + "itkLocalVariationImageFilter.h" #mitk/Modules/ImageDenoising + "mitkGL.h" #mitk/Modules/LegacyGL + "mitkLabel.h" #mitk/Modules/Multilabel + "itkAdaptiveThresholdIterator.h" #mitk/Modules/Segmentation/Algorithms + "mitkSegmentationInterpolationController.h" #mitk/Modules/Segmentation/Controllers + # "mitkAdaptiveRegionGrowingTool.h" #mitk/Modules/Segmentation/Interactions + # "ui_QmitkAdaptiveRegionGrowingToolGUIControls.h" #mitk/Modules/SegmentationUI + # "QmitkAdaptiveRegionGrowingToolGUI.h" #mitk/Modules/SegmentationUI/Qmitk + "mitkSurfaceInterpolationController.h" #mitk/Modules/SurfaceInterpolation + "ui_QmitkFileReaderOptionsDialog.h" #mitk/Modules/QtWidgets + # dp "PythonQt.h" #PythonQt + # "tinyxml.h" #tinyxml + "mitkIDataStorageService.h" #mitk/plugins/org.mitk.core.services + "mitkDataNodeSelection.h" #mitk/plugins/org.mitk.gui.common + "QmitkFileOpenAction.h" #mitk/plugins/org.mitk.gui.qt.application + "QmitkAbstractView.h" #mitk/plugins/org.mitk.gui.qt.common + # "QmitkFunctionality.h" #mitk/plugins/org.mitk.gui.qt.common.legacy + "mitkIContextMenuAction.h" #mitk/plugins/org.mitk.gui.qt.datamanager + "QmitkStdMultiWidgetEditor.h" #mitk/plugins/org.mitk.gui.qt.stdmultiwidgeteditor + "QmitkExtActionBarAdvisor.h" #mitk/plugins/org.mitk.gui.qt.ext + "berryMacros.h" #mitk/plugins/org.blueberry.core.runtime + "berryIApplication.h" #mitk/plugins/org.blueberry.core.runtime/application + "berryIConfigurationElement.h" #mitk/plugins/org.blueberry.core.runtime/registry + "berryQtViewPart.h" #mitk/plugins/org.blueberry.ui.qt + "berryQtWorkbenchAdvisor.h" #mitk/plugins/org.blueberry.ui.qt/application + "berryIntroPart.h" #mitk/plugins/org.blueberry.ui.qt/intro + # dp "QmitkSlicesInterpolator.h" + "QmitkToolGUIArea.h" + # "QmitkToolReferenceDataSelectionBox.h" + "QmitkToolSelectionBox.h" + "mitkTool.h" + "QmitkNewSegmentationDialog.h" +) + +if(${proj}_VERSION STREQUAL "2016.03") + list(APPEND ${proj}_HEADERS + "mitkLogoOverlay.h" #mitk/Modules/Overlays + ) +elseif(${proj}_VERSION VERSION_GREATER "2018.01") + list(APPEND ${proj}_HEADERS + "mitkLogoAnnotation.h" #mitk/Modules/Annotation + ) +endif() +if(SV_USE_MITK_SEGMENTATION) + list(APPEND ${proj}_HEADERS + "mitkLabelSetImage.h" #mitk/Modules/Multilabel + "mitkBooleanOperation.h" #mitk/Modules/Segmentation/SegmentationUtilities/BooleanOperations + "mitkMorphologicalOperations.h" #mitk/Modules/Segmentation/SegmentationUtilities/MorphologicalOperations + ) +endif() + + +set(${proj}_HEADERS_MISSING ${${proj}_HEADERS}) +list(REMOVE_DUPLICATES ${proj}_HEADERS_MISSING) +set(${proj}_HEADERS_WORK "") +foreach(header ${${proj}_HEADERS}) + unset(${proj}_${header}_HEADER CACHE) + find_path(${proj}_${header}_HEADER + NAMES + ${header} + PATHS + ${${proj}_POSSIBLE_INCLUDE_PATHS} + NO_DEFAULT_PATH + ) + + mark_as_advanced(${proj}_${header}_HEADER) + set(${proj}_HEADER_FULLNAMES ${${proj}_HEADER_FULLNAMES} ${proj}_${header}_HEADER) + if(${proj}_${header}_HEADER) + set(${proj}_HEADERS_WORK ${${proj}_HEADERS_WORK} "${${proj}_${header}_HEADER}") + list(REMOVE_ITEM ${proj}_HEADERS_MISSING ${header}) + endif() +endforeach() + +list(LENGTH ${proj}_HEADERS_WORK ${proj}_NUMHEADERS) +list(LENGTH ${proj}_HEADERS ${proj}_NUMHEADERS_EXPECTED) +#message("${${proj}_NUMHEADERS} ${${proj}_NUMHEADERS_EXPECTED}") +if (NOT ${proj}_NUMHEADERS EQUAL ${proj}_NUMHEADERS_EXPECTED) + set(${proj}_HEADERS_WORK "${proj}_HEADERS-NOTFOUND") + message(FATAL_ERROR "${proj}_HEADERS_MISSING: ${${proj}_HEADERS_MISSING}") +endif() + +set(${proj}_HEADERS_WORK ${${proj}_DIR}/include ${${proj}_HEADERS_WORK}) +set(${proj}_INCLUDE_DIRS ${${proj}_HEADERS_WORK} CACHE STRING + "${proj} include directories" FORCE) +list(GET ${proj}_INCLUDE_DIRS 0 ${proj}_INCLUDE_DIR) + +#----------------------------------------------------------------------------- +# Handle Standard Args +find_package_handle_standard_args(${proj} + FOUND_VAR ${proj}_FOUND + REQUIRED_VARS ${proj}_INCLUDE_DIR ${proj}_LIBRARIES ${proj}_LIBRARY_DIR ${proj}_PLUGIN_LIBRARIES ${proj}_PLUGIN_LIBRARY_DIR + VERSION_VAR ${proj}_VERSION_STRING + FAIL_MESSAGE "Could NOT find ${proj} missing component: ${${proj}_LIBS_MISSING} and ${${proj}_HEADERS_MISSING}") + +set(${proj}_LIBRARY ${${proj}_LIBRARIES}) + +mark_as_advanced( + ${proj}_INCLUDE_DIR + ${proj}_LIBRARIES + ${proj}_LIBRARY_DIR + ${proj}_PLUGIN_LIBRARIES + ${proj}_PLUGIN_LIBRARY_DIR + ) diff --git a/Code/CMake/SimVascularDependentOptions.cmake b/Code/CMake/SimVascularDependentOptions.cmake index 8bbbbed00..89edff601 100644 --- a/Code/CMake/SimVascularDependentOptions.cmake +++ b/Code/CMake/SimVascularDependentOptions.cmake @@ -251,12 +251,18 @@ endif() #----------------------------------------------------------------------------- # Gui Options: Qt GUI if(SV_USE_SV4_GUI OR (SV_USE_OpenCASCADE AND SV_USE_OpenCASCADE_SHARED)) - SimVascularFunctionCheckCompilerFlags("-std=c++11" SimVascular_CXX11_FLAG) - if(NOT SimVascular_CXX11_FLAG) + + # [DaveP] Don't set compiler here. + # + #SimVascularFunctionCheckCompilerFlags("-std=c++11" SimVascular_CXX11_FLAG) + + #if(NOT SimVascular_CXX11_FLAG) # Older gcc compilers use -std=c++0x - SimVascularFunctionCheckCompilerFlags("-std=c++0x" SimVascular_CXX11_FLAG) - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimVascular_CXX11_FLAG}") + #SimVascularFunctionCheckCompilerFlags("-std=c++0x" SimVascular_CXX11_FLAG) + #endif() + + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimVascular_CXX11_FLAG}") + if(WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0501 -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN -DNOMINMAX") endif() @@ -280,8 +286,9 @@ if(SV_USE_SV4_GUI) set(SV_USE_QT "ON" CACHE BOOL "Force ON" FORCE) set(SV_USE_QT_SHARED "ON" CACHE BOOL "Force ON" FORCE) - set(SV_USE_Qt5 "ON" CACHE BOOL "Force ON" FORCE) - set(SV_USE_Qt5_SHARED "ON" CACHE BOOL "Force ON" FORCE) + # [DaveP] Change to Qt6 + set(SV_USE_Qt6 "ON" CACHE BOOL "Force ON" FORCE) + set(SV_USE_Qt6_SHARED "ON" CACHE BOOL "Force ON" FORCE) else() # Not perfect, but download of externals crashes if CppMicroServices isn't # present so leave mitk on originally and then turn off if need be diff --git a/Code/CMake/SimVascularExternalsVersions.cmake b/Code/CMake/SimVascularExternalsVersions.cmake index 8e835e298..4bbb8d366 100644 --- a/Code/CMake/SimVascularExternalsVersions.cmake +++ b/Code/CMake/SimVascularExternalsVersions.cmake @@ -27,58 +27,17 @@ #----------------------------------------------------------------------------- # URLs for external downloads and git repositories -set(SV_EXTERNALS_VERSION_NUMBER "2022.10" CACHE STRING "SimVascular Externals version") -set_property(CACHE SV_EXTERNALS_VERSION_NUMBER PROPERTY STRINGS "2018.01" "2018.03" "2018.05" "2019.02" "2019.06" "2022.10") +set(SV_EXTERNALS_VERSION_NUMBER "2024.05" CACHE STRING "SimVascular Externals version") +#set(SV_EXTERNALS_VERSION_NUMBER "2022.10" CACHE STRING "SimVascular Externals version") +set_property(CACHE SV_EXTERNALS_VERSION_NUMBER PROPERTY STRINGS "2019.06" "2022.10" "2024.05") #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # set external version based on externals version number -if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") +if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.06") - set(Qt5_VERSION "5.4.2") - set(TCL_VERSION "8.6.4") - set(TK_VERSION "8.6.4") - set(TCLLIB_VERSION "1.17") - set(TKLIB_VERSION "0.6") - if(WIN32) - set(PYTHON_VERSION "2.7.13") - else() - set(PYTHON_VERSION "2.7.11") - endif() - set(PIP_VERSION "0.0.0") - set(NUMPY_VERSION "1.11.1") - set(FREETYPE_VERSION "2.6.3") - set(SWIG_VERSION "3.0.12") - set(MMG_VERSION "5.1.0") - set(GDCM_VERSION "2.6.1") - set(VTK_VERSION "6.2.0") - set(ITK_VERSION "4.7.1") - set(OpenCASCADE_VERSION "7.0.0") - set(MITK_VERSION "2016.03") - -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.03") - - set(Qt5_VERSION "5.6.3") - set(TCL_VERSION "8.6.8") - set(TK_VERSION "8.6.8") - set(TCLLIB_VERSION "1.17") - set(TKLIB_VERSION "0.6") - set(PYTHON_VERSION "3.5.2") - set(PIP_VERSION "0.0.0") - set(NUMPY_VERSION "1.11.1") - set(FREETYPE_VERSION "2.6.3") - set(SWIG_VERSION "3.0.12") - set(MMG_VERSION "5.3.9") - set(GDCM_VERSION "2.6.3") - set(VTK_VERSION "8.0.0") - set(ITK_VERSION "4.12.2") - set(OpenCASCADE_VERSION "7.3.0") - set(MITK_VERSION "2018.02") - -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") - - set(Qt5_VERSION "5.6.3") + set(Qt5_VERSION "5.11.3") set(HDF5_VERSION "1.10.1") set(TINYXML2_VERSION "6.2.0") set(TCL_VERSION "8.6.4") @@ -93,59 +52,40 @@ elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") set(MMG_VERSION "5.3.9") set(GDCM_VERSION "2.6.3") set(VTK_VERSION "8.1.1") - set(ITK_VERSION "4.13.0") + set(ITK_VERSION "4.13.2") set(OpenCASCADE_VERSION "7.3.0") - set(MITK_VERSION "2018.04.0") + set(MITK_VERSION "2018.04.2") set(ML_VERSION "1.0.0") -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.02") +elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2022.10") - set(Qt5_VERSION "5.6.3") - set(HDF5_VERSION "1.10.1") + set(Qt5_VERSION "5.15.10") + set(HDF5_VERSION "1.12.2") set(TINYXML2_VERSION "6.2.0") - set(TCL_VERSION "8.6.4") - set(TK_VERSION "8.6.4") + set(TCL_VERSION "8.6.13") + set(TK_VERSION "8.6.13") set(TCLLIB_VERSION "1.17") set(TKLIB_VERSION "0.6") - set(PYTHON_VERSION "3.5.5") + set(PYTHON_VERSION "3.9.10") set(PIP_VERSION "0.0.0") set(NUMPY_VERSION "1.14.3") - set(FREETYPE_VERSION "2.6.3") + set(FREETYPE_VERSION "2.13.0") set(SWIG_VERSION "3.0.12") set(MMG_VERSION "5.3.9") - set(GDCM_VERSION "2.6.3") - set(VTK_VERSION "8.1.1") - set(ITK_VERSION "4.13.0") - set(OpenCASCADE_VERSION "7.3.0") - set(MITK_VERSION "2018.04.0") + set(GDCM_VERSION "3.0.10") + set(VTK_VERSION "9.1.0") + set(ITK_VERSION "5.2.1") + set(OpenCASCADE_VERSION "7.6.0") + set(MITK_VERSION "2022.10") set(ML_VERSION "1.0.0") -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.06") +elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2024.05") - set(Qt5_VERSION "5.11.3") - set(HDF5_VERSION "1.10.1") - set(TINYXML2_VERSION "6.2.0") - set(TCL_VERSION "8.6.4") - set(TK_VERSION "8.6.4") - set(TCLLIB_VERSION "1.17") - set(TKLIB_VERSION "0.6") - set(PYTHON_VERSION "3.5.5") - set(PIP_VERSION "0.0.0") - set(NUMPY_VERSION "1.14.3") - set(FREETYPE_VERSION "2.6.3") - set(SWIG_VERSION "3.0.12") - set(MMG_VERSION "5.3.9") - set(GDCM_VERSION "2.6.3") - set(VTK_VERSION "8.1.1") - set(ITK_VERSION "4.13.2") - set(OpenCASCADE_VERSION "7.3.0") - set(MITK_VERSION "2018.04.2") - set(ML_VERSION "1.0.0") + set(Qt6_VERSION "6.6.2") -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2022.10") + set(HDF5_VERSION "1.14.3") + #set(HDF5_VERSION "1.12.2") - set(Qt5_VERSION "5.15.10") - set(HDF5_VERSION "1.12.2") set(TINYXML2_VERSION "6.2.0") set(TCL_VERSION "8.6.13") set(TK_VERSION "8.6.13") @@ -158,8 +98,13 @@ elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2022.10") set(SWIG_VERSION "3.0.12") set(MMG_VERSION "5.3.9") set(GDCM_VERSION "3.0.10") - set(VTK_VERSION "9.1.0") - set(ITK_VERSION "5.2.1") + + set(VTK_VERSION "9.3.0") + #set(VTK_VERSION "9.1.0") + + set(ITK_VERSION "5.4.0") + #set(ITK_VERSION "5.2.1") + set(OpenCASCADE_VERSION "7.6.0") set(MITK_VERSION "2022.10") set(ML_VERSION "1.0.0") diff --git a/Code/CMake/SimVascularInstallQt.cmake b/Code/CMake/SimVascularInstallQt.cmake index 88887091b..14fa5b3f2 100644 --- a/Code/CMake/SimVascularInstallQt.cmake +++ b/Code/CMake/SimVascularInstallQt.cmake @@ -28,24 +28,26 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -if(Qt5_DIR) - get_filename_component(_Qt5_DIR "${Qt5_DIR}/../../../" ABSOLUTE) +# [DaveP] disable this for now, using installed Qt6. +# +if(Qt6_DIR) + get_filename_component(_Qt6_DIR "${Qt6_DIR}/../../../" ABSOLUTE) if(${CMAKE_PROJECT_NAME}_ENABLE_DISTRIBUTION) set(LIB_DESTINATION "${SV_EXTERNALS_INSTALL_PREFIX}") else() - set(LIB_DESTINATION "${SV_EXTERNALS_INSTALL_PREFIX}/Qt5") + set(LIB_DESTINATION "${SV_EXTERNALS_INSTALL_PREFIX}/Qt6") endif() if(${CMAKE_PROJECT_NAME}_ENABLE_DISTRIBUTION) - if(EXISTS ${_Qt5_DIR}/lib) - install(DIRECTORY ${_Qt5_DIR}/lib DESTINATION ${LIB_DESTINATION} COMPONENT ExternalLibraries) + if(EXISTS ${_Qt6_DIR}/lib) + install(DIRECTORY ${_Qt6_DIR}/lib DESTINATION ${LIB_DESTINATION} COMPONENT ExternalLibraries) endif() - if(EXISTS ${_Qt5_DIR}/bin) - install(DIRECTORY ${_Qt5_DIR}/bin DESTINATION ${LIB_DESTINATION} COMPONENT ExternalExecutables) + if(EXISTS ${_Qt6_DIR}/bin) + install(DIRECTORY ${_Qt6_DIR}/bin DESTINATION ${LIB_DESTINATION} COMPONENT ExternalExecutables) endif() - if(EXISTS ${_Qt5_DIR}/plugins) - simvascular_get_subdirs(_Qt5_SUBDIRS "${_Qt5_DIR}/plugins") - foreach(subdir ${_Qt5_SUBDIRS}) - install(DIRECTORY "${_Qt5_DIR}/plugins/${subdir}" DESTINATION ${SV_INSTALL_RUNTIME_DIR} COMPONENT ExternalLibraries) + if(EXISTS ${_Qt6_DIR}/plugins) + simvascular_get_subdirs(_Qt6_SUBDIRS "${_Qt6_DIR}/plugins") + foreach(subdir ${_Qt6_SUBDIRS}) + install(DIRECTORY "${_Qt6_DIR}/plugins/${subdir}" DESTINATION ${SV_INSTALL_RUNTIME_DIR} COMPONENT ExternalLibraries) endforeach() endif() endif() diff --git a/Code/CMake/SimVascularMacros.cmake b/Code/CMake/SimVascularMacros.cmake index e86eee931..7afdc4d3a 100644 --- a/Code/CMake/SimVascularMacros.cmake +++ b/Code/CMake/SimVascularMacros.cmake @@ -559,7 +559,9 @@ function(simvascular_generate_plugin_manifest QRC_SRCS) configure_file("${SV_SOURCE_DIR}/CMake/MANIFEST.MF.in" "${_manifest_filepath}" @ONLY) configure_file("${SV_SOURCE_DIR}/CMake/plugin_manifest.qrc.in" "${_manifest_qrc_filepath}" @ONLY) - if (CTK_QT_VERSION VERSION_GREATER "4") + if (CTK_QT_VERSION VERSION_GREATER "5") + QT6_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath}) + elseif (CTK_QT_VERSION VERSION_GREATER "4") QT5_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath}) else() QT4_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath}) @@ -682,7 +684,8 @@ macro(simvascular_generate_plugin_resource_file QRC_SRCS) ") configure_file("${SV_SOURCE_DIR}/CMake/plugin_resources_cached.qrc.in" "${_qrc_filepath}" @ONLY) - qt5_add_resources(${QRC_SRCS} ${_qrc_filepath}) + qt6_add_resources(${QRC_SRCS} ${_qrc_filepath}) + #dp qt5_add_resources(${QRC_SRCS} ${_qrc_filepath}) endmacro() @@ -712,17 +715,21 @@ function(simvascular_create_plugin) usFunctionGenerateModuleInit(CPP_FILES) #------------------------------------QT------------------------------------- - qt5_wrap_ui(UISrcs ${UI_FILES}) - qt5_add_resources(QRCSrcs ${QRC_FILES}) + qt6_wrap_ui(UISrcs ${UI_FILES}) + qt6_add_resources(QRCSrcs ${QRC_FILES}) + #qt5_wrap_ui(UISrcs ${UI_FILES}) + #qt5_add_resources(QRCSrcs ${QRC_FILES}) + set(MOC_OPTIONS "-DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED") foreach(moc_src ${MOC_H_FILES}) - qt5_wrap_cpp(MOCSrcs ${moc_src} OPTIONS -f${moc_src} ${MOC_OPTIONS} -DHAVE_QT5 TARGET ${lib_name}) + qt6_wrap_cpp(MOCSrcs ${moc_src} OPTIONS -f${moc_src} ${MOC_OPTIONS} -DHAVE_QT6 TARGET ${lib_name}) + #qt5_wrap_cpp(MOCSrcs ${moc_src} OPTIONS -f${moc_src} ${MOC_OPTIONS} -DHAVE_QT5 TARGET ${lib_name}) endforeach() #------------------------------------QT------------------------------------- #---------------------------------MANIFEST---------------------------------- # If a file named manifest_headers.cmake exists, read it - set(CTK_QT_VERSION "${Qt5_MAJOR_VERSION}.${Qt5_MINOR_VERSION}") + set(CTK_QT_VERSION "${Qt6_MAJOR_VERSION}.${Qt6_MINOR_VERSION}") set(manifest_headers_dep ) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/manifest_headers.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/manifest_headers.cmake) @@ -853,9 +860,12 @@ function(simvascular_create_module) endif() include(${CMAKE_CURRENT_SOURCE_DIR}/files.cmake) - qt5_wrap_ui(UISrcs ${UI_FILES}) - qt5_add_resources(QRCSrcs ${QRC_FILES}) - qt5_wrap_cpp(MOCSrcs ${MOC_H_FILES}) + qt6_wrap_ui(UISrcs ${UI_FILES}) + qt6_add_resources(QRCSrcs ${QRC_FILES}) + qt6_wrap_cpp(MOCSrcs ${MOC_H_FILES}) + #qt5_wrap_ui(UISrcs ${UI_FILES}) + #qt5_add_resources(QRCSrcs ${QRC_FILES}) + #qt5_wrap_cpp(MOCSrcs ${MOC_H_FILES}) usFunctionGenerateModuleInit(CPP_FILES) if(RESOURCE_FILES) @@ -1311,7 +1321,21 @@ endmacro() #----------------------------------------------------------------------------- # sv_externals_add_new_external # \brief Create new external and set variables with default values based on inputs +# +# Sets +# +# SV_EXTERNALS_${proj}_BINARIES_URL - location of tar file on /downloads/public/simvascular/externals +# macro(sv_externals_add_new_external proj version use shared dirname install_dirname) + + message(STATUS " ") + message(STATUS "========== sv_externals_add_new_external ==========") + message(STATUS "[sv_externals_add_new_external] ARGC: ${ARGC} ") + message(STATUS "[sv_externals_add_new_external] proj: ${proj} ") + message(STATUS "[sv_externals_add_new_external] version: ${version} ") + message(STATUS "[sv_externals_add_new_external] dirname: ${dirname} ") + message(STATUS "[sv_externals_add_new_external] install_dirname: ${install_dirname} ") + option(SV_EXTERNALS_ENABLE_${proj} "Enable ${proj} Plugin" ${use}) option(SV_EXTERNALS_ENABLE_${proj}_SHARED "Build ${proj} libraries as shared libs" ${shared}) mark_as_advanced(SV_EXTERNALS_ENABLE_${proj}_SHARED) @@ -1321,6 +1345,7 @@ macro(sv_externals_add_new_external proj version use shared dirname install_dirn # Version set(SV_EXTERNALS_${proj}_VERSION "${version}") simvascular_get_major_minor_patch_version(${SV_EXTERNALS_${proj}_VERSION} SV_EXTERNALS_${proj}_MAJOR_VERSION SV_EXTERNALS_${proj}_MINOR_VERSION SV_EXTERNALS_${proj}_PATCH_VERSION) + message(STATUS "[sv_externals_add_new_external] SV_EXTERNALS_${proj}_VERSION ${version}") # Src, bin, build, prefic dirs set(${proj}_VERSION_DIR ${dirname}-${SV_EXTERNALS_${proj}_VERSION}) @@ -1340,6 +1365,7 @@ macro(sv_externals_add_new_external proj version use shared dirname install_dirn if(NOT SV_EXTERNALS_INSTALL_${proj}_LIBRARY_DIR) set(SV_EXTERNALS_INSTALL_${proj}_LIBRARY_DIR ${SV_EXTERNALS_${proj}_BIN_DIR}/lib) + message(STATUS "[sv_externals_add_new_external] SV_EXTERNALS_INSTALL_${proj}_LIBRARY_DIR: ${SV_EXTERNALS_${proj}_BIN_DIR}/lib") endif() if(NOT SV_EXTERNALS_INSTALL_${proj}_ARCHIVE_DIR) @@ -1363,16 +1389,23 @@ macro(sv_externals_add_new_external proj version use shared dirname install_dirn string(TOLOWER "${SV_BUILD_TYPE_DIR}" SV_BUILD_TYPE_LOWER) simvascular_today(YEAR MONTH DAY) set(SV_EXTERNALS_${proj}_TAR_INSTALL_NAME ${SV_PLATFORM_DIR}.${SV_PLATFORM_VERSION_DIR}.${SV_COMPILER_DIR}.${SV_COMPILER_VERSION_DIR}.${SV_ARCH_DIR}.${SV_BUILD_TYPE_LOWER}.${YEAR}.${MONTH}.${DAY}.${install_dirname}.${SV_EXTERNALS_${proj}_VERSION}) + + # Generates installation rules for a project. + # if(EXISTS "${SV_EXTERNALS_TAR_INSTALL_DIR}") install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E tar -czvf ${SV_EXTERNALS_TAR_INSTALL_DIR}/${SV_EXTERNALS_${proj}_TAR_INSTALL_NAME}.tar.gz ${SV_EXTERNALS_${proj}_BIN_DIR} WORKING_DIRECTORY ${SV_EXTERNALS_TOPLEVEL_BIN_DIR})") endif() endif() - # Set up download stuff if downloading + # Set up file download. + # + if(NOT "${install_dirname}" STREQUAL "none") if(SV_EXTERNALS_DOWNLOAD_${proj}) + message(STATUS "[sv_externals_add_new_external] SV_EXTERNALS_DOWNLOAD_${proj} true") set(${proj}_TEST_FILE "${SV_EXTERNALS_URL}/${SV_EXTERNALS_VERSION_NUMBER}/${SV_KERNEL_DIR}/${SV_PLATFORM_DIR}/externals_compiler_info.txt") + message(STATUS "[sv_externals_add_new_external] Download externals_compiler_info.tx") file(DOWNLOAD "${${proj}_TEST_FILE}" "${SV_EXTERNALS_${proj}_PFX_DIR}/externals_compiler_info.txt" STATUS _status LOG _log INACTIVITY_TIMEOUT 5 TIMEOUT 5) list(GET _status 0 err) list(GET _status 1 msg) @@ -1383,6 +1416,7 @@ macro(sv_externals_add_new_external proj version use shared dirname install_dirn sv_externals_check_versioning("${FILE_CONTENTS}" ${SV_PLATFORM_VERSION_DIR} ${SV_COMPILER_DIR} ${SV_COMPILER_VERSION_DIR} SV_DOWNLOAD_DIR) string(REPLACE "/" "." SV_TAR_PREFIX "${SV_DOWNLOAD_DIR}") set(SV_EXTERNALS_${proj}_BINARIES_URL "${SV_EXTERNALS_URL}/${SV_EXTERNALS_VERSION_NUMBER}/${SV_KERNEL_DIR}/${SV_PLATFORM_DIR}/${SV_DOWNLOAD_DIR}/${SV_PLATFORM_DIR}.${SV_TAR_PREFIX}.${install_dirname}.${SV_EXTERNALS_${proj}_VERSION}.tar.gz") + message(STATUS "[sv_externals_add_new_external] SV_EXTERNALS_${proj}_BINARIES_URL: ${SV_EXTERNALS_${proj}_BINARIES_URL}") endif() endif() endif() @@ -1520,11 +1554,11 @@ macro(sv_externals_check_versioning check_file_contents platform_version compile elseif(platform_only) # Even worse, issue warning and leave - message(WARNING "${GENERIC_MESSAGE} Pre-built binaries for ${SV_PLATFORM_DIR} version ${platform_version} and compiler ${platform_only_oldest_compiler}-${platform_only_oldest_compiler_ver} are being downloaded and used. Proceed with caution!") + #message(WARNING "${GENERIC_MESSAGE} Pre-built binaries for ${SV_PLATFORM_DIR} version ${platform_version} and compiler ${platform_only_oldest_compiler}-${platform_only_oldest_compiler_ver} are being downloaded and used. Proceed with caution!") set(${output_dir} "${platform_version}/${platform_only_oldest_compiler}/${platform_only_oldest_compiler_ver}/${platform_only_rest_of_line}") else() # The worst! fatal error - message(WARNING "${GENERIC_MESSAGE} Pre-built binaries for ${SV_PLATFORM_DIR} version ${nothing_oldest_platform_ver} and compiler ${nothing_oldest_compiler}/${nothing_oldest_compiler_ver}") + #message(WARNING "${GENERIC_MESSAGE} Pre-built binaries for ${SV_PLATFORM_DIR} version ${nothing_oldest_platform_ver} and compiler ${nothing_oldest_compiler}/${nothing_oldest_compiler_ver}") set(${output_dir} "${nothing_oldest_platform_ver}/${nothing_oldest_compiler}/${nothing_oldest_compiler_ver}/${nothing_rest_of_line}") endif() diff --git a/Code/CMake/SimVascularOptions.cmake b/Code/CMake/SimVascularOptions.cmake index dc8f104ee..d43d8fe8e 100644 --- a/Code/CMake/SimVascularOptions.cmake +++ b/Code/CMake/SimVascularOptions.cmake @@ -86,7 +86,7 @@ option(SV_EXTERNALS_USE_TOPLEVEL_BIN_DIR "If ON, SV_EXTERNALS_TOPLEVEL_BIN_DIR w option(SV_EXTERNALS_INSTALL_HEADERS "If ON, The externals headers will be included in the installation" OFF) # Qt -simvascular_add_new_external(Qt5 ${Qt5_VERSION} ON ON qt) +simvascular_add_new_external(Qt6 ${Qt6_VERSION} ON ON qt) # ML if (SV_EXTERNALS_VERSION_NUMBER VERSION_GREATER_EQUAL "2019.02") diff --git a/Code/CMake/SimVascularUseExternals.cmake b/Code/CMake/SimVascularUseExternals.cmake index 94a15c6f0..00242dde1 100644 --- a/Code/CMake/SimVascularUseExternals.cmake +++ b/Code/CMake/SimVascularUseExternals.cmake @@ -118,55 +118,8 @@ endif() ##----------------------------------------------------------------------------- #----------------------------------------------------------------------------- -# Qt5 -if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01") - simvascular_add_new_external(Qt5 5.4.2 ON ON qt) - simvascular_add_new_external(TCL 8.6.4 ON ON tcltk) - if(WIN32) - simvascular_add_new_external(PYTHON 2.7.13 ON ON python) - else() - simvascular_add_new_external(PYTHON 2.7.11 ON ON python) - endif() - simvascular_add_new_external(FREETYPE 2.6.3 ON ON freetype) - simvascular_add_new_external(MMG 5.1.0 ON OFF mmg) - simvascular_add_new_external(VTK 6.2.0 ON ON vtk) - simvascular_add_new_external(GDCM 2.6.1 ON ON gdcm) - simvascular_add_new_external(ITK 4.7.1 ON ON itk) - simvascular_add_new_external(OpenCASCADE 7.0.0 ON ON opencascade) - simvascular_add_new_external(MITK 2016.03 ON ON mitk) - -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.05") - simvascular_add_new_external(Qt5 5.6.3 ON ON qt) - simvascular_add_new_external(HDF5 1.10.1 ON ON hdf5) - simvascular_add_new_external(TCL 8.6.4 ON ON tcltk) - if(WIN32) - simvascular_add_new_external(PYTHON 2.7.13 ON ON python) - else() - simvascular_add_new_external(PYTHON 3.5.5 ON ON python) - endif() - simvascular_add_new_external(FREETYPE 2.6.3 ON ON freetype) - simvascular_add_new_external(MMG 5.3.9 ON OFF mmg) - simvascular_add_new_external(GDCM 2.6.3 ON ON gdcm) - simvascular_add_new_external(VTK 8.1.1 ON ON vtk) - simvascular_add_new_external(ITK 4.13.0 ON ON itk) - simvascular_add_new_external(OpenCASCADE 7.3.0 ON ON opencascade) - simvascular_add_new_external(MITK 2018.04.0 ON ON mitk) - -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.02") - simvascular_add_new_external(Qt5 5.6.3 ON ON qt) - simvascular_add_new_external(HDF5 1.10.1 ON ON hdf5) - simvascular_add_new_external(TCL 8.6.4 ON ON tcltk) - simvascular_add_new_external(PYTHON 3.5.5 ON ON python) - simvascular_add_new_external(FREETYPE 2.6.3 ON ON freetype) - simvascular_add_new_external(MMG 5.3.9 ON OFF mmg) - simvascular_add_new_external(GDCM 2.6.3 ON ON gdcm) - simvascular_add_new_external(VTK 8.1.1 ON ON vtk) - simvascular_add_new_external(ITK 4.13.0 ON ON itk) - simvascular_add_new_external(OpenCASCADE 7.3.0 ON ON opencascade) - simvascular_add_new_external(MITK 2018.04.0 ON ON mitk) - -elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.06") +if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.06") simvascular_add_new_external(Qt5 5.11.3 ON ON qt) simvascular_add_new_external(HDF5 1.10.1 ON ON hdf5) simvascular_add_new_external(TCL 8.6.4 ON ON tcltk) @@ -178,6 +131,7 @@ elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2019.06") simvascular_add_new_external(ITK 4.13.2 ON ON itk) simvascular_add_new_external(OpenCASCADE 7.3.0 ON ON opencascade) simvascular_add_new_external(MITK 2018.04.2 ON ON mitk) + elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2022.10") simvascular_add_new_external(Qt5 5.11.3 ON ON qt) simvascular_add_new_external(HDF5 1.10.1 ON ON hdf5) @@ -189,6 +143,28 @@ elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2022.10") simvascular_add_new_external(ITK 4.13.2 ON ON itk) simvascular_add_new_external(OpenCASCADE 7.3.0 ON ON opencascade) simvascular_add_new_external(MITK 2018.04.2 ON ON mitk) + +# [DaveP] is this used? +# +elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2024.05") + #simvascular_add_new_external(Qt6 6.7.0 ON ON qt) + + simvascular_add_new_external(HDF5 1.14.3 ON ON hdf5) + #simvascular_add_new_external(HDF5 1.12.1 ON ON hdf5) + + simvascular_add_new_external(PYTHON 3.9.10 ON ON python) + simvascular_add_new_external(FREETYPE 2.13.0 ON ON freetype) + simvascular_add_new_external(GDCM 3.0.10 ON ON gdcm) + simvascular_add_new_external(MMG 5.3.9 ON OFF mmg) + + simvascular_add_new_external(VTK 9.3.0 ON ON vtk) + #simvascular_add_new_external(VTK 9.1.0 ON ON vtk) + + simvascular_add_new_external(ITK 5.4.0 ON ON itk) + + simvascular_add_new_external(OpenCASCADE 7.6.0 ON ON opencascade) + simvascular_add_new_external(MITK 2022.10 ON ON mitk) + endif() #----------------------------------------------------------------------------- diff --git a/Code/CMakeLists.txt b/Code/CMakeLists.txt index 5cd61a838..8ad336b89 100644 --- a/Code/CMakeLists.txt +++ b/Code/CMakeLists.txt @@ -480,9 +480,15 @@ endif() #----------------------------------------------------------------------------- # Configure Exe Scripts, this should be the last subdirectory +# +# [DaveP] change to find Qt6 package. +# if(SV_USE_SV4_GUI) + #find_package(Qt6 COMPONENTS Core CoreTools Gui Widgets) + #find_package(Qt6 COMPONENTS Core CoreTools Gui Widgets PATHS /Users/parkerda/software/qt/qt-6-install/lib/cmake NO_DEFAULT_PATH) include(SimVascularInstallQt) endif() + include(SimVascularInstallLibs) add_subdirectory(Scripts) #----------------------------------------------------------------------------- diff --git a/Code/Source/Include/sv_IOstream.h b/Code/Source/Include/sv_IOstream.h index 178ffd7f1..a6ed77dfa 100644 --- a/Code/Source/Include/sv_IOstream.h +++ b/Code/Source/Include/sv_IOstream.h @@ -32,7 +32,7 @@ #ifndef SU_cvIOstream_H #define SU_cvIOstream_H -#include "vtkConfigure.h" +//dp #include "vtkConfigure.h" #include #include diff --git a/Code/Source/Include/sv_VTK.h b/Code/Source/Include/sv_VTK.h index 231db5cd5..996cbd1aa 100644 --- a/Code/Source/Include/sv_VTK.h +++ b/Code/Source/Include/sv_VTK.h @@ -32,7 +32,7 @@ #ifndef __CV_VTK_H #define __CV_VTK_H -#include "vtkToolkits.h" +//dp #include "vtkToolkits.h" #include "vtkAbstractMapper.h" #include "vtkAbstractTransform.h" #include "vtkActor2D.h" @@ -101,7 +101,7 @@ #include "vtkMatrixToLinearTransform.h" #include "vtkMergePoints.h" //#include "vtkMultiThreader.h" -#include "vtkMutexLock.h" +//dp #include "vtkMutexLock.h" #include "vtkObject.h" #include "vtkObjectFactory.h" #include "vtkObjectFactoryCollection.h" diff --git a/Code/Source/PythonAPI/GeometryBlendOptions_PyClass.cxx b/Code/Source/PythonAPI/GeometryBlendOptions_PyClass.cxx index 7aced4102..fd27fad11 100644 --- a/Code/Source/PythonAPI/GeometryBlendOptions_PyClass.cxx +++ b/Code/Source/PythonAPI/GeometryBlendOptions_PyClass.cxx @@ -104,7 +104,8 @@ BlendOptionsGetInt(PyObject* blendOptions, std::string name) std::cout << "Internal error: The '" + name + "' BlendOptions paramater is not correctly setup." << std::endl; return 0; } - auto value = PyInt_AsLong(obj); + auto value = PyLong_AsLong(obj); + //dp auto value = PyInt_AsLong(obj); Py_DECREF(obj); return value; } diff --git a/Code/Source/PythonAPI/GeometryLoftNurbsOptions_PyClass.cxx b/Code/Source/PythonAPI/GeometryLoftNurbsOptions_PyClass.cxx index 41450d0cd..60807eda8 100644 --- a/Code/Source/PythonAPI/GeometryLoftNurbsOptions_PyClass.cxx +++ b/Code/Source/PythonAPI/GeometryLoftNurbsOptions_PyClass.cxx @@ -147,7 +147,8 @@ static int LoftNurbsOptionsGetInt(PyObject* loftOptions, std::string name) { auto obj = PyObject_GetAttrString(loftOptions, name.c_str()); - auto value = PyInt_AsLong(obj); + auto value = PyLong_AsLong(obj); + //dp auto value = PyInt_AsLong(obj); Py_DECREF(obj); return value; } @@ -170,7 +171,8 @@ const static char * LoftNurbsOptionsGetString(PyObject* loftOptions, std::string name) { auto obj = PyObject_GetAttrString(loftOptions, name.c_str()); - auto value = PyString_AsString(obj); + auto value = PyUnicode_AsUTF8(obj); + //dp auto value = PyString_AsString(obj); Py_DECREF(obj); return value; } diff --git a/Code/Source/PythonAPI/GeometryLoftOptions_PyClass.cxx b/Code/Source/PythonAPI/GeometryLoftOptions_PyClass.cxx index 247b00e35..586cdb31f 100644 --- a/Code/Source/PythonAPI/GeometryLoftOptions_PyClass.cxx +++ b/Code/Source/PythonAPI/GeometryLoftOptions_PyClass.cxx @@ -113,7 +113,8 @@ LoftOptionsGetInt(PyObject* loftOptions, std::string name) std::cout << "Internal error: The '" + name + "' LoftOptions paramater is not correctly setup." << std::endl; return 0; } - auto value = PyInt_AsLong(obj); + auto value = PyLong_AsLong(obj); + //dp auto value = PyInt_AsLong(obj); Py_DECREF(obj); return value; } diff --git a/Code/Source/PythonAPI/Geometry_PyModule.cxx b/Code/Source/PythonAPI/Geometry_PyModule.cxx index 3a66e7f46..18c1f0b46 100644 --- a/Code/Source/PythonAPI/Geometry_PyModule.cxx +++ b/Code/Source/PythonAPI/Geometry_PyModule.cxx @@ -794,7 +794,8 @@ Geom_local_sphere_smooth(PyObject* self, PyObject* args, PyObject* kwargs) api.error("The 'smooth_parameters' argument has no 'method' key."); return nullptr; } - std::string smoothingMethod(PyString_AsString(methodItem)); + std::string smoothingMethod(PyUnicode_AsUTF8(methodItem)); + //dp std::string smoothingMethod(PyString_AsString(methodItem)); int numIters = 0; double constrainFactor = 0.0; @@ -824,7 +825,8 @@ Geom_local_sphere_smooth(PyObject* self, PyObject* args, PyObject* kwargs) Py_ssize_t pos = 0; while (PyDict_Next(smoothingParmaArg, &pos, &key, &value)) { - auto keyName = std::string(PyString_AsString(key)); + auto keyName = std::string(PyUnicode_AsUTF8(key)); + //dp auto keyName = std::string(PyString_AsString(key)); if ((keyName == "method") || (keyName == "num_iterations")) { continue; } @@ -858,7 +860,8 @@ Geom_local_sphere_smooth(PyObject* self, PyObject* args, PyObject* kwargs) Py_ssize_t pos = 0; while (PyDict_Next(smoothingParmaArg, &pos, &key, &value)) { - auto keyName = std::string(PyString_AsString(key)); + auto keyName = std::string(PyUnicode_AsUTF8(key)); + //dp auto keyName = std::string(PyString_AsString(key)); if ((keyName == "method") || (keyName == "num_iterations")) { continue; } diff --git a/Code/Source/PythonAPI/MeshingMeshSimOptions_PyClass.cxx b/Code/Source/PythonAPI/MeshingMeshSimOptions_PyClass.cxx index 108749f85..8ece2dbf1 100644 --- a/Code/Source/PythonAPI/MeshingMeshSimOptions_PyClass.cxx +++ b/Code/Source/PythonAPI/MeshingMeshSimOptions_PyClass.cxx @@ -202,7 +202,7 @@ namespace MeshSimOption { { std::string paramErrMsg = "The " + paramName + " parameter must be a " + description; auto objRep = PyObject_Repr(obj); - const char* objStr = PyString_AsString(objRep); + const char* objStr = PyUnicode_AsUTF8(objRep); auto objErrorMsg = "Error in option '" + std::string(objStr) + "'. "; auto errorMsg = objErrorMsg + paramErrMsg; return errorMsg; @@ -385,7 +385,7 @@ PyMeshSimOptionsGetValues(PyObject* meshingOptions, std::string name) if (PyFloat_Check(obj)) { auto value = PyFloat_AsDouble(obj); values.push_back(value); - } else if (PyInt_Check(obj)) { + } else if (PyLong_Check(obj)) { auto value = PyLong_AsDouble(obj); values.push_back(value); } else if (PyTuple_Check(obj)) { @@ -485,7 +485,7 @@ PyMeshSimOptions_parse_python_meshsim_options(PyMeshingMeshSimOptions* self, PyO std::cout << "[PyMeshSimOptions_check] bool value: " << boolValue << std::endl; } else if (itemType == "MeshSimListOption") { auto listName = PyObject_GetAttrString(item, "name"); - std::string name(PyString_AsString(listName)); + std::string name(PyUnicode_AsUTF8(listName)); auto dList = PyObject_GetAttrString(item, "dlist"); PyTypeObject* type = dList->ob_type; auto itemType = std::string(type->tp_name); diff --git a/Code/Source/PythonAPI/MeshingMeshSim_PyClass.cxx b/Code/Source/PythonAPI/MeshingMeshSim_PyClass.cxx index 2e3e1bc3a..187c3f349 100644 --- a/Code/Source/PythonAPI/MeshingMeshSim_PyClass.cxx +++ b/Code/Source/PythonAPI/MeshingMeshSim_PyClass.cxx @@ -133,14 +133,14 @@ void MeshingMeshSimOptionsSetDictValues(PyObject* optionObj, const std::string& if (PyFloat_Check(obj)) { auto value = PyFloat_AsDouble(obj); values.push_back(value); - } else if (PyInt_Check(obj)) { + } else if (PyLong_Check(obj)) { auto value = PyLong_AsDouble(obj); values.push_back(value); // A string type is used only for face names in 'face_id' for now. - } else if (PyString_Check(obj)) { + } else if (PyUnicode_Check(obj)) { if (elemName == "face_id") { - auto name = std::string(PyString_AsString(obj)); + auto name = std::string(PyUnicode_AsUTF8(obj)); if (nameIDMap.count(name) == 0) { throw std::runtime_error("The face name '" + name + "' is not valid."); } @@ -179,7 +179,7 @@ MeshingMeshSimOptionsGetValues(cvMeshObject* mesher, PyObject* meshingOptions, s if (PyFloat_Check(obj)) { auto value = PyFloat_AsDouble(obj); values.push_back(value); - } else if (PyInt_Check(obj)) { + } else if (PyLong_Check(obj)) { auto value = PyLong_AsDouble(obj); values.push_back(value); } else if (PyTuple_Check(obj)) { diff --git a/Code/Source/PythonAPI/MeshingTetGenAdaptOptions_PyClass.cxx b/Code/Source/PythonAPI/MeshingTetGenAdaptOptions_PyClass.cxx index 8f58fe246..d2b7aaa3f 100644 --- a/Code/Source/PythonAPI/MeshingTetGenAdaptOptions_PyClass.cxx +++ b/Code/Source/PythonAPI/MeshingTetGenAdaptOptions_PyClass.cxx @@ -179,7 +179,7 @@ PyTetGenAdaptOptGetValue(PyObject* meshingOptions, std::string name, double& val if (PyFloat_Check(obj)) { value = PyFloat_AsDouble(obj); - } else if (PyInt_Check(obj)) { + } else if (PyLong_Check(obj)) { value = PyLong_AsDouble(obj); } diff --git a/Code/Source/PythonAPI/MeshingTetGenOptions_PyClass.cxx b/Code/Source/PythonAPI/MeshingTetGenOptions_PyClass.cxx index 4a1b4cf7a..0149f07e4 100644 --- a/Code/Source/PythonAPI/MeshingTetGenOptions_PyClass.cxx +++ b/Code/Source/PythonAPI/MeshingTetGenOptions_PyClass.cxx @@ -576,7 +576,8 @@ PyTetGenOptionsGetValues(PyObject* meshingOptions, std::string name) if (PyFloat_Check(obj)) { auto value = PyFloat_AsDouble(obj); values.push_back(value); - } else if (PyInt_Check(obj)) { + } else if (PyLong_Check(obj)) { + //dp } else if (PyInt_Check(obj)) { auto value = PyLong_AsDouble(obj); values.push_back(value); } else if (PyTuple_Check(obj)) { @@ -640,9 +641,9 @@ PyTetGenOptionsGetListValues(PyObject* meshingOptions, std::string name) PyObject *ptype, *pvalue, *ptraceback; PyErr_Fetch(&ptype, &pvalue, &ptraceback); auto pystr = PyObject_Str(pvalue); - auto valMsg = std::string(PyString_AsString(pystr)); + auto valMsg = std::string(PyUnicode_AsUTF8(pystr)); auto itemRep = PyObject_Repr(item); - auto itemStr = std::string(PyString_AsString(itemRep)); + auto itemStr = std::string(PyUnicode_AsUTF8(itemRep)); std::string msg = itemStr + ": " + valMsg; if (msg != errorMsg) { msg += ". " + errorMsg; diff --git a/Code/Source/PythonAPI/PathPlanningPath_PyClass.cxx b/Code/Source/PythonAPI/PathPlanningPath_PyClass.cxx index f050f973d..883463749 100644 --- a/Code/Source/PythonAPI/PathPlanningPath_PyClass.cxx +++ b/Code/Source/PythonAPI/PathPlanningPath_PyClass.cxx @@ -790,7 +790,7 @@ Path_set_subdivision_method(PyPath* self, PyObject* args, PyObject* kwargs) PyObject* numTotalObj = nullptr; PyObject* spacingObj = nullptr; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &methodName, &PyInt_Type, &numDivObj, &PyInt_Type, &numTotalObj, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &methodName, &PyLong_Type, &numDivObj, &PyLong_Type, &numTotalObj, &PyFloat_Type, &spacingObj)) { return api.argsError(); } @@ -843,7 +843,7 @@ Path_set_subdivision_method(PyPath* self, PyObject* args, PyObject* kwargs) return nullptr; } - int numDiv = PyInt_AsLong(numDivObj); + int numDiv = PyLong_AsLong(numDivObj); if (PyErr_Occurred()) { return nullptr; } @@ -864,7 +864,7 @@ Path_set_subdivision_method(PyPath* self, PyObject* args, PyObject* kwargs) return nullptr; } - int numTotal = PyInt_AsLong(numTotalObj); + int numTotal = PyLong_AsLong(numTotalObj); if (PyErr_Occurred()) { return nullptr; } diff --git a/Code/Source/PythonAPI/PyUtils.cxx b/Code/Source/PythonAPI/PyUtils.cxx index f391cdecb..236a7bcbc 100644 --- a/Code/Source/PythonAPI/PyUtils.cxx +++ b/Code/Source/PythonAPI/PyUtils.cxx @@ -114,9 +114,9 @@ void PyUtilGetPyErrorInfo(PyObject* item, std::string& errorMsg, std::string& it PyObject *ptype, *pvalue, *ptraceback; PyErr_Fetch(&ptype, &pvalue, &ptraceback); auto pystr = PyObject_Str(pvalue); - errorMsg = std::string(PyString_AsString(pystr)); + errorMsg = std::string(PyUnicode_AsUTF8(pystr)); auto itemRep = PyObject_Repr(item); - itemStr = std::string(PyString_AsString(itemRep)); + itemStr = std::string(PyUnicode_AsUTF8(itemRep)); } //-------------------------- @@ -424,7 +424,7 @@ PyUtilGetIntAttr(PyObject* obj, std::string name) std::string msg = "The '" + typeName + "' object has no attribute named '" + name + "'." ; throw std::runtime_error(msg); } - int value = PyInt_AsLong(attr); + int value = PyLong_AsLong(attr); if (PyErr_Occurred()) { std::string valErrorMsg; std::string itemStr; @@ -450,7 +450,7 @@ PyUtilGetStringAttr(PyObject* obj, std::string name) throw std::runtime_error(msg); } - std::string value(PyString_AsString(attr)); + std::string value(PyUnicode_AsUTF8(attr)); if (PyErr_Occurred()) { std::string valErrorMsg; std::string itemStr; @@ -500,14 +500,14 @@ PyUtilGetDictListAttr(PyObject* obj, std::string name) std::map vmap; while (PyDict_Next(item, &pos, &key, &value)) { - std::string keyStr(PyString_AsString(key)); + std::string keyStr(PyUnicode_AsUTF8(key)); std::string sval; if (PyFloat_Check(value)) { sval = std::to_string(PyFloat_AsDouble(value)); } else if (PyLong_Check(value)) { sval = std::to_string(PyLong_AsLong(value)); } else { - sval = PyString_AsString(value); + sval = PyUnicode_AsUTF8(value); } vmap[keyStr] = sval; } @@ -546,7 +546,7 @@ PyUtilGetStringListAttr(PyObject* obj, std::string name) std::vector values; for (int i = 0; i < listSize; i++) { auto data = PyList_GetItem(attr, i); - std::string value(PyString_AsString(data)); + std::string value(PyUnicode_AsUTF8(data)); values.push_back(value); } @@ -743,7 +743,7 @@ void PyUtilSetLoftParams(PyUtilApiFunction& api, PyObject* loftOpts, svLoftingPa {"linear_multiplier", [](ParamType params, ValType value) -> void { params.linearMuliplier = PyLong_AsLong(value); }}, - {"method", [](ParamType params, ValType value) -> void { params.method = PyString_AsString(value); }}, + {"method", [](ParamType params, ValType value) -> void { params.method = PyUnicode_AsUTF8(value); }}, {"num_modes", [](ParamType params, ValType value) -> void { params.numModes = PyLong_AsLong(value); }}, {"num_out_pts_along_length", [](ParamType params, ValType value) -> void { params.numOutPtsAlongLength = PyLong_AsLong(value); }}, @@ -757,10 +757,10 @@ void PyUtilSetLoftParams(PyUtilApiFunction& api, PyObject* loftOpts, svLoftingPa {"u_degree", [](ParamType params, ValType value) -> void { params.uDegree = PyLong_AsLong(value); }}, {"v_degree", [](ParamType params, ValType value) -> void { params.vDegree = PyLong_AsLong(value); }}, - {"u_knot_span_type", [](ParamType params, ValType value) -> void { params.uKnotSpanType = PyString_AsString(value); }}, - {"v_knot_span_type", [](ParamType params, ValType value) -> void { params.vKnotSpanType = PyString_AsString(value); }}, - {"u_parametric_span_type", [](ParamType params, ValType value) -> void { params.uParametricSpanType = PyString_AsString(value); }}, - {"v_parametric_span_type", [](ParamType params, ValType value) -> void { params.vParametricSpanType = PyString_AsString(value); }}, + {"u_knot_span_type", [](ParamType params, ValType value) -> void { params.uKnotSpanType = PyUnicode_AsUTF8(value); }}, + {"v_knot_span_type", [](ParamType params, ValType value) -> void { params.vKnotSpanType = PyUnicode_AsUTF8(value); }}, + {"u_parametric_span_type", [](ParamType params, ValType value) -> void { params.uParametricSpanType = PyUnicode_AsUTF8(value); }}, + {"v_parametric_span_type", [](ParamType params, ValType value) -> void { params.vParametricSpanType = PyUnicode_AsUTF8(value); }}, {"use_linear_sample_along_length", [](ParamType params, ValType value) -> void { params.useLinearSampleAlongLength = PyLong_AsLong(value); }}, {"use_fft", [](ParamType params, ValType value) -> void { params.useFFT = PyLong_AsLong(value); }}, @@ -773,7 +773,7 @@ void PyUtilSetLoftParams(PyUtilApiFunction& api, PyObject* loftOpts, svLoftingPa Py_ssize_t pos = 0; while (PyDict_Next(loftOpts, &pos, &key, &value)) { - auto name = std::string(PyString_AsString(key)); + auto name = std::string(PyUnicode_AsUTF8(key)); try { SetParamValue[name](params, value); } catch (const std::bad_function_call& except) { diff --git a/Code/Source/PythonAPI/SegmentationSplinePolygon_PyClass.cxx b/Code/Source/PythonAPI/SegmentationSplinePolygon_PyClass.cxx index c3d7c9f21..ca32302f8 100644 --- a/Code/Source/PythonAPI/SegmentationSplinePolygon_PyClass.cxx +++ b/Code/Source/PythonAPI/SegmentationSplinePolygon_PyClass.cxx @@ -343,7 +343,9 @@ SplinePolygonSegmentation_set_subdivision_params(PySplinePolygonSegmentation* se PyObject* spacingArg = nullptr; PyObject* numberArg = nullptr; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &typeName, &PyFloat_Type, &spacingArg, &PyInt_Type, &numberArg)) { + if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &typeName, + &PyFloat_Type, &spacingArg, &PyLong_Type, &numberArg)) { + //dp if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &typeName, &PyFloat_Type, &spacingArg, &PyInt_Type, &numberArg)) return nullptr; } @@ -378,7 +380,8 @@ SplinePolygonSegmentation_set_subdivision_params(PySplinePolygonSegmentation* se // Set number. // if (numberArg != nullptr) { - auto number = PyInt_AsLong(numberArg); + auto number = PyLong_AsLong(numberArg); + //dp auto number = PyInt_AsLong(numberArg); // This regenerates the contour. contour->SetSubdivisionNumber(number); } diff --git a/Code/Source/PythonAPI/SimulationROM_PyClass.cxx b/Code/Source/PythonAPI/SimulationROM_PyClass.cxx index 6645b3b8c..c9334cb0a 100644 --- a/Code/Source/PythonAPI/SimulationROM_PyClass.cxx +++ b/Code/Source/PythonAPI/SimulationROM_PyClass.cxx @@ -329,7 +329,7 @@ ROMSim_AddMaterialParameters(sv4guiROMSimulationPython& pythonInterface, PyObjec if (nameObj == nullptr) { throw std::runtime_error("The material model has no 'name' attribute"); } - std::string materialName(PyString_AsString(nameObj)); + std::string materialName(PyUnicode_AsUTF8(nameObj)); if (materialName == MATERIAL_OLUFSEN) { pythonInterface.AddParameter(params.MATERIAL_MODEL, materialName); @@ -578,7 +578,7 @@ ROMSim_write_input_file(PySimulationROM* self, PyObject* args, PyObject* kwargs) PyObject* solutionParamsArg = nullptr; char* outputDirArg = nullptr; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &PyInt_Type, &modelOrderArg, &modelParamsArg, &meshParamsArg, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &PyLong_Type, &modelOrderArg, &modelParamsArg, &meshParamsArg, &fluidPropsArg, &materialModelArg, &bcsParamsArg, &solutionParamsArg, &outputDirArg)) { return api.argsError(); } @@ -590,7 +590,7 @@ ROMSim_write_input_file(PySimulationROM* self, PyObject* args, PyObject* kwargs) // Set model order. // - int modelOrder = PyInt_AsLong(modelOrderArg); + int modelOrder = PyLong_AsLong(modelOrderArg); if (PyErr_Occurred()) { return nullptr; } diff --git a/Code/Source/PythonAPI/Vmtk_PyModule.cxx b/Code/Source/PythonAPI/Vmtk_PyModule.cxx index f078c4192..5e9af426c 100644 --- a/Code/Source/PythonAPI/Vmtk_PyModule.cxx +++ b/Code/Source/PythonAPI/Vmtk_PyModule.cxx @@ -209,7 +209,7 @@ Vmtk_cap_with_ids(PyObject* self, PyObject* args, PyObject* kwargs) PyObject* fillIdArg = nullptr; PyObject* incIdArg = nullptr; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &surfaceArg, &PyInt_Type, &fillIdArg, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &surfaceArg, &PyLong_Type, &fillIdArg, &PyBool_Type, &incIdArg)) { return api.argsError(); } @@ -225,7 +225,7 @@ Vmtk_cap_with_ids(PyObject* self, PyObject* args, PyObject* kwargs) int fillType = 2; if (fillIdArg != nullptr) { - fillId = PyInt_AsLong(fillIdArg); + fillId = PyLong_AsLong(fillIdArg); if (fillId < 0) { api.error("Cap fill ID must be >= 0."); return nullptr; diff --git a/Code/Source/sv/Geometry/sv_sys_geom.cxx b/Code/Source/sv/Geometry/sv_sys_geom.cxx index fe563a5f2..5a720ebe0 100644 --- a/Code/Source/sv/Geometry/sv_sys_geom.cxx +++ b/Code/Source/sv/Geometry/sv_sys_geom.cxx @@ -4129,7 +4129,7 @@ int sys_geom_set_ids_for_caps( cvPolyData *pd,cvPolyData **outpd,int **doublecap vtkNew(vtkThreshold,threshold1); threshold1->SetInputData(geom); threshold1->SetInputArrayToProcess(0,0,0,1,"ModelFaceID"); - threshold1->ThresholdBetween(i+1,i+1); + //dp threshold1->ThresholdBetween(i+1,i+1); threshold1->Update(); vtkNew(vtkDataSetSurfaceFilter,surfacer); diff --git a/Code/Source/sv/Mesh/MMGMeshUtils/sv_mmg_mesh_utils.cxx b/Code/Source/sv/Mesh/MMGMeshUtils/sv_mmg_mesh_utils.cxx index 883bed735..c7f665acd 100644 --- a/Code/Source/sv/Mesh/MMGMeshUtils/sv_mmg_mesh_utils.cxx +++ b/Code/Source/sv/Mesh/MMGMeshUtils/sv_mmg_mesh_utils.cxx @@ -414,7 +414,7 @@ int MMGUtils_SurfaceRemeshing(vtkPolyData *surface, double hmin, double hmax, do thresholder->SetInputData(pd); //Set Input Array to 0 port,0 connection,1 for Cell Data, and WallID is the type name thresholder->SetInputArrayToProcess(0,0,0,1,"WallID"); - thresholder->ThresholdBetween(1,1); + //dp thresholder->ThresholdBetween(1,1); thresholder->Update(); vtkSmartPointer surfacer = diff --git a/Code/Source/sv/Mesh/TetGenMeshObject/sv_TetGenMeshObject.cxx b/Code/Source/sv/Mesh/TetGenMeshObject/sv_TetGenMeshObject.cxx index 3ecb01545..c3fc7909c 100644 --- a/Code/Source/sv/Mesh/TetGenMeshObject/sv_TetGenMeshObject.cxx +++ b/Code/Source/sv/Mesh/TetGenMeshObject/sv_TetGenMeshObject.cxx @@ -1116,7 +1116,7 @@ int cvTetGenMeshObject::SetWalls(int numWalls, int *walls) thresholder->SetInputData(polydatasolid_); //Set Input Array to 0 port,0 connection,1 for Cell Data, and WallID is the type name thresholder->SetInputArrayToProcess(0,0,0,1,"WallID"); - thresholder->ThresholdBetween(1,1); + //dp thresholder->ThresholdBetween(1,1); thresholder->Update(); auto surfacer = vtkSmartPointer::New(); diff --git a/Code/Source/sv/Mesh/VMTKUtils/sv_vmtk_utils.cxx b/Code/Source/sv/Mesh/VMTKUtils/sv_vmtk_utils.cxx index 2fa542bfd..fb368c784 100644 --- a/Code/Source/sv/Mesh/VMTKUtils/sv_vmtk_utils.cxx +++ b/Code/Source/sv/Mesh/VMTKUtils/sv_vmtk_utils.cxx @@ -1615,7 +1615,7 @@ int VMTKUtils_CreateBoundaryLayerSurfaceAndCaps(vtkUnstructuredGrid* boundaryMes auto thresholder = vtkSmartPointer::New(); thresholder->SetInputData(boundaryMesh); thresholder->SetInputArrayToProcess(0, 0, 0, 1, "isSurface"); - thresholder->ThresholdBetween(1, 1); + //dp thresholder->ThresholdBetween(1, 1); thresholder->Update(); auto surfacer = vtkSmartPointer::New(); @@ -1628,7 +1628,7 @@ int VMTKUtils_CreateBoundaryLayerSurfaceAndCaps(vtkUnstructuredGrid* boundaryMes // thresholder->SetInputData(boundaryMesh); thresholder->SetInputArrayToProcess(0, 0, 0, 1, "isSurface"); - thresholder->ThresholdBetween(0, 0); + //dp thresholder->ThresholdBetween(0, 0); thresholder->Update(); boundaryMeshVolume->DeepCopy(thresholder->GetOutput()); @@ -1637,7 +1637,7 @@ int VMTKUtils_CreateBoundaryLayerSurfaceAndCaps(vtkUnstructuredGrid* boundaryMes // thresholder->SetInputData(surfaceWithSize); thresholder->SetInputArrayToProcess(0,0,0,1,"WallID"); - thresholder->ThresholdBetween(0,0); + //dp thresholder->ThresholdBetween(0,0); thresholder->Update(); surfacer->SetInputData(thresholder->GetOutput()); diff --git a/Code/Source/sv/Model/OCCTSolidModel/sv_OCCTSolidModel.cxx b/Code/Source/sv/Model/OCCTSolidModel/sv_OCCTSolidModel.cxx index 162314a5b..780ac868b 100644 --- a/Code/Source/sv/Model/OCCTSolidModel/sv_OCCTSolidModel.cxx +++ b/Code/Source/sv/Model/OCCTSolidModel/sv_OCCTSolidModel.cxx @@ -1713,7 +1713,7 @@ int cvOCCTSolidModel::GetOnlyPD(vtkPolyData *pd,double &max_dist) const //Set Input Array to 0 port,0 connection,1 for Cell Data, and MESh_TYPES is the type name thresholder->SetInputArrayToProcess(0,0,0,1,"MESH_TYPES"); //Source polydata is on MESH_TYPE 7 - thresholder->ThresholdBetween(7,7); + //dp thresholder->ThresholdBetween(7,7); thresholder->Update(); //Extract surface vtkSmartPointer surfacer = diff --git a/Code/Source/sv/Model/PolyDataSolidModel/sv_polydatasolid_utils.cxx b/Code/Source/sv/Model/PolyDataSolidModel/sv_polydatasolid_utils.cxx index 6a02ac9c8..c3238a14e 100644 --- a/Code/Source/sv/Model/PolyDataSolidModel/sv_polydatasolid_utils.cxx +++ b/Code/Source/sv/Model/PolyDataSolidModel/sv_polydatasolid_utils.cxx @@ -219,7 +219,7 @@ int PlyDtaUtils_GetFacePolyData(vtkPolyData *geom, int *faceid, vtkPolyData *fac idThreshold->SetInputData(geom); //Set Input Array to 0 port,0 connection,1 for Cell Data, and Regions is the type name idThreshold->SetInputArrayToProcess(0,0,0,1,"ModelFaceID"); - idThreshold->ThresholdBetween(facenum,facenum); + //dp idThreshold->ThresholdBetween(facenum,facenum); idThreshold->Update(); tempGrid = idThreshold->GetOutput(); diff --git a/Code/Source/sv3/Path/sv3_PathUtils.cxx b/Code/Source/sv3/Path/sv3_PathUtils.cxx index 878f0db21..0150cb709 100644 --- a/Code/Source/sv3/Path/sv3_PathUtils.cxx +++ b/Code/Source/sv3/Path/sv3_PathUtils.cxx @@ -75,7 +75,7 @@ PathUtils::ExtractCenterlinesSections(vtkSmartPointer& centerlines) auto threshold = vtkSmartPointer::New(); threshold->SetInputData(centerlines); threshold->SetInputArrayToProcess(0, 0, 0, "vtkDataObject::FIELD_ASSOCIATION_CELLS", CenterlineIdsArrayName.c_str()); - threshold->ThresholdBetween(cid, cid); + //dp threshold->ThresholdBetween(cid, cid); threshold->Update(); auto surfacer = vtkSmartPointer::New(); @@ -90,7 +90,7 @@ PathUtils::ExtractCenterlinesSections(vtkSmartPointer& centerlines) auto groupThreshold = vtkSmartPointer::New(); groupThreshold->SetInputData(centerlinesCidThreshold); groupThreshold->SetInputArrayToProcess(0, 0, 0, "vtkDataObject::FIELD_ASSOCIATION_CELLS", GroupIdsArrayName.c_str()); - groupThreshold->ThresholdBetween(lowerValue, upperValue); + //dp groupThreshold->ThresholdBetween(lowerValue, upperValue); groupThreshold->Update(); auto groupSurfacer = vtkSmartPointer::New(); diff --git a/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.cxx b/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.cxx index ca7deb51e..fa1f493e8 100644 --- a/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.cxx +++ b/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.cxx @@ -50,6 +50,7 @@ std::vector sv4guiStringUtils::split(const std::string &s, char del return elems; } +/*dp std::string sv4guiStringUtils::ltrim(std::string s) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); @@ -70,3 +71,4 @@ std::string sv4guiStringUtils::lower(std::string s) { std::transform(s.begin(), s.end(), s.begin(), ::tolower); return s; } +*/ diff --git a/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.h b/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.h index 8454f763d..ac5b33904 100644 --- a/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.h +++ b/Code/Source/sv4gui/Modules/Common/sv4gui_StringUtils.h @@ -60,6 +60,26 @@ static std::vector sv4guiStringUtils_split(const std::string &s, ch return elems; } +//dp +static inline std::string &sv4guiStringUtils_ltrim(std::string &s) { + s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) {return !std::isspace(c);})); + return s; +} + +static inline std::string &sv4guiStringUtils_rtrim(std::string &s) { + typedef std::string::iterator iter_type; + iter_type from (s.begin()); + iter_type until (s.end()); + std::reverse_iterator rev_until(from); + s.erase(std::find_if(from, until, [](int c) {return !std::isspace(c);})); + return s; +} + +static inline std::string sv4guiStringUtils_trim(std::string s) { + return sv4guiStringUtils_ltrim(sv4guiStringUtils_rtrim(s)); +} + +/*dp static std::string sv4guiStringUtils_ltrim(std::string s) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); @@ -75,6 +95,7 @@ static std::string sv4guiStringUtils_rtrim(std::string s) { static std::string sv4guiStringUtils_trim(std::string s) { return sv4guiStringUtils_ltrim(sv4guiStringUtils_rtrim(s)); } +*/ static std::string sv4guiStringUtils_lower(std::string s) { std::transform(s.begin(), s.end(), s.begin(), ::tolower); diff --git a/Code/Source/sv4gui/Modules/MachineLearning/sv4gui_json.hxx b/Code/Source/sv4gui/Modules/MachineLearning/sv4gui_json.hxx index abf05e7b1..a858728c4 100644 --- a/Code/Source/sv4gui/Modules/MachineLearning/sv4gui_json.hxx +++ b/Code/Source/sv4gui/Modules/MachineLearning/sv4gui_json.hxx @@ -1,8459 +1,15073 @@ -/* - __ _____ _____ _____ - __| | __| | | | JSON for Modern C++ -| | |__ | | | | | | version 3.5.0 -|_____|_____|_____|_|___| https://github.com/nlohmann/json - -Licensed under the MIT License . -SPDX-License-Identifier: MIT -Copyright (c) 2013-2018 Niels Lohmann . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -#ifndef NLOHMANN_JSON_HPP -#define NLOHMANN_JSON_HPP +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ -#define NLOHMANN_JSON_VERSION_MAJOR 3 -#define NLOHMANN_JSON_VERSION_MINOR 5 -#define NLOHMANN_JSON_VERSION_PATCH 0 +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ #include // all_of, find, for_each -#include // assert -#include // and, not, or #include // nullptr_t, ptrdiff_t, size_t #include // hash, less #include // initializer_list -#include // istream, ostream +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO #include // random_access_iterator_tag -#include // accumulate +#include // unique_ptr #include // string, stoi, to_string #include // declval, forward, move, pair, swap - -// #include -#ifndef NLOHMANN_JSON_FWD_HPP -#define NLOHMANN_JSON_FWD_HPP - -#include // int64_t, uint64_t -#include // map -#include // allocator -#include // string #include // vector -/*! -@brief namespace for Niels Lohmann -@see https://github.com/nlohmann -@since version 1.0.0 -*/ -namespace nlohmann -{ -/*! -@brief default JSONSerializer template argument - -This serializer ignores the template arguments and uses ADL -([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) -for serialization. -*/ -template -struct adl_serializer; - -template class ObjectType = - std::map, - template class ArrayType = std::vector, - class StringType = std::string, class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = - adl_serializer> -class basic_json; - -/*! -@brief JSON Pointer - -A JSON pointer defines a string syntax for identifying a specific value -within a JSON document. It can be used with functions `at` and -`operator[]`. Furthermore, JSON pointers are the base for JSON patches. - -@sa [RFC 6901](https://tools.ietf.org/html/rfc6901) - -@since version 2.0.0 -*/ -template -class json_pointer; +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -/*! -@brief default JSON class -This type is the default specialization of the @ref basic_json class which -uses the standard template types. -@since version 1.0.0 -*/ -using json = basic_json<>; -} // namespace nlohmann +#include -#endif +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -// #include -// This file contains all internal macro definitions -// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them +// This file contains all macro definitions affecting or depending on the ABI -// exclude unsupported compilers -#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) - #if defined(__clang__) - #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 - #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" - #endif - #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) - #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 - #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3 + #warning "Already included a different version of the library!" #endif #endif #endif -// disable float-equal warnings on GCC/clang -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wfloat-equal" +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 #endif -// disable documentation warnings on clang -#if defined(__clang__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdocumentation" +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 #endif -// allow for portable deprecation warnings -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) - #define JSON_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) - #define JSON_DEPRECATED __declspec(deprecated) +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag #else - #define JSON_DEPRECATED + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS #endif -// allow to disable exceptions -#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) - #define JSON_THROW(exception) throw exception - #define JSON_TRY try - #define JSON_CATCH(exception) catch(exception) - #define JSON_INTERNAL_CATCH(exception) catch(exception) +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp #else - #define JSON_THROW(exception) std::abort() - #define JSON_TRY if(true) - #define JSON_CATCH(exception) if(false) - #define JSON_INTERNAL_CATCH(exception) if(false) + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON #endif -// override exception macros -#if defined(JSON_THROW_USER) - #undef JSON_THROW - #define JSON_THROW JSON_THROW_USER -#endif -#if defined(JSON_TRY_USER) - #undef JSON_TRY - #define JSON_TRY JSON_TRY_USER -#endif -#if defined(JSON_CATCH_USER) - #undef JSON_CATCH - #define JSON_CATCH JSON_CATCH_USER - #undef JSON_INTERNAL_CATCH - #define JSON_INTERNAL_CATCH JSON_CATCH_USER -#endif -#if defined(JSON_INTERNAL_CATCH_USER) - #undef JSON_INTERNAL_CATCH - #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 #endif -// manual branch prediction -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) - #define JSON_LIKELY(x) __builtin_expect(!!(x), 1) - #define JSON_UNLIKELY(x) __builtin_expect(!!(x), 0) -#else - #define JSON_LIKELY(x) x - #define JSON_UNLIKELY(x) x -#endif +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) -// C++ language standard detection -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 - #define JSON_HAS_CPP_17 - #define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) - #define JSON_HAS_CPP_14 -#endif +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) -/*! -@brief macro to briefly define a mapping between an enum and JSON -@def NLOHMANN_JSON_SERIALIZE_ENUM -@since version 3.4.0 -*/ -#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ - template \ - inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ - { \ - static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ - static const std::pair m[] = __VA_ARGS__; \ - auto it = std::find_if(std::begin(m), std::end(m), \ - [e](const std::pair& ej_pair) -> bool \ - { \ - return ej_pair.first == e; \ - }); \ - j = ((it != std::end(m)) ? it : std::begin(m))->second; \ - } \ - template \ - inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ - { \ - static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ - static const std::pair m[] = __VA_ARGS__; \ - auto it = std::find_if(std::begin(m), std::end(m), \ - [j](const std::pair& ej_pair) -> bool \ - { \ - return ej_pair.second == j; \ - }); \ - e = ((it != std::end(m)) ? it : std::begin(m))->first; \ - } +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) -// Ugly macros to avoid uglier copy-paste when specializing basic_json. They -// may be removed in the future once the class is split. +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif -#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ - template class ObjectType, \ - template class ArrayType, \ - class StringType, class BooleanType, class NumberIntegerType, \ - class NumberUnsignedType, class NumberFloatType, \ - template class AllocatorType, \ - template class JSONSerializer> +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) -#define NLOHMANN_BASIC_JSON_TPL \ - basic_json +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif -// #include +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif -#include // not -#include // size_t -#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -namespace nlohmann -{ -namespace detail -{ -// alias templates to reduce boilerplate -template -using enable_if_t = typename std::enable_if::type; -template -using uncvref_t = typename std::remove_cv::type>::type; -// implementation of C++14 index_sequence and affiliates -// source: https://stackoverflow.com/a/32223343 -template -struct index_sequence -{ - using type = index_sequence; - using value_type = std::size_t; - static constexpr std::size_t size() noexcept - { - return sizeof...(Ints); - } -}; +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray -template -struct merge_and_renumber; +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -template -struct merge_and_renumber, index_sequence> - : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; -template -struct make_index_sequence - : merge_and_renumber < typename make_index_sequence < N / 2 >::type, - typename make_index_sequence < N - N / 2 >::type > {}; -template<> struct make_index_sequence<0> : index_sequence<> {}; -template<> struct make_index_sequence<1> : index_sequence<0> {}; +#include // nullptr_t +#include // exception +#if JSON_DIAGNOSTICS + #include // accumulate +#endif +#include // runtime_error +#include // to_string +#include // vector -template -using index_sequence_for = make_index_sequence; +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -// dispatch utility (taken from ranges-v3) -template struct priority_tag : priority_tag < N - 1 > {}; -template<> struct priority_tag<0> {}; -// taken from ranges-v3 -template -struct static_const -{ - static constexpr T value{}; -}; -template -constexpr T static_const::value; -} // namespace detail -} // namespace nlohmann +#include // array +#include // size_t +#include // uint8_t +#include // string -// #include +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -#include // not -#include // numeric_limits -#include // false_type, is_constructible, is_integral, is_same, true_type -#include // declval -// #include +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -// #include -#include // random_access_iterator_tag +#include // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT -namespace nlohmann -{ -namespace detail -{ -template struct make_void -{ - using type = void; -}; -template using void_t = typename make_void::type; -} // namespace detail -} // namespace nlohmann -// #include +// #include -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { -template -struct iterator_types {}; - -template -struct iterator_types < - It, - void_t> -{ - using difference_type = typename It::difference_type; - using value_type = typename It::value_type; - using pointer = typename It::pointer; - using reference = typename It::reference; - using iterator_category = typename It::iterator_category; -}; - -// This is required as some compilers implement std::iterator_traits in a way that -// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. -template -struct iterator_traits -{ -}; - -template -struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> - : iterator_types -{ -}; -template -struct iterator_traits::value>> +template struct make_void { - using iterator_category = std::random_access_iterator_tag; - using value_type = T; - using difference_type = ptrdiff_t; - using pointer = T*; - using reference = T&; + using type = void; }; -} -} - -// #include +template using void_t = typename make_void::type; -// #include - - -#include - -// #include +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END -// http://en.cppreference.com/w/cpp/experimental/is_detected -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { + +// https://en.cppreference.com/w/cpp/experimental/is_detected struct nonesuch { nonesuch() = delete; ~nonesuch() = delete; nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; }; -template class Op, - class... Args> +template class Op, + class... Args> struct detector { using value_t = std::false_type; using type = Default; }; -template class Op, class... Args> +template class Op, class... Args> struct detector>, Op, Args...> { using value_t = std::true_type; using type = Op; }; -template