From ca6840fcda035f892665c794ead2def4c11de411 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 19 Oct 2011 13:16:44 +0000 Subject: [PATCH 1/8] Fix handling of CGAL_USE_GEOMVIEW by some demos and a test Do not even include CGAL headers, especially the headers about Geomview_stream support, if CGAL_USE_GEOMVIEW is not defined. Has Geomview_stream has not been given a full CGAL_EXPORT support on Windows, the single inclusion of may trigger warning (or errors, I do not remember: see test result of CGAL-3.10-Ic-163). --- .../demo/Convex_hull_3/incremental_hull_3_demo.cpp | 6 ++++-- .../demo/Convex_hull_3/quickhull_3_demo.cpp | 6 ++++-- .../demo/Convex_hull_d/chull_3d-geomview-demo.cpp | 12 ++++++------ .../demo/Convex_hull_d/chull_dd-geomview-demo.cpp | 12 ++++++------ .../test/Interpolation/test_surface_neighbor_3.cpp | 1 - 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Convex_hull_3/demo/Convex_hull_3/incremental_hull_3_demo.cpp b/Convex_hull_3/demo/Convex_hull_3/incremental_hull_3_demo.cpp index 9ba73f7da51..3f0d36aa982 100644 --- a/Convex_hull_3/demo/Convex_hull_3/incremental_hull_3_demo.cpp +++ b/Convex_hull_3/demo/Convex_hull_3/incremental_hull_3_demo.cpp @@ -18,6 +18,9 @@ // Author(s) : Susan Hert // +#include + +#ifdef CGAL_USE_GEOMVIEW #include #include @@ -31,8 +34,6 @@ #include #include -#ifdef CGAL_USE_GEOMVIEW - #ifdef CGAL_USE_LEDA #include typedef leda_integer RT; @@ -89,6 +90,7 @@ int main () #else +#include int main() { std::cerr << "This demo requires geomview, which is not present on this platform\n"; diff --git a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp index 3bd02fc30a5..57f5beacd5d 100644 --- a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp +++ b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp @@ -17,7 +17,9 @@ // // Author(s) : Susan Hert +#include +#ifdef CGAL_USE_GEOMVIEW #include #include @@ -28,8 +30,6 @@ #include #include -#ifdef CGAL_USE_GEOMVIEW - #ifdef CGAL_USE_LEDA #include typedef leda_integer RT; @@ -128,6 +128,8 @@ int main(int argc, char* argv[]) #else +#include + int main() { std::cerr << "This demo requires geomview, which is not present on this platform\n"; diff --git a/Convex_hull_d/demo/Convex_hull_d/chull_3d-geomview-demo.cpp b/Convex_hull_d/demo/Convex_hull_d/chull_3d-geomview-demo.cpp index 7220ed1b0d5..1f983976ab9 100644 --- a/Convex_hull_d/demo/Convex_hull_d/chull_3d-geomview-demo.cpp +++ b/Convex_hull_d/demo/Convex_hull_d/chull_3d-geomview-demo.cpp @@ -17,7 +17,12 @@ // // Author(s) : Michael Seel -#include +#include +#include +#include + +#if !defined(_MSC_VER) + #include #include #include @@ -27,11 +32,6 @@ #include #include #include -#include -#include -#include - -#if !defined(_MSC_VER) #ifdef CGAL_USE_LEDA #include diff --git a/Convex_hull_d/demo/Convex_hull_d/chull_dd-geomview-demo.cpp b/Convex_hull_d/demo/Convex_hull_d/chull_dd-geomview-demo.cpp index de9e6a12513..4ce06d30f2a 100644 --- a/Convex_hull_d/demo/Convex_hull_d/chull_dd-geomview-demo.cpp +++ b/Convex_hull_d/demo/Convex_hull_d/chull_dd-geomview-demo.cpp @@ -17,7 +17,12 @@ // // Author(s) : Michael Seel -#include +#include +#include +#include + +#if !defined(_MSC_VER) + #include #include #include @@ -26,11 +31,6 @@ #include #include #include -#include -#include -#include - -#if !defined(_MSC_VER) #ifdef CGAL_USE_LEDA #include diff --git a/Interpolation/test/Interpolation/test_surface_neighbor_3.cpp b/Interpolation/test/Interpolation/test_surface_neighbor_3.cpp index ff0c7b6f292..1d969cd4c37 100644 --- a/Interpolation/test/Interpolation/test_surface_neighbor_3.cpp +++ b/Interpolation/test/Interpolation/test_surface_neighbor_3.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include From eea6d0df2be76c3eb3ba164ee45e7d140548fbf4 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 20 Oct 2011 10:27:56 +0000 Subject: [PATCH 2/8] int -> std::size_t --- .../CGAL/Arr_geometry_traits/Conic_arc_2.h | 6 +-- .../Conic_intersections_2.h | 38 ++++++++++--------- .../Conic_x_monotone_arc_2.h | 4 +- .../include/CGAL/Arrangement_2/Open_hash.h | 2 +- .../CGAL/Sweep_line_2/Sweep_line_2_utils.h | 2 +- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h index 0835f2b3e07..6e922cb23aa 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h @@ -1622,7 +1622,7 @@ protected: const Integer _four = 4; Algebraic xs[2]; Algebraic *xs_end; - int n_xs; + std::size_t n_xs; Nt_traits nt_traits; xs_end = nt_traits.solve_quadratic_equation (_t*_t - _four*_r*_s, @@ -1634,7 +1634,7 @@ protected: // Find the y-coordinates of the vertical tangency points. Algebraic ys[2]; Algebraic *ys_end; - int n_ys; + std::size_t n_ys; if (CGAL::sign (_t) == ZERO) { @@ -1705,7 +1705,7 @@ protected: // (t*y + u)^2 - 4*r*(s*y^2 + v*y + w) = 0 const Integer _two = 2; const Integer _four = 4; - int n; + std::size_t n; Algebraic ys[2]; Algebraic *ys_end; Nt_traits nt_traits; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h index 589a3cc89b6..72da48a1d1d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h @@ -38,22 +38,23 @@ namespace CGAL { * \return The number of distinct roots found. */ template -int _compute_resultant_roots (Nt_traits& nt_traits, - const typename Nt_traits::Integer& r1, - const typename Nt_traits::Integer& s1, - const typename Nt_traits::Integer& t1, - const typename Nt_traits::Integer& u1, - const typename Nt_traits::Integer& v1, - const typename Nt_traits::Integer& w1, - const int& deg1, - const typename Nt_traits::Integer& r2, - const typename Nt_traits::Integer& s2, - const typename Nt_traits::Integer& t2, - const typename Nt_traits::Integer& u2, - const typename Nt_traits::Integer& v2, - const typename Nt_traits::Integer& w2, - const int& deg2, - typename Nt_traits::Algebraic *xs) +std::size_t + _compute_resultant_roots (Nt_traits& nt_traits, + const typename Nt_traits::Integer& r1, + const typename Nt_traits::Integer& s1, + const typename Nt_traits::Integer& t1, + const typename Nt_traits::Integer& u1, + const typename Nt_traits::Integer& v1, + const typename Nt_traits::Integer& w1, + const int& deg1, + const typename Nt_traits::Integer& r2, + const typename Nt_traits::Integer& s2, + const typename Nt_traits::Integer& t2, + const typename Nt_traits::Integer& u2, + const typename Nt_traits::Integer& v2, + const typename Nt_traits::Integer& w2, + const int& deg2, + typename Nt_traits::Algebraic *xs) { if (deg1 == 2 && deg2 == 1) { @@ -179,8 +180,9 @@ int _compute_resultant_roots (Nt_traits& nt_traits, * \return The number of distinct roots found. */ template -int _compute_resultant_roots (Nt_traits& nt_traits, - const typename Nt_traits::Algebraic& r, +std::size_t +_compute_resultant_roots (Nt_traits& nt_traits, + const typename Nt_traits::Algebraic& r, const typename Nt_traits::Algebraic& s, const typename Nt_traits::Algebraic& t, const typename Nt_traits::Algebraic& u, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h index b68a407e20e..19eaabb2ae8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h @@ -1853,9 +1853,9 @@ private: const int deg2 = ((arc._info & DEGREE_MASK) == DEGREE_1) ? 1 : 2; Nt_traits nt_traits; Algebraic xs[4]; - int n_xs = 0; + std::size_t n_xs = 0; Algebraic ys[4]; - int n_ys = 0; + std::size_t n_ys = 0; if (arc._is_special_segment()) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h index c4e77f61497..4f44f5212f8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h @@ -539,7 +539,7 @@ private: } /*! Find the given object in the given bucket. */ - Bucket_iterator _find_in_bucket (int index, + Bucket_iterator _find_in_bucket (std::size_t index, const value_type& val) const { Bucket& my_bucket = const_cast(buckets[index]); diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h index f3ed1f771b0..b664baf0a63 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h @@ -55,7 +55,7 @@ void make_x_monotone (CurveInputIter begin, CurveInputIter end, const Traits * tr) { // Split the input curves into x-monotone objects. - unsigned int num_of_curves = std::distance(begin, end); + std::size_t num_of_curves = std::distance(begin, end); std::vector object_vec; CurveInputIter iter; From 2a5bc234be7177017df73db98a8851dff7f93ac8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 20 Oct 2011 10:36:22 +0000 Subject: [PATCH 3/8] size_t -> unsigned int to avoid a warning --- .../test/STL_Extension/test_Modifiable_priority_queue.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/STL_Extension/test/STL_Extension/test_Modifiable_priority_queue.cpp b/STL_Extension/test/STL_Extension/test_Modifiable_priority_queue.cpp index 4bd359ae3cc..9530c12e624 100644 --- a/STL_Extension/test/STL_Extension/test_Modifiable_priority_queue.cpp +++ b/STL_Extension/test/STL_Extension/test_Modifiable_priority_queue.cpp @@ -149,7 +149,7 @@ int main() q.push(&data[0]+i); } - for (std::size_t i=0;i<10;++i){ + for (unsigned int i=0;i<10;++i){ data[i].second=9-i; q.update(&data[0]+i,true); CGAL_assertion(q.top()->first==i); @@ -169,14 +169,14 @@ int main() q.push(&data[0]+i); } - for (std::size_t i=0;i<9;++i){ + for (unsigned int i=0;i<9;++i){ data[i].second=10+i; q.update(&data[0]+i,true); CGAL_assertion(q.top()->first==i+1); } //revert order - for (std::size_t i=0;i<10;++i){ + for (unsigned int i=0;i<10;++i){ data[9-i].second=i; q.update(&data[0]+9-i,true); CGAL_assertion(q.top()->first==9); From 731ad9eb4203dfffa7a1083be62ddfc96b924f49 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 20 Oct 2011 10:39:17 +0000 Subject: [PATCH 4/8] Fix Arrangement cgal_test on Cygwin On Cygwin, when one kill a process with the SIGKILL signal (9), then the child processes of it are not killed. Use the SIGHUP signal instead. --- .../test/Arrangement_on_surface_2/cgal_test_base | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index a1c2641669d..bc11ca4f3d2 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -186,8 +186,8 @@ run_trapped_test() else run_test $1 $2 $3 $4 $5 $6 & WPID=$! - trap "kill -9 $WPID" INT - (sleep 1200; kill -9 $WPID) > /dev/null 2>&1 & + trap "kill -HUP $WPID" INT + (sleep 1200; kill -HUP $WPID) > /dev/null 2>&1 & SPID=$! wait $WPID > /dev/null 2>&1 # RES=$? From 278d79915d83058431cdddb63bc0967c8b994bdb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 20 Oct 2011 11:09:41 +0000 Subject: [PATCH 5/8] Suppress warning --- .../test/Intersections_3/bbox_other_do_intersect_test.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp index 1e182071d0d..4b17a7d48ab 100644 --- a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp +++ b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp @@ -21,6 +21,11 @@ #include +#include + +#if defined(BOOST_MSVC) +# pragma warning(disable:4244) // int to float conversion warning +#endif #include #include From 2d57319daae10c542699d1b144563080d2982380 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 20 Oct 2011 11:16:20 +0000 Subject: [PATCH 6/8] Add static_cast to avoid warning --- Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h b/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h index f38781799f7..5a58cd70dab 100644 --- a/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h +++ b/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h @@ -427,8 +427,8 @@ fill_matrix(InputIterator begin, InputIterator end, M.set(line_count, k*(k+1)/2+i, std::pow(x,static_cast(k-i)) * std::pow(y,static_cast(i)) - /( fact(i) * - fact(k-i) + /( fact(static_cast(i)) * + fact(static_cast(k-i)) *std::pow(this->preconditionning,static_cast(k)))); } } From 7de2788e66aad455a19d92f5cb028b21f68adf9c Mon Sep 17 00:00:00 2001 From: Olivier Devillers Date: Thu, 20 Oct 2011 13:59:30 +0000 Subject: [PATCH 7/8] removing deprecated in test suite --- Maintenance/test_handling/candidate_branches | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Maintenance/test_handling/candidate_branches b/Maintenance/test_handling/candidate_branches index 410c94fd2ac..9cf6a4ec1da 100644 --- a/Maintenance/test_handling/candidate_branches +++ b/Maintenance/test_handling/candidate_branches @@ -1,2 +1,3 @@ unique_sqrt_extension-sloriot -global_function_solve_1-hemmer \ No newline at end of file +global_function_solve_1-hemmer +Generator-removed_deprecated-odevil From 4273a5a69ea8652f07a08cdd295bd8f632f4d9e7 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 20 Oct 2011 15:49:05 +0000 Subject: [PATCH 8/8] Improvement of cgal_create_cmake_script This allows to create a CMakeLists.txt in a directory whereas the sources are in another directory. This will allow out-of-sources creation of CMakeLists.txt files. And, in the end, that will improve the branch-build. --- Scripts/scripts/cgal_create_cmake_script | 101 +++++++++++++++-------- 1 file changed, 65 insertions(+), 36 deletions(-) diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index 7251f0cbf26..a663c284909 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -58,7 +58,7 @@ EOF if [ "${TYPE}" = "demo" ] ; then target_name="${PROJECT}_${TYPE}" - for file in `ls *.C *.cpp 2>/dev/null | sort` ; do + for file in `ls "$SOURCE_DIR"*.C "$SOURCE_DIR"*.cpp 2>/dev/null | sort` ; do all="$all $file" done cat <<'EOF' @@ -87,16 +87,16 @@ EOF EOF - if [ -d ../../include ] ; then - echo ' include_directories (BEFORE ../../include)' + if [ -d "${SOURCE_DIR}../../include" ] ; then + echo " include_directories (BEFORE \"${SOURCE_DIR}../../include\")" echo fi - if [ -d ../include ] ; then - echo ' include_directories (BEFORE ../include)' + if [ -d "${SOURCE_DIR}../include" ] ; then + echo " include_directories (BEFORE \"${SOURCE_DIR}../include\")" echo fi - if [ -d include ] ; then - echo ' include_directories (BEFORE include)' + if [ -d "${SOURCE_DIR}include" ] ; then + echo " include_directories (BEFORE \"${SOURCE_DIR}include\")" echo fi cat </dev/null | sort` ; do + for file in `ls "$SOURCE_DIR"*.C "$SOURCE_DIR"*.cpp 2>/dev/null | sort` ; do # Create an executable for each cpp that contains a function "main()" BASE=`basename $file .C` BASE=`basename $BASE .cpp` @@ -173,34 +173,63 @@ EOF usage() { - echo "Usage: cgal_create_cmake_script [TYPE]" + echo "Usage: cgal_create_cmake_script [TYPE] [--source_dir ]" echo - echo " TYPE must be any of example, demo or test." - echo " Default is example." - echo + echo " Create a CMakeLists.txt file in the current working directory." + echo + echo " TYPE must be any of example, demo or test. The default is example." + echo + echo " If the option --source_dir is specified with a directory, the " + echo " CMakeLists.txt uses source files from that directory, otherwise " + echo " the source directory is supposed to be the current directory." } +SOURCE_DIR= -case $# in - 0) TYPE="example";; - 1) TYPE=$1;; - *) usage - exit 1 -esac - - - -if [ "${TYPE}" = "example" -o "${TYPE}" = "demo" -o "${TYPE}" = "test" ]; then - ok='y' -fi - -if [ -z "$ok" ]; then - echo "Invalid type: ${TYPE}. Valid values are example, demo or test" - exit 1 -fi +while [ $1 ]; do + case "$1" in + -h|-help|--h|--help) + usage; exit + ;; + example) + if [ -z "$TYPE" ]; then TYPE=$1; shift; else usage; exit 1; fi + ;; + demo) + if [ -z "$TYPE" ]; then TYPE=$1; shift; else usage; exit 1; fi + ;; + test) + if [ -z "$TYPE" ]; then TYPE=$1; shift; else usage; exit 1; fi + ;; + --source_dir) + if [ -d "$2" ]; then + SOURCE_DIR=$2; + shift; + shift; + else + if [ -z "$2" ]; then + echo "Error: you must specify a directory after the --source_dir option!" + echo + else + echo "Error: \"$2\" is not a directory!" + echo + fi + usage; exit 1; + fi + ;; + *) + echo "Unknown option: $1" + usage; exit 1 + ;; + esac +done OUTPUTFILE=CMakeLists.txt -PROJECT=`basename $PWD` +if [ -n "$SOURCE_DIR" ]; then + PROJECT=`basename $SOURCE_DIR` + SOURCE_DIR=$SOURCE_DIR/ +else + PROJECT=`basename $PWD` +fi if [ -f ${OUTPUTFILE} ] ; then echo "moving $OUTPUTFILE to ${OUTPUTFILE}.bak ..."