Commit ea1739ca authored by David Thompson's avatar David Thompson
Browse files

WIP: Initial draft.

Compiles, doesn't link.
parents
[submodule "vtk/meshing/netgen"]
path = vtk/meshing/netgen
url = https://gitlab.kitware.com/meshing/vtk-netgen.git
cmake_minimum_required(VERSION 3.8.2)
cmake_policy(VERSION 3.12)
# Project name and version
project(aeva-session VERSION 1.0)
# Add our cmake directory to the module search path
list(INSERT CMAKE_MODULE_PATH 0
${PROJECT_SOURCE_DIR}/cmake)
# This project requires C++11
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
endif()
# Use shared libs, otherwise we don't get a loadable plugin
set(BUILD_SHARED_LIBS True)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(aevaCoverage)
include(aevaOptions)
include(aevaDependencies)
include(aevaSanitize)
include(aevaSettings)
include(aevaEarlyVTKModuleScan) # For modules without smtkAEVASession dependencies
add_subdirectory(smtk)
add_subdirectory(data)
include(aevaPackaging)
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "SuperBuild-ConceptualModelBuilder")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
set(CTEST_DROP_METHOD "https")
set(CTEST_DROP_SITE "open.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=aeva")
set(CTEST_DROP_SITE_CDASH TRUE)
##------------------------------------------------------------------------------
## Ignore warnings in generated code during the build process
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
# Ignore warnings from generated UnitTest source code.
"UnitTests_"
)
cmake_policy(SET CMP0012 NEW)
if(@aeva_enable_coverage@)
set(COVERAGE_EXTRA_FLAGS "-l -p")
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
)
endif()
# 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})
# without source files, don't make a target
return()
endif()
if (AEVA_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 "AEVA_DATA_DIR=\"${PROJECT_SOURCE_DIR}/data\"")
target_compile_definitions(${test_prog} PRIVATE "AEVA_SCRATCH_DIR=\"${CMAKE_BINARY_DIR}/Testing/Temporary\"")
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)
if(ut_LABEL)
set_tests_properties(${tname} PROPERTIES LABELS ${ut_LABEL})
endif()
endforeach(test)
endif ()
endfunction(unit_tests)
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
include(CMakeFindDependencyMacro)
find_dependency(smtk)
find_dependency(VTK COMPONENTS CommonCore CommonDataModel IOXML hdf5)
find_dependency(Boost COMPONENTS filesystem)
# Set the directory where sample data is installed.
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
set(${CMAKE_FIND_PACKAGE_NAME}_DATA "${_IMPORT_PREFIX}/share/@PROJECT_NAME@/@PROJECT_VERSION@/data")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/AEVAVTKModules-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/AEVAVTKModules-vtk-module-properties.cmake")
if (@SMTK_ENABLE_PARAVIEW_SUPPORT@) # SMTK_ENABLE_PARAVIEW_SUPPORT
include("${CMAKE_CURRENT_LIST_DIR}/AEVASessionPlugins-aeva_session_paraview_plugins-targets-depends.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/AEVASessionPlugins-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/AEVASessionPlugins-paraview-plugin-properties.cmake")
endif ()
if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
endif ()
#=========================================================================
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notice for more information.
#
#=========================================================================
# This code has been adapted from remus (https://gitlab.kitware.com/cmb/remus)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
include(CheckCXXCompilerFlag)
#Add option for enabling gcov coverage
option(aeva_enable_coverage "Build with gcov support." OFF)
mark_as_advanced(aeva_enable_coverage)
if(aeva_enable_coverage)
#We're setting the CXX flags and C flags beacuse they're propagated down
#independent of build type.
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fno-elide-constructors -fprofile-instr-generate -fcoverage-mapping")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping")
endif()
endif()
endif()
##
## Python interpreter and pybind11
##
if (AEVA_ENABLE_PYTHON)
# Only look for python packages if they are not already found (this is a
# workaround for pybind11's custom python cmake scripts)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
# Set the python module extension (needed for pybind11)
if (DEFINED Python3_SOABI)
set(PYTHON_MODULE_EXTENSION "${Python3_SOABI}")
elseif(WIN32)
set(PYTHON_MODULE_EXTENSION ".pyd")
else()
set(PYTHON_MODULE_EXTENSION ".so")
endif()
set(PYTHON_MODULE_PREFIX "")
find_package(pybind11 REQUIRED)
# Pybind11 settings
set(PYBIND11_FLAGS " ")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(PYBIND11_FLAGS "${PYBIND11_FLAGS} -Wno-shadow")
endif()
endif ()
##
## SMTK
##
find_package(smtk
REQUIRED
)
if (AEVA_ENABLE_PYTHON AND NOT SMTK_ENABLE_PYTHON_WRAPPING)
message(FATAL_ERROR
"Python support in the AEVA session requires Python support from SMTK.")
endif ()
##
## VTK
##
find_package(VTK
COMPONENTS
CommonCore
CommonDataModel
IOXML
REQUIRED
)
##
## ITK and ITKVTKGlue
##
find_package(ITK
COMPONENTS
ITKCommon
ITKIOImageBase
ITKIONRRD
ITKIONIFTI
ITKVtkGlue
REQUIRED
)
include(${ITK_USE_FILE})
##
## Netgen
##
find_package(Netgen
QUIET
REQUIRED
)
# This is run before smtkAEVASession is declared as a target.
# Add any VTK modules here that do not depend on smtkAEVASession.
set(module_files
"${CMAKE_CURRENT_SOURCE_DIR}/vtk/aeva/ext/vtk.module"
"${CMAKE_CURRENT_SOURCE_DIR}/vtk/meshing/netgen/vtk.module"
)
vtk_module_scan(
MODULE_FILES ${module_files}
PROVIDES_MODULES aeva_vtk_modules
HIDE_MODULES_FROM_CACHE ON
WANT_BY_DEFAULT ON
)
vtk_module_build(
MODULES ${aeva_vtk_modules}
PACKAGE AEVAVTKModules
INSTALL_EXPORT AEVAVTKModules
CMAKE_DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${PROJECT_VERSION}"
TEST_DIRECTORY_NAME "NONE"
)
set_property(GLOBAL
PROPERTY
_aeva_vtk_extension_modules "${aeva_vtk_modules}"
)
# if (SMTK_ENABLE_PYTHON_WRAPPING)
# set(vtk_python_wrappable_modules
# vtkAEVAWidgets)
# set(vtk_modules_to_wrap)
# foreach (vtk_python_wrappable_module IN LISTS vtk_python_wrappable_modules)
# if (TARGET "${vtk_python_wrappable_module}")
# list(APPEND vtk_modules_to_wrap
# "${vtk_python_wrappable_module}")
# endif ()
# endforeach ()
# vtk_module_wrap_python(
# MODULES ${vtk_modules_to_wrap}
# INSTALL_EXPORT smtk
# INSTALL_HEADERS OFF
# PYTHON_PACKAGE "smtk.session.aeva.vtk._modules"
# #MODULE_DESTINATION "${PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX}"
# #CMAKE_DESTINATION "${paraview_cmake_destination}/vtk"
# WRAPPED_MODULES vtk_python_wrapped_modules
# TARGET vtkaevapythonmodules)
# add_subdirectory(pybind11)
# endif()
option(AEVA_ENABLE_TESTING "Enable tests." ON)
option(AEVA_ENABLE_PYTHON "Build python bindings for aeva." OFF)
include(CMakePackageConfigHelpers)
# Our requirements for a version file are basic, so we use CMake's basic version
# file generator
write_basic_package_version_file(
"${CMAKE_CMAKE_OUTPUT_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion
)
# Export the targets generated by the plugin
export(
EXPORT AEVASession
FILE "${CMAKE_CMAKE_OUTPUT_DIRECTORY}/${PROJECT_NAME}Targets.cmake")
install(
EXPORT AEVASession
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
FILE ${PROJECT_NAME}Targets.cmake
)
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Config.cmake.in"
"${CMAKE_CMAKE_OUTPUT_DIRECTORY}/${PROJECT_NAME}Config.cmake"
@ONLY)
# Install the generated configure files
install(
FILES
"${CMAKE_CMAKE_OUTPUT_DIRECTORY}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CMAKE_OUTPUT_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION
${CMAKE_INSTALL_CMAKEDIR}
COMPONENT
Devel
)
#=========================================================================
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notice for more information.
#
#=========================================================================
# This code has been adapted from remus (https://gitlab.kitware.com/cmb/remus)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
include(CheckCXXCompilerFlag)
#Add option for enabling sanitizers
option(aeva_enable_sanitizer "Build with sanitizer support." OFF)
mark_as_advanced(aeva_enable_sanitizer)
if(aeva_enable_sanitizer)
set(aeva_sanitizer "address"
CACHE STRING "The sanitizer to use")
mark_as_advanced(aeva_sanitizer)
#We're setting the CXX flags and C flags beacuse they're propagated down
#independent of build type.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${aeva_sanitizer}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${aeva_sanitizer}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${aeva_sanitizer}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=${aeva_sanitizer}")
endif()
endif()
# Setting this ensures that "make install" will leave rpaths to external
# libraries (not part of the build-tree e.g. Qt, ffmpeg, etc.) intact on
# "make install". This ensures that one can install a version of ParaView on the
# build machine without any issues. If this not desired, simply specify
# CMAKE_INSTALL_RPATH_USE_LINK_PATH when configuring and "make install" will
# strip all rpaths, which is default behavior.
if (NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif ()
# Use GNU install directories.
include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}")
# Set the directory where the binaries will be stored
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_CMAKE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR})
if (AEVA_ENABLE_TESTING)
include(CTest)
enable_testing()
include(TestingMacros)
# Do not report some warnings from generated code to the dashboard:
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/CTestCustom.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake")
endif()
# A contract file for testing the aeva session within SMTK.
cmake_minimum_required(VERSION 3.8.2)
project(aeva-session)
include(ExternalProject)
ExternalProject_Add(aeva-session
GIT_REPOSITORY "https://gitlab.kitware.com/aeva/session"
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_PYTHON_WRAPPING=ON
-DENABLE_TESTING=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-Dsmtk_DIR=${smtk_DIR}
${response_file}
INSTALL_COMMAND ""
TEST_COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure
TEST_BEFORE_INSTALL True
)
#add_subdirectory(itk)
#add_subdirectory(med)
#add_subdirectory(smtk)
#add_subdirectory(stl)
#add_subdirectory(vtk)
# AEVA License Version 1.0
Copyright (c) 2019 Kitware Inc.<br>
1712 Route 9, Suite 300<br>
Clifton Park, NY, 12065, USA.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Kitware nor the names of any contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
**This software is provided by the copyright holders and contributors ``as is''
and any express or implied warranties, including, but not limited to, the
implied warranties of merchantability and fitness for a particular purpose
are disclaimed. In no event shall the authors or contributors be liable for
any direct, indirect, incidental, special, exemplary, or consequential
damages (including, but not limited to, procurement of substitute goods or
services; loss of use, data, or profits; or business interruption) however
caused and on any theory of liability, whether in contract, strict liability,
or tort (including negligence or otherwise) arising in any way out of the use
of this software, even if advised of the possibility of such damage.**
The following files and directories come from third parties. Check the
contents of these for details on the specifics of their respective
licenses.
---
thirdparty/*
## SMTK session for aeva
The aeva session is focused on annotating virtual anatomy
and transforming those annotations across different models
of the same anatomical features — whether they be models
of the same patient but at different points in time like a
longitudinal study; or models of different patients in a
cohort; or abstracted models of common nominal and/or
malformed modes.
+ For more information, see [aeva's website at simtk.org](https://simtk.org/projects/aeva-apps)
+ For application binaries that use this session,
see [aeva downloads at data.kitware.com](https://data.kitware.com/#collection/5e387f9caf2e2eed3562242e)
+ `custom` contains custom builds
+ `continuous` contains builds queued by our continuous integration system.
+ Build and develop documentation can be found in the [aeva repository](https://gitlab.kitware.com/aeva/aeva/-/tree/master/doc/dev)
add_subdirectory(session)
add_subdirectory(aeva)
set(sources)
set(headers)
set(classes
# CellSelection
Geometry
NameManager
# Operation
# Predicates
# RegisterStyleFunction
Registrar
Resource
# Session
# json/jsonResource
nodes/Annotation
)
set(operators
# AllPrimitivesFeature
# AdjacencyFeature
# Boolean
# BooleanIntersect
# BooleanSubtract
# BooleanUnite
# CreateAnnotationResource
Delete
# Duplicate
# EditFreeformAttributes
# Export
# ExportFeb
# GrowSelection
# Import
# ImprintGeometry
# ImprintImage
# MeshLabel
# NetgenSurfaceRemesher
# NormalFeature
# LinearToQuadratic
# PointsOfPrimitivesFeature
# ProportionalEdit
# ProximityFeature
# Read
# ReconstructSurface
# Segment
# SelectionResponder
# SmoothSurface
# UnreferencedPrimitives
# VolumeMesher
# Write
)
set(icons
adjacency_feature
all_primitives_feature
boolean_unite
boolean_intersect
boolean_subtract
boolean_symmetric_subtract
create_annotations
contains_feature
duplicate
freeform_attributes
grow_feature
imprint_geometry
imprint_image
normal_feature
quadratic_promotion
points_of_primitives_feature
proportional_edit
proximity_feature
reconstruct_surface
smooth_surface
unreferenced_primitives
volume_mesh
)
foreach(icon ${icons})
smtk_encode_file(
"${CMAKE_CURRENT_SOURCE_DIR}/icons/${icon}.svg" TYPE "_svg" TARGET_OUTPUT targetName)
list(APPEND aevaDependencies ${targetName})
endforeach()
## smtk_encode_file results in errors on MSVC about too-long array.
## As long as we don't need the includes, we can use VTK's solution:
#vtk_encode_string(
# INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../../../data/workflow/aeva.sbt"
# NAME "aeva_xml"
# HEADER_OUTPUT sbtHeader
# SOURCE_OUTPUT sbtSource
# BINARY
# NUL_TERMINATE)
#list(APPEND sources "${sbtSource}")
#list(APPEND headers "${sbtHeader}")
file(GLOB SESSION_FILES "*.h" "*.cxx")
source_group("session" FILES ${SESSION_FILES})
file(GLOB OPERATIONS_FILES "operators/*.h" "operators/*.cxx" "operators/*.sbt")
source_group("session\\operators" FILES ${OPERATIONS_FILES})
# Turn "classes" into source and headers entries
foreach(class ${classes})
list(APPEND headers ${class}.h)
list(APPEND sources ${class}.cxx)