Commit 067351ed authored by John Tourtellott's avatar John Tourtellott
Browse files

Add cmake files

parent b53eb206
# Declare unit tests Usage:
#
# smtk_unit_tests(
# LABEL <prefix for all unit tests>
# SOURCES <test_source_list>
# SOURCES_REQUIRE_DATA <test_sources_that_require_DATA_DIR>
# EXTRA_SOURCES <helper_source_files>
# LIBRARIES <dependent_library_list>
# )
function(unit_tests)
set(options)
set(oneValueArgs)
set(multiValueArgs LABEL SOURCES SOURCES_REQUIRE_DATA EXTRA_SOURCES LIBRARIES)
cmake_parse_arguments(ut
"${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
list(APPEND ut_SOURCES ${ut_SOURCES_REQUIRE_DATA})
list(LENGTH ut_SOURCES num_sources)
if(NOT ${num_sources})
#no sources don't make a target
return()
endif()
if (ENABLE_TESTING)
smtk_get_kit_name(kit)
#we use UnitTests_ so that it is a unique key to exclude from coverage
set(test_prog UnitTests_${kit})
create_test_sourcelist(TestSources ${test_prog}.cxx ${ut_SOURCES})
add_executable(${test_prog} ${TestSources} ${ut_EXTRA_SOURCES})
target_link_libraries(${test_prog} LINK_PRIVATE ${ut_LIBRARIES})
target_include_directories(${test_prog}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${MOAB_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
)
target_compile_definitions(${test_prog} PRIVATE "DATA_DIR=\"${PROJECT_SOURCE_DIR}/data\"")
target_compile_definitions(${test_prog} PRIVATE "SCRATCH_DIR=\"${CMAKE_BINARY_DIR}/Testing/Temporary\"")
set(smtk_module_dir ${smtk_DIR}/${SMTK_PYTHON_MODULEDIR})
if(NOT IS_ABSOLUTE ${smtk_module_dir})
get_filename_component(smtk_module_dir
${PROJECT_BINARY_DIR}/${smtk_DIR}/${SMTK_PYTHON_MODULEDIR} ABSOLUTE)
endif()
foreach (test ${ut_SOURCES})
get_filename_component(tname ${test} NAME_WE)
add_test(NAME ${tname}
COMMAND ${test_prog} ${tname} ${${tname}_EXTRA_ARGUMENTS}
)
set_tests_properties(${tname} PROPERTIES TIMEOUT 120
ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}:${smtk_module_dir}:$ENV{PYTHONPATH}")
if(ut_LABEL)
set_tests_properties(${tname} PROPERTIES LABELS ${ut_LABEL})
endif()
endforeach(test)
endif (ENABLE_TESTING)
endfunction(unit_tests)
# A contract file for testing ACE3P extensions within SMTK.
cmake_minimum_required(VERSION 3.12)
project(ace3p-extensions)
include(ExternalProject)
ExternalProject_Add(ace3p-extensions
GIT_REPOSITORY "https://gitlab.kitware.com/cmb/plugins/ace3p-extensions.git"
GIT_TAG "origin/master"
PREFIX plugin
STAMP_DIR plugin/stamp
SOURCE_DIR plugin/src
BINARY_DIR plugin/build
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DENABLE_TESTING=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-Dsmtk_DIR=${smtk_DIR}
${response_file}
INSTALL_COMMAND ""
TEST_BEFORE_INSTALL True
)
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
find_package(smtk REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-plugin-@safe_project_name@_paraview_plugins-targets-depends.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-plugin-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-plugin-paraview-plugin-properties.cmake")
if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
endif ()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment