Fixes when neither LEDA nor GMP is available (#7960)

This commit is contained in:
Sebastien Loriot 2024-01-19 13:57:12 +01:00 committed by GitHub
commit 128b169b24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 147 additions and 96 deletions

View File

@ -72,13 +72,23 @@ if(CGAL_DISABLE_GMP)
endif()
if(CGAL_DISABLE_GMP)
message(STATUS "GMP is disable. Try to use LEDA instead.")
set(GMPZ_NT ${LEDA_INT_NT})
set(QUOTIENT_CGAL_GMPZ_NT ${LEDA_RAT_NT})
set(CGAL_GMPQ_NT ${LEDA_RAT_NT})
set(LAZY_CGAL_GMPQ_NT ${LAZY_LEDA_RAT_NT})
set(LAZY_GMPZ_NT ${LAZY_LEDA_RAT_NT})
set(CGAL_GMPZ_NT ${LEDA_INT_NT})
if (CGAL_USE_LEDA)
message(STATUS "GMP is disabled, try to use LEDA instead.")
set(GMPZ_NT ${LEDA_INT_NT})
set(QUOTIENT_CGAL_GMPZ_NT ${LEDA_RAT_NT})
set(CGAL_GMPQ_NT ${LEDA_RAT_NT})
set(LAZY_CGAL_GMPQ_NT ${LAZY_LEDA_RAT_NT})
set(LAZY_GMPZ_NT ${LAZY_LEDA_RAT_NT})
set(CGAL_GMPZ_NT ${LEDA_INT_NT})
else()
message(STATUS "GMP is disabled, try to use MP float instead.")
set(GMPZ_NT ${MP_FLOAT_NT})
set(QUOTIENT_CGAL_GMPZ_NT ${QUOTIENT_MP_FLOAT_NT})
set(CGAL_GMPQ_NT ${QUOTIENT_MP_FLOAT_NT})
set(LAZY_CGAL_GMPQ_NT ${LAZY_QUOTIENT_MP_FLOAT_NT})
set(LAZY_GMPZ_NT ${LAZY_QUOTIENT_MP_FLOAT_NT})
set(CGAL_GMPZ_NT ${MP_FLOAT_NT})
endif()
endif()
set(COMPARE 1)

View File

@ -78,13 +78,23 @@ CORE_INT_NT=15
CORE_RAT_NT=16
if [ -n "${CGAL_DISABLE_GMP}" ]; then
echo GMP is disable. Try to use LEDA instead.
GMPZ_NT=$LEDA_INT_NT
QUOTIENT_CGAL_GMPZ_NT=$LEDA_RAT_NT
CGAL_GMPQ_NT=$LEDA_RAT_NT
LAZY_CGAL_GMPQ_NT=$LAZY_LEDA_RAT_NT
LAZY_GMPZ_NT=$LAZY_LEDA_RAT_NT
CGAL_GMPZ_NT=$LEDA_INT_NT
if [ -n "CGAL_USE_LEDA" ]; then
echo GMP is disabled, try to use LEDA instead.
GMPZ_NT=$LEDA_INT_NT
QUOTIENT_CGAL_GMPZ_NT=$LEDA_RAT_NT
CGAL_GMPQ_NT=$LEDA_RAT_NT
LAZY_CGAL_GMPQ_NT=$LAZY_LEDA_RAT_NT
LAZY_GMPZ_NT=$LAZY_LEDA_RAT_NT
CGAL_GMPZ_NT=$LEDA_INT_NT
else
echo GMP is disabled, try to use MP float instead.
GMPZ_NT=$MP_FLOAT_NT
QUOTIENT_CGAL_GMPZ_NT=$QUOTIENT_MP_FLOAT_NT
CGAL_GMPQ_NT=$QUOTIENT_MP_FLOAT_NT
LAZY_CGAL_GMPQ_NT=$LAZY_QUOTIENT_MP_FLOAT_NT
LAZY_GMPZ_NT=$LAZY_QUOTIENT_MP_FLOAT_NT
CGAL_GMPZ_NT=$MP_FLOAT_NT
fi
fi
COMPARE=1

View File

@ -5,21 +5,10 @@ find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core)
find_package(LEDA QUIET)
if(CGAL_Core_FOUND OR LEDA_FOUND)
if(MSVC)
# Turn off a boost related warning that appears with VC2015
# boost_1_65_1\boost\graph\named_function_params.hpp(240) :
# warning C4172: returning address of local variable or temporary
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4172")
endif()
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
create_single_source_cgal_program("compute_cones.cpp")
create_single_source_cgal_program("theta_io.cpp")
else()
message("NOTICE: This program requires the CGAL_Core library (or LEDA), and will not be compiled.")
endif()
create_single_source_cgal_program("dijkstra_theta.cpp")

View File

@ -30,7 +30,9 @@
#include <CGAL/Polynomial.h>
#include <CGAL/number_type_config.h> // CGAL_PI is defined there
#include <CGAL/enum.h>
#if defined(CGAL_USE_LEDA) || defined(CGAL_USE_CORE)
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
#endif
#include <CGAL/Aff_transformation_2.h>
namespace CGAL {
@ -111,7 +113,7 @@ public:
};
#if defined(CGAL_USE_LEDA) || defined(CGAL_USE_CORE)
/*
The specialised functor for computing the directions of cone boundaries exactly
with a given cone number and a given initial direction.
@ -209,6 +211,7 @@ public:
} // end of operator()
}; // end of functor specialization: Compute_cone_..._2
#endif
} // namespace CGAL

View File

@ -22,7 +22,6 @@
#include <CGAL/Polynomial.h>
#include <CGAL/number_utils.h>
#include <CGAL/enum.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
#include <CGAL/Aff_transformation_2.h>
#include <boost/config.hpp>

View File

@ -5,12 +5,16 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Cone_spanners_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
create_single_source_cgal_program("cones_inexact.cpp")
create_single_source_cgal_program("theta_inexact.cpp")
create_single_source_cgal_program("yao_inexact.cpp")
if(CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("cones_exact.cpp")
create_single_source_cgal_program("theta_exact.cpp")
create_single_source_cgal_program("yao_exact.cpp")
else()
message("NOTICE: Some tests require the CGAL_Core library (or LEDA), and will not be compiled.")
endif()

View File

@ -6,11 +6,10 @@ project(Envelope_3_Tests)
find_package(CGAL REQUIRED COMPONENTS Core)
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
create_single_source_cgal_program("triangles_test.cpp")
if (CGAL_Core_FOUND)
create_single_source_cgal_program("spheres_test.cpp")
else()
message("NOTICE: A test requires CGAL_Core, and will not be compiled.")
endif()

View File

@ -5,7 +5,7 @@
int main ()
{
bool UNTESTED_TRAITS_AS_CORE_IS_NOT_ISTALLED;
bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED;
std::cout << std::endl
<< "WARNING: Core is not installed, "
<< "skipping the test ..."

View File

@ -5,6 +5,11 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Hyperbolic_triangulation_2_Examples)
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
create_single_source_cgal_program("ht2_example.cpp")
create_single_source_cgal_program("ht2_example_color.cpp")
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("ht2_example.cpp")
create_single_source_cgal_program("ht2_example_color.cpp")
else()
message("NOTICE: Examples require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -5,11 +5,16 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Hyperbolic_triangulation_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
create_single_source_cgal_program("ht2_test_clear.cpp")
create_single_source_cgal_program("ht2_test_locate.cpp")
create_single_source_cgal_program("ht2_test_remove.cpp")
create_single_source_cgal_program("ht2_test_swap.cpp")
create_single_source_cgal_program("ht2_test_copy.cpp")
create_single_source_cgal_program("ht2_test_hyperbolic_circulator.cpp")
create_single_source_cgal_program("ht2_test_insert_degenerate.cpp")
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("ht2_test_clear.cpp")
create_single_source_cgal_program("ht2_test_locate.cpp")
create_single_source_cgal_program("ht2_test_remove.cpp")
create_single_source_cgal_program("ht2_test_swap.cpp")
create_single_source_cgal_program("ht2_test_copy.cpp")
create_single_source_cgal_program("ht2_test_hyperbolic_circulator.cpp")
create_single_source_cgal_program("ht2_test_insert_degenerate.cpp")
else()
message("NOTICE: Tests require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -14,7 +14,9 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Simple_homogeneous.h>
#if defined(CGAL_USE_CORE) || defined(CGAL_USE_LEDA)
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_kth_root.h>
#endif
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Has_conversion.h>
@ -36,13 +38,16 @@ int main()
typedef CGAL::Simple_homogeneous<NT_exact> SH;
typedef CGAL::Filtered_kernel<SH> FSH;
#if defined(CGAL_USE_CORE) || defined(CGAL_USE_LEDA)
typedef CGAL::Exact_predicates_exact_constructions_kernel_with_kth_root EPECK;
CGAL_USE_TYPE(EPECK);
#endif
CGAL_USE_TYPE(ASC);
CGAL_USE_TYPE(FSC);
CGAL_USE_TYPE(SH);
CGAL_USE_TYPE(FSH);
CGAL_USE_TYPE(EPECK);
assert((CGAL::Has_conversion<SC, SC, SC::Point_2, SC::Point_2>::value));
assert((CGAL::Has_conversion<SC, SC, SC::Object_2, SC::Object_2>::value));
@ -55,10 +60,12 @@ int main()
assert((CGAL::Has_conversion<SH, FSH, SH::Vector_3, FSH::Vector_3>::value));
assert((CGAL::Has_conversion<SC, ASC, SC::Sphere_3, ASC::Sphere_3>::value));
#if defined(CGAL_USE_CORE) || defined(CGAL_USE_LEDA)
assert((CGAL::Has_conversion<SC, EPECK, SC::Triangle_2, EPECK::Triangle_2>::value));
assert((CGAL::Has_conversion<EPECK, SC, EPECK::Circle_3, SC::Circle_3>::value));
assert(!(CGAL::Has_conversion<SC, EPECK, SC::Weighted_point_2, EPECK::Weighted_point_3>::value));
#endif
assert(!(CGAL::Has_conversion<SC, ASC, SC::Point_2, ASC::Weighted_point_2>::value));
// below will produce static assert failures

View File

@ -1,14 +1,9 @@
#include <CGAL/Homogeneous.h>
#include <CGAL/Nef_polyhedron_S2.h>
#include <CGAL/test_macros.h>
#include <CGAL/Exact_integer.h>
#ifdef CGAL_USE_LEDA
#include <CGAL/leda_integer.h>
typedef leda_integer NT;
#else
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz NT;
#endif
typedef CGAL::Exact_integer NT;
typedef CGAL::Homogeneous<NT> Kernel;
typedef CGAL::Nef_polyhedron_S2<Kernel> Nef_polyhedron;

View File

@ -19,6 +19,11 @@
#include <CGAL/Gmpz.h>
#endif
#include <CGAL/float.h>
#include <CGAL/double.h>
#include <CGAL/int.h>
#if 0
#ifdef CGAL_USE_CLN
#include <CGAL/CLN/cl_integer.h>

View File

@ -1,7 +1,7 @@
// #define CGAL_PMP_COMPUTE_NORMAL_DEBUG_PP
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
//#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polyhedron_3.h>
@ -15,10 +15,10 @@
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK;
typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK;
//typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK;
typedef CGAL::Surface_mesh<EPICK::Point_3> EPICK_SM;
typedef CGAL::Surface_mesh<EPECK::Point_3> EPECK_SM;
//typedef CGAL::Surface_mesh<EPECK::Point_3> EPECK_SM;
namespace PMP = CGAL::Polygon_mesh_processing;
@ -100,8 +100,8 @@ void test(const Mesh& mesh,
{
if (PMP::is_degenerate_triangle_face(f, mesh))
{
if (std::is_same<K, EPECK>())
assert(get(fnormals, f) == CGAL::NULL_VECTOR);
// if (std::is_same<K, EPECK>())
// assert(get(fnormals, f) == CGAL::NULL_VECTOR);
}
else
assert(get(fnormals, f) != CGAL::NULL_VECTOR);

View File

@ -1,6 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
//#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/draw_straight_skeleton_2.h>

View File

@ -5,23 +5,34 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Straight_skeleton_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Qt6 Core)
find_package(LEDA QUIET)
include_directories(BEFORE "include")
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
create_single_source_cgal_program("issue4533.cpp")
create_single_source_cgal_program("issue4684.cpp")
create_single_source_cgal_program("test_sls.cpp")
create_single_source_cgal_program("test_sls_previous_issues.cpp")
create_single_source_cgal_program("test_sls_traits.cpp")
create_single_source_cgal_program("test_straight_skeleton_copy.cpp")
if(CGAL_Qt6_FOUND)
target_link_libraries(issue4684 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(issue7149 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(issue7284 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_previous_issues PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_offset PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_polygons_with_holes PUBLIC CGAL::CGAL_Basic_viewer)
endif()
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("test_sls_offset.cpp")
create_single_source_cgal_program("issue7284.cpp")
create_single_source_cgal_program("test_sls_simple.cpp")
create_single_source_cgal_program("test_sls_weighted_polygons_with_holes.cpp")
create_single_source_cgal_program("issue7149.cpp")
if(CGAL_Qt6_FOUND)
target_link_libraries(issue7149 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(issue7284 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_offset PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_polygons_with_holes PUBLIC CGAL::CGAL_Basic_viewer)
endif()
else()
message("NOTICE: Some test require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -5,18 +5,15 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Straight_skeleton_extrusion_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Qt6 Core)
find_package(LEDA QUIET)
include_directories(BEFORE "include")
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
if(CGAL_Qt6_FOUND)
target_link_libraries(test_sls_extrude PUBLIC CGAL::CGAL_Basic_viewer)
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("test_sls_extrude.cpp")
if(CGAL_Qt6_FOUND)
target_link_libraries(test_sls_extrude PUBLIC CGAL::CGAL_Basic_viewer)
endif()
else()
message("NOTICE: Tests require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -3,9 +3,15 @@ cmake_minimum_required(VERSION 3.1...3.23)
project( Triangulation_on_sphere_2_Examples )
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
create_single_source_cgal_program( "triang_on_sphere.cpp" )
create_single_source_cgal_program( "triang_on_sphere_range.cpp" )
create_single_source_cgal_program( "triang_on_sphere_exact.cpp" )
create_single_source_cgal_program( "triang_on_sphere_proj.cpp" )
create_single_source_cgal_program( "triang_on_sphere_geo.cpp" )
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program( "triang_on_sphere_exact.cpp" )
else()
message("NOTICE: Some tests require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -3,14 +3,20 @@ cmake_minimum_required(VERSION 3.1...3.23)
project( Triangulation_on_sphere_2_Tests )
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
create_single_source_cgal_program( "test_dtos.cpp" )
create_single_source_cgal_program( "test_dtos2_remove.cpp" )
create_single_source_cgal_program( "test_dtos_degenerate_cases.cpp" )
create_single_source_cgal_program( "test_dtos_illegal_points.cpp" )
create_single_source_cgal_program( "test_dtos_projection_traits.cpp" )
create_single_source_cgal_program( "test_dtos_traits.cpp" )
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program( "test_dtos_degenerate_cases.cpp" )
else()
message("NOTICE: Some tests require CGAL_Core (or LEDA), and will not be compiled.")
endif()
find_package(Eigen3 3.1.0 QUIET) #(requires 3.1.0 or greater)
include(CGAL_Eigen3_support)
if(TARGET CGAL::Eigen3_support)