diff --git a/.gitignore b/.gitignore index 3e4f3b1088..01bcefc082 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ cmake # Sphinx builds docs/_build/ +/build diff --git a/Superbuild/BoostConfig.cmake.in b/Superbuild/BoostConfig.cmake.in index fbfc876a84..37be542103 100644 --- a/Superbuild/BoostConfig.cmake.in +++ b/Superbuild/BoostConfig.cmake.in @@ -1,6 +1,181 @@ -set(SCI_BOOST_INCLUDE "@SCI_BOOST_INCLUDE@") - -# These are IMPORTED targets created by FooBarTargets.cmake -set(SCI_BOOST_LIBRARY @SCI_BOOST_LIBRARY@) -set(SCI_BOOST_LIBRARY_DIR "@SCI_BOOST_LIBRARY_DIR@") -set(SCI_BOOST_USE_FILE "@SCI_BOOST_USE_FILE@") +# ============================================================================ +# BoostConfig.cmake - generated by SCIRun superbuild +# ============================================================================ + +@PACKAGE_INIT@ + +set(Boost_FOUND TRUE) + +# --------------------------------------------------------------------------- +# Paths +# --------------------------------------------------------------------------- +set(Boost_INCLUDE_DIRS "@SCI_BOOST_INCLUDE@") +set(Boost_LIBRARY_DIR "@SCI_BOOST_LIBRARY_DIR@") + +# --------------------------------------------------------------------------- +# Helper: define Boost imported library target (cross-platform) +# --------------------------------------------------------------------------- +function(_scirun_define_boost_target lib) + # If Boost already created the target, just ensure includes + if(TARGET Boost::${lib}) + set_target_properties(Boost::${lib} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}" + ) + return() + endif() + + # Boost.Atomic is header-only on macOS + if(APPLE AND lib STREQUAL "atomic") + add_library(Boost::atomic INTERFACE IMPORTED) + set_target_properties(Boost::atomic PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}" + ) + return() + endif() + + # Create imported library target + add_library(Boost::${lib} UNKNOWN IMPORTED) + set_target_properties(Boost::${lib} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}" + ) + + # Boost.Python static macro (SCIRun convention) + if(lib MATCHES "^python") + set_target_properties(Boost::${lib} PROPERTIES + INTERFACE_COMPILE_DEFINITIONS BOOST_PYTHON_STATIC_LIB + ) + endif() + + # Detect architecture + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_boost_arch "x64") + else() + set(_boost_arch "x32") + endif() + + set(_release_lib "") + set(_debug_lib "") + + # ------------------------------------------------------------------------- + # Windows: SCIRun-built Boost uses tagged .lib names + # ------------------------------------------------------------------------- + if(WIN32) + file(GLOB _all_candidates + "${Boost_LIBRARY_DIR}/libboost_${lib}-*.lib" + ) + + list(FILTER _all_candidates INCLUDE REGEX "-${_boost_arch}-") + + if(NOT _all_candidates) + message(FATAL_ERROR + "Boost '${lib}' not found for architecture ${_boost_arch}\n" + "Directory: ${Boost_LIBRARY_DIR}" + ) + endif() + + # ----------------------------------------------------------------------- + # ABI-aware Debug / Release selection (Boost 1.8+) + # + # Rules: + # - Debug libraries contain '-g' + # - Release libraries do NOT contain '-g' + # - 'y' means Python enabled and may appear in BOTH + # ----------------------------------------------------------------------- + + # Debug candidates + set(_dbg_candidates "${_all_candidates}") + list(FILTER _dbg_candidates INCLUDE REGEX "-g") + + if(_dbg_candidates) + list(GET _dbg_candidates 0 _debug_lib) + endif() + + # Release candidates + set(_rel_candidates "${_all_candidates}") + list(FILTER _rel_candidates EXCLUDE REGEX "-g") + + if(_rel_candidates) + list(GET _rel_candidates 0 _release_lib) + endif() + + # ------------------------------------------------------------------------- + # macOS / Linux + # ------------------------------------------------------------------------- + else() + file(GLOB _all_candidates + "${Boost_LIBRARY_DIR}/libboost_${lib}.a" + "${Boost_LIBRARY_DIR}/libboost_${lib}-mt.a" + "${Boost_LIBRARY_DIR}/libboost_${lib}.dylib" + "${Boost_LIBRARY_DIR}/libboost_${lib}-mt.dylib" + ) + + if(NOT _all_candidates) + message(FATAL_ERROR + "Boost library '${lib}' could not be resolved.\n" + "Directory: ${Boost_LIBRARY_DIR}\n" + "Platform: ${CMAKE_SYSTEM_NAME}" + ) + endif() + + list(GET _all_candidates 0 _release_lib) + set(_debug_lib "${_release_lib}") + endif() + + # ------------------------------------------------------------------------- + # Fail fast if resolution failed + # ------------------------------------------------------------------------- + if(NOT _release_lib OR NOT _debug_lib) + message(FATAL_ERROR + "Boost library '${lib}' could not be resolved for both configurations.\n" + "All candidates:\n ${_all_candidates}" + ) + endif() + + set_target_properties(Boost::${lib} PROPERTIES + IMPORTED_CONFIGURATIONS "Release;Debug" + IMPORTED_LOCATION_RELEASE "${_release_lib}" + IMPORTED_LOCATION_DEBUG "${_debug_lib}" + ) +endfunction() + +# --------------------------------------------------------------------------- +# Core Boost components +# --------------------------------------------------------------------------- +_scirun_define_boost_target(atomic) +_scirun_define_boost_target(chrono) +_scirun_define_boost_target(date_time) +_scirun_define_boost_target(filesystem) +_scirun_define_boost_target(program_options) +_scirun_define_boost_target(regex) +_scirun_define_boost_target(serialization) +_scirun_define_boost_target(thread) + +# --------------------------------------------------------------------------- +# Boost.Python (optional) +# --------------------------------------------------------------------------- +if(@BUILD_WITH_PYTHON@) + _scirun_define_boost_target(python@SCI_PYTHON_VERSION_SHORT_WIN32@) +endif() + +# --------------------------------------------------------------------------- +# Compatibility variables +# --------------------------------------------------------------------------- +set(Boost_LIBRARIES + Boost::atomic + Boost::chrono + Boost::date_time + Boost::filesystem + Boost::program_options + Boost::regex + Boost::serialization + Boost::thread +) + +add_library(Boost::headers INTERFACE IMPORTED) +set_target_properties(Boost::headers PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}" +) + +if(@BUILD_WITH_PYTHON@) + list(APPEND Boost_LIBRARIES Boost::python@SCI_PYTHON_VERSION_SHORT_WIN32@) +endif() \ No newline at end of file diff --git a/Superbuild/BoostExternal.cmake b/Superbuild/BoostExternal.cmake index b21974cb00..f4225648a2 100644 --- a/Superbuild/BoostExternal.cmake +++ b/Superbuild/BoostExternal.cmake @@ -24,103 +24,309 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -# Borrowed CMake code from the MaidSafe Boost CMake build -# found at https://github.com/maidsafe/MaidSafe/blob/master/cmake_modules/add_boost.cmake -# and code borrowed from ITK4 HDFMacros.cmake +# +# Boost External Project for SCIRun Superbuild +# SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base}) -# disable auto linking -# also set in Seg3D? +# ------------------------------------------------------------------------------ +# Boost compile flags +# ------------------------------------------------------------------------------ SET(boost_CXX_Flags "-DBOOST_ALL_NO_LIB=1") IF(APPLE) - LIST(APPEND boost_CXX_Flag "-DBOOST_LCAST_NO_WCHAR_T" "-DBOOST_THREAD_DONT_USE_ATOMIC") + LIST(APPEND boost_CXX_Flags "-DBOOST_LCAST_NO_WCHAR_T" "-DBOOST_THREAD_DONT_USE_ATOMIC") ENDIF() IF(WIN32) - LIST(APPEND boost_CXX_Flag "-DBOOST_BIND_ENABLE_STDCALL") + LIST(APPEND boost_CXX_Flags "-DBOOST_BIND_ENABLE_STDCALL") ENDIF() -SET( boost_DEPENDENCIES ) +SET(boost_DEPENDENCIES) -# explicitly set library list +# ------------------------------------------------------------------------------ +# Explicit library list +# ------------------------------------------------------------------------------ SET(boost_Libraries - "atomic" - "chrono" - "date_time" - "exception" - "filesystem" - "program_options" - "regex" - "serialization" - #"system" - "thread" - CACHE INTERNAL "Boost library name.") + atomic + chrono + date_time + exception + filesystem + program_options + regex + serialization + thread + CACHE INTERNAL "Boost library names." +) IF(BUILD_WITH_PYTHON) ADD_DEFINITIONS(-DBOOST_PYTHON_STATIC_LIB=1) LIST(APPEND boost_Libraries python) LIST(APPEND boost_DEPENDENCIES Python_external) - LIST(APPEND boost_CXX_Flag "-DBOOST_PYTHON_STATIC_MODULE" "-DBOOST_PYTHON_STATIC_LIB") + LIST(APPEND boost_CXX_Flags "-DBOOST_PYTHON_STATIC_MODULE" "-DBOOST_PYTHON_STATIC_LIB") ENDIF() -# for travis clang builds--need a narrower test +# ------------------------------------------------------------------------------ +# Darwin/Unix/Windows consistency flags +# ------------------------------------------------------------------------------ IF(UNIX) ADD_DEFINITIONS(-DBOOST_NO_CXX11_ALLOCATOR) ENDIF() -SET(boost_GIT_TAG "origin/v1.89.0a") - -# TODO: set up 64-bit build detection -# Boost Jam needs to have 64-bit build explicitly configured IF(WIN32) SET(FORCE_64BIT_BUILD ON) ENDIF() +SET(_boost_git_url "https://github.com/CIBC-Internal/boost.git") +SET(_boost_git_tag "v1.90.0") -SET(boost_GIT_URL "https://github.com/CIBC-Internal/boost.git") +# ------------------------------------------------------------------------------ +# Compute Python library filenames +# ------------------------------------------------------------------------------ +if(WIN32 AND MSVC) + set(SCI_PYTHON_LIBRARY_FILE_RELEASE + "${SCI_PYTHON_LIBRARY_RELEASE}") + set(SCI_PYTHON_LIBRARY_FILE_DEBUG + "${SCI_PYTHON_LIBRARY_DEBUG}") +elseif(APPLE) + set(SCI_PYTHON_LIBRARY_FILE + "${SCI_PYTHON_LIBRARY_DIR}/libpython${SCI_PYTHON_VERSION_SHORT}.dylib") +else() + set(SCI_PYTHON_LIBRARY_FILE + "${SCI_PYTHON_LIBRARY_DIR}/libpython${SCI_PYTHON_VERSION_SHORT}.so") +endif() -# TODO: fix install step -# -# If CMake ever allows overriding the checkout command or adding flags, -# git checkout -q will silence message about detached head (harmless). +# ------------------------------------------------------------------------------ +# Compute b2 Python flags (MUST be separate arguments) +# ------------------------------------------------------------------------------ +IF(BUILD_WITH_PYTHON) + SET(BOOST_PYTHON_WITH_FLAG --with-python) + #SET(BOOST_PYTHON_EXE_FLAG python=${SCI_PYTHON_EXE}) + #SET(BOOST_PYTHON_INC_FLAG include=${SCI_PYTHON_INCLUDE}) + #SET(BOOST_PYTHON_LIB_FLAG library-path=${SCI_PYTHON_LIBRARY_DIR}) + SET(BOOST_PYTHON_VERSION_FLAG python-version=${SCI_PYTHON_VERSION_SHORT}) +ELSE() + SET(BOOST_PYTHON_WITH_FLAG --without-python) + SET(BOOST_PYTHON_EXE_FLAG "") + SET(BOOST_PYTHON_INC_FLAG "") + SET(BOOST_PYTHON_LIB_FLAG "") +ENDIF() + +if(WIN32) + # Convert Windows PATH to CMake-friendly forward-slash form + file(TO_CMAKE_PATH "$ENV{PATH}" _SCIRUN_ENV_PATH_CMAKE) +else() + set(_SCIRUN_ENV_PATH_CMAKE "$ENV{PATH}") +endif() +# ------------------------------------------------------------------------------ +# ExternalProject_Add: Boost +# ------------------------------------------------------------------------------ ExternalProject_Add(Boost_external DEPENDS ${boost_DEPENDENCIES} - GIT_REPOSITORY ${boost_GIT_URL} - GIT_TAG ${boost_GIT_TAG} + GIT_REPOSITORY ${_boost_git_url} + GIT_TAG ${_boost_git_tag} BUILD_IN_SOURCE ON PATCH_COMMAND "" INSTALL_COMMAND "" + CMAKE_CACHE_ARGS - -DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE} - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DBUILD_PYTHON:BOOL=${BUILD_WITH_PYTHON} - -DPython_DIR:PATH=${Python_DIR} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DFORCE_64BIT_BUILD:BOOL=${FORCE_64BIT_BUILD} - -DSCI_BOOST_LIBRARIES:STATIC=${boost_Libraries} - -DSCI_BOOST_CXX_FLAGS:STRING=${boost_CXX_Flags} + -DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE} + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DFORCE_64BIT_BUILD:BOOL=${FORCE_64BIT_BUILD} + + # ---------- Python ON/OFF controlled by SCIRun option ---------- + -DBUILD_PYTHON:BOOL=${BUILD_WITH_PYTHON} + #-DBOOST_ENABLE_PYTHON:BOOL=${BUILD_WITH_PYTHON} + + # ---------- FORCE FindPython3 to use SCIRun Python, not Xcode ---------- + -DPython3_FIND_FRAMEWORK:STRING=NEVER + -DPython3_FIND_STRATEGY:STRING=LOCATION + -DPython3_FIND_REQUIRED:BOOL=${BUILD_WITH_PYTHON} + -DPython3_ROOT_DIR:PATH=${SCI_PYTHON_ROOT_DIR} + -DPython3_EXECUTABLE:FILEPATH=${SCI_PYTHON_EXE} + -DPython3_INCLUDE_DIR:PATH=${SCI_PYTHON_INCLUDE} + if(WIN32 AND MSVC) + -DPython3_LIBRARY_DEBUG:FILEPATH=${SCI_PYTHON_LIBRARY_FILE_DEBUG} + -DPython3_LIBRARY_RELEASE:FILEPATH=${SCI_PYTHON_LIBRARY_FILE_RELEASE} + else() + -DPython3_LIBRARY:FILEPATH=${SCI_PYTHON_LIBRARY_FILE} + endif() + + CMAKE_COMMAND_ENV + "PYTHONHOME=${SCI_PYTHON_ROOT_DIR}" + "PYTHONPATH=" + "PATH=${SCI_PYTHON_ROOT_DIR}/bin:${_SCIRUN_ENV_PATH_CMAKE}" + "CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE" + "CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=FALSE" + "CMAKE_FIND_FRAMEWORK=NEVER" + "Python3_FIND_FRAMEWORK=NEVER" + "Python3_FIND_STRATEGY=LOCATION" ) +# ------------------------------------------------------------------------------ +# Internal paths from ExternalProject +# ------------------------------------------------------------------------------ ExternalProject_Get_Property(Boost_external INSTALL_DIR) ExternalProject_Get_Property(Boost_external SOURCE_DIR) -SET(SCI_BOOST_INCLUDE ${SOURCE_DIR}) -SET(SCI_BOOST_LIBRARY_DIR ${SOURCE_DIR}/lib) -SET(SCI_BOOST_USE_FILE ${INSTALL_DIR}/UseBoost.cmake) -SET(BOOST_PREFIX "boost_") -SET(THREAD_POSTFIX "-mt") +IF(WIN32) + SET(_B2_CMD ${SOURCE_DIR}/b2.exe) + SET(_B2_BOOTSTRAP_CMD bootstrap.bat) +ELSE() + SET(_B2_CMD ${SOURCE_DIR}/b2) + SET(_B2_BOOTSTRAP_CMD ./bootstrap.sh) +ENDIF() + +# -------------------------------------------------------------- +# Step: bootstrap b2 +# -------------------------------------------------------------- +ExternalProject_Add_Step(Boost_external bootstrap_b2 + COMMAND ${_B2_BOOTSTRAP_CMD} + WORKING_DIRECTORY ${SOURCE_DIR} + DEPENDEES update + INDEPENDENT 1 + COMMENT "Bootstrapping b2" +) -SET(SCI_BOOST_LIBRARY) +# -------------------------------------------------------------- +# Step: write project-config.jam (AFTER bootstrap) +# -------------------------------------------------------------- +ExternalProject_Add_Step(Boost_external write_project_config + COMMAND ${CMAKE_COMMAND} + -DOUTPUT_FILE=${SOURCE_DIR}/project-config.jam + -DVERSION=${SCI_PYTHON_VERSION_SHORT} + -DEXE=${SCI_PYTHON_EXE} + -DINCLUDE=${SCI_PYTHON_INCLUDE} + -DLIB_RELEASE=${SCI_PYTHON_LIBRARY_RELEASE} + -DLIB_DEBUG=${SCI_PYTHON_LIBRARY_DEBUG} + -P ${SUPERBUILD_DIR}/WriteProjectConfigJam.cmake + DEPENDEES bootstrap_b2 + INDEPENDENT 1 -FOREACH(lib ${boost_Libraries}) - SET(LIB_NAME "${BOOST_PREFIX}${lib}${THREAD_POSTFIX}") - LIST(APPEND SCI_BOOST_LIBRARY ${LIB_NAME}) -ENDFOREACH() + COMMENT "Overwriting project-config.jam with Python toolset AFTER bootstrap" +) -# Boost is special case - normally this should be handled in external library repo -CONFIGURE_FILE(${SUPERBUILD_DIR}/BoostConfig.cmake.in ${INSTALL_DIR}/BoostConfig.cmake @ONLY) -CONFIGURE_FILE(${SUPERBUILD_DIR}/UseBoost.cmake ${SCI_BOOST_USE_FILE} COPYONLY) +# -------------------------------------------------------------- +# Step: verify project-config.jam +# -------------------------------------------------------------- +ExternalProject_Add_Step(Boost_external verify_project_config + COMMAND ${CMAKE_COMMAND} -E echo "==== VERIFY project-config.jam AFTER bootstrap ====" + COMMAND ${CMAKE_COMMAND} -E cat ${SOURCE_DIR}/project-config.jam -SET(Boost_DIR ${INSTALL_DIR} CACHE PATH "") + DEPENDEES write_project_config + INDEPENDENT 1 + + COMMENT "Verifying final project-config.jam" +) -MESSAGE(STATUS "Boost_DIR: ${Boost_DIR}") +# ------------------------------------------------------------------------------ +# Step: b2 headers +# ------------------------------------------------------------------------------ +ExternalProject_Add_Step(Boost_external stage_headers + COMMAND ${_B2_CMD} headers + WORKING_DIRECTORY ${SOURCE_DIR} + DEPENDEES write_project_config + COMMENT "Running b2 headers" +) + +# ------------------------------------------------------------------------------ +# Step: Install full headers +# ------------------------------------------------------------------------------ +ExternalProject_Add_Step(Boost_external install_full_headers + COMMAND ${CMAKE_COMMAND} -E make_directory ${INSTALL_DIR}/include + COMMAND ${CMAKE_COMMAND} -E remove_directory ${INSTALL_DIR}/include/boost + COMMAND ${CMAKE_COMMAND} -E copy_directory ${SOURCE_DIR}/boost ${INSTALL_DIR}/include/boost + WORKING_DIRECTORY ${SOURCE_DIR} + DEPENDEES stage_headers + DEPENDERS install + COMMENT "Installing full Boost headers" +) + +# ------------------------------------------------------------------------------ +# Step: Build Boost libraries +# ------------------------------------------------------------------------------ +# ------------------------------------------------------------------ +# Common Boost b2 build arguments (used for echo + real build) +# ------------------------------------------------------------------ +if(WIN32) + set(_BOOST_CXXFLAGS "") +else() + set(_BOOST_CXXFLAGS cxxflags=-fPIC) +endif() +# ------------------------------------------------------------------ +# Boost.Python debug ABI (Windows requires this for python313_d + 'y') +# ------------------------------------------------------------------ +if(WIN32 AND MSVC AND BUILD_WITH_PYTHON) + set(BOOST_PYTHON_DEBUGGING_FLAG python-debugging=on) +else() + set(BOOST_PYTHON_DEBUGGING_FLAG "") +endif() + +set(_BOOST_B2_ARGS + --with-atomic + --with-chrono + --with-date_time + --with-filesystem + --with-program_options + --with-regex + --with-serialization + --with-thread + + ${BOOST_PYTHON_WITH_FLAG} + ${BOOST_PYTHON_DEBUGGING_FLAG} + + link=static + runtime-link=shared + variant=release,debug + threading=multi + stage +) + +ExternalProject_Add_Step(Boost_external build_libs + COMMAND ${CMAKE_COMMAND} -E echo "=== B2 PYTHON FLAGS ===" + COMMAND ${CMAKE_COMMAND} -E echo "${BOOST_PYTHON_WITH_FLAG}" + COMMAND ${CMAKE_COMMAND} -E echo "${BOOST_PYTHON_EXE_FLAG}" + COMMAND ${CMAKE_COMMAND} -E echo "${BOOST_PYTHON_INC_FLAG}" + COMMAND ${CMAKE_COMMAND} -E echo "${BOOST_PYTHON_LIB_FLAG}" + COMMAND ${CMAKE_COMMAND} -E echo "SCI_PYTHON_EXE = ${SCI_PYTHON_EXE}" + COMMAND ${CMAKE_COMMAND} -E echo "SCI_PYTHON_INCLUDE = ${SCI_PYTHON_INCLUDE}" + COMMAND ${CMAKE_COMMAND} -E echo "SCI_PYTHON_LIBRARY_DIR = ${SCI_PYTHON_LIBRARY_DIR}" + + COMMAND ${CMAKE_COMMAND} -E echo "=== B2 FULL CMD ===" + COMMAND ${CMAKE_COMMAND} -E echo "${_B2_CMD} ${_BOOST_B2_ARGS}" + + COMMAND ${_B2_CMD} ${_BOOST_B2_ARGS} + + WORKING_DIRECTORY ${SOURCE_DIR} + DEPENDEES stage_headers + COMMENT "Building Boost static libraries (Debug + Release)" +) + +# ------------------------------------------------------------------------------ +# Export Boost library info +# ------------------------------------------------------------------------------ +SET(SCI_BOOST_INCLUDE ${INSTALL_DIR}/include) +SET(SCI_BOOST_LIBRARY_DIR ${SOURCE_DIR}/stage/lib) +#SET(SCI_BOOST_USE_FILE ${INSTALL_DIR}/UseBoost.cmake) + +SET(BOOST_PREFIX "boost_") +SET(THREAD_POSTFIX "") + +#SET(SCI_BOOST_LIBRARY) +#FOREACH(lib ${boost_Libraries}) +# IF(lib STREQUAL "python") +# # Python library is versioned: e.g., boost_python313 +# LIST(APPEND SCI_BOOST_LIBRARY "${BOOST_PREFIX}${lib}${SCI_PYTHON_VERSION_SHORT_WIN32}") +# ELSE() +# LIST(APPEND SCI_BOOST_LIBRARY "${BOOST_PREFIX}${lib}${THREAD_POSTFIX}") +# ENDIF() +#ENDFOREACH() + +CONFIGURE_FILE(${SUPERBUILD_DIR}/BoostConfig.cmake.in + ${INSTALL_DIR}/BoostConfig.cmake @ONLY) +#CONFIGURE_FILE(${SUPERBUILD_DIR}/UseBoost.cmake +# ${SCI_BOOST_USE_FILE} COPYONLY) + +SET(Boost_DIR ${INSTALL_DIR} CACHE PATH "") +MESSAGE(STATUS "Boost_DIR: ${Boost_DIR}") \ No newline at end of file diff --git a/Superbuild/PythonConfig.cmake.in b/Superbuild/PythonConfig.cmake.in index e720d28530..223811712f 100644 --- a/Superbuild/PythonConfig.cmake.in +++ b/Superbuild/PythonConfig.cmake.in @@ -1,23 +1,62 @@ +# ----------------------------------------------------------------------------- +# SCIRun Python configuration +# ----------------------------------------------------------------------------- set(SCI_PYTHON_VERSION_SHORT "@SCI_PYTHON_VERSION_SHORT@") set(SCI_PYTHON_ROOT "@SCI_PYTHON_ROOT_DIR@") set(SCI_PYTHON_INCLUDE "@SCI_PYTHON_INCLUDE@") + +# NOTE: +# This variable historically held "the" Python library. +# On Windows/MSVC this is unsafe for multi-config generators, +# so consumers should prefer SCI_PYTHON_LIBRARIES instead. set(SCI_PYTHON_LIBRARY "@SCI_PYTHON_LIBRARY@") + set(SCI_PYTHON_LIBRARY_DIR "@SCI_PYTHON_LIBRARY_DIR@") set(SCI_PYTHON_LINK_LIBRARY_DIRS "@SCI_PYTHON_LINK_LIBRARY_DIRS@") set(SCI_PYTHON_EXE "@SCI_PYTHON_EXE@") + +# ----------------------------------------------------------------------------- +# Windows / MSVC-specific Python settings +# ----------------------------------------------------------------------------- if(WIN32 AND MSVC) set(SCI_PYTHON_VERSION_SHORT_WIN32 "@SCI_PYTHON_VERSION_SHORT_WIN32@") set(SCI_PYTHON_DEBUG_EXE "@SCI_PYTHON_DEBUG_EXE@") + + # Explicit Python import libraries set(SCI_PYTHON_LIBRARY_RELEASE "@SCI_PYTHON_LIBRARY_RELEASE@") - set(SCI_PYTHON_LIBRARY_DEBUG "@SCI_PYTHON_LIBRARY_DEBUG@") - set(SCI_PYTHON_DLL_PATH "@SCI_PYTHON_DLL_PATH@") - set(SCI_PYTHON_DLL_DEBUG_PATH "@SCI_PYTHON_DLL_DEBUG_PATH@") + set(SCI_PYTHON_LIBRARY_DEBUG "@SCI_PYTHON_LIBRARY_DEBUG@") + + # Runtime DLL search paths + set(SCI_PYTHON_DLL_PATH "@SCI_PYTHON_DLL_PATH@") + set(SCI_PYTHON_DLL_DEBUG_PATH "@SCI_PYTHON_DLL_DEBUG_PATH@") + set(SCI_PYTHON_MODULE_PARENT_PATH "@SCI_PYTHON_MODULE_PARENT_PATH@") set(SCI_PYTHON_NAME "@SCI_PYTHON_NAME@") + + # --------------------------------------------------------------------------- + # NEW: Canonical, configuration-safe Python library variable + # + # This must be used by all targets that link against Python on Windows. + # --------------------------------------------------------------------------- + set(SCI_PYTHON_LIBRARIES + "$<$:${SCI_PYTHON_LIBRARY_DEBUG}>" + "$<$>:${SCI_PYTHON_LIBRARY_RELEASE}>" + ) + +else() + # --------------------------------------------------------------------------- + # Non-Windows platforms (Linux, macOS): + # Python has a single ABI, so a single library is correct. + # --------------------------------------------------------------------------- + set(SCI_PYTHON_LIBRARIES "${SCI_PYTHON_LIBRARY}") endif() + +# ----------------------------------------------------------------------------- +# macOS framework support +# ----------------------------------------------------------------------------- if(APPLE) set(SCI_PYTHON_FRAMEWORK "@SCI_PYTHON_FRAMEWORK@") set(SCI_PYTHON_FRAMEWORK_ARCHIVE "@SCI_PYTHON_FRAMEWORK_ARCHIVE@") @@ -26,5 +65,14 @@ else() set(SCI_PYTHON_64BIT_MODULE_LIBRARY_PATH "@SCI_PYTHON_64BIT_MODULE_LIBRARY_PATH@") endif() + +# ----------------------------------------------------------------------------- +# Python module search path +# ----------------------------------------------------------------------------- set(PYTHON_MODULE_SEARCH_PATH "@PYTHON_MODULE_SEARCH_PATH@") -set(SCI_PYTHON_USE_FILE "@SCI_PYTHON_USE_FILE@") + + +# ----------------------------------------------------------------------------- +# Entry point for consumers +# ----------------------------------------------------------------------------- +set(SCI_PYTHON_USE_FILE "@SCI_PYTHON_USE_FILE@") \ No newline at end of file diff --git a/Superbuild/PythonExternal.cmake b/Superbuild/PythonExternal.cmake index 21fd01b488..9eac14c6ef 100644 --- a/Superbuild/PythonExternal.cmake +++ b/Superbuild/PythonExternal.cmake @@ -28,7 +28,7 @@ SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base}) -SET(DEFAULT_PYTHON_VERSION "3.11.11") +SET(DEFAULT_PYTHON_VERSION "3.13.1") set(USER_PYTHON_VERSION ${DEFAULT_PYTHON_VERSION} CACHE STRING "Branch name corresponding to Python version number") set_property(CACHE USER_PYTHON_VERSION PROPERTY STRINGS 3.10.16 3.11.11 3.12.8 3.13.1) @@ -110,8 +110,9 @@ ELSE() CONFIGURE_COMMAND PCbuild/build.bat BUILD_IN_SOURCE ON BUILD_COMMAND ${CMAKE_BUILD_TOOL} PCbuild/pcbuild.sln /nologo /property:Configuration=Release /property:Platform=${python_WIN32_ARCH} - INSTALL_COMMAND "${CMAKE_COMMAND}" -E copy_if_different - /PC/pyconfig.h + INSTALL_COMMAND "${CMAKE_COMMAND}" -E + copy_if_different + /PCbuild/${python_WIN32_64BIT_DIR}/pyconfig.h /Include/pyconfig.h ) # build both Release and Debug versions @@ -131,22 +132,24 @@ SET(SCI_PYTHON_MODULE_PARENT_PATH lib) IF(UNIX) SET(SCI_PYTHON_NAME python${SCI_PYTHON_VERSION_SHORT}) IF(APPLE) - # TODO: check Xcode IDE builds... - SET(SCI_PYTHON_FRAMEWORK ${INSTALL_DIR}/Python.framework) SET(SCI_PYTHON_ROOT_DIR ${SCI_PYTHON_FRAMEWORK}/Versions/${SCI_PYTHON_VERSION_SHORT}) SET(SCI_PYTHON_INCLUDE ${SCI_PYTHON_ROOT_DIR}/Headers) SET(SCI_PYTHON_LIBRARY_DIR ${SCI_PYTHON_ROOT_DIR}/lib) SET(SCI_PYTHON_LINK_LIBRARY_DIRS ${SCI_PYTHON_LIBRARY_DIR}) - SET(SCI_PYTHON_EXE ${SCI_PYTHON_ROOT_DIR}/bin/${SCI_PYTHON_NAME}) - SET(SCI_PYTHON_LIBRARY ${SCI_PYTHON_NAME}) - # required by interpreter interface + # Boost.Build requires python3, NOT python3.x inside frameworks + SET(SCI_PYTHON_EXE ${SCI_PYTHON_ROOT_DIR}/bin/python3) + + # Keep SCI_PYTHON_LIBRARY as the module name (python3.11 works here) + SET(SCI_PYTHON_LIBRARY python${SCI_PYTHON_VERSION_SHORT}) + IF(BUILD_HEADLESS) - SET(PYTHON_MODULE_SEARCH_PATH Python.framework/Versions/${SCI_PYTHON_VERSION_SHORT}/${SCI_PYTHON_MODULE_PARENT_PATH}/${SCI_PYTHON_NAME} CACHE INTERNAL "Python modules." FORCE) + SET(PYTHON_MODULE_SEARCH_PATH Python.framework/Versions/${SCI_PYTHON_VERSION_SHORT}/${SCI_PYTHON_MODULE_PARENT_PATH}/${SCI_PYTHON_LIBRARY} CACHE INTERNAL "Python modules." FORCE) ELSE() - SET(PYTHON_MODULE_SEARCH_PATH Frameworks/Python.framework/Versions/${SCI_PYTHON_VERSION_SHORT}/${SCI_PYTHON_MODULE_PARENT_PATH}/${SCI_PYTHON_NAME} CACHE INTERNAL "Python modules." FORCE) + SET(PYTHON_MODULE_SEARCH_PATH Frameworks/Python.framework/Versions/${SCI_PYTHON_VERSION_SHORT}/${SCI_PYTHON_MODULE_PARENT_PATH}/${SCI_PYTHON_LIBRARY} CACHE INTERNAL "Python modules." FORCE) ENDIF() + SET(SCI_PYTHON_FRAMEWORK_ARCHIVE ${INSTALL_DIR}/${python_FRAMEWORK_ARCHIVE}) ELSE() SET(SCI_PYTHON_ROOT_DIR ${INSTALL_DIR}) diff --git a/Superbuild/QwtExternal.cmake b/Superbuild/QwtExternal.cmake index 9d767c41e5..93a27d2323 100644 --- a/Superbuild/QwtExternal.cmake +++ b/Superbuild/QwtExternal.cmake @@ -1,4 +1,4 @@ -# For more information, please see: http://software.sci.utah.edu +# For more information, please see: http://software.sci.utah.edu # # The MIT License # @@ -24,41 +24,123 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base}) +# QwtExternal.cmake — build Qwt via the internal CMake wrapper (preferred over qmake) -SET(QWT_CACHE_ARGS - "-DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE}" - "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}" - "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON" - ) +# ---------------------------- +# Single place to pin wrapper tag +# ---------------------------- +# Bump this tag when you cut a new wrapper release (e.g., v0.1.1, v0.2.0) +set(qwt_WRAPPER_GIT_TAG "v0.1.1") -LIST(APPEND QWT_CACHE_ARGS - "-DQt_PATH:PATH=${Qt_PATH}" - "-DQt5_PATH:PATH=${Qt_PATH}" - "-DQt${QT_VERSION_MAJOR}Core_DIR:PATH=${Qt${QT_VERSION_MAJOR}Core_DIR}" - "-DQt${QT_VERSION_MAJOR}CoreTools_DIR:PATH=${Qt${QT_VERSION_MAJOR}CoreTools_DIR}" - "-DQt${QT_VERSION_MAJOR}Gui_DIR:PATH=${Qt${QT_VERSION_MAJOR}Gui_DIR}" - "-DQt${QT_VERSION_MAJOR}GuiTools_DIR:PATH=${Qt${QT_VERSION_MAJOR}GuiTools_DIR}" -) +# Keep the legacy variable for visibility; it's the upstream Qwt tag +# that your wrapper fetches internally (informational only here). +set(qwt_GIT_TAG "v6.3.0") + +# Ensure ExternalProject directories are rooted under the superbuild 'ep_base' +set_property(DIRECTORY PROPERTY EP_BASE "${ep_base}") -if (${QT_VERSION_MAJOR} STREQUAL "5") - SET(qwt_GIT_TAG "origin/qt5-static-6.1.5") +# ---------------------------- +# Superbuild directories +# ---------------------------- +set(_qwt_src "${CMAKE_BINARY_DIR}/Externals/Source/Qwt_external") +set(_qwt_bin "${CMAKE_BINARY_DIR}/Externals/Build/Qwt_external") +set(_qwt_inst "${CMAKE_BINARY_DIR}/Externals/Install/Qwt_external") + +# Qwt install layout +set(QWT_INSTALL_DIR "${_qwt_inst}") +set(QWT_INCLUDE "${_qwt_inst}/include") +set(QWT_LIBRARY_DIR "${_qwt_inst}/lib") + +# ---------------------------- +# Qt discovery hints (optional) +# ---------------------------- +set(_qwt_extra_cmake_args "") +if(DEFINED Qt6_DIR) + list(APPEND _qwt_extra_cmake_args "-DQt6_DIR=${Qt6_DIR}") +endif() +if(DEFINED Qt5_DIR) + list(APPEND _qwt_extra_cmake_args "-DQt5_DIR=${Qt5_DIR}") +endif() + +include(ExternalProject) + +# Detect whether we're using a multi-config generator (e.g., Visual Studio) +get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_is_multi) + # Forward the native config placeholder (e.g., $(Configuration)) + set(_EP_CFG "${CMAKE_CFG_INTDIR}") else() - SET(qwt_GIT_TAG "origin/qt6-static-6.2.0") + # Single-config (e.g., Ninja/Unix Makefiles) → use CMAKE_BUILD_TYPE (may be empty = default) + if(CMAKE_BUILD_TYPE) + set(_EP_CFG "${CMAKE_BUILD_TYPE}") + else() + set(_EP_CFG ".") # no named config; the placeholder is '.' for single-config + endif() endif() -# If CMake ever allows overriding the checkout command or adding flags, -# git checkout -q will silence message about detached head (harmless). ExternalProject_Add(Qwt_external - GIT_REPOSITORY "https://github.com/CIBC-Internal/Qwt.git" - GIT_TAG ${qwt_GIT_TAG} - PATCH_COMMAND "" - INSTALL_DIR "" - INSTALL_COMMAND "" - CMAKE_CACHE_ARGS ${QWT_CACHE_ARGS} + GIT_REPOSITORY "https://github.com/CIBC-Internal/Qwt-cmake-wrapper.git" + GIT_TAG ${qwt_WRAPPER_GIT_TAG} + + # Make cloning robust for pinned tags (turn off shallow during stabilization) + GIT_SHALLOW 0 # <-- changed from 1 to 0 + GIT_PROGRESS 1 + GIT_SUBMODULES "" # explicit: no submodules + + SOURCE_DIR ${_qwt_src} + BINARY_DIR ${_qwt_bin} + INSTALL_DIR ${_qwt_inst} + + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${_qwt_inst} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + ${_qwt_extra_cmake_args} + + # For pinned tags, skip update step entirely to avoid running git in a non-git tree + UPDATE_COMMAND "" # <-- added: prevents Qwt_external-gitupdate.cmake + + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${_EP_CFG} + INSTALL_COMMAND ${CMAKE_COMMAND} --install . --config ${_EP_CFG} + + LOG_DOWNLOAD 1 + LOG_UPDATE 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 ) -ExternalProject_Get_Property(Qwt_external BINARY_DIR) -SET(QWT_DIR ${BINARY_DIR} CACHE PATH "") +# ---------------------------- +# Exported Qwt library variables (config-aware) +# ---------------------------- + +if(WIN32) + # Qwt wrapper uses qwtd.lib for Debug, qwt.lib for Release + set(QWT_LIBRARY_DEBUG "${QWT_LIBRARY_DIR}/qwtd.lib") + set(QWT_LIBRARY_RELEASE "${QWT_LIBRARY_DIR}/qwt.lib") + + # Generator-expression aware library selection + set(QWT_LIBRARY + $<$:${QWT_LIBRARY_DEBUG}> + $<$:${QWT_LIBRARY_RELEASE}> + $<$:${QWT_LIBRARY_RELEASE}> + $<$:${QWT_LIBRARY_RELEASE}> + ) + +elseif(APPLE) + set(QWT_LIBRARY "${QWT_LIBRARY_DIR}/libqwt.a") +else() + set(QWT_LIBRARY "${QWT_LIBRARY_DIR}/libqwt.a") +endif() + +# Export to SCIRun +# Export to parent (SCIRun superbuild) +set(QWT_INSTALL_DIR "${QWT_INSTALL_DIR}" PARENT_SCOPE) +set(QWT_INCLUDE "${QWT_INCLUDE}" PARENT_SCOPE) +set(QWT_LIBRARY_DIR "${QWT_LIBRARY_DIR}" PARENT_SCOPE) +set(QWT_LIBRARY "${QWT_LIBRARY}" PARENT_SCOPE) -MESSAGE(STATUS "QWT_DIR: ${QWT_DIR}") +message(STATUS "[Qwt_external] WRAPPER_TAG=${qwt_WRAPPER_GIT_TAG} ; QWT_TAG=${qwt_GIT_TAG}") +message(STATUS "[Qwt_external] INSTALL_DIR=${QWT_INSTALL_DIR}") +message(STATUS "[Qwt_external] INCLUDE=${QWT_INCLUDE}") +message(STATUS "[Qwt_external] LIBDIR=${QWT_LIBRARY_DIR}") diff --git a/Superbuild/Superbuild.cmake b/Superbuild/Superbuild.cmake index 70d78bd55f..0b6ea6b20d 100644 --- a/Superbuild/Superbuild.cmake +++ b/Superbuild/Superbuild.cmake @@ -106,27 +106,97 @@ list(GET SCIRUN_QT_MIN_VERSION_LIST 2 QT_VERSION_PATCH) IF(NOT BUILD_HEADLESS) - SET(Qt_PATH "" CACHE PATH "Path to directory where Qt is installed. Directory should contain lib and bin subdirectories.") + SET(Qt_PATH "" CACHE PATH + "Path to directory where Qt is installed. Directory should contain lib and bin subdirectories.") + + # ------------------------------------------------------------ + # Platform-specific Qt auto-detection + # ------------------------------------------------------------ + if(APPLE OR WIN32) + + # If user did NOT set Qt_PATH or path is invalid → try auto-detect + if(NOT Qt_PATH OR NOT IS_DIRECTORY "${Qt_PATH}") + + if(APPLE) + set(_qt_default "/Users/basisunus/Qt/6.10.2/macos") + elseif(WIN32) + set(_qt_default "C:/Qt/6.10.1/msvc2022_64") + endif() + + if(IS_DIRECTORY "${_qt_default}") + message(STATUS + "Qt_PATH not set or invalid — using auto-detected Qt: ${_qt_default}" + ) + + # Force-set Qt_PATH + set(Qt_PATH "${_qt_default}" CACHE PATH "Qt install prefix" FORCE) + + # -------------------------------------------------------- + # Auto-detect Qt version from directory structure + # + # Examples: + # macOS : /Users/.../Qt/6.10.2/macos + # Windows: C:/Qt/6.10.1/msvc2022_64 + # -------------------------------------------------------- + get_filename_component(_qt_parent "${_qt_default}" DIRECTORY) + get_filename_component(_qt_version "${_qt_parent}" NAME) + + set(SCIRUN_QT_MIN_VERSION + "${_qt_version}" + CACHE STRING "Qt version" FORCE) + + string(REPLACE "." ";" SCIRUN_QT_MIN_VERSION_LIST + ${SCIRUN_QT_MIN_VERSION}) + + list(GET SCIRUN_QT_MIN_VERSION_LIST 0 QT_VERSION_MAJOR) + list(GET SCIRUN_QT_MIN_VERSION_LIST 1 QT_VERSION_MINOR) + list(GET SCIRUN_QT_MIN_VERSION_LIST 2 QT_VERSION_PATCH) + + endif() - IF(IS_DIRECTORY ${Qt_PATH}) - if (${QT_VERSION_MAJOR} STREQUAL "6") - FIND_PACKAGE(Qt${QT_VERSION_MAJOR} ${SCIRUN_QT_MIN_VERSION} COMPONENTS DBus DBusTools Core Gui Widgets Network OpenGL Concurrent PrintSupport Svg CoreTools GuiTools WidgetsTools OpenGLWidgets REQUIRED HINTS ${Qt_PATH}) else() - FIND_PACKAGE(Qt${QT_VERSION_MAJOR} ${SCIRUN_QT_MIN_VERSION} COMPONENTS Core Gui Widgets Network OpenGL Concurrent PrintSupport Svg REQUIRED HINTS ${Qt_PATH}) + message(STATUS "Using user-provided Qt_PATH: ${Qt_PATH}") + endif() + + endif() # APPLE OR WIN32 + + # ------------------------------------------------------------ + # Qt package discovery + # ------------------------------------------------------------ + IF(IS_DIRECTORY "${Qt_PATH}") + if (QT_VERSION_MAJOR STREQUAL "6") + FIND_PACKAGE(Qt${QT_VERSION_MAJOR} ${SCIRUN_QT_MIN_VERSION} + COMPONENTS + DBus DBusTools + Core Gui Widgets Network OpenGL Concurrent PrintSupport Svg + CoreTools GuiTools WidgetsTools OpenGLWidgets + REQUIRED + HINTS ${Qt_PATH}) + else() + FIND_PACKAGE(Qt${QT_VERSION_MAJOR} ${SCIRUN_QT_MIN_VERSION} + COMPONENTS + Core Gui Widgets Network OpenGL Concurrent PrintSupport Svg + REQUIRED + HINTS ${Qt_PATH}) endif() ELSE() - MESSAGE(SEND_ERROR "Set Qt_PATH to directory where Qt is installed (containing lib and bin subdirectories) or set BUILD_HEADLESS to ON.") + MESSAGE(SEND_ERROR + "Set Qt_PATH to the Qt install prefix (with bin/ and lib/) or enable BUILD_HEADLESS.") ENDIF() + # ------------------------------------------------------------ + # macOS-only settings + # ------------------------------------------------------------ IF(APPLE) - SET(MACDEPLOYQT_OUTPUT_LEVEL 0 CACHE STRING "Set macdeployqt output level (0-3)") + SET(MACDEPLOYQT_OUTPUT_LEVEL 0 CACHE STRING + "Set macdeployqt output level (0–3)") MARK_AS_ADVANCED(MACDEPLOYQT_OUTPUT_LEVEL) ENDIF() + ELSE() ADD_DEFINITIONS(-DBUILD_HEADLESS) ENDIF() - ########################################### # Configure Doxygen documentation OPTION(BUILD_DOCUMENTATION "Build documentation" OFF) @@ -283,7 +353,10 @@ IF(NOT BUILD_HEADLESS) "-DQt${QT_VERSION_MAJOR}Widgets_DIR:PATH=${Qt${QT_VERSION_MAJOR}Widgets_DIR}" "-DQt${QT_VERSION_MAJOR}Concurrent_DIR:PATH=${Qt${QT_VERSION_MAJOR}Concurrent_DIR}" "-DMACDEPLOYQT_OUTPUT_LEVEL:STRING=${MACDEPLOYQT_OUTPUT_LEVEL}" - "-DQWT_DIR:PATH=${QWT_DIR}" + "-DQWT_INCLUDE:PATH=${QWT_INCLUDE}" + "-DQWT_LIBRARY_DIR:PATH=${QWT_LIBRARY_DIR}" + "-DQWT_LIBRARY:STRING=${QWT_LIBRARY}" + "-DQWT_INSTALL_DIR:PATH=${QWT_INSTALL_DIR}" ) ENDIF() diff --git a/Superbuild/TetgenExternal.cmake b/Superbuild/TetgenExternal.cmake index 3d704281a2..f40cfd33f9 100644 --- a/Superbuild/TetgenExternal.cmake +++ b/Superbuild/TetgenExternal.cmake @@ -24,30 +24,76 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base}) +# ------------------------------------------------------- +# TetgenExternal.cmake - unified Windows/macOS/Linux version +# ------------------------------------------------------- + +set_property(DIRECTORY PROPERTY EP_BASE "${ep_base}") + +# Common CMake args for external TetGen +set(_cmake_args + -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + + -DCMAKE_INSTALL_PREFIX= + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=/lib + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/lib + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/bin +) + +# Handle single‑config (Ninja/Makefiles) +if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE) + list(APPEND _cmake_args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) +endif() + +# Superbuild paths +set(_tetgen_src "${CMAKE_BINARY_DIR}/Externals/Source/Tetgen_external") +set(_tetgen_bin "${CMAKE_BINARY_DIR}/Externals/Build/Tetgen_external") +set(_tetgen_inst "${CMAKE_BINARY_DIR}/Externals/Install/Tetgen_external") + ExternalProject_Add(Tetgen_external - URL "https://github.com/CIBC-Internal/SCIRunTestData/releases/download/test/tetgen1.5.1-beta1.tar.gz" - PATCH_COMMAND "" - INSTALL_COMMAND "" - CMAKE_CACHE_ARGS - -DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - #-DTETLIBRARY + GIT_REPOSITORY https://github.com/CIBC-Internal/TetGen.git + GIT_TAG v1.6.1 + UPDATE_DISCONNECTED 1 + + SOURCE_DIR ${_tetgen_src} + BINARY_DIR ${_tetgen_bin} + + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_GENERATOR_PLATFORM "${CMAKE_GENERATOR_PLATFORM}" + CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}" + + CMAKE_ARGS ${_cmake_args} + INSTALL_COMMAND "" # because we set output dirs directly ) +# Obtain external project properties ExternalProject_Get_Property(Tetgen_external SOURCE_DIR) ExternalProject_Get_Property(Tetgen_external BINARY_DIR) ExternalProject_Get_Property(Tetgen_external INSTALL_DIR) -SET(TETGEN_INCLUDE ${SOURCE_DIR}) -SET(TETGEN_LIBRARY_DIR ${BINARY_DIR}) -SET(TETGEN_USE_FILE ${INSTALL_DIR}/UseTetgen.cmake) -# see Tetgen CMakeLists.txt file -SET(TETGEN_LIBRARY "tet") -SET(Tetgen_DIR ${INSTALL_DIR} CACHE PATH "") - -# Boost is special case - normally this should be handled in external library repo -CONFIGURE_FILE(${SUPERBUILD_DIR}/TetgenConfig.cmake.in ${INSTALL_DIR}/TetgenConfig.cmake @ONLY) -CONFIGURE_FILE(${SUPERBUILD_DIR}/UseTetgen.cmake ${TETGEN_USE_FILE} COPYONLY) - -MESSAGE(STATUS "Tetgen_DIR: ${Tetgen_DIR}") + +# ------------------------------------------------------- +# Unified exported variables (working on Windows + macOS) +# ------------------------------------------------------- + +set(TETGEN_INSTALL_DIR ${_tetgen_inst}) +set(TETGEN_INCLUDE ${SOURCE_DIR}) +set(TETGEN_LIBRARY_DIR ${TETGEN_INSTALL_DIR}/lib) +set(TETGEN_LIBRARY "tet") # matches TetGen’s CMakeLists + +# Create config + use scripts for downstream projects +file(MAKE_DIRECTORY "${TETGEN_INSTALL_DIR}") + +set(TETGEN_USE_FILE "${TETGEN_INSTALL_DIR}/UseTetgen.cmake") + +configure_file(${SUPERBUILD_DIR}/TetgenConfig.cmake.in + ${TETGEN_INSTALL_DIR}/TetgenConfig.cmake @ONLY) + +configure_file(${SUPERBUILD_DIR}/UseTetgen.cmake + ${TETGEN_USE_FILE} COPYONLY) + +# register for find_package(Tetgen CONFIG) +set(Tetgen_DIR ${TETGEN_INSTALL_DIR} CACHE PATH "") + +message(STATUS "[Tetgen_external] INSTALL_DIR=${TETGEN_INSTALL_DIR}") +message(STATUS "[Tetgen_external] USE_FILE=${TETGEN_USE_FILE}") \ No newline at end of file diff --git a/Superbuild/UseBoost.cmake b/Superbuild/UseBoost.cmake deleted file mode 100644 index e1a337fbb3..0000000000 --- a/Superbuild/UseBoost.cmake +++ /dev/null @@ -1,92 +0,0 @@ -include_directories(${SCI_BOOST_INCLUDE}) -link_directories(${SCI_BOOST_LIBRARY_DIR}) -add_definitions(-DBOOST_ALL_NO_LIB) -if(BUILD_WITH_PYTHON) - add_definitions(-DBOOST_PYTHON_STATIC_LIB -DBOOST_PYTHON_STATIC_MODULE) -endif() - -if(UNIX) - add_definitions(-DBOOST_NO_CXX11_ALLOCATOR) -endif() - -check_c_compiler_flag("-arch x86_64" x86_64Supported) -#message("x86_64Supported=${x86_64Supported}") -check_c_compiler_flag("-arch arm64" arm64Supported) -#message("arm64Supported=${arm64Supported}") - -# TODO: if static runtime link is supported, then ABI tag postfix must include s -# see: -# http://www.boost.org/doc/libs/1_58_0/more/getting_started/windows.html -# http://www.boost.org/doc/libs/1_58_0/more/getting_started/unix-variants.html -if(WIN32) - if(BUILD_WITH_PYTHON) - set(DEBUG_POSTFIX "-gyd") - else() - set(DEBUG_POSTFIX "-gd") - endif() - set(boost_LIB_PREFIX "lib") -else() - if(BUILD_WITH_PYTHON) - set(DEBUG_POSTFIX "-yd") - else() - set(DEBUG_POSTFIX "-d") - endif() - set(boost_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) - if(${arm64Supported}) - set(PLATFORM_SUFFIX "a64") - else() - set(PLATFORM_SUFFIX "x64") - endif() -endif() - -foreach(lib ${SCI_BOOST_LIBRARY}) - add_library(${lib} STATIC IMPORTED GLOBAL) - - if((APPLE OR UNIX) AND CMAKE_BUILD_TYPE MATCHES "Debug") - if(${lib} MATCHES "boost_python-mt") - set(FULL_LIB_NAME "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}boost_python${USER_PYTHON_VERSION_MAJOR}${USER_PYTHON_VERSION_MINOR}-mt${DEBUG_POSTFIX}-${PLATFORM_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - set(FULL_LIB_NAME "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}${lib}${DEBUG_POSTFIX}-${PLATFORM_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - endif() - elseif(APPLE OR UNIX) - if(${lib} MATCHES "boost_python-mt") - set(FULL_LIB_NAME "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}boost_python${USER_PYTHON_VERSION_MAJOR}${USER_PYTHON_VERSION_MINOR}-mt-${PLATFORM_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - set(FULL_LIB_NAME "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}${lib}-${PLATFORM_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - endif() - else() - if(${lib} MATCHES "boost_python-mt") - if(WIN32) - set(FULL_LIB_NAME_RELEASE "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}boost_python${USER_PYTHON_VERSION_MAJOR}${USER_PYTHON_VERSION_MINOR}-mt-x64${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(FULL_LIB_NAME_DEBUG "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}boost_python${USER_PYTHON_VERSION_MAJOR}${USER_PYTHON_VERSION_MINOR}-mt${DEBUG_POSTFIX}-x64${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - set(FULL_LIB_NAME_RELEASE "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}boost_python${USER_PYTHON_VERSION_MAJOR}${USER_PYTHON_VERSION_MINOR}-mt${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(FULL_LIB_NAME_DEBUG "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}boost_python${USER_PYTHON_VERSION_MAJOR}${USER_PYTHON_VERSION_MINOR}-mt${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - endif() - else() # non-python libraries - if(WIN32) - set(FULL_LIB_NAME_RELEASE "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}${lib}-x64${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(FULL_LIB_NAME_DEBUG "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}${lib}${DEBUG_POSTFIX}-x64${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - set(FULL_LIB_NAME_RELEASE "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(FULL_LIB_NAME_DEBUG "${SCI_BOOST_LIBRARY_DIR}/${boost_LIB_PREFIX}${lib}${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - endif() - endif() - endif() - - message(STATUS "Configure Boost library ${lib}") - - if(CMAKE_GENERATOR MATCHES "Makefiles") - set_target_properties(${lib} - PROPERTIES - IMPORTED_LOCATION ${FULL_LIB_NAME} - ) - else() # IDEs: Xcode, VS, others... - set_target_properties(${lib} - PROPERTIES - IMPORTED_CONFIGURATIONS "RELEASE;DEBUG" - IMPORTED_LOCATION_RELEASE ${FULL_LIB_NAME_RELEASE} - IMPORTED_LOCATION_DEBUG ${FULL_LIB_NAME_DEBUG} - ) - endif() -endforeach() diff --git a/Superbuild/WriteProjectConfigJam.cmake b/Superbuild/WriteProjectConfigJam.cmake new file mode 100644 index 0000000000..27cc404780 --- /dev/null +++ b/Superbuild/WriteProjectConfigJam.cmake @@ -0,0 +1,3 @@ +file(WRITE "${OUTPUT_FILE}" +"using python : ${VERSION} : ${EXE} : ${INCLUDE} : ${LIBDIR} ; +") diff --git a/scripts/clean-boost-only.ps1 b/scripts/clean-boost-only.ps1 new file mode 100644 index 0000000000..674b6f1ad1 --- /dev/null +++ b/scripts/clean-boost-only.ps1 @@ -0,0 +1,16 @@ +$BuildDir = "C:\Users\Yong\Documents\SCIRun\build" +$BoostDirs = @( + "Boost_external", + "boost", + "_deps" +) + +foreach ($name in $BoostDirs) { + $path = Join-Path $BuildDir $name + if (Test-Path $path) { + Write-Host "Removing $path" + Remove-Item -Recurse -Force $path + } +} + +Write-Host "? Boost-related directories removed." \ No newline at end of file diff --git a/scripts/clean-build.ps1 b/scripts/clean-build.ps1 new file mode 100644 index 0000000000..82d30cc642 --- /dev/null +++ b/scripts/clean-build.ps1 @@ -0,0 +1,54 @@ +# ============================================================ +# Safe SCIRun build directory cleanup +# ============================================================ + +$ExpectedBuildDir = "C:\Users\Yong\Documents\SCIRun\build" + +Write-Host "SCIRun safe cleanup script" +Write-Host "Target directory:" +Write-Host " $ExpectedBuildDir" +Write-Host "" + +# Resolve actual path +try { + $Resolved = (Resolve-Path $ExpectedBuildDir).Path +} catch { + Write-Error "ERROR: Build directory does not exist." + exit 1 +} + +# Safety checks +if ($Resolved -ne $ExpectedBuildDir) { + Write-Error "ERROR: Resolved path mismatch." + Write-Error "Resolved: $Resolved" + exit 1 +} + +if ($Resolved -match "^C:\\Users\\Yong\\?$") { + Write-Error "ERROR: Refusing to operate on user directory." + exit 1 +} + +if ($Resolved -ne "C:\Users\Yong\Documents\SCIRun\build") { + Write-Error "ERROR: Refusing to clean unexpected path: $Resolved" + exit 1 +} + +Write-Host "? Safety checks passed." +Write-Host "" + +# Confirmation +$answer = Read-Host "Type 'DELETE BUILD DIR' to continue" +if ($answer -ne "DELETE BUILD DIR") { + Write-Host "Aborted." + exit 0 +} + +Write-Host "" +Write-Host "Cleaning build contents (directory preserved)..." +Write-Host "" + +Get-ChildItem -Path $Resolved -Force | + Remove-Item -Recurse -Force -ErrorAction Stop + +Write-Host "? Build directory cleaned safely." diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ecee63aada..c28df374f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -228,8 +228,68 @@ IF(BUILD_WITH_PYTHON) INCLUDE(${SCI_PYTHON_USE_FILE}) ENDIF() -CONFIG_STANDARD_EXTERNAL( Boost BoostConfig.cmake ${Boost_DIR} ) -INCLUDE(${SCI_BOOST_USE_FILE}) +# Disable Boost MSVC auto-linking globally +# (prevents Boost headers from injecting -gd / -mt / etc. library names) +add_compile_definitions( + BOOST_ALL_NO_LIB + BOOST_FILESYSTEM_NO_LIB + BOOST_SYSTEM_NO_LIB +) +set(_scirun_boost_components + atomic + chrono + filesystem + program_options + regex + serialization + thread +) + +if(BUILD_WITH_PYTHON) + list(APPEND _scirun_boost_components + python${SCI_PYTHON_VERSION_SHORT_WIN32}) +endif() + +find_package(Boost CONFIG REQUIRED COMPONENTS + ${_scirun_boost_components} +) + +# --------------------------------------------------------------------------- +# Ensure BOOST_ALL_NO_LIB propagates to EVERY consumer of Boost +# by attaching it to the imported Boost targets as INTERFACE +# --------------------------------------------------------------------------- +foreach(_boost_comp ${_scirun_boost_components}) + if(TARGET Boost::${_boost_comp}) + target_compile_definitions(Boost::${_boost_comp} + INTERFACE BOOST_ALL_NO_LIB + ) + endif() +endforeach() + +if(TARGET Boost::filesystem) + target_compile_definitions(Boost::filesystem + INTERFACE + BOOST_FILESYSTEM_NO_LIB + BOOST_SYSTEM_NO_LIB + BOOST_FILESYSTEM_STATIC_LINK + ) +endif() + +# --------------------------------------------------------------------------- +# Diagnostics +# --------------------------------------------------------------------------- +get_property(_allTargets GLOBAL PROPERTY TARGETS) + +message(STATUS "==== Boost-related targets ====") +foreach(t ${_allTargets}) + if(t MATCHES "^Boost::") + message(STATUS " ${t}") + endif() +endforeach() + +message(STATUS "Boost_FOUND = ${Boost_FOUND}") +message(STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS}") +message(STATUS "Boost_LIBRARIES = ${Boost_LIBRARIES}") CONFIG_STANDARD_EXTERNAL( Tny TnyConfig.cmake ${TNY_DIR} ) INCLUDE(${TNY_USE_FILE}) @@ -253,8 +313,10 @@ IF(WIN32) ENDIF() IF(NOT BUILD_HEADLESS) - CONFIG_STANDARD_EXTERNAL( Qwt QwtConfig.cmake ${QWT_DIR} ) - INCLUDE(${QWT_USE_FILE}) +# QWT variables come directly from superbuild + set(SCI_QWT_INCLUDE "${QWT_INCLUDE}") + set(SCI_QWT_LIBRARY_DIR "${QWT_LIBRARY_DIR}") + set(SCI_QWT_LIBRARY "${QWT_LIBRARY}") ENDIF() ######################################################################## diff --git a/src/Core/Algorithms/BrainStimulator/CMakeLists.txt b/src/Core/Algorithms/BrainStimulator/CMakeLists.txt index 1724ecde6c..227e34cf58 100644 --- a/src/Core/Algorithms/BrainStimulator/CMakeLists.txt +++ b/src/Core/Algorithms/BrainStimulator/CMakeLists.txt @@ -60,7 +60,6 @@ TARGET_LINK_LIBRARIES(Algorithms_BrainStimulator Core_Algorithms_Legacy_Fields # Core_Datatypes_Legacy_BrainStimulator Algorithms_Base - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Algorithms/DataIO/CMakeLists.txt b/src/Core/Algorithms/DataIO/CMakeLists.txt index 2ed1adcd93..e4e83b2c57 100644 --- a/src/Core/Algorithms/DataIO/CMakeLists.txt +++ b/src/Core/Algorithms/DataIO/CMakeLists.txt @@ -50,7 +50,6 @@ TARGET_LINK_LIBRARIES(Algorithms_DataIO Core_Datatypes_Mesh Algorithms_Base Core_Datatypes_Legacy_Field - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Algorithms/Describe/CMakeLists.txt b/src/Core/Algorithms/Describe/CMakeLists.txt index 93598799cc..25f0133130 100644 --- a/src/Core/Algorithms/Describe/CMakeLists.txt +++ b/src/Core/Algorithms/Describe/CMakeLists.txt @@ -45,7 +45,6 @@ TARGET_LINK_LIBRARIES(Algorithms_Describe Core_Datatypes_Legacy_Field Algorithms_Field Algorithms_Math - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Algorithms/Factory/CMakeLists.txt b/src/Core/Algorithms/Factory/CMakeLists.txt index 2412f10d31..02d5031675 100644 --- a/src/Core/Algorithms/Factory/CMakeLists.txt +++ b/src/Core/Algorithms/Factory/CMakeLists.txt @@ -41,8 +41,7 @@ IF(GENERATE_MODULE_FACTORY_CODE) MESSAGE(STATUS "Setting up algorithm factory generator") ADD_EXECUTABLE(MakeAlgorithmFactory Generator/MakeAlgorithmFactory.h Generator/MakeAlgorithmFactory.cc) TARGET_LINK_LIBRARIES(MakeAlgorithmFactory - Modules_Factory_Generator - ${SCI_BOOST_LIBRARY}) + Modules_Factory_Generator) SET_PROPERTY(TARGET MakeAlgorithmFactory PROPERTY FOLDER "Modules") # add the command to generate the source code @@ -79,7 +78,6 @@ TARGET_LINK_LIBRARIES(Algorithms_Factory Core_Algorithms_Visualization Core_Algorithms_Legacy_FiniteElements Core_Algorithms_Legacy_Converter - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Algorithms/Factory/Tests/CMakeLists.txt b/src/Core/Algorithms/Factory/Tests/CMakeLists.txt index 45a50e5097..c455da45a9 100644 --- a/src/Core/Algorithms/Factory/Tests/CMakeLists.txt +++ b/src/Core/Algorithms/Factory/Tests/CMakeLists.txt @@ -48,5 +48,4 @@ TARGET_LINK_LIBRARIES(Algorithm_Layer_Test Engine_Network gtest_main gtest - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Core/Algorithms/Field/CMakeLists.txt b/src/Core/Algorithms/Field/CMakeLists.txt index e929ba4805..163729e3a3 100644 --- a/src/Core/Algorithms/Field/CMakeLists.txt +++ b/src/Core/Algorithms/Field/CMakeLists.txt @@ -51,7 +51,6 @@ TARGET_LINK_LIBRARIES(Algorithms_Field Core_Datatypes_Legacy_Field Algorithms_Base Core_Algorithms_Legacy_Fields - ${SCI_BOOST_LIBRARY} ${SCI_CLEAVER2_LIBRARY} ) diff --git a/src/Core/Algorithms/Legacy/Inverse/CMakeLists.txt b/src/Core/Algorithms/Legacy/Inverse/CMakeLists.txt index b562705869..7293735f88 100644 --- a/src/Core/Algorithms/Legacy/Inverse/CMakeLists.txt +++ b/src/Core/Algorithms/Legacy/Inverse/CMakeLists.txt @@ -56,7 +56,6 @@ TARGET_LINK_LIBRARIES(Algorithms_Legacy_Inverse Core_Basis #field basis Core_Algorithms_Legacy_Fields Algorithms_Base - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Algorithms/Math/CMakeLists.txt b/src/Core/Algorithms/Math/CMakeLists.txt index ae073d05b0..5c4c93e86d 100644 --- a/src/Core/Algorithms/Math/CMakeLists.txt +++ b/src/Core/Algorithms/Math/CMakeLists.txt @@ -87,7 +87,6 @@ TARGET_LINK_LIBRARIES(Algorithms_Math Core_Thread Algorithms_Base Core_Parser - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Algorithms/Visualization/CMakeLists.txt b/src/Core/Algorithms/Visualization/CMakeLists.txt index 9c37997e8b..1236e17462 100644 --- a/src/Core/Algorithms/Visualization/CMakeLists.txt +++ b/src/Core/Algorithms/Visualization/CMakeLists.txt @@ -44,7 +44,6 @@ TARGET_LINK_LIBRARIES(Core_Algorithms_Visualization Core_Datatypes_Legacy_Field Graphics_Glyphs Algorithms_Base - ${SCI_BOOST_LIBRARY} ) IF(WITH_OSPRAY) diff --git a/src/Core/Application/CMakeLists.txt b/src/Core/Application/CMakeLists.txt index 00141431fa..d443c794c5 100644 --- a/src/Core/Application/CMakeLists.txt +++ b/src/Core/Application/CMakeLists.txt @@ -52,7 +52,6 @@ TARGET_LINK_LIBRARIES(Core_Application Core_IEPlugin Core_Application_Session Core_Application_Preferences - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Application/Preferences/CMakeLists.txt b/src/Core/Application/Preferences/CMakeLists.txt index eed6832e5c..5b782564eb 100644 --- a/src/Core/Application/Preferences/CMakeLists.txt +++ b/src/Core/Application/Preferences/CMakeLists.txt @@ -43,7 +43,6 @@ SCIRUN_ADD_LIBRARY(Core_Application_Preferences TARGET_LINK_LIBRARIES(Core_Application_Preferences Core_Logging Algorithms_Base - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Application/Session/CMakeLists.txt b/src/Core/Application/Session/CMakeLists.txt index b7991b164a..4d2d04f4c6 100644 --- a/src/Core/Application/Session/CMakeLists.txt +++ b/src/Core/Application/Session/CMakeLists.txt @@ -44,7 +44,6 @@ TARGET_LINK_LIBRARIES(Core_Application_Session Core_Logging Algorithms_Base Core_DatabaseManager - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Basis/CMakeLists.txt b/src/Core/Basis/CMakeLists.txt index a722b29709..0d700a3cff 100644 --- a/src/Core/Basis/CMakeLists.txt +++ b/src/Core/Basis/CMakeLists.txt @@ -95,6 +95,10 @@ SCIRUN_ADD_LIBRARY(Core_Basis ${Core_Basis_SRCS} ) +target_link_libraries(Core_Basis + Boost::headers +) + IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DBUILD_Core_Basis) ENDIF(BUILD_SHARED_LIBS) diff --git a/src/Core/Command/CMakeLists.txt b/src/Core/Command/CMakeLists.txt index 9222492ebf..e27f314031 100644 --- a/src/Core/Command/CMakeLists.txt +++ b/src/Core/Command/CMakeLists.txt @@ -50,7 +50,6 @@ TARGET_LINK_LIBRARIES(Core_Command Core_CommandLine Core_Utils Algorithms_Base - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/CommandLine/CMakeLists.txt b/src/Core/CommandLine/CMakeLists.txt index 31af8bf871..8f4e64acea 100644 --- a/src/Core/CommandLine/CMakeLists.txt +++ b/src/Core/CommandLine/CMakeLists.txt @@ -41,7 +41,8 @@ SCIRUN_ADD_LIBRARY(Core_CommandLine ) TARGET_LINK_LIBRARIES(Core_CommandLine - ${SCI_BOOST_LIBRARY} + Boost::filesystem + Boost::program_options ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/ConsoleApplication/CMakeLists.txt b/src/Core/ConsoleApplication/CMakeLists.txt index ecc78e9dba..44f46d796d 100644 --- a/src/Core/ConsoleApplication/CMakeLists.txt +++ b/src/Core/ConsoleApplication/CMakeLists.txt @@ -47,7 +47,6 @@ SCIRUN_ADD_LIBRARY(Core_ConsoleApplication TARGET_LINK_LIBRARIES(Core_ConsoleApplication Core_Application Core_Command - ${SCI_BOOST_LIBRARY} ) IF(BUILD_WITH_PYTHON) diff --git a/src/Core/DatabaseManager/CMakeLists.txt b/src/Core/DatabaseManager/CMakeLists.txt index 33400d9f49..f37de690b5 100644 --- a/src/Core/DatabaseManager/CMakeLists.txt +++ b/src/Core/DatabaseManager/CMakeLists.txt @@ -41,8 +41,10 @@ SCIRUN_ADD_LIBRARY(Core_DatabaseManager ) TARGET_LINK_LIBRARIES(Core_DatabaseManager - ${SCI_SQLITE_LIBRARY} - ${SCI_BOOST_LIBRARY}) + ${SCI_SQLITE_LIBRARY} + Boost::atomic + Boost::filesystem +) IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DBUILD_Core_DatabaseManager) diff --git a/src/Core/Datatypes/Legacy/Field/CMakeLists.txt b/src/Core/Datatypes/Legacy/Field/CMakeLists.txt index c3aaa8fbd0..9a77f38d19 100644 --- a/src/Core/Datatypes/Legacy/Field/CMakeLists.txt +++ b/src/Core/Datatypes/Legacy/Field/CMakeLists.txt @@ -115,7 +115,6 @@ TARGET_LINK_LIBRARIES(Core_Datatypes_Legacy_Field Core_Util_Legacy Core_Datatypes Core_Datatypes_Legacy_Base - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Datatypes/Legacy/Nrrd/CMakeLists.txt b/src/Core/Datatypes/Legacy/Nrrd/CMakeLists.txt index 5144745f59..00fe16f9dc 100644 --- a/src/Core/Datatypes/Legacy/Nrrd/CMakeLists.txt +++ b/src/Core/Datatypes/Legacy/Nrrd/CMakeLists.txt @@ -51,7 +51,6 @@ TARGET_LINK_LIBRARIES(Core_Datatypes_Legacy_Nrrd Core_Util_Legacy Core_Datatypes Core_Datatypes_Legacy_Base - ${SCI_BOOST_LIBRARY} ${SCI_TEEM_LIBRARY} ) diff --git a/src/Core/Datatypes/Mesh/CMakeLists.txt b/src/Core/Datatypes/Mesh/CMakeLists.txt index dc8d459173..f4306e6187 100644 --- a/src/Core/Datatypes/Mesh/CMakeLists.txt +++ b/src/Core/Datatypes/Mesh/CMakeLists.txt @@ -51,7 +51,6 @@ TARGET_LINK_LIBRARIES(Core_Datatypes_Mesh Core_Basis Core_Utils Core_Util_Legacy - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Exceptions/CMakeLists.txt b/src/Core/Exceptions/CMakeLists.txt index 8064f13967..79f2df3fa5 100644 --- a/src/Core/Exceptions/CMakeLists.txt +++ b/src/Core/Exceptions/CMakeLists.txt @@ -61,4 +61,5 @@ SCIRUN_ADD_LIBRARY(Core_Exceptions_Legacy TARGET_LINK_LIBRARIES(Core_Exceptions_Legacy ${DL_LIBRARY} + Boost::headers ) diff --git a/src/Core/Logging/CMakeLists.txt b/src/Core/Logging/CMakeLists.txt index 089cb35b18..bcfff312af 100644 --- a/src/Core/Logging/CMakeLists.txt +++ b/src/Core/Logging/CMakeLists.txt @@ -51,6 +51,7 @@ SCIRUN_ADD_LIBRARY(Core_Logging TARGET_LINK_LIBRARIES(Core_Logging Core_Utils + Boost::filesystem ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Python/CMakeLists.txt b/src/Core/Python/CMakeLists.txt index 602f1e9b8f..34a434a54d 100644 --- a/src/Core/Python/CMakeLists.txt +++ b/src/Core/Python/CMakeLists.txt @@ -42,6 +42,19 @@ SCIRUN_ADD_LIBRARY(Core_Python ${Core_Python_SRCS} ) +# --- MSVC Debug-only Python ABI enforcement --- +if (MSVC) + target_compile_definitions(Core_Python PRIVATE + $<$:Py_DEBUG> + $<$:Py_TRACE_REFS> + ) + + # Defensive: prevent accidental linkage to release Python + target_link_options(Core_Python PRIVATE + $<$:/NODEFAULTLIB:python313.lib> + ) +endif() + IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DBUILD_Core_Python) ENDIF(BUILD_SHARED_LIBS) @@ -60,8 +73,7 @@ ELSE() ENDIF() TARGET_LINK_LIBRARIES(Core_Python - ${SCI_PYTHON_LIBRARY} - ${SCI_BOOST_LIBRARY} + ${SCI_PYTHON_LIBRARIES} SCIRunPythonAPI Core_Matlab Core_Datatypes diff --git a/src/Core/Python/PythonInterpreter.cc b/src/Core/Python/PythonInterpreter.cc index 5b2ddeb184..bdcebe410d 100644 --- a/src/Core/Python/PythonInterpreter.cc +++ b/src/Core/Python/PythonInterpreter.cc @@ -250,49 +250,171 @@ bool needsSpecialPythonPathTreatment(const std::string& commandLine) #endif } -void PythonInterpreter::initialize_eventhandler(bool needsSpecialPythonPathTreatment, const boost::filesystem::path& libPath) +void PythonInterpreter::initialize_eventhandler(bool needsSpecialPythonPathTreatment, + const boost::filesystem::path& libPath) { PRINT_PY_INIT_DEBUG(1); - using namespace boost::python; + using namespace boost::python; - PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() ); + PythonInterpreterPrivate::lock_type lock(this->private_->get_mutex()); PRINT_PY_INIT_DEBUG(2); - // Register C++ to Python type converters - //RegisterToPythonConverters(); - - // Add the extension modules - PyImport_AppendInittab( "interpreter", PyInit_interpreter ); - PyImport_AppendInittab( "SCIRunPythonAPI", PyInit_SCIRunPythonAPI ); - for ( module_list_type::iterator it = this->private_->modules_.begin(); - it != this->private_->modules_.end(); ++it ) + + // Register built-in extension modules BEFORE initialization (still allowed) + PyImport_AppendInittab("interpreter", PyInit_interpreter); + PyImport_AppendInittab("SCIRunPythonAPI", PyInit_SCIRunPythonAPI); + for (module_list_type::iterator it = this->private_->modules_.begin(); + it != this->private_->modules_.end(); ++it) { - PyImport_AppendInittab( ( *it ).first.c_str(), ( *it ).second ); + PyImport_AppendInittab((*it).first.c_str(), (*it).second); } PRINT_PY_INIT_DEBUG(3); - //std::wcerr << "initialize_eventhandler: program name=" << this->private_->programName() << std::endl; - Py_SetProgramName(const_cast< wchar_t* >(this->private_->programName())); - PRINT_PY_INIT_DEBUG(4); - //std::wcout << "lib_path: " << lib_path.wstring() << std::endl; +#if PY_VERSION_HEX >= 0x03080000 + // ----------------------------- + // Modern init path (Python >=3.8) + // ----------------------------- + // Build a list of module search paths (as wide strings). + std::vector search_paths; + +#if defined(_WIN32) + const std::wstring PATH_SEP(L";"); // not used in PyConfig, but kept for clarity + boost::filesystem::path lib_path = libPath; + boost::filesystem::path top_lib_path = lib_path / PYTHONPATH / PYTHONNAME; + boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload"; + boost::filesystem::path site_lib_path = top_lib_path / "site-packages"; + + // Historically you only used top + site on Windows. + search_paths.push_back(top_lib_path.wstring()); + search_paths.push_back(site_lib_path.wstring()); + +#elif defined(__APPLE__) + const std::wstring PATH_SEP(L":"); // not used in PyConfig, but kept for clarity + boost::filesystem::path lib_path = libPath.parent_path(); + + std::vector lib_path_list; + lib_path_list.push_back(lib_path.parent_path() / boost::filesystem::path("Frameworks") / PYTHONPATH); + lib_path_list.push_back(lib_path / PYTHONPATH); + lib_path_list.push_back(lib_path.parent_path() / PYTHONPATH); + + if (needsSpecialPythonPathTreatment) + { + boost::filesystem::path full_lib_path(PYTHONLIBDIR); + full_lib_path /= PYTHONLIB; + lib_path_list.push_back(full_lib_path); + } + + for (size_t i = 0; i < lib_path_list.size(); ++i) + { + const auto& path = lib_path_list[i]; + boost::filesystem::path plat_lib_path = path / "plat-darwin"; // keep legacy layout if present + boost::filesystem::path dynload_lib_path= path / "lib-dynload"; + boost::filesystem::path site_lib_path = path / "site-packages"; + + search_paths.push_back(path.wstring()); + search_paths.push_back(plat_lib_path.wstring()); + search_paths.push_back(dynload_lib_path.wstring()); + search_paths.push_back(site_lib_path.wstring()); + } + +#else + // Linux and other Unix + const std::wstring PATH_SEP(L":"); // not used in PyConfig, but kept for clarity + boost::filesystem::path lib_path = libPath; + boost::filesystem::path top_lib_path = lib_path / PYTHONPATH; + boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload"; + boost::filesystem::path site_lib_path = top_lib_path / "site-packages"; + boost::filesystem::path plat_lib_path = top_lib_path / "plat-linux"; + + search_paths.push_back(top_lib_path.wstring()); + search_paths.push_back(plat_lib_path.wstring()); + search_paths.push_back(dynload_lib_path.wstring()); + search_paths.push_back(site_lib_path.wstring()); +#endif + + // ----------------------------- + // PyPreConfig / PyConfig setup + // ----------------------------- + PyStatus status; + PyPreConfig preconfig; + PyConfig config; + + // If you previously set Py_IgnoreEnvironmentFlag = 1, use "isolated" preinit. + PyPreConfig_InitIsolatedConfig(&preconfig); + status = Py_PreInitialize(&preconfig); + if (PyStatus_Exception(status)) { + Py_ExitStatusException(status); // exits with message + } + + // Start from isolated defaults (equivalent to ignoring env, no signal handlers, etc.) + PyConfig_InitIsolatedConfig(&config); + + // Replace deprecated Py_SetProgramName(...) with config.program_name + // (Use your stored wide program name) + { + const wchar_t* prog = this->private_->programName(); + status = PyConfig_SetString(&config, &config.program_name, prog); + if (PyStatus_Exception(status)) { + PyConfig_Clear(&config); + Py_ExitStatusException(status); + } + } + + // Replace global flags: + // Py_IgnoreEnvironmentFlag = 1 -> config.use_environment = 0 + // Py_InspectFlag = 1 -> config.inspect = 1 + // Py_OptimizeFlag = 2 -> config.optimization_level = 2 + // Py_NoSiteFlag = 1 (non-Windows)-> config.site_import = 0 + config.use_environment = 0; + config.inspect = 1; + config.optimization_level = 2; +#if !defined(_WIN32) + config.site_import = 0; +#endif + + // Populate module_search_paths (replacement for Py_SetPath) + // NOTE: PyConfig expects absolute, existing directories; add only those that exist. + for (const auto& wpath : search_paths) + { + if (!wpath.empty()) { + // Optional: skip non-existing paths to avoid warnings + // (Converting back to narrow only for filesystem exists check if needed) + // Here we trust the layout and append directly: + status = PyWideStringList_Append(&config.module_search_paths, wpath.c_str()); + if (PyStatus_Exception(status)) { + PyConfig_Clear(&config); + Py_ExitStatusException(status); + } + } + } + + // Finalize initialization + status = Py_InitializeFromConfig(&config); + PyConfig_Clear(&config); + if (PyStatus_Exception(status)) { + Py_ExitStatusException(status); + } + + PRINT_PY_INIT_DEBUG(8); + +#else + // ------------------------------- + // Legacy fallback (Python < 3.8) + // ------------------------------- + Py_SetProgramName(const_cast(this->private_->programName())); + std::wstringstream lib_paths; -#if defined( _WIN32 ) +# if defined(_WIN32) const std::wstring PATH_SEP(L";"); -#else +# else const std::wstring PATH_SEP(L":"); -#endif - PRINT_PY_INIT_DEBUG(5); -#if defined( __APPLE__ ) +# endif + +# if defined(__APPLE__) boost::filesystem::path lib_path = libPath.parent_path(); std::vector lib_path_list; - // relative paths - PRINT_PY_INIT_DEBUG(lib_path); - PRINT_PY_INIT_DEBUG(boost::filesystem::path(PYTHONPATH)); lib_path_list.push_back(lib_path.parent_path() / boost::filesystem::path("Frameworks") / PYTHONPATH); - PRINT_PY_INIT_DEBUG(lib_path_list.back()); lib_path_list.push_back(lib_path / PYTHONPATH); - PRINT_PY_INIT_DEBUG(lib_path_list.back()); lib_path_list.push_back(lib_path.parent_path() / PYTHONPATH); - PRINT_PY_INIT_DEBUG(lib_path_list.back()); if (needsSpecialPythonPathTreatment) { @@ -301,104 +423,95 @@ void PythonInterpreter::initialize_eventhandler(bool needsSpecialPythonPathTreat lib_path_list.push_back(full_lib_path); } - for ( size_t i = 0; i < lib_path_list.size(); ++i ) + for (size_t i = 0; i < lib_path_list.size(); ++i) { auto path = lib_path_list[i]; boost::filesystem::path plat_lib_path = path / "plat-darwin"; boost::filesystem::path dynload_lib_path = path / "lib-dynload"; boost::filesystem::path site_lib_path = path / "site-packages"; - if (i > 0) - { - lib_paths << PATH_SEP; - } + if (i > 0) lib_paths << PATH_SEP; lib_paths << path.wstring() << PATH_SEP << plat_lib_path.wstring() << PATH_SEP << dynload_lib_path.wstring() << PATH_SEP << site_lib_path.wstring(); } + Py_SetPath(lib_paths.str().c_str()); - Py_SetPath( lib_paths.str().c_str() ); -#elif defined (_WIN32) - boost::filesystem::path lib_path = libPath;// Application::Instance().executablePath(); - boost::filesystem::path top_lib_path = lib_path / PYTHONPATH / PYTHONNAME; - //std::cout << "top_lib_path: " << top_lib_path.string() << std::endl; - boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload"; - //std::cout << "dynload_lib_path: " << dynload_lib_path.string() << std::endl; - boost::filesystem::path site_lib_path = top_lib_path / "site-packages"; - //std::cout << "site_lib_path: " << site_lib_path.string() << std::endl; - lib_paths << top_lib_path.wstring() << PATH_SEP - << site_lib_path.wstring(); - //std::wcout << "lib_paths final: " << lib_paths.str() << std::endl; - Py_SetPath( lib_paths.str().c_str() ); - PRINT_PY_INIT_DEBUG(6); -#else - // linux... - boost::filesystem::path lib_path = libPath; - boost::filesystem::path top_lib_path = lib_path / PYTHONPATH; - boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload"; - boost::filesystem::path site_lib_path = top_lib_path / "site-packages"; - boost::filesystem::path plat_lib_path = top_lib_path / "plat-linux"; - lib_paths << top_lib_path.wstring() << PATH_SEP - << plat_lib_path.wstring() << PATH_SEP - << dynload_lib_path.wstring() << PATH_SEP - << site_lib_path.wstring(); - Py_SetPath( lib_paths.str().c_str() ); -#endif +# elif defined(_WIN32) + { + boost::filesystem::path lib_path = libPath; + boost::filesystem::path top_lib_path = lib_path / PYTHONPATH / PYTHONNAME; + boost::filesystem::path site_lib_path = top_lib_path / "site-packages"; + lib_paths << top_lib_path.wstring() << PATH_SEP + << site_lib_path.wstring(); + Py_SetPath(lib_paths.str().c_str()); + } +# else + { + boost::filesystem::path lib_path = libPath; + boost::filesystem::path top_lib_path = lib_path / PYTHONPATH; + boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload"; + boost::filesystem::path site_lib_path = top_lib_path / "site-packages"; + boost::filesystem::path plat_lib_path = top_lib_path / "plat-linux"; + lib_paths << top_lib_path.wstring() << PATH_SEP + << plat_lib_path.wstring() << PATH_SEP + << dynload_lib_path.wstring() << PATH_SEP + << site_lib_path.wstring(); + Py_SetPath(lib_paths.str().c_str()); + } +# endif - // TODO: remove debug print when confident python initialization is stable - //std::wcerr << lib_paths.str() << std::endl; - PRINT_PY_INIT_DEBUG(7); Py_IgnoreEnvironmentFlag = 1; Py_InspectFlag = 1; Py_OptimizeFlag = 2; -#if !defined( _WIN32 ) +# if !defined(_WIN32) Py_NoSiteFlag = 1; -#endif +# endif + Py_Initialize(); PRINT_PY_INIT_DEBUG(8); - // Create the compiler object - PyRun_SimpleString( "from codeop import CommandCompiler\n" - "__internal_compiler = CommandCompiler()\n" ); - boost::python::object main_module = boost::python::import( "__main__" ); - boost::python::object main_namespace = main_module.attr( "__dict__" ); - this->private_->compiler_ = main_namespace[ "__internal_compiler" ]; - this->private_->globals_ = main_namespace; - PRINT_PY_INIT_DEBUG(9); - // Set up the prompt strings - PyRun_SimpleString( "import sys\n" - "try:\n" - "\tsys.ps1\n" - "except AttributeError:\n" - "\tsys.ps1 = \">>> \"\n" - "try:\n" - "\tsys.ps2\n" - "except AttributeError:\n" - "\tsys.ps2 = \"... \"\n" ); - boost::python::object sys_module = main_namespace[ "sys" ]; - boost::python::object sys_namespace = sys_module.attr( "__dict__" ); - this->private_->prompt1_ = boost::python::extract< std::string >( sys_namespace[ "ps1" ] ); - this->private_->prompt2_ = boost::python::extract< std::string >( sys_namespace[ "ps2" ] ); - PRINT_PY_INIT_DEBUG(10); - // Hook up the I/O - PyRun_SimpleString( "import interpreter\n" - "__term_io = interpreter.terminalio()\n" - "__term_err = interpreter.terminalerr()\n" ); - PyRun_SimpleString( "import sys\n" - "sys.stdin = __term_io\n" - "sys.stdout = __term_io\n" - "sys.stderr = __term_err\n" ); +#endif // PY_VERSION_HEX >= 0x03080000 + + PyRun_SimpleString( + "from codeop import CommandCompiler\n" + "__internal_compiler = CommandCompiler()\n" ); + + boost::python::object main_module = boost::python::import("__main__"); + boost::python::object main_namespace = main_module.attr("__dict__"); + this->private_->compiler_ = main_namespace["__internal_compiler"]; + this->private_->globals_ = main_namespace; + + PyRun_SimpleString( + "import sys\n" + "try:\n" + "\tsys.ps1\n" + "except AttributeError:\n" + "\tsys.ps1 = \">>> \"\n" + "try:\n" + "\tsys.ps2\n" + "except AttributeError:\n" + "\tsys.ps2 = \"... \"\n"); + + boost::python::object sys_module = main_namespace["sys"]; + boost::python::object sys_namespace = sys_module.attr("__dict__"); + this->private_->prompt1_ = boost::python::extract(sys_namespace["ps1"]); + this->private_->prompt2_ = boost::python::extract(sys_namespace["ps2"]); PyRun_SimpleString( + "import interpreter\n" + "__term_io = interpreter.terminalio()\n" + "__term_err = interpreter.terminalerr()\n" + "import sys\n" + "sys.stdin = __term_io\n" + "sys.stdout = __term_io\n" + "sys.stderr = __term_err\n" "import atexit\n" "def quit_gracefully():\n" "\tprint('Goodbye!')\n" "atexit.register(quit_gracefully)\n" ); - PRINT_PY_INIT_DEBUG(11); - // Remove intermediate python variables - PyRun_SimpleString( "del (interpreter, __internal_compiler, __term_io, __term_err)\n" ); - PRINT_PY_INIT_DEBUG(12); + PyRun_SimpleString("del (interpreter, __internal_compiler, __term_io, __term_err)\n"); this->private_->initialized_ = true; PRINT_PY_INIT_DEBUG(999); diff --git a/src/Core/Thread/CMakeLists.txt b/src/Core/Thread/CMakeLists.txt index 645a4ec206..685747a6ef 100644 --- a/src/Core/Thread/CMakeLists.txt +++ b/src/Core/Thread/CMakeLists.txt @@ -48,7 +48,7 @@ SCIRUN_ADD_LIBRARY(Core_Thread TARGET_LINK_LIBRARIES(Core_Thread Core_Logging - ${SCI_BOOST_LIBRARY} + Boost::thread ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Utils/CMakeLists.txt b/src/Core/Utils/CMakeLists.txt index d7150ba837..518a47793c 100644 --- a/src/Core/Utils/CMakeLists.txt +++ b/src/Core/Utils/CMakeLists.txt @@ -53,7 +53,7 @@ SCIRUN_ADD_LIBRARY(Core_Utils ) TARGET_LINK_LIBRARIES(Core_Utils - ${SCI_BOOST_LIBRARY} + Boost::atomic ) IF(BUILD_SHARED_LIBS) diff --git a/src/Core/Utils/Legacy/CMakeLists.txt b/src/Core/Utils/Legacy/CMakeLists.txt index f5828d0afc..aa5ce6e68b 100644 --- a/src/Core/Utils/Legacy/CMakeLists.txt +++ b/src/Core/Utils/Legacy/CMakeLists.txt @@ -60,7 +60,6 @@ TARGET_LINK_LIBRARIES(Core_Util_Legacy Core_Exceptions_Legacy Core_Thread Core_Utils - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Dataflow/Engine/Python/CMakeLists.txt b/src/Dataflow/Engine/Python/CMakeLists.txt index acb3abf83e..2120648ca8 100644 --- a/src/Dataflow/Engine/Python/CMakeLists.txt +++ b/src/Dataflow/Engine/Python/CMakeLists.txt @@ -46,8 +46,8 @@ TARGET_LINK_LIBRARIES(SCIRunPythonAPI Core_Thread Core_Datatypes_Legacy_Base Core_Persistent - ${SCI_PYTHON_LIBRARY} - ${SCI_BOOST_LIBRARY} + ${SCI_PYTHON_LIBRARIES} + Boost::python313 ) IF(BUILD_SHARED_LIBS) diff --git a/src/Dataflow/Engine/Scheduler/Tests/CMakeLists.txt b/src/Dataflow/Engine/Scheduler/Tests/CMakeLists.txt index 758ff33e22..6b66556a9b 100644 --- a/src/Dataflow/Engine/Scheduler/Tests/CMakeLists.txt +++ b/src/Dataflow/Engine/Scheduler/Tests/CMakeLists.txt @@ -56,5 +56,4 @@ TARGET_LINK_LIBRARIES(Engine_Scheduler_Tests gtest_main gtest gmock - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Dataflow/Network/CMakeLists.txt b/src/Dataflow/Network/CMakeLists.txt index 76e51cc67f..902dca1aeb 100644 --- a/src/Dataflow/Network/CMakeLists.txt +++ b/src/Dataflow/Network/CMakeLists.txt @@ -94,5 +94,4 @@ TARGET_LINK_LIBRARIES(Dataflow_Network Core_Logging Algorithms_Base Algorithms_Describe - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Dataflow/Serialization/Network/CMakeLists.txt b/src/Dataflow/Serialization/Network/CMakeLists.txt index dbfc56741d..fcf18aa732 100644 --- a/src/Dataflow/Serialization/Network/CMakeLists.txt +++ b/src/Dataflow/Serialization/Network/CMakeLists.txt @@ -58,7 +58,7 @@ TARGET_LINK_LIBRARIES(Core_Serialization_Network Dataflow_Network Core_Datatypes Dataflow_State - ${SCI_BOOST_LIBRARY} + Boost::serialization ) ADD_SUBDIRECTORY(Importer) diff --git a/src/Dataflow/Serialization/Network/Importer/CMakeLists.txt b/src/Dataflow/Serialization/Network/Importer/CMakeLists.txt index 20c273d49d..28951351de 100644 --- a/src/Dataflow/Serialization/Network/Importer/CMakeLists.txt +++ b/src/Dataflow/Serialization/Network/Importer/CMakeLists.txt @@ -53,5 +53,4 @@ TARGET_LINK_LIBRARIES(Core_Serialization_Network_Importer Dataflow_State Core_XMLUtil ${SCI_LIBXML2_LIBRARY} - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Dataflow/Serialization/Network/Tools/CMakeLists.txt b/src/Dataflow/Serialization/Network/Tools/CMakeLists.txt index 04514df2ed..4bd3e15eb0 100644 --- a/src/Dataflow/Serialization/Network/Tools/CMakeLists.txt +++ b/src/Dataflow/Serialization/Network/Tools/CMakeLists.txt @@ -38,5 +38,4 @@ ADD_EXECUTABLE(bundle_toolkit TARGET_LINK_LIBRARIES(bundle_toolkit Core_Serialization_Network - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Graphics/Glyphs/CMakeLists.txt b/src/Graphics/Glyphs/CMakeLists.txt index b0953be2d8..8406020723 100644 --- a/src/Graphics/Glyphs/CMakeLists.txt +++ b/src/Graphics/Glyphs/CMakeLists.txt @@ -55,7 +55,6 @@ TARGET_LINK_LIBRARIES(Graphics_Glyphs Graphics_Datatypes ${OPENGL_LIBRARIES} ${SCI_SPIRE_LIBRARY} - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Graphics/Widgets/CMakeLists.txt b/src/Graphics/Widgets/CMakeLists.txt index 16b03012ec..f278ccab0b 100644 --- a/src/Graphics/Widgets/CMakeLists.txt +++ b/src/Graphics/Widgets/CMakeLists.txt @@ -68,7 +68,6 @@ TARGET_LINK_LIBRARIES(Graphics_Widgets Graphics_Glyphs Graphics_Datatypes ${OPENGL_LIBRARIES} - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Interface/Application/CMakeLists.txt b/src/Interface/Application/CMakeLists.txt index 0887669bfe..fb215a213f 100644 --- a/src/Interface/Application/CMakeLists.txt +++ b/src/Interface/Application/CMakeLists.txt @@ -154,7 +154,6 @@ SET(NonPythonInterface_ApplicationLinkLibraries Interface_Modules_Base Interface_Modules_Factory Core_Application_Preferences - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS} ) diff --git a/src/Interface/Modules/Base/CMakeLists.txt b/src/Interface/Modules/Base/CMakeLists.txt index 9587c9fef7..5ed41e5a10 100644 --- a/src/Interface/Modules/Base/CMakeLists.txt +++ b/src/Interface/Modules/Base/CMakeLists.txt @@ -105,7 +105,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Base Core_Datatypes Dataflow_State Core_Application_Preferences - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/BrainStimulator/CMakeLists.txt b/src/Interface/Modules/BrainStimulator/CMakeLists.txt index 1792891ed9..9a52700383 100644 --- a/src/Interface/Modules/BrainStimulator/CMakeLists.txt +++ b/src/Interface/Modules/BrainStimulator/CMakeLists.txt @@ -65,7 +65,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_BrainStimulator Algorithms_Field Modules_BrainStimulator Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Bundle/CMakeLists.txt b/src/Interface/Modules/Bundle/CMakeLists.txt index 3c0c839815..765f9d9359 100644 --- a/src/Interface/Modules/Bundle/CMakeLists.txt +++ b/src/Interface/Modules/Bundle/CMakeLists.txt @@ -77,7 +77,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Bundle Modules_Legacy_Bundle Core_Algorithms_Legacy_Converter Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES}) IF(BUILD_SHARED_LIBS) diff --git a/src/Interface/Modules/DataIO/CMakeLists.txt b/src/Interface/Modules/DataIO/CMakeLists.txt index 7f1859eb24..93c5a9a974 100644 --- a/src/Interface/Modules/DataIO/CMakeLists.txt +++ b/src/Interface/Modules/DataIO/CMakeLists.txt @@ -78,7 +78,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_DataIO Modules_DataIO Modules_Legacy_Teem_DataIO Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES}) IF(BUILD_SHARED_LIBS) diff --git a/src/Interface/Modules/Factory/CMakeLists.txt b/src/Interface/Modules/Factory/CMakeLists.txt index bb4a3b0c8b..b2182c9b1a 100644 --- a/src/Interface/Modules/Factory/CMakeLists.txt +++ b/src/Interface/Modules/Factory/CMakeLists.txt @@ -43,7 +43,6 @@ IF(GENERATE_MODULE_FACTORY_CODE) ADD_EXECUTABLE(MakeDialogFactory Generator/MakeDialogFactory.h Generator/MakeDialogFactory.cc) TARGET_LINK_LIBRARIES(MakeDialogFactory Modules_Factory_Generator - ${SCI_BOOST_LIBRARY} ) SET_PROPERTY(TARGET MakeDialogFactory PROPERTY FOLDER "Interface") @@ -88,7 +87,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Factory Interface_Modules_Teem Interface_Modules_Visualization Interface_Modules_Python - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Fields/CMakeLists.txt b/src/Interface/Modules/Fields/CMakeLists.txt index 08dfb2107f..9ea797d55b 100644 --- a/src/Interface/Modules/Fields/CMakeLists.txt +++ b/src/Interface/Modules/Fields/CMakeLists.txt @@ -217,7 +217,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Fields Interface_Modules_Base Modules_Legacy_Fields Modules_Basic - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/FiniteElements/CMakeLists.txt b/src/Interface/Modules/FiniteElements/CMakeLists.txt index 36d276daf7..0d80821d1b 100644 --- a/src/Interface/Modules/FiniteElements/CMakeLists.txt +++ b/src/Interface/Modules/FiniteElements/CMakeLists.txt @@ -59,7 +59,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_FiniteElements Algorithms_Field Interface_Modules_Base Modules_Legacy_FiniteElements - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Forward/CMakeLists.txt b/src/Interface/Modules/Forward/CMakeLists.txt index 9e5bab4c3a..ba5143e77d 100644 --- a/src/Interface/Modules/Forward/CMakeLists.txt +++ b/src/Interface/Modules/Forward/CMakeLists.txt @@ -55,7 +55,6 @@ SCIRUN_ADD_LIBRARY(Interface_Modules_Forward TARGET_LINK_LIBRARIES(Interface_Modules_Forward Modules_Legacy_Forward Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Inverse/CMakeLists.txt b/src/Interface/Modules/Inverse/CMakeLists.txt index 40edb4281c..3694d60974 100644 --- a/src/Interface/Modules/Inverse/CMakeLists.txt +++ b/src/Interface/Modules/Inverse/CMakeLists.txt @@ -58,11 +58,16 @@ SCIRUN_ADD_LIBRARY(Interface_Modules_Inverse TARGET_LINK_LIBRARIES(Interface_Modules_Inverse Modules_Legacy_Inverse Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ${SCI_QWT_LIBRARY} ) +if (QT_VERSION_MAJOR EQUAL 6) + TARGET_LINK_LIBRARIES(Interface_Modules_Inverse Qt6::Svg) +elseif(QT_VERSION_MAJOR EQUAL 5) + TARGET_LINK_LIBRARIES(Interface_Modules_Inverse Qt5::Svg) +endif() + IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DBUILD_Interface_Modules_Inverse) ENDIF(BUILD_SHARED_LIBS) diff --git a/src/Interface/Modules/Inverse/SolveInverseProblemWithTikhonovDialog.cc b/src/Interface/Modules/Inverse/SolveInverseProblemWithTikhonovDialog.cc index 59494d8933..d1e2950ecf 100644 --- a/src/Interface/Modules/Inverse/SolveInverseProblemWithTikhonovDialog.cc +++ b/src/Interface/Modules/Inverse/SolveInverseProblemWithTikhonovDialog.cc @@ -30,11 +30,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace SCIRun::Gui; using namespace SCIRun::Dataflow::Networks; diff --git a/src/Interface/Modules/Math/CMakeLists.txt b/src/Interface/Modules/Math/CMakeLists.txt index 8e15fe9dd0..1ceef444a6 100644 --- a/src/Interface/Modules/Math/CMakeLists.txt +++ b/src/Interface/Modules/Math/CMakeLists.txt @@ -128,18 +128,34 @@ SCIRUN_ADD_LIBRARY(Interface_Modules_Math ${Interface_Modules_Math_SOURCES} ) +#target_compile_definitions(Interface_Modules_Math +# PRIVATE +# QWT_STATIC +# QWT_NO_DLL +#) + TARGET_LINK_LIBRARIES(Interface_Modules_Math Algorithms_Math Modules_Math Modules_Legacy_Math Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ${SCI_QWT_LIBRARY} ) +if (QT_VERSION_MAJOR EQUAL 6) + TARGET_LINK_LIBRARIES(Interface_Modules_Math + Qt6::Svg + Qt6::PrintSupport + ) +elseif(QT_VERSION_MAJOR EQUAL 5) + TARGET_LINK_LIBRARIES(Interface_Modules_Math + Qt5::Svg + Qt5::PrintSupport + ) +endif() -ADD_DEFINITIONS(-DQWT_DLL) +#ADD_DEFINITIONS(-DQWT_DLL) IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DBUILD_Interface_Modules_Math) diff --git a/src/Interface/Modules/Math/PlotDialog.cc b/src/Interface/Modules/Math/PlotDialog.cc index be0c9de005..66e108022d 100644 --- a/src/Interface/Modules/Math/PlotDialog.cc +++ b/src/Interface/Modules/Math/PlotDialog.cc @@ -28,17 +28,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifndef Q_MOC_RUN #include #endif diff --git a/src/Interface/Modules/Math/PlotDialog.h b/src/Interface/Modules/Math/PlotDialog.h index fed93d531b..90c0cbc273 100644 --- a/src/Interface/Modules/Math/PlotDialog.h +++ b/src/Interface/Modules/Math/PlotDialog.h @@ -30,8 +30,8 @@ #define INTERFACE_MODULES_MATH_PLOTDIALOG_H #include -#include -#include +#include +#include #include class QwtPlotMarker; diff --git a/src/Interface/Modules/Matlab/CMakeLists.txt b/src/Interface/Modules/Matlab/CMakeLists.txt index a2c509a131..afa7429a48 100644 --- a/src/Interface/Modules/Matlab/CMakeLists.txt +++ b/src/Interface/Modules/Matlab/CMakeLists.txt @@ -64,7 +64,6 @@ SCIRUN_ADD_LIBRARY(Interface_Modules_Matlab TARGET_LINK_LIBRARIES(Interface_Modules_Matlab Modules_Legacy_Matlab_DataIO Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES}) IF(BUILD_SHARED_LIBS) diff --git a/src/Interface/Modules/Python/CMakeLists.txt b/src/Interface/Modules/Python/CMakeLists.txt index c1d1689a34..8019bf2a48 100644 --- a/src/Interface/Modules/Python/CMakeLists.txt +++ b/src/Interface/Modules/Python/CMakeLists.txt @@ -71,7 +71,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Python Modules_Python Modules_Basic Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Render/CMakeLists.txt b/src/Interface/Modules/Render/CMakeLists.txt index 449c718938..a0e18a25e3 100644 --- a/src/Interface/Modules/Render/CMakeLists.txt +++ b/src/Interface/Modules/Render/CMakeLists.txt @@ -134,7 +134,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Render ${OPENGL_LIBRARIES} ${QT_OPENGL_LIBRARY} ${SCI_SPIRE_LIBRARY} - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ${SCI_FREETYPE_LIBRARY} ${SCI_LODEPNG_LIBRARY} @@ -143,6 +142,11 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Render ) TARGET_LINK_LIBRARIES(Interface_Modules_Render ${QT_GRAPHICS_LIBRARIES}) +if (QT_VERSION_MAJOR EQUAL 6) + TARGET_LINK_LIBRARIES(Interface_Modules_Render Qt6::Svg) +elseif(QT_VERSION_MAJOR EQUAL 5) + TARGET_LINK_LIBRARIES(Interface_Modules_Render Qt5::Svg) +endif() IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DBUILD_Interface_Modules_Render) diff --git a/src/Interface/Modules/Render/Tests/CMakeLists.txt b/src/Interface/Modules/Render/Tests/CMakeLists.txt index 7bcd86358d..59bbe9bbfb 100644 --- a/src/Interface/Modules/Render/Tests/CMakeLists.txt +++ b/src/Interface/Modules/Render/Tests/CMakeLists.txt @@ -42,7 +42,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Render_Tests Interface_Modules_Render ${OPENGL_LIBRARIES} ${QT_OPENGL_LIBRARY} - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} Testing_Utils Testing_ModuleTestBase diff --git a/src/Interface/Modules/Render/ViewSceneControlsDock.cc b/src/Interface/Modules/Render/ViewSceneControlsDock.cc index bd47edd226..cc4026aff9 100644 --- a/src/Interface/Modules/Render/ViewSceneControlsDock.cc +++ b/src/Interface/Modules/Render/ViewSceneControlsDock.cc @@ -35,8 +35,8 @@ #include #include -#include -#include +#include +#include using namespace SCIRun; using namespace SCIRun::Core; diff --git a/src/Interface/Modules/String/CMakeLists.txt b/src/Interface/Modules/String/CMakeLists.txt index 7f7367b032..0ee39aefcf 100644 --- a/src/Interface/Modules/String/CMakeLists.txt +++ b/src/Interface/Modules/String/CMakeLists.txt @@ -73,7 +73,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_String Modules_Legacy_String Interface_Modules_Base Modules_Legacy_Bundle - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Teem/CMakeLists.txt b/src/Interface/Modules/Teem/CMakeLists.txt index 5fc572a1fd..114f66450f 100644 --- a/src/Interface/Modules/Teem/CMakeLists.txt +++ b/src/Interface/Modules/Teem/CMakeLists.txt @@ -69,7 +69,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Teem Modules_Legacy_Teem_Tend Modules_Legacy_Teem_Converters Interface_Modules_Base - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Interface/Modules/Visualization/CMakeLists.txt b/src/Interface/Modules/Visualization/CMakeLists.txt index a3585302bf..3ee54b54e3 100644 --- a/src/Interface/Modules/Visualization/CMakeLists.txt +++ b/src/Interface/Modules/Visualization/CMakeLists.txt @@ -93,7 +93,6 @@ TARGET_LINK_LIBRARIES(Interface_Modules_Visualization Core_Algorithms_Legacy_Fields Interface_Modules_Base Core_Application - ${SCI_BOOST_LIBRARY} ${QT_LIBRARIES} ) diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index e546b24912..dca07858bd 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -76,6 +76,30 @@ ELSEIF(WIN32) ADD_EXECUTABLE(${APPLICATION_NAME} WIN32 ${SCIRunMain_SOURCES}) + # Windows + MSVC + non-headless: enable Qt runtime for VS debugging + IF(WIN32 AND MSVC AND NOT BUILD_HEADLESS) + + # Detect Qt version (Qt6 preferred, fallback to Qt5) + IF(TARGET Qt6::qmake) + SET(_qt_qmake_target Qt6::qmake) + ELSEIF(TARGET Qt5::qmake) + SET(_qt_qmake_target Qt5::qmake) + ELSE() + SET(_qt_qmake_target "") + ENDIF() + + IF(_qt_qmake_target) + get_target_property(_qt_qmake_exe ${_qt_qmake_target} LOCATION) + get_filename_component(_qt_bin_dir "${_qt_qmake_exe}" DIRECTORY) + + set_property(TARGET ${APPLICATION_NAME} PROPERTY + VS_DEBUGGER_ENVIRONMENT + "PATH=${_qt_bin_dir};%PATH%" + ) + ENDIF() + + ENDIF() + # TODO: probably need this for Xcode IF(WIN32 AND MSVC) # TODO: more build types to be supported? @@ -101,7 +125,7 @@ ELSEIF(WIN32) ${SCIRun_BINARY_DIR}/Assets ${SCIRun_BINARY_DIR}/$/Assets ) -ENDIF() + ENDIF() ELSE() ADD_EXECUTABLE(${APPLICATION_NAME} ${SCIRunMain_SOURCES}) diff --git a/src/Modules/DataIO/CMakeLists.txt b/src/Modules/DataIO/CMakeLists.txt index 3dd871b301..20619f85cc 100644 --- a/src/Modules/DataIO/CMakeLists.txt +++ b/src/Modules/DataIO/CMakeLists.txt @@ -65,7 +65,6 @@ TARGET_LINK_LIBRARIES(Modules_DataIO Algorithms_DataIO Core_Algorithms_Legacy_DataIO Core_ImportExport - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Modules/DataIO/Tests/CMakeLists.txt b/src/Modules/DataIO/Tests/CMakeLists.txt index 86d88ae9af..921780184d 100644 --- a/src/Modules/DataIO/Tests/CMakeLists.txt +++ b/src/Modules/DataIO/Tests/CMakeLists.txt @@ -50,5 +50,4 @@ TARGET_LINK_LIBRARIES(Modules_DataIO_Tests gtest_main gtest gmock - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Modules/Factory/Generator/CMakeLists.txt b/src/Modules/Factory/Generator/CMakeLists.txt index 644f5e7f19..1c213a6c8d 100644 --- a/src/Modules/Factory/Generator/CMakeLists.txt +++ b/src/Modules/Factory/Generator/CMakeLists.txt @@ -41,14 +41,14 @@ SCIRUN_ADD_LIBRARY(Modules_Factory_Generator ) TARGET_LINK_LIBRARIES(Modules_Factory_Generator - ${SCI_BOOST_LIBRARY} + Boost::filesystem ) SET_PROPERTY(TARGET Modules_Factory_Generator PROPERTY FOLDER "Modules") IF(GENERATE_MODULE_FACTORY_CODE) ADD_EXECUTABLE(MakeModuleFactory MakeModuleFactory.h MakeModuleFactory.cc) - TARGET_LINK_LIBRARIES(MakeModuleFactory Modules_Factory_Generator ${SCI_BOOST_LIBRARY}) + TARGET_LINK_LIBRARIES(MakeModuleFactory Modules_Factory_Generator) SET_PROPERTY(TARGET MakeModuleFactory PROPERTY FOLDER "Modules") ENDIF() diff --git a/src/Modules/Legacy/Fields/InterfaceWithTetGenImpl.cc b/src/Modules/Legacy/Fields/InterfaceWithTetGenImpl.cc index 13240f72e8..7e4a7793b3 100644 --- a/src/Modules/Legacy/Fields/InterfaceWithTetGenImpl.cc +++ b/src/Modules/Legacy/Fields/InterfaceWithTetGenImpl.cc @@ -47,6 +47,8 @@ #include #include +#include +#include #include @@ -323,9 +325,23 @@ FieldHandle detail::InterfaceWithTetGenImplImpl::runImpl(const std::deque(cmmd_ln.c_str()), &in, &out, addtgio); + // --- TetGen 1.6+ behavior-based API --- + tetgenbehavior b; + + // parse_commandline expects a mutable C string; copy cmmd_ln. + std::string opts = cmmd_ln; // cmmd_ln is your existing switches string + std::vector buf(opts.begin(), opts.end()); + buf.push_back('\0'); // NUL-terminate + + b.parse_commandline(buf.data()); + + // Map old call: + // tetrahedralize(char* switches, &in, &out, addtgio); + // to new signature: + // tetrahedralize(tetgenbehavior*, &in, &out, addin, bgmmesh); + tetrahedralize(&b, &in, &out, addtgio, nullptr); } - catch(std::exception& e) + catch (std::exception& e) { module_->error(std::string("TetGen failed to generate a mesh: ") + e.what()); return nullptr; diff --git a/src/Modules/Legacy/Matlab/DataIO/Tests/CMakeLists.txt b/src/Modules/Legacy/Matlab/DataIO/Tests/CMakeLists.txt index 671c8cde78..c749c8e989 100644 --- a/src/Modules/Legacy/Matlab/DataIO/Tests/CMakeLists.txt +++ b/src/Modules/Legacy/Matlab/DataIO/Tests/CMakeLists.txt @@ -49,5 +49,4 @@ TARGET_LINK_LIBRARIES(Modules_Legacy_Matlab_DataIO_Tests gtest_main gtest gmock - ${SCI_BOOST_LIBRARY} ) diff --git a/src/Testing/ModuleTestBase/CMakeLists.txt b/src/Testing/ModuleTestBase/CMakeLists.txt index c01c01e36b..b4811d4829 100644 --- a/src/Testing/ModuleTestBase/CMakeLists.txt +++ b/src/Testing/ModuleTestBase/CMakeLists.txt @@ -49,7 +49,6 @@ TARGET_LINK_LIBRARIES(Testing_ModuleTestBase Dataflow_State gtest gmock - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS) diff --git a/src/Testing/Utils/CMakeLists.txt b/src/Testing/Utils/CMakeLists.txt index f41c087f49..92336f0b3f 100644 --- a/src/Testing/Utils/CMakeLists.txt +++ b/src/Testing/Utils/CMakeLists.txt @@ -50,7 +50,6 @@ TARGET_LINK_LIBRARIES(Testing_Utils Core_Algorithms_Legacy_Fields gtest gmock - ${SCI_BOOST_LIBRARY} ) IF(BUILD_SHARED_LIBS)