diff --git a/.gitattributes b/.gitattributes index 088eeaddbbf..2fe19aab00e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1080,6 +1080,7 @@ CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt -text CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp -text CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp -text CGAL_ipelets/demo/CGAL_ipelets/bbox_restriction.cpp -text +CGAL_ipelets/demo/CGAL_ipelets/cgal_test_with_cmake eol=lf CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp -text CGAL_ipelets/demo/CGAL_ipelets/generator.cpp -text CGAL_ipelets/demo/CGAL_ipelets/hilbert_sort.cpp -text diff --git a/CGAL_ipelets/demo/CGAL_ipelets/cgal_test_with_cmake b/CGAL_ipelets/demo/CGAL_ipelets/cgal_test_with_cmake new file mode 100755 index 00000000000..272d6afbfa7 --- /dev/null +++ b/CGAL_ipelets/demo/CGAL_ipelets/cgal_test_with_cmake @@ -0,0 +1,173 @@ +#! /bin/sh + +# This is a script for the CGAL test suite. Such a script must obey +# the following rules: +# +# - the name of the script is cgal_test_with_cmake +# - for every target two one line messages are written to the file 'error.txt' +# the first one indicates if the compilation was successful +# the second one indicates if the execution was successful +# if one of the two was not successful, the line should start with 'ERROR:' +# - running the script should not require any user interaction +# - the script should clean up object files and executables + + ERRORFILE=error.txt + DO_RUN=y + if [ -z "${MAKE_CMD}" ]; then + MAKE_CMD=make + fi + NEED_CLEAN= + +#---------------------------------------------------------------------# +# configure +#---------------------------------------------------------------------# + +configure() +{ + echo "Configuring... " + + if eval 'cmake "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \ + -DCGAL_DIR="$CGAL_DIR" \ + .' ; then + + echo " succesful configuration" >> $ERRORFILE + else + echo " ERROR: configuration" >> $ERRORFILE + fi +} + +#---------------------------------------------------------------------# +# compile_and_run +#---------------------------------------------------------------------# + +compile_and_run() +{ + echo "Compiling $1 ... " + SUCCES="y" + + if eval '${MAKE_CMD} VERBOSE=ON -fMakefile $1' ; then + echo " succesful compilation of $1" >> $ERRORFILE + else + echo " ERROR: compilation of $1" >> $ERRORFILE + SUCCES="" + fi + + if [ -n "$DO_RUN" ] ; then + if [ -n "${SUCCES}" ] ; then + OUTPUTFILE=ProgramOutput.$1.$PLATFORM + rm -f $OUTPUTFILE + COMMAND="./$1" + if [ -f $1.cmd ] ; then + COMMAND="$COMMAND `cat $1.cmd`" + fi + if [ -f $1.cin ] ; then + COMMAND="cat $1.cin | $COMMAND" + fi + echo "Executing $1 ... " + echo + ulimit -t 3600 2> /dev/null + if eval $COMMAND > $OUTPUTFILE 2>&1 ; then + echo " succesful execution of $1" >> $ERRORFILE + else + echo " ERROR: execution of $1" >> $ERRORFILE + fi + else + echo " ERROR: not executed $1" >> $ERRORFILE + fi + fi +} + +#---------------------------------------------------------------------# +# remove the previous error file +#---------------------------------------------------------------------# + +rm -f $ERRORFILE +touch $ERRORFILE + +#---------------------------------------------------------------------# +# configure, compile and run the tests +#---------------------------------------------------------------------# + +configure + +if [ $# -ne 0 ] ; then + for file in $* ; do + compile_and_run $file + done +else + echo "Run all tests." +if ${MAKE_CMD} -f Makefile help | grep "alpha_shapes" > /dev/null; then + compile_and_run CGAL_alpha_shapes + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "arrangement" > /dev/null; then + compile_and_run CGAL_arrangement + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "bbox_restriction" > /dev/null; then + compile_and_run CGAL_bbox_restriction + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "diagrams" > /dev/null; then + compile_and_run CGAL_diagrams + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "generator" > /dev/null; then + compile_and_run CGAL_generator + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "hilbert_sort" > /dev/null; then + compile_and_run CGAL_hilbert_sort + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "hull" > /dev/null; then + compile_and_run CGAL_hull + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "mesh_2" > /dev/null; then + compile_and_run CGAL_mesh_2 + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "minkowski" > /dev/null; then + compile_and_run CGAL_minkowski + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "multi_delaunay" > /dev/null; then + compile_and_run CGAL_multi_delaunay + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "multi_regular" > /dev/null; then + compile_and_run CGAL_multi_regular + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "partition" > /dev/null; then + compile_and_run CGAL_partition + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "pca" > /dev/null; then + compile_and_run CGAL_pca + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "simple_triangulation" > /dev/null; then + compile_and_run CGAL_simple_triangulation + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "skeleton" > /dev/null; then + compile_and_run CGAL_skeleton + NEED_CLEAN=y +fi +if ${MAKE_CMD} -f Makefile help | grep "triangulation" > /dev/null; then + compile_and_run CGAL_triangulation + NEED_CLEAN=y +fi +fi + +# +# The clean target generated by CMake under cygwin +# always fails for some reason +# +if [ -n "${NEED_CLEAN}" ]; then + if ! ( uname | grep -q "CYGWIN" ) ; then + ${MAKE_CMD} -fMakefile clean + fi +fi