From 1791adb713b648adde7a059f9b951240816d5862 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 3 Aug 2023 12:26:56 +0200 Subject: [PATCH 1/2] patch to support Windows 32 bits --- Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 7329be33116..718d37f25b0 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -119,6 +119,11 @@ function(CGAL_setup_CGAL_dependencies target) target_link_options(${target} INTERFACE -fsanitize=address) endif() # Now setup compilation flags + if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + message(STATUS "Boost MP is turned off for all Windows 32 bits architectures!") + target_compile_options(${target} INTERFACE "-DCGAL_DO_NOT_USE_BOOST_MP") + endif() + if(MSVC) target_compile_options(${target} INTERFACE "-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS") From cf0c6c07822050346cf0fd760ac0035b179de6cf Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 3 Aug 2023 14:05:37 +0200 Subject: [PATCH 2/2] tweak in CGAL/boost_mp.h instead --- .../cmake/modules/CGAL_SetupCGALDependencies.cmake | 5 ----- Number_types/include/CGAL/boost_mp.h | 12 +++++++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 718d37f25b0..7329be33116 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -119,11 +119,6 @@ function(CGAL_setup_CGAL_dependencies target) target_link_options(${target} INTERFACE -fsanitize=address) endif() # Now setup compilation flags - if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) - message(STATUS "Boost MP is turned off for all Windows 32 bits architectures!") - target_compile_options(${target} INTERFACE "-DCGAL_DO_NOT_USE_BOOST_MP") - endif() - if(MSVC) target_compile_options(${target} INTERFACE "-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS") diff --git a/Number_types/include/CGAL/boost_mp.h b/Number_types/include/CGAL/boost_mp.h index 3dcaadcad21..b98980acbc5 100644 --- a/Number_types/include/CGAL/boost_mp.h +++ b/Number_types/include/CGAL/boost_mp.h @@ -20,8 +20,18 @@ // easy solution. // MSVC had trouble with versions <= 1.69: // https://github.com/boostorg/multiprecision/issues/98 +// +// Disable also on Windows 32 bits +// because CGAL/cpp_float.h assumes _BitScanForward64 is available +// See https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64 +// +// Disable also with PowerPC processors, with Boost<1.80 because of that bug: +// https://github.com/boostorg/multiprecision/pull/421 +// #if !defined CGAL_DO_NOT_USE_BOOST_MP && \ - (!defined _MSC_VER || BOOST_VERSION >= 107000) + (!defined _MSC_VER || BOOST_VERSION >= 107000) && \ + (!defined _WIN32 || defined _WIN64) && \ + (BOOST_VERSION >= 108000 || (!defined _ARCH_PPC && !defined _ARCH_PPC64)) #define CGAL_USE_BOOST_MP 1 #include