Skip to content

Commit

Permalink
Fixes when neither LEDA nor GMP is available (#7960)
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot authored Jan 19, 2024
2 parents fc66579 + fbd15aa commit 128b169
Show file tree
Hide file tree
Showing 19 changed files with 147 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 4 additions & 15 deletions Cone_spanners_2/examples/Cone_spanners_2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
5 changes: 4 additions & 1 deletion Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -111,7 +113,7 @@ class Compute_cone_boundaries_2 {

};


#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.
Expand Down Expand Up @@ -209,6 +211,7 @@ class Compute_cone_boundaries_2<Exact_predicates_exact_constructions_kernel_with

} // end of operator()
}; // end of functor specialization: Compute_cone_..._2
#endif

} // namespace CGAL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
20 changes: 12 additions & 8 deletions Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
15 changes: 7 additions & 8 deletions Envelope_3/test/Envelope_3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion Envelope_3/test/Envelope_3/spheres_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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()
9 changes: 8 additions & 1 deletion Kernel_23/test/Kernel_23/test_Has_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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));
Expand All @@ -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
Expand Down
9 changes: 2 additions & 7 deletions Nef_S2/test/Nef_S2/Nef_polyhedron_S2-test.cpp
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 5 additions & 0 deletions Number_types/test/Number_types/to_interval_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
35 changes: 23 additions & 12 deletions Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Loading

0 comments on commit 128b169

Please sign in to comment.