star-enclosures-2d

Extract enclosures from 2D geometry
git clone git://git.meso-star.fr/star-enclosures-2d.git
Log | Files | Refs | README | LICENSE

commit 032b30794963a1a802bf82c972bf5011fbdbc071
parent 3acbc6da3dd74cdc3a53ede682abffb9b0d9ac10
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Mon, 27 Jan 2020 10:28:52 +0100

Make huge tests optional

Diffstat:
Mcmake/CMakeLists.txt | 74+++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 53 insertions(+), 21 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -13,13 +13,19 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.1) project(Star-Enclosures2D C) enable_testing() +include(CMakeDependentOption) + set(SENC2D_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) option(NO_TEST "Do not build tests" OFF) +cmake_dependent_option(HUGE_ADDITIONAL_TESTS + "Build additional tests that involve millions of segments" OFF + "NOT NO_TEST" OFF) + ################################################################################ # Check dependencies ################################################################################ @@ -29,17 +35,28 @@ find_package(RSys 0.8.1 REQUIRED) find_package(OpenMP 2.0 REQUIRED) if(NOT NO_TEST) -find_package(StarSP 0.7 REQUIRED) + find_package(StarSP 0.7 REQUIRED) endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR}) include(rcmake) include(rcmake_runtime) - + if(NO_TEST) -rcmake_append_runtime_dirs(_runtime_dirs RSys Star2D) + include_directories( + ${RSys_INCLUDE_DIR} + ${Star2D_INCLUDE_DIR}) + + rcmake_append_runtime_dirs(_runtime_dirs RSys Star2D) else() -rcmake_append_runtime_dirs(_runtime_dirs RSys StarSP Star2D) + include_directories( + ${RSys_INCLUDE_DIR} + ${Star2D_INCLUDE_DIR} + ${StarSP_INCLUDE_DIR}) + + if(HUGE_ADDITIONAL_TESTS) + rcmake_append_runtime_dirs(_runtime_dirs RSys StarSP Star2D) + endif() endif() ################################################################################ @@ -59,16 +76,16 @@ set(SENC2D_FILES_SRC set(SENC2D_FILES_INC_API senc2d.h - senc2d_s2d_wrapper.h) + senc2d_s2d_helper.h) set(SENC2D_FILES_INC - senc2d_descriptor_c.h senc2d_device_c.h senc2d_enclosure_c.h senc2d_enclosure_data.h senc2d_internal_types.h senc2d_scene_c.h - senc2d_scene_analyze_c.h) + senc2d_scene_analyze_c.h + senc2d_side_range.h) set(SENC2D_FILES_DOC COPYING README.md) @@ -78,11 +95,15 @@ rcmake_prepend_path(SENC2D_FILES_INC ${SENC2D_SOURCE_DIR}) rcmake_prepend_path(SENC2D_FILES_INC_API ${SENC2D_SOURCE_DIR}) rcmake_prepend_path(SENC2D_FILES_DOC ${PROJECT_SOURCE_DIR}/../) +if(CMAKE_COMPILER_IS_GNUCC) + set(MATH_LIB m) +endif() + add_library(senc2d SHARED ${SENC2D_FILES_SRC} ${SENC2D_FILES_INC} ${SENC2D_FILES_INC_API}) -target_link_libraries(senc2d RSys Star2D) +target_link_libraries(senc2d RSys Star2D ${MATH_LIB}) set_target_properties(senc2d PROPERTIES DEFINE_SYMBOL SENC2D_SHARED_BUILD @@ -96,7 +117,7 @@ if(CMAKE_COMPILER_IS_GNUCC) target_link_libraries(senc2d m) endif() -rcmake_setup_devel(senc2d StarEnc2D ${VERSION} star/senc2d_version.h) +rcmake_setup_devel(senc2d StarEnc ${VERSION} star/senc2d_version.h) ################################################################################ # Add tests @@ -106,6 +127,10 @@ if(NOT NO_TEST) add_executable(${_name} ${SENC2D_SOURCE_DIR}/test_senc2d_utils.h ${SENC2D_SOURCE_DIR}/${_name}.c) + foreach(other ${ARGN}) + target_sources(${_name} + PUBLIC ${STAR_GEOM_SOURCE_DIR}/${other}) + endforeach() target_link_libraries(${_name} RSys senc2d) endfunction() @@ -115,27 +140,34 @@ if(NOT NO_TEST) endfunction() function(new_test _name) - build_test(${_name}) + build_test(${_name} ${ARGN}) register_test(${_name} ${_name}) endfunction() - new_test(test_senc2d_add_n_merge) - new_test(test_senc2d_descriptor) + new_test(test_senc2d_square_behind_square) + new_test(test_senc2d_square_in_square) + new_test(test_senc2d_square_on_square) new_test(test_senc2d_device) new_test(test_senc2d_enclosure) new_test(test_senc2d_inconsistant_square) - new_test(test_senc2d_many_enclosures) - new_test(test_senc2d_many_segments) new_test(test_senc2d_sample_enclosure) new_test(test_senc2d_scene) - new_test(test_senc2d_square_behind_square) - new_test(test_senc2d_square_in_square) - new_test(test_senc2d_square_on_square) + new_test(test_senc2d_some_enclosures) + new_test(test_senc2d_some_segments) new_test(test_senc2d_undefined_medium) - new_test(test_senc2d_undefined_medium_attr) - target_link_libraries(test_senc2d_sample_enclosure StarSP) + target_link_libraries(test_senc2d_enclosure Star2D) + target_link_libraries(test_senc2d_sample_enclosure StarSP Star2D) + rcmake_copy_runtime_libraries(test_senc2d_sample_enclosure) + + if(HUGE_ADDITIONAL_TESTS) + new_test(test_senc2d_many_enclosures) + new_test(test_senc2d_many_segments) + + rcmake_copy_runtime_libraries(test_senc2d_many_enclosures test_senc2d_utils2.h) + rcmake_copy_runtime_libraries(test_senc2d_many_segments test_senc2d_utils2.h) + endif() endif() ################################################################################ @@ -146,4 +178,4 @@ install(TARGETS senc2d LIBRARY DESTINATION lib RUNTIME DESTINATION bin) install(FILES ${SENC2D_FILES_INC_API} DESTINATION include/star) -install(FILES ${SENC2D_FILES_DOC} DESTINATION share/doc/star-enc2d) +install(FILES ${SENC2D_FILES_DOC} DESTINATION share/doc/star-enc)