From 6ef750a7cf4e70b81b9a2097659b38bf7da3045d Mon Sep 17 00:00:00 2001 From: Aron Helser Date: Thu, 5 Mar 2020 16:45:01 -0500 Subject: [PATCH 1/3] Change smtk_operation_xml to build-time instead of cmake configure time. Uses a custom target for the generated file so it gets created before the source file tries to include it. --- CMake/SMTKOperationXML.cmake | 130 +++++++++++++++++------ smtk/CMakeLists.txt | 3 + smtk/attribute/Attribute.h | 2 +- smtk/attribute/CMakeLists.txt | 9 +- smtk/extension/matplotlib/CMakeLists.txt | 5 +- smtk/session/multiscale/CMakeLists.txt | 4 +- 6 files changed, 117 insertions(+), 36 deletions(-) diff --git a/CMake/SMTKOperationXML.cmake b/CMake/SMTKOperationXML.cmake index 744e6ff874..9817b90ecb 100644 --- a/CMake/SMTKOperationXML.cmake +++ b/CMake/SMTKOperationXML.cmake @@ -1,57 +1,123 @@ +set(_smtk_operation_xml_script_file "${CMAKE_CURRENT_LIST_FILE}") + + include("${CMAKE_CURRENT_LIST_DIR}/EncodeStringFunctions.cmake") -# Given a list of filenames (opSpecs) containing XML descriptions of -# operations, configure C++ source that encodes the XML as a string. +# Given a filename (opSpecs) containing an XML description of an +# operation, configure C++ or Python source that encodes the XML as a string. # Includes in the xml that resolve to accessible files are replaced by # the injection of the included file's contents. Query paths for included # files are passed to this macro with the flag INCLUDE_DIRS. -# The resulting files are placed in the current binary directory and -# appended to genFiles. +# The resulting files are placed in the current binary directory. # smtk_operation_xml( -# +# # INCLUDE_DIRS +# EXT "py" (optional, defaults to "h" and C++, use "py" for python) +# TYPE "_json" (optional, defaults to "_xml", appended to file and var name) +# HEADER_OUTPUT (optional, filled in with full path of generated header) # ) -function(smtk_operation_xml opSpecs genFiles) +# use of add_custom_command() borrowed from vtkEncodeString.cmake +function(smtk_operation_xml_new inOpSpecs) set(options) - set(oneValueArgs) + set(oneValueArgs "EXT;TYPE;HEADER_OUTPUT;TARGET_OUTPUT") set(multiValueArgs INCLUDE_DIRS) - cmake_parse_arguments(SMTK_op "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - list(APPEND SMTK_op_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}) + cmake_parse_arguments(_SMTK_op "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if (_SMTK_op_UNPARSED_ARGUMENTS) + message(FATAL_ERROR + "Unrecognized arguments to smtk_operation_xml_new: " + "${_SMTK_op_UNPARSED_ARGUMENTS}") + endif () + + set(inExt "h") + if (DEFINED _SMTK_op_EXT) + set(inExt ${_SMTK_op_EXT}) + endif() + set(inType "_xml") + if (DEFINED _SMTK_op_TYPE) + set(inType ${_SMTK_op_TYPE}) + endif() + list(APPEND _SMTK_op_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}) if (smtk_PREFIX_PATH) - list(APPEND SMTK_op_INCLUDE_DIRS ${smtk_PREFIX_PATH}/${SMTK_OPERATION_INCLUDE_DIR}) + list(APPEND _SMTK_op_INCLUDE_DIRS ${smtk_PREFIX_PATH}/${SMTK_OPERATION_INCLUDE_DIR}) endif () - foreach (opSpec ${opSpecs}) - get_filename_component(genFileBase "${opSpec}" NAME_WE) - set(genFile "${CMAKE_CURRENT_BINARY_DIR}/${genFileBase}_xml.h") - configureFileAsCVariable("${opSpec}" "${genFile}" "${genFileBase}_xml" "${SMTK_op_INCLUDE_DIRS}") - set(${genFiles} ${${genFiles}} "${genFile}" PARENT_SCOPE) - endforeach() + + get_filename_component(_genFileBase "${inOpSpecs}" NAME_WE) + set(_genFile "${CMAKE_CURRENT_BINARY_DIR}/${_genFileBase}${inType}.${inExt}") + message("_genFile: ${_genFile} depends ${_smtk_operation_xml_script_file} ${inOpSpecs} cmd ${CMAKE_COMMAND}" ) + + add_custom_command( + OUTPUT ${_genFile} + DEPENDS "${_smtk_operation_xml_script_file}" + "${inOpSpecs}" + COMMAND "${CMAKE_COMMAND}" + "-DgenFileBase=${_genFileBase}" + "-DgenFile=${_genFile}" + "-Dinclude_dirs=${_SMTK_op_INCLUDE_DIRS}" + "-DopSpec=${inOpSpecs}" + "-Dtype=${inType}" + "-Dext=${inExt}" + "-D_smtk_operation_xml_run=ON" + -P "${_smtk_operation_xml_script_file}") + string(REPLACE "\\" "_" _targetName "generate_${_genFile}") + string(REPLACE "/" "_" _targetName "${_targetName}") + string(REPLACE ":" "" _targetName "${_targetName}") + + add_custom_target(${_targetName} DEPENDS ${_genFile}) + + set_source_files_properties(${_genFile} PROPERTIES GENERATED ON) + + if (DEFINED _SMTK_op_HEADER_OUTPUT) + set("${_SMTK_op_HEADER_OUTPUT}" + "${_genFile}" + PARENT_SCOPE) + message("parent: " ${_genFile}) + endif () + if (DEFINED _SMTK_op_TARGET_OUTPUT) + set("${_SMTK_op_TARGET_OUTPUT}" + "${_targetName}" + PARENT_SCOPE) + message("target: " ${_targetName}) + endif () + endfunction() -# Given a list of filenames (opSpecs) containing XML descriptions of -# operations, configure Python source that encodes the XML as a string. -# Includes in the xml that resolve to accessible files are replaced by -# the injection of the included file's contents. Query paths for included -# files are passed to this macro with the flag INCLUDE_DIRS. -# The resulting files are placed in the current binary directory and -# appended to genFiles. -# smtk_pyoperation_xml( -# -# INCLUDE_DIRS -# ) -function(smtk_pyoperation_xml opSpecs genFiles) +# the old implementation, should be replaced when the new one works. +function(smtk_operation_xml opSpecs genFiles) set(options) - set(oneValueArgs) + set(oneValueArgs "EXT;TYPE") set(multiValueArgs INCLUDE_DIRS) cmake_parse_arguments(SMTK_op "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(ext "h") + if (DEFINED SMTK_op_EXT) + set(ext ${SMTK_op_EXT}) + endif() + set(type "_xml") + if (DEFINED SMTK_op_TYPE) + set(type ${SMTK_op_TYPE}) + endif() list(APPEND SMTK_op_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}) if (smtk_PREFIX_PATH) list(APPEND SMTK_op_INCLUDE_DIRS ${smtk_PREFIX_PATH}/${SMTK_OPERATION_INCLUDE_DIR}) endif () foreach (opSpec ${opSpecs}) get_filename_component(genFileBase "${opSpec}" NAME_WE) - set(genFile "${CMAKE_CURRENT_BINARY_DIR}/${genFileBase}_xml.py") - configureFileAsPyVariable("${opSpec}" "${genFile}" "${genFileBase}_xml" "${SMTK_op_INCLUDE_DIRS}") - set(${genFiles} ${${genFiles}} "${genFile}" PARENT_SCOPE) + set(genFile "${CMAKE_CURRENT_BINARY_DIR}/${genFileBase}${type}.${ext}") + if (ext STREQUAL "py") + configureFileAsPyVariable("${opSpec}" "${genFile}" "${genFileBase}${type}" "${SMTK_op_INCLUDE_DIRS}") + else () + configureFileAsCVariable("${opSpec}" "${genFile}" "${genFileBase}${type}" "${SMTK_op_INCLUDE_DIRS}") + endif() + # set(${genFiles} ${${genFiles}} "${genFile}" PARENT_SCOPE) endforeach() endfunction() + + + +if (_smtk_operation_xml_run AND CMAKE_SCRIPT_MODE_FILE) + + if (ext STREQUAL "py") + configureFileAsPyVariable("${opSpec}" "${genFile}" "${genFileBase}${type}" "${include_dirs}") + else () + configureFileAsCVariable("${opSpec}" "${genFile}" "${genFileBase}${type}" "${include_dirs}") + endif() +endif() diff --git a/smtk/CMakeLists.txt b/smtk/CMakeLists.txt index 727d676232..bf669528f2 100644 --- a/smtk/CMakeLists.txt +++ b/smtk/CMakeLists.txt @@ -105,6 +105,9 @@ if(SMTK_ENABLE_PYTHON_WRAPPING) endif() add_library(smtkCore ${smtk_srcs}) +message("smtkCore ${attributeDependencies}") +add_dependencies(smtkCore ${attributeDependencies}) + target_include_directories(smtkCore PUBLIC ${smtkCore_public_include_directories} diff --git a/smtk/attribute/Attribute.h b/smtk/attribute/Attribute.h index 904f148eae..f218b2a72e 100644 --- a/smtk/attribute/Attribute.h +++ b/smtk/attribute/Attribute.h @@ -172,7 +172,7 @@ public: typename T::ConstPtr findAs(const std::string& name, SearchStyle style = RECURSIVE_ACTIVE) const; /** - * @brief Given a container, file items in the attribute by a lambda function + * @brief Given a container, filter items in the attribute by a lambda function * @param values a container which holds items * @param test a lambda function which would be applied on children items * Example filter double and int items diff --git a/smtk/attribute/CMakeLists.txt b/smtk/attribute/CMakeLists.txt index 8c3749a23b..fbf42523b4 100644 --- a/smtk/attribute/CMakeLists.txt +++ b/smtk/attribute/CMakeLists.txt @@ -183,7 +183,14 @@ smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Export.sbt" defOpXML) smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Import.sbt" defOpXML) smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" defOpXML) smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Signal.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" defOpXML) +smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" + HEADER_OUTPUT defOpXML + TARGET_OUTPUT targetName) +# list(APPEND attributeHeaders ${defOpXML}) +# set(attributeDependencies "generate_${defOpXML}") +message("Lovely: ${defOpXML} ${targetName}") +set(attributeDependencies ${targetName} PARENT_SCOPE) +# add_dependencies(smtkCore ${attributeDependencies}) #install the headers smtk_public_headers(smtkCore ${attributeHeaders}) diff --git a/smtk/extension/matplotlib/CMakeLists.txt b/smtk/extension/matplotlib/CMakeLists.txt index 1d97fd214a..6ff390f47b 100644 --- a/smtk/extension/matplotlib/CMakeLists.txt +++ b/smtk/extension/matplotlib/CMakeLists.txt @@ -12,7 +12,10 @@ set(matplotlibPySrcs set(matplotlib_pymodulefiles) set(matplotlib_pyxmlfiles) -smtk_pyoperation_xml("${CMAKE_CURRENT_SOURCE_DIR}/render_mesh.sbt" matplotlib_pyxmlfiles) +smtk_operation_xml( + "${CMAKE_CURRENT_SOURCE_DIR}/render_mesh.sbt" matplotlib_pyxmlfiles + EXT "py" + ) foreach(pyfile ${matplotlibPySrcs}) get_filename_component(filename ${pyfile} NAME) diff --git a/smtk/session/multiscale/CMakeLists.txt b/smtk/session/multiscale/CMakeLists.txt index 3b56d8b7f1..9edc2bc5fa 100644 --- a/smtk/session/multiscale/CMakeLists.txt +++ b/smtk/session/multiscale/CMakeLists.txt @@ -80,7 +80,9 @@ configureStringAsPyVariable(AFRL_DIR list(APPEND multiscale_pyxmlfiles ${CMAKE_CURRENT_BINARY_DIR}/AFRLDir.py) -smtk_pyoperation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/import_from_deform.sbt" multiscale_pyxmlfiles) +smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/import_from_deform.sbt" multiscale_pyxmlfiles + EXT "py" + ) foreach(pyfile ${multiscalePySrcs}) get_filename_component(filename ${pyfile} NAME) -- GitLab From a9fb633710470505ac07089c39eaec9e400c38fc Mon Sep 17 00:00:00 2001 From: Aron Helser Date: Sun, 8 Mar 2020 17:38:44 -0400 Subject: [PATCH 2/3] Convert to smtk_operation_xml_new wherever possible. All C++ uses are converted, but Python use cases still use the old method. --- CMake/SMTKOperationXML.cmake | 5 +- .../implement_an_operator/CMakeLists.txt | 11 ++- smtk/CMakeLists.txt | 5 +- smtk/attribute/CMakeLists.txt | 48 ++++----- smtk/extension/delaunay/CMakeLists.txt | 33 +++++-- smtk/extension/opencv/CMakeLists.txt | 4 +- smtk/extension/paraview/server/CMakeLists.txt | 19 ++-- smtk/extension/qt/CMakeLists.txt | 5 +- smtk/extension/vtk/operators/CMakeLists.txt | 5 +- smtk/mesh/CMakeLists.txt | 93 ++++++----------- smtk/model/CMakeLists.txt | 5 +- smtk/operation/CMakeLists.txt | 31 +++--- smtk/session/discrete/CMakeLists.txt | 74 ++++++-------- smtk/session/mesh/CMakeLists.txt | 48 ++++----- smtk/session/multiscale/CMakeLists.txt | 28 +++--- smtk/session/oscillator/CMakeLists.txt | 56 +++++------ smtk/session/polygon/CMakeLists.txt | 99 ++++++++----------- smtk/session/vtk/CMakeLists.txt | 40 ++++---- 18 files changed, 279 insertions(+), 330 deletions(-) diff --git a/CMake/SMTKOperationXML.cmake b/CMake/SMTKOperationXML.cmake index 9817b90ecb..187f5379ba 100644 --- a/CMake/SMTKOperationXML.cmake +++ b/CMake/SMTKOperationXML.cmake @@ -43,7 +43,6 @@ function(smtk_operation_xml_new inOpSpecs) get_filename_component(_genFileBase "${inOpSpecs}" NAME_WE) set(_genFile "${CMAKE_CURRENT_BINARY_DIR}/${_genFileBase}${inType}.${inExt}") - message("_genFile: ${_genFile} depends ${_smtk_operation_xml_script_file} ${inOpSpecs} cmd ${CMAKE_COMMAND}" ) add_custom_command( OUTPUT ${_genFile} @@ -52,7 +51,7 @@ function(smtk_operation_xml_new inOpSpecs) COMMAND "${CMAKE_COMMAND}" "-DgenFileBase=${_genFileBase}" "-DgenFile=${_genFile}" - "-Dinclude_dirs=${_SMTK_op_INCLUDE_DIRS}" + "-Dinclude_dirs=\"${_SMTK_op_INCLUDE_DIRS}\"" "-DopSpec=${inOpSpecs}" "-Dtype=${inType}" "-Dext=${inExt}" @@ -70,13 +69,11 @@ function(smtk_operation_xml_new inOpSpecs) set("${_SMTK_op_HEADER_OUTPUT}" "${_genFile}" PARENT_SCOPE) - message("parent: " ${_genFile}) endif () if (DEFINED _SMTK_op_TARGET_OUTPUT) set("${_SMTK_op_TARGET_OUTPUT}" "${_targetName}" PARENT_SCOPE) - message("target: " ${_targetName}) endif () endfunction() diff --git a/doc/tutorials/implement_an_operator/CMakeLists.txt b/doc/tutorials/implement_an_operator/CMakeLists.txt index 92ee75d26b..d3a58e2da8 100644 --- a/doc/tutorials/implement_an_operator/CMakeLists.txt +++ b/doc/tutorials/implement_an_operator/CMakeLists.txt @@ -7,15 +7,15 @@ set(CMAKE_CXX_EXTENSIONS False) find_package(smtk) -# The smtk_operation_xml() function writes a file to the current +# The smtk_operation_xml_new() function writes a file to the current # binary directory sharing the same name as the input file # but with "_xml.h" replacing the file extension. For this # example, that filename is "implement_an_operator_xml.h". -# smtk_operation_xml() appends the exact filename to the -# "operatorXML" variable. -smtk_operation_xml( +# smtk_operation_xml_new() provides a target name that we can +# add as a dependency so this file gets generated during the build. +smtk_operation_xml_new( "${CMAKE_CURRENT_SOURCE_DIR}/implement_an_operator.xml" - operatorXML + TARGET_OUTPUT targetName ) # Make sure we can include the resulting file: @@ -26,6 +26,7 @@ include(CTest) enable_testing() add_executable(implement_an_operator implement_an_operator.cxx) +add_dependencies(implement_an_operator ${targetName}) target_link_libraries(implement_an_operator smtkCore smtkCoreModelTesting) add_test(NAME tut-implement_an_operator COMMAND implement_an_operator) set_tests_properties(tut-implement_an_operator PROPERTIES SKIP_RETURN_CODE 125) diff --git a/smtk/CMakeLists.txt b/smtk/CMakeLists.txt index bf669528f2..b3f3258857 100644 --- a/smtk/CMakeLists.txt +++ b/smtk/CMakeLists.txt @@ -105,8 +105,11 @@ if(SMTK_ENABLE_PYTHON_WRAPPING) endif() add_library(smtkCore ${smtk_srcs}) -message("smtkCore ${attributeDependencies}") +# dependencies on generated files from subdirectories add_dependencies(smtkCore ${attributeDependencies}) +add_dependencies(smtkCore ${meshDependencies}) +add_dependencies(smtkCore ${modelDependencies}) +add_dependencies(smtkCore ${operationDependencies}) target_include_directories(smtkCore PUBLIC diff --git a/smtk/attribute/CMakeLists.txt b/smtk/attribute/CMakeLists.txt index fbf42523b4..f6c805b0e8 100644 --- a/smtk/attribute/CMakeLists.txt +++ b/smtk/attribute/CMakeLists.txt @@ -72,6 +72,16 @@ set(jsonAttributeSrcs json/jsonVoidItemDefinition.cxx ) +set(attributeOperators + Associate + Dissociate + Export + Import + Read + Signal + Write + ) + set(attributeHeaders ${jsonAttributeHeaders} Analyses.h @@ -117,14 +127,6 @@ set(attributeHeaders ValueItemTemplate.h VoidItem.h VoidItemDefinition.h - - operators/Associate.h - operators/Dissociate.h - operators/Export.h - operators/Import.h - operators/Read.h - operators/Signal.h - operators/Write.h ) set(attributeSrcs @@ -166,31 +168,17 @@ set(attributeSrcs ValueItemDefinition.cxx VoidItem.cxx VoidItemDefinition.cxx - - operators/Associate.cxx - operators/Dissociate.cxx - operators/Export.cxx - operators/Import.cxx - operators/Read.cxx - operators/Signal.cxx - operators/Write.cxx ) -#construct operator inputs -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Associate.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Dissociate.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Export.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Import.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Signal.sbt" defOpXML) -smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" - HEADER_OUTPUT defOpXML +# construct operator inputs +foreach (operator ${attributeOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) -# list(APPEND attributeHeaders ${defOpXML}) -# set(attributeDependencies "generate_${defOpXML}") -message("Lovely: ${defOpXML} ${targetName}") -set(attributeDependencies ${targetName} PARENT_SCOPE) -# add_dependencies(smtkCore ${attributeDependencies}) + list(APPEND attributeSrcs operators/${operator}.cxx) + list(APPEND attributeHeaders operators/${operator}.h) + list(APPEND _attributeDependencies ${targetName}) +endforeach() +set(attributeDependencies ${_attributeDependencies} PARENT_SCOPE) #install the headers smtk_public_headers(smtkCore ${attributeHeaders}) diff --git a/smtk/extension/delaunay/CMakeLists.txt b/smtk/extension/delaunay/CMakeLists.txt index 4b66170f6d..f4c70cc58d 100644 --- a/smtk/extension/delaunay/CMakeLists.txt +++ b/smtk/extension/delaunay/CMakeLists.txt @@ -1,19 +1,25 @@ -set(source +set(delaunaySrcs Registrar.cxx io/ImportDelaunayMesh.cxx io/ExportDelaunayMesh.cxx - operators/TessellateFaces.cxx - operators/TriangulateFaces.cxx) -set(headers + ) +set(delaunayHeaders Registrar.h io/ImportDelaunayMesh.h io/ExportDelaunayMesh.h - operators/TessellateFaces.h - operators/TriangulateFaces.h) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/TriangulateFaces.sbt" delaunayOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/TessellateFaces.sbt" delaunayOperationXML) + ) -add_library(smtkDelaunayExt ${source}) +set(delaunayOperators + TessellateFaces + TriangulateFaces + ) + +foreach (operator ${delaunayOperators}) + list(APPEND delaunaySrcs operators/${operator}.cxx) + list(APPEND delaunayHeaders operators/${operator}.h) +endforeach() + +add_library(smtkDelaunayExt ${delaunaySrcs}) target_link_libraries(smtkDelaunayExt PRIVATE smtkCore @@ -25,9 +31,16 @@ target_link_libraries(smtkDelaunayExt ) smtk_export_header(smtkDelaunayExt Exports.h) -smtk_public_headers(smtkDelaunayExt ${headers}) +smtk_public_headers(smtkDelaunayExt ${delaunayHeaders}) smtk_install_library(smtkDelaunayExt) +foreach (operator ${delaunayOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND delaunayDependencies ${targetName}) +endforeach() +add_dependencies(smtkDelaunayExt ${delaunayDependencies}) + if (SMTK_ENABLE_PARAVIEW_SUPPORT) set_property(GLOBAL APPEND PROPERTY _smtk_plugin_files "${CMAKE_CURRENT_SOURCE_DIR}/plugin/paraview.plugin") diff --git a/smtk/extension/opencv/CMakeLists.txt b/smtk/extension/opencv/CMakeLists.txt index 6a17ed36df..54a564588a 100644 --- a/smtk/extension/opencv/CMakeLists.txt +++ b/smtk/extension/opencv/CMakeLists.txt @@ -7,7 +7,8 @@ if(SMTK_ENABLE_POLYGON_SESSION) operators/SurfaceExtractContours.cxx ) - smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SurfaceExtractContours.sbt" opencvOperationXML) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/SurfaceExtractContours.sbt" + TARGET_OUTPUT secTarget) set(import_vtk_depends) @@ -28,6 +29,7 @@ if(SMTK_ENABLE_POLYGON_SESSION) endif() add_library(smtkOpenCVExt ${opencvSrcs}) + add_dependencies(smtkOpenCVExt ${secTarget}) target_link_libraries(smtkOpenCVExt LINK_PUBLIC smtkCore diff --git a/smtk/extension/paraview/server/CMakeLists.txt b/smtk/extension/paraview/server/CMakeLists.txt index 91402d8f4b..a661ec4895 100644 --- a/smtk/extension/paraview/server/CMakeLists.txt +++ b/smtk/extension/paraview/server/CMakeLists.txt @@ -1,8 +1,5 @@ set(classes Registrar - RespondToVTKSelection - VTKMeshCellSelection - VTKModelInstancePlacementSelection VTKSelectionResponderGroup smtkModelEntityPointLocator @@ -19,13 +16,23 @@ set(classes vtkSMTKSettings vtkSMTKWrapper) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/RespondToVTKSelection.sbt" smtkPVServerOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/VTKMeshCellSelection.sbt" smtkPVServerOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/VTKModelInstancePlacementSelection.sbt" smtkPVServerOperationXML) +set(pvServerOps + RespondToVTKSelection + VTKMeshCellSelection + VTKModelInstancePlacementSelection +) +foreach (operator ${pvServerOps}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND classes ${operator}) + list(APPEND pvServerDependencies ${targetName}) +endforeach() vtk_module_add_module(smtkPVServerExt CLASSES ${classes} HEADERS_SUBDIR "smtk/extension/paraview/server") +add_dependencies(smtkPVServerExt ${pvServerDependencies}) + vtk_module_link(smtkPVServerExt PUBLIC nlohmann_json diff --git a/smtk/extension/qt/CMakeLists.txt b/smtk/extension/qt/CMakeLists.txt index 92124f8ac4..9050cf2420 100644 --- a/smtk/extension/qt/CMakeLists.txt +++ b/smtk/extension/qt/CMakeLists.txt @@ -160,7 +160,8 @@ add_library(smtkQtExt ) # put contents of this file in a string in a header. It's not xml, but it still works. -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/ResourcePanelConfiguration.json" qtResourcePanelJSON) +smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/ResourcePanelConfiguration.json" + TARGET_OUTPUT rpJsonTarget) #we need to add the location of the moc files to the include dir for qtsmtk target_include_directories(smtkQtExt PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) @@ -175,6 +176,8 @@ target_link_libraries(smtkQtExt LINK_PRIVATE Threads::Threads ) +add_dependencies(smtkQtExt ${rpJsonTarget}) + smtk_export_header(smtkQtExt Exports.h) #install the library and exports the library when used from a build tree diff --git a/smtk/extension/vtk/operators/CMakeLists.txt b/smtk/extension/vtk/operators/CMakeLists.txt index 292b7a33bf..d82d94bddb 100644 --- a/smtk/extension/vtk/operators/CMakeLists.txt +++ b/smtk/extension/vtk/operators/CMakeLists.txt @@ -2,11 +2,14 @@ set(classes ExportEdgesToVTK vtkSMTKOperation) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/ExportEdgesToVTK.sbt" smtkVTKOperationXML) +smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/ExportEdgesToVTK.sbt" + TARGET_OUTPUT optargetName) vtk_module_add_module(vtkSMTKOperationsExt CLASSES ${classes} HEADERS_SUBDIR "smtk/extension/vtk/operators") +add_dependencies(vtkSMTKOperationsExt ${optargetName}) + vtk_module_link(vtkSMTKOperationsExt PUBLIC smtkCore diff --git a/smtk/mesh/CMakeLists.txt b/smtk/mesh/CMakeLists.txt index aec248c102..0850de687f 100644 --- a/smtk/mesh/CMakeLists.txt +++ b/smtk/mesh/CMakeLists.txt @@ -40,27 +40,6 @@ set(meshSrcs moab/Readers.cxx moab/Writers.cxx - operators/DeleteMesh.cxx - operators/ElevateMesh.cxx - operators/Export.cxx - operators/ExtractAdjacency.cxx - operators/ExtractByDihedralAngle.cxx - operators/ExtractSkin.cxx - operators/GenerateHotStartData.cxx - operators/Import.cxx - operators/InterpolateOntoMesh.cxx - operators/MergeCoincidentPoints.cxx - operators/PrintMeshInformation.cxx - operators/Read.cxx - operators/ReadResource.cxx - operators/SelectCells.cxx - operators/SetMeshName.cxx - operators/Subtract.cxx - operators/Transform.cxx - operators/UndoElevateMesh.cxx - operators/Write.cxx - operators/WriteResource.cxx - resource/Registrar.cxx resource/Selection.cxx @@ -112,27 +91,6 @@ set(meshHeaders moab/Interface.h moab/ModelEntityPointLocator.h - operators/DeleteMesh.h - operators/ElevateMesh.h - operators/Export.h - operators/ExtractAdjacency.h - operators/ExtractByDihedralAngle.h - operators/ExtractSkin.h - operators/GenerateHotStartData.h - operators/Import.h - operators/InterpolateOntoMesh.h - operators/MergeCoincidentPoints.h - operators/PrintMeshInformation.h - operators/Read.h - operators/ReadResource.h - operators/SelectCells.h - operators/SetMeshName.h - operators/Subtract.h - operators/Transform.h - operators/UndoElevateMesh.h - operators/Write.h - operators/WriteResource.h - resource/Registrar.h resource/Selection.h @@ -144,27 +102,38 @@ set(meshHeaders utility/Metrics.h utility/Reclassify.h ) +set(meshOperators + DeleteMesh + ElevateMesh + Export + ExtractAdjacency + ExtractByDihedralAngle + ExtractSkin + GenerateHotStartData + Import + InterpolateOntoMesh + MergeCoincidentPoints + PrintMeshInformation + Read + ReadResource + SelectCells + SetMeshName + Subtract + Transform + UndoElevateMesh + Write + WriteResource + ) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/DeleteMesh.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ElevateMesh.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Export.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ExtractAdjacency.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ExtractByDihedralAngle.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ExtractSkin.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/GenerateHotStartData.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Import.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/InterpolateOntoMesh.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/MergeCoincidentPoints.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/PrintMeshInformation.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ReadResource.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SelectCells.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SetMeshName.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Subtract.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Transform.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/UndoElevateMesh.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/WriteResource.sbt" defOpXML) +# construct operator inputs +foreach (operator ${meshOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND meshSrcs operators/${operator}.cxx) + list(APPEND meshHeaders operators/${operator}.h) + list(APPEND _meshDependencies ${targetName}) +endforeach() +set(meshDependencies ${_meshDependencies} PARENT_SCOPE) #install the headers smtk_public_headers(smtkCore ${meshHeaders}) diff --git a/smtk/model/CMakeLists.txt b/smtk/model/CMakeLists.txt index c94d9d47fd..6a5a0a5439 100644 --- a/smtk/model/CMakeLists.txt +++ b/smtk/model/CMakeLists.txt @@ -119,10 +119,13 @@ set(modelHeaders ) foreach (operator ${modelOps}) - smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" defOpXML) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) list(APPEND modelSrcs operators/${operator}.cxx) list(APPEND modelHeaders operators/${operator}.h) + list(APPEND _modelDependencies ${targetName}) endforeach() +set(modelDependencies ${_modelDependencies} PARENT_SCOPE) #install the headers smtk_public_headers(smtkCore ${modelHeaders}) diff --git a/smtk/operation/CMakeLists.txt b/smtk/operation/CMakeLists.txt index 276eacad3c..48e0e28dd8 100644 --- a/smtk/operation/CMakeLists.txt +++ b/smtk/operation/CMakeLists.txt @@ -19,10 +19,6 @@ set(operationSrcs groups/WriterGroup.cxx operators/ImportResource.cxx - operators/ReadResource.cxx - operators/RemoveResource.cxx - operators/SetProperty.cxx - operators/WriteResource.cxx ) set(operationHeaders @@ -50,10 +46,6 @@ set(operationHeaders groups/WriterGroup.h operators/ImportResource.h - operators/ReadResource.h - operators/RemoveResource.h - operators/SetProperty.h - operators/WriteResource.h ) set(operationXML @@ -61,11 +53,24 @@ set(operationXML Result.xml ) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/Operation.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ReadResource.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/RemoveResource.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SetProperty.sbt" defOpXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/WriteResource.sbt" defOpXML) +set(operationOperators + ReadResource + RemoveResource + SetProperty + WriteResource + ) + +smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/Operation.sbt" + TARGET_OUTPUT targetName) +list(APPEND _operationDependencies ${targetName}) +foreach (operator ${operationOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND operationSrcs operators/${operator}.cxx) + list(APPEND operationHeaders operators/${operator}.h) + list(APPEND _operationDependencies ${targetName}) +endforeach() +set(operationDependencies ${_operationDependencies} PARENT_SCOPE) if (SMTK_ENABLE_PYTHON_WRAPPING) diff --git a/smtk/session/discrete/CMakeLists.txt b/smtk/session/discrete/CMakeLists.txt index d179ce9ece..45fb10c225 100644 --- a/smtk/session/discrete/CMakeLists.txt +++ b/smtk/session/discrete/CMakeLists.txt @@ -116,23 +116,6 @@ set(discreteSessionSrcs Session.cxx Operation.cxx ArrangementHelper.cxx - operators/CreateEdgesOperation.cxx - operators/EntityGroupOperation.cxx - operators/ImportOperation.cxx - operators/LegacyReadResource.cxx - operators/MergeOperation.cxx - operators/ReadOperation.cxx - operators/ReadResource.cxx - operators/SplitFaceOperation.cxx - operators/WriteOperation.cxx - operators/WriteResource.cxx - operators/RemoveModel.cxx - operators/SetProperty.cxx - # TODO: These operators use the old MeshSelectionItem - # and need to be updated in order to be used - # operators/EdgeOperation.cxx - # operators/GrowOperation.cxx - ) set(discreteSessionHeaders @@ -141,39 +124,40 @@ set(discreteSessionHeaders Session.h Operation.h ArrangementHelper.h - operators/CreateEdgesOperation.h - operators/EntityGroupOperation.h - operators/ImportOperation.h - operators/LegacyReadResource.h - operators/MergeOperation.h - operators/ReadOperation.h - operators/ReadResource.h - operators/SplitFaceOperation.h - operators/GrowOperation.h - operators/WriteOperation.h - operators/WriteResource.h - operators/RemoveModel.h - operators/EdgeOperation.h - operators/SetProperty.h ) +set(discreteSessionOperators + CreateEdgesOperation + EntityGroupOperation + ImportOperation + LegacyReadResource + MergeOperation + ReadOperation + ReadResource + RemoveModel + SetProperty + SplitFaceOperation + WriteOperation + WriteResource + # TODO: These operators use the old MeshSelectionItem + # and need to be updated in order to be used + # EdgeOperation + # GrowOperation + ) + include(SMTKOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateEdgesOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/MergeOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ReadOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/LegacyReadResource.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ReadResource.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SplitFaceOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ImportOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/EntityGroupOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/GrowOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/WriteOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/WriteResource.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/RemoveModel.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/EdgeOperation.sbt" unitOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SetProperty.sbt" unitOperationXML) + +# construct operator inputs +foreach (operator ${discreteSessionOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND discreteSessionSrcs operators/${operator}.cxx) + list(APPEND discreteSessionHeaders operators/${operator}.h) + list(APPEND _discreteSessionDependencies ${targetName}) +endforeach() add_library(smtkDiscreteSession ${_module_src} ${discreteSessionSrcs}) +add_dependencies(smtkDiscreteSession ${_discreteSessionDependencies}) set (__public_dependencies) set (__private_dependencies) diff --git a/smtk/session/mesh/CMakeLists.txt b/smtk/session/mesh/CMakeLists.txt index 222217227c..5dc89ed432 100644 --- a/smtk/session/mesh/CMakeLists.txt +++ b/smtk/session/mesh/CMakeLists.txt @@ -4,14 +4,6 @@ set(meshSrcs Resource.cxx Session.cxx Topology.cxx - operators/CreateUniformGrid.cxx - operators/EulerCharacteristicRatio.cxx - operators/Export.cxx - operators/Import.cxx - operators/Merge.cxx - operators/Print.cxx - operators/Read.cxx - operators/Write.cxx ) set(meshHeaders @@ -20,14 +12,6 @@ set(meshHeaders Resource.h Session.h Topology.h - operators/CreateUniformGrid.h - operators/EulerCharacteristicRatio.h - operators/Export.h - operators/Import.h - operators/Merge.h - operators/Print.h - operators/Read.h - operators/Write.h ) if (SMTK_ENABLE_VTK_SUPPORT) @@ -37,21 +21,29 @@ if (SMTK_ENABLE_VTK_SUPPORT) vtk/Geometry.h) endif () -add_library(smtkMeshSession ${meshSrcs}) +set(meshOperators + CreateUniformGrid + EulerCharacteristicRatio + Export + Import + Merge + Print + Read + Write + ) # Operations which have XML descriptions in separate files # need to have it encoded as a string in a header. -# We do not need the path to the generated header (appended -# to meshOperationXML) since the operators themselves include -# the header in their implementations. -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateUniformGrid.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/EulerCharacteristicRatio.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Export.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Import.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Merge.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Print.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" meshOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" meshOperationXML) +foreach (operator ${meshOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND meshSrcs operators/${operator}.cxx) + list(APPEND meshHeaders operators/${operator}.h) + list(APPEND meshDependencies ${targetName}) +endforeach() + +add_library(smtkMeshSession ${meshSrcs}) +add_dependencies(smtkMeshSession ${meshDependencies}) # Install the headers smtk_public_headers(smtkMeshSession ${meshHeaders}) diff --git a/smtk/session/multiscale/CMakeLists.txt b/smtk/session/multiscale/CMakeLists.txt index 9edc2bc5fa..f919c7a2a1 100644 --- a/smtk/session/multiscale/CMakeLists.txt +++ b/smtk/session/multiscale/CMakeLists.txt @@ -2,21 +2,33 @@ set(multiscaleSrcs Registrar.cxx Resource.cxx Session.cxx - operators/PartitionBoundaries.cxx - operators/Revolve.cxx ) set(multiscaleHeaders Registrar.h Resource.h Session.h - operators/PartitionBoundaries.h - operators/Revolve.h ) +set(multiscaleOperators + PartitionBoundaries + Revolve + ) + +# Operations which have XML descriptions in separate files +# need to have it encoded as a string in a header. +foreach (operator ${multiscaleOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND multiscaleSrcs operators/${operator}.cxx) + list(APPEND multiscaleHeaders operators/${operator}.h) + list(APPEND _multiscaleDependencies ${targetName}) +endforeach() + install(FILES PointerDefs.h DESTINATION include/smtk/${SMTK_VERSION}/smtk/session/multiscale) add_library(smtkMultiscaleSession ${multiscaleSrcs}) +add_dependencies(smtkMultiscaleSession ${_multiscaleDependencies}) target_compile_definitions(smtkMultiscaleSession PRIVATE "AFRL_DIR=\"${AFRL_DIR}\"") target_compile_definitions(smtkMultiscaleSession PRIVATE "SMTK_SCRATCH_DIR=\"${CMAKE_BINARY_DIR}/Testing/Temporary\"") @@ -45,14 +57,6 @@ smtk_export_header(smtkMultiscaleSession Exports.h) #install the library and exports the library when used from a build tree smtk_install_library(smtkMultiscaleSession) -# Operations which have XML descriptions in separate files -# need to have it encoded as a string in a header. -# We do not need the path to the generated header (appended -# to multiscaleOperationXML) since the operators themselves include -# the header in their implementations. -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/PartitionBoundaries.sbt" multiscaleOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Revolve.sbt" multiscaleOperationXML) - # Install the headers smtk_public_headers(smtkMultiscaleSession ${multiscaleHeaders}) diff --git a/smtk/session/oscillator/CMakeLists.txt b/smtk/session/oscillator/CMakeLists.txt index 3de29146a1..8ca8ae42a3 100644 --- a/smtk/session/oscillator/CMakeLists.txt +++ b/smtk/session/oscillator/CMakeLists.txt @@ -2,29 +2,41 @@ set(oscillatorSrcs Registrar.cxx Resource.cxx SimulationAttribute.cxx - operators/CreateModel.cxx - # operators/Delete.cxx - operators/EditDomain.cxx - operators/EditSource.cxx - operators/Export.cxx - operators/Read.cxx - operators/Write.cxx ) set(oscillatorHeaders Registrar.h Resource.h SimulationAttribute.h - operators/CreateModel.h - # operators/Delete.h - operators/EditDomain.h - operators/EditSource.h - operators/Export.h - operators/Read.h - operators/Write.h ) +set(oscillatorOperators + CreateModel + # Delete + EditDomain + EditSource + Export + Read + Write + ) + +# Operators which have XML descriptions in separate files +# need to have it encoded as a string in a header. +foreach (operator ${oscillatorOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND oscillatorSrcs operators/${operator}.cxx) + list(APPEND oscillatorHeaders operators/${operator}.h) + list(APPEND _oscillatorDependencies ${targetName}) +endforeach() +# This is not an operation but a simulation attribute. However, we can use +# the XML encoding the same way: +smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/SimulationAttribute.sbt" + TARGET_OUTPUT targetName) +list(APPEND _oscillatorDependencies ${targetName}) + add_library(smtkOscillatorSession ${oscillatorSrcs}) +add_dependencies(smtkOscillatorSession ${_oscillatorDependencies}) target_link_libraries(smtkOscillatorSession PUBLIC smtkCore @@ -34,22 +46,6 @@ target_link_libraries(smtkOscillatorSession smtk_export_header(smtkOscillatorSession Exports.h) smtk_install_library(smtkOscillatorSession) -# Operators which have XML descriptions in separate files -# need to have it encoded as a string in a header. -# We do not need the path to the generated header (appended -# to oscillatorOperatorXML) since the operators themselves include -# the header in their implementations. -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateModel.sbt" oscillatorOperatorXML) -# smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Delete.sbt" oscillatorOperatorXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/EditDomain.sbt" oscillatorOperatorXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/EditSource.sbt" oscillatorOperatorXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Export.sbt" oscillatorOperatorXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" oscillatorOperatorXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" oscillatorOperatorXML) -# This is not an operation but a simulation attribute. However, we can use -# the XML encoding the same way: -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/SimulationAttribute.sbt" oscillatorOperatorXML) - # Install the headers smtk_public_headers(smtkOscillatorSession ${oscillatorHeaders}) diff --git a/smtk/session/polygon/CMakeLists.txt b/smtk/session/polygon/CMakeLists.txt index 47a8c13cb2..39bfe59d0c 100644 --- a/smtk/session/polygon/CMakeLists.txt +++ b/smtk/session/polygon/CMakeLists.txt @@ -14,22 +14,6 @@ set(polygonSrcs json/jsonModel.cxx json/jsonResource.cxx json/jsonVertex.cxx - operators/CleanGeometry.cxx - operators/CreateModel.cxx - operators/CreateVertices.cxx - operators/CreateEdge.cxx - operators/CreateEdgeFromPoints.cxx - operators/CreateEdgeFromVertices.cxx - operators/CreateFaces.cxx - operators/CreateFacesFromEdges.cxx - operators/Delete.cxx - operators/DemoteVertex.cxx - operators/ForceCreateFace.cxx - operators/LegacyRead.cxx - operators/Read.cxx - operators/SplitEdge.cxx - operators/TweakEdge.cxx - operators/Write.cxx ) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND @@ -56,22 +40,6 @@ set(polygonHeaders internal/Region.h internal/SweepEvent.h internal/Vertex.h - operators/CleanGeometry.h - operators/CreateModel.h - operators/CreateVertices.h - operators/CreateEdge.h - operators/CreateEdgeFromPoints.h - operators/CreateEdgeFromVertices.h - operators/CreateFaces.h - operators/CreateFacesFromEdges.h - operators/Delete.h - operators/DemoteVertex.h - operators/ForceCreateFace.h - operators/LegacyRead.h - operators/Read.h - operators/SplitEdge.h - operators/TweakEdge.h - operators/Write.h json/jsonEdge.h json/jsonModel.h @@ -79,38 +47,49 @@ set(polygonHeaders json/jsonVertex.h ) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CleanGeometry.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/NewCreateModel.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateModel.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateVertices.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateEdge.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateEdgeFromPoints.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateEdgeFromVertices.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateFaces.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/CreateFacesFromEdges.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Delete.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/DemoteVertex.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ForceCreateFace.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/LegacyRead.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/SplitEdge.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/TweakEdge.sbt" polygonOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" polygonOperationXML) +set(polygonOperators + CleanGeometry + CreateModel + CreateVertices + CreateEdge + CreateEdgeFromPoints + CreateEdgeFromVertices + CreateFaces + CreateFacesFromEdges + Delete + DemoteVertex + ForceCreateFace + LegacyRead + Read + SplitEdge + TweakEdge + Write + ) + +# construct operator inputs +foreach (operator ${polygonOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND polygonSrcs operators/${operator}.cxx) + list(APPEND polygonHeaders operators/${operator}.h) + list(APPEND _polygonDependencies ${targetName}) +endforeach() set(import_vtk_depends) # The import operator is only available if there is VTK if(SMTK_ENABLE_VTK_SUPPORT) - set(polygonSrcs ${polygonSrcs} - operators/ExtractContours.cxx - operators/Import.cxx - ) - set(polygonHeaders ${polygonHeaders} - operators/ExtractContours.h - operators/Import.h - ) - smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/ExtractContours.sbt" polygonOperationXML) - smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Import.sbt" polygonOperationXML) + set(polygonOperators + ExtractContours + Import + ) + foreach (operator ${polygonOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND polygonSrcs operators/${operator}.cxx) + list(APPEND polygonHeaders operators/${operator}.h) + list(APPEND _polygonDependencies ${targetName}) + endforeach() list(APPEND import_vtk_depends vtkSMTKReaderExt VTK::CommonCore @@ -127,6 +106,8 @@ if(SMTK_ENABLE_VTK_SUPPORT) endif() add_library(smtkPolygonSession ${polygonSrcs}) +add_dependencies(smtkPolygonSession ${_polygonDependencies}) + if(SMTK_ENABLE_VTK_SUPPORT) target_compile_definitions(smtkPolygonSession PUBLIC VTK_SUPPORT) endif() diff --git a/smtk/session/vtk/CMakeLists.txt b/smtk/session/vtk/CMakeLists.txt index 8e555b6002..7f3cb595d4 100644 --- a/smtk/session/vtk/CMakeLists.txt +++ b/smtk/session/vtk/CMakeLists.txt @@ -5,11 +5,6 @@ set(vtkSrcs Session.cxx Operation.cxx json/jsonResource.cxx - operators/Export.cxx - operators/Import.cxx - operators/LegacyRead.cxx - operators/Read.cxx - operators/Write.cxx ) set(vtkHeaders @@ -19,16 +14,30 @@ set(vtkHeaders Session.h Operation.h json/jsonResource.h - operators/Export.h - operators/Import.h - operators/LegacyRead.h - operators/Read.h - operators/Write.h ) +set(vtkOperators + Export + Import + LegacyRead + Read + Write + ) + +# Operations which have XML descriptions in separate files +# need to have it encoded as a string in a header. +foreach (operator ${vtkOperators}) + smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + TARGET_OUTPUT targetName) + list(APPEND vtkSrcs operators/${operator}.cxx) + list(APPEND vtkHeaders operators/${operator}.h) + list(APPEND _vtkDependencies ${targetName}) +endforeach() + install(FILES PointerDefs.h DESTINATION include/smtk/${SMTK_VERSION}/smtk/session/vtk) add_library(smtkVTKSession ${vtkSrcs}) +add_dependencies(smtkVTKSession ${_vtkDependencies}) #set smtkVTKSession to publicly link to smtkCore and VTK set(__dependencies) @@ -83,17 +92,6 @@ install( ) export(EXPORT ${SMTK_EXPORT_SET} FILE "${PROJECT_BINARY_DIR}/${SMTK_INSTALL_CONFIG_DIR}/${SMTK_EXPORT_SET}-targets.cmake") -# Operations which have XML descriptions in separate files -# need to have it encoded as a string in a header. -# We do not need the path to the generated header (appended -# to vtkOperationXML) since the operations themselves include -# the header in their implementations. -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Export.sbt" vtkOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Import.sbt" vtkOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/LegacyRead.sbt" vtkOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" vtkOperationXML) -smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" vtkOperationXML) - # Install the headers smtk_public_headers(smtkVTKSession ${vtkHeaders}) -- GitLab From cfc6dc5acfef3083ab03a3cbb8144f7f9d89edda Mon Sep 17 00:00:00 2001 From: Aron Helser Date: Mon, 9 Mar 2020 14:39:03 -0400 Subject: [PATCH 3/3] Rename to smtk_encode_file(), use PYTHON option Rename smtk_operation_xml_new to smtk_encode_file, and use a boolean option to enable python generation. Mark multiscale as currently unbuildable. --- CMake/SMTKOperationXML.cmake | 32 +++++++++---------- .../notes/smtk_operation_xml_updated.md | 8 +++++ .../implement_an_operator/CMakeLists.txt | 6 ++-- smtk/attribute/CMakeLists.txt | 2 +- smtk/extension/delaunay/CMakeLists.txt | 2 +- smtk/extension/matplotlib/CMakeLists.txt | 5 ++- smtk/extension/opencv/CMakeLists.txt | 2 +- smtk/extension/paraview/server/CMakeLists.txt | 2 +- smtk/extension/qt/CMakeLists.txt | 2 +- smtk/extension/vtk/operators/CMakeLists.txt | 2 +- smtk/mesh/CMakeLists.txt | 2 +- smtk/model/CMakeLists.txt | 2 +- smtk/operation/CMakeLists.txt | 4 +-- smtk/session/CMakeLists.txt | 3 ++ smtk/session/discrete/CMakeLists.txt | 2 +- smtk/session/mesh/CMakeLists.txt | 2 +- smtk/session/multiscale/CMakeLists.txt | 5 +-- smtk/session/oscillator/CMakeLists.txt | 4 +-- smtk/session/polygon/CMakeLists.txt | 4 +-- smtk/session/vtk/CMakeLists.txt | 2 +- 20 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 doc/release/notes/smtk_operation_xml_updated.md diff --git a/CMake/SMTKOperationXML.cmake b/CMake/SMTKOperationXML.cmake index 187f5379ba..443df47d7a 100644 --- a/CMake/SMTKOperationXML.cmake +++ b/CMake/SMTKOperationXML.cmake @@ -17,20 +17,20 @@ include("${CMAKE_CURRENT_LIST_DIR}/EncodeStringFunctions.cmake") # HEADER_OUTPUT (optional, filled in with full path of generated header) # ) # use of add_custom_command() borrowed from vtkEncodeString.cmake -function(smtk_operation_xml_new inOpSpecs) - set(options) - set(oneValueArgs "EXT;TYPE;HEADER_OUTPUT;TARGET_OUTPUT") +function(smtk_encode_file inOpSpecs) + set(options "PYTHON") + set(oneValueArgs "TYPE;HEADER_OUTPUT;TARGET_OUTPUT") set(multiValueArgs INCLUDE_DIRS) cmake_parse_arguments(_SMTK_op "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if (_SMTK_op_UNPARSED_ARGUMENTS) message(FATAL_ERROR - "Unrecognized arguments to smtk_operation_xml_new: " + "Unrecognized arguments to smtk_encode_file: " "${_SMTK_op_UNPARSED_ARGUMENTS}") endif () set(inExt "h") - if (DEFINED _SMTK_op_EXT) - set(inExt ${_SMTK_op_EXT}) + if (_SMTK_op_PYTHON) + set(inExt "py") endif() set(inType "_xml") if (DEFINED _SMTK_op_TYPE) @@ -80,26 +80,26 @@ endfunction() # the old implementation, should be replaced when the new one works. function(smtk_operation_xml opSpecs genFiles) - set(options) - set(oneValueArgs "EXT;TYPE") + set(options "PYTHON") + set(oneValueArgs "TYPE") set(multiValueArgs INCLUDE_DIRS) - cmake_parse_arguments(SMTK_op "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(_SMTK_op "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(ext "h") - if (DEFINED SMTK_op_EXT) - set(ext ${SMTK_op_EXT}) + if (_SMTK_op_PYTHON) + set(ext "py") endif() set(type "_xml") - if (DEFINED SMTK_op_TYPE) - set(type ${SMTK_op_TYPE}) + if (DEFINED _SMTK_op_TYPE) + set(type ${_SMTK_op_TYPE}) endif() - list(APPEND SMTK_op_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}) + list(APPEND _SMTK_op_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}) if (smtk_PREFIX_PATH) - list(APPEND SMTK_op_INCLUDE_DIRS ${smtk_PREFIX_PATH}/${SMTK_OPERATION_INCLUDE_DIR}) + list(APPEND _SMTK_op_INCLUDE_DIRS ${smtk_PREFIX_PATH}/${SMTK_OPERATION_INCLUDE_DIR}) endif () foreach (opSpec ${opSpecs}) get_filename_component(genFileBase "${opSpec}" NAME_WE) set(genFile "${CMAKE_CURRENT_BINARY_DIR}/${genFileBase}${type}.${ext}") - if (ext STREQUAL "py") + if (_SMTK_op_PYTHON) configureFileAsPyVariable("${opSpec}" "${genFile}" "${genFileBase}${type}" "${SMTK_op_INCLUDE_DIRS}") else () configureFileAsCVariable("${opSpec}" "${genFile}" "${genFileBase}${type}" "${SMTK_op_INCLUDE_DIRS}") diff --git a/doc/release/notes/smtk_operation_xml_updated.md b/doc/release/notes/smtk_operation_xml_updated.md new file mode 100644 index 0000000000..bd711e46bd --- /dev/null +++ b/doc/release/notes/smtk_operation_xml_updated.md @@ -0,0 +1,8 @@ +### smtk_operation_xml() replaced with smtk_export_file() + +When operations add a .sbt xml file to specify the interface of the operation, +it was wrapped into a header file by the cmake function +`smtk_operation_xml()`. Update operations to use `smtk_encode_file()`, +because it will generate the file at build time instead of cmake configure +time, and the build tool (like `ninja`) will pick up on changes to the .sbt +file and rebuild. diff --git a/doc/tutorials/implement_an_operator/CMakeLists.txt b/doc/tutorials/implement_an_operator/CMakeLists.txt index d3a58e2da8..5c7a02760a 100644 --- a/doc/tutorials/implement_an_operator/CMakeLists.txt +++ b/doc/tutorials/implement_an_operator/CMakeLists.txt @@ -7,13 +7,13 @@ set(CMAKE_CXX_EXTENSIONS False) find_package(smtk) -# The smtk_operation_xml_new() function writes a file to the current +# The smtk_encode_file() function writes a file to the current # binary directory sharing the same name as the input file # but with "_xml.h" replacing the file extension. For this # example, that filename is "implement_an_operator_xml.h". -# smtk_operation_xml_new() provides a target name that we can +# smtk_encode_file() provides a target name that we can # add as a dependency so this file gets generated during the build. -smtk_operation_xml_new( +smtk_encode_file( "${CMAKE_CURRENT_SOURCE_DIR}/implement_an_operator.xml" TARGET_OUTPUT targetName ) diff --git a/smtk/attribute/CMakeLists.txt b/smtk/attribute/CMakeLists.txt index f6c805b0e8..297ca567c3 100644 --- a/smtk/attribute/CMakeLists.txt +++ b/smtk/attribute/CMakeLists.txt @@ -172,7 +172,7 @@ set(attributeSrcs # construct operator inputs foreach (operator ${attributeOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND attributeSrcs operators/${operator}.cxx) list(APPEND attributeHeaders operators/${operator}.h) diff --git a/smtk/extension/delaunay/CMakeLists.txt b/smtk/extension/delaunay/CMakeLists.txt index f4c70cc58d..5fc40b71a6 100644 --- a/smtk/extension/delaunay/CMakeLists.txt +++ b/smtk/extension/delaunay/CMakeLists.txt @@ -35,7 +35,7 @@ smtk_public_headers(smtkDelaunayExt ${delaunayHeaders}) smtk_install_library(smtkDelaunayExt) foreach (operator ${delaunayOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND delaunayDependencies ${targetName}) endforeach() diff --git a/smtk/extension/matplotlib/CMakeLists.txt b/smtk/extension/matplotlib/CMakeLists.txt index 6ff390f47b..e911ea0f24 100644 --- a/smtk/extension/matplotlib/CMakeLists.txt +++ b/smtk/extension/matplotlib/CMakeLists.txt @@ -12,10 +12,12 @@ set(matplotlibPySrcs set(matplotlib_pymodulefiles) set(matplotlib_pyxmlfiles) +# TODO consider updating to smtk_encode_file() if matplotlib is re-enabled. smtk_operation_xml( "${CMAKE_CURRENT_SOURCE_DIR}/render_mesh.sbt" matplotlib_pyxmlfiles - EXT "py" + PYTHON ) +message("XXX Matplotlib ${matplotlib_pyxmlfiles}") foreach(pyfile ${matplotlibPySrcs}) get_filename_component(filename ${pyfile} NAME) @@ -36,6 +38,7 @@ foreach(pyfile ${matplotlib_pyxmlfiles}) ) list(APPEND matplotlib_pymodulefiles "${CMAKE_BINARY_DIR}/${relativefile}") endforeach() +message("XXX Matplotlib ${matplotlib_pymodulefiles}") file(RELATIVE_PATH relativedir ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) install( diff --git a/smtk/extension/opencv/CMakeLists.txt b/smtk/extension/opencv/CMakeLists.txt index 54a564588a..6cf8047b67 100644 --- a/smtk/extension/opencv/CMakeLists.txt +++ b/smtk/extension/opencv/CMakeLists.txt @@ -7,7 +7,7 @@ if(SMTK_ENABLE_POLYGON_SESSION) operators/SurfaceExtractContours.cxx ) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/SurfaceExtractContours.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/SurfaceExtractContours.sbt" TARGET_OUTPUT secTarget) set(import_vtk_depends) diff --git a/smtk/extension/paraview/server/CMakeLists.txt b/smtk/extension/paraview/server/CMakeLists.txt index a661ec4895..472d904af9 100644 --- a/smtk/extension/paraview/server/CMakeLists.txt +++ b/smtk/extension/paraview/server/CMakeLists.txt @@ -22,7 +22,7 @@ set(pvServerOps VTKModelInstancePlacementSelection ) foreach (operator ${pvServerOps}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND classes ${operator}) list(APPEND pvServerDependencies ${targetName}) diff --git a/smtk/extension/qt/CMakeLists.txt b/smtk/extension/qt/CMakeLists.txt index 9050cf2420..3baa2b1eef 100644 --- a/smtk/extension/qt/CMakeLists.txt +++ b/smtk/extension/qt/CMakeLists.txt @@ -160,7 +160,7 @@ add_library(smtkQtExt ) # put contents of this file in a string in a header. It's not xml, but it still works. -smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/ResourcePanelConfiguration.json" +smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/ResourcePanelConfiguration.json" TARGET_OUTPUT rpJsonTarget) #we need to add the location of the moc files to the include dir for qtsmtk diff --git a/smtk/extension/vtk/operators/CMakeLists.txt b/smtk/extension/vtk/operators/CMakeLists.txt index d82d94bddb..a2d064de2c 100644 --- a/smtk/extension/vtk/operators/CMakeLists.txt +++ b/smtk/extension/vtk/operators/CMakeLists.txt @@ -2,7 +2,7 @@ set(classes ExportEdgesToVTK vtkSMTKOperation) -smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/ExportEdgesToVTK.sbt" +smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/ExportEdgesToVTK.sbt" TARGET_OUTPUT optargetName) vtk_module_add_module(vtkSMTKOperationsExt diff --git a/smtk/mesh/CMakeLists.txt b/smtk/mesh/CMakeLists.txt index 0850de687f..e4661ecfa7 100644 --- a/smtk/mesh/CMakeLists.txt +++ b/smtk/mesh/CMakeLists.txt @@ -127,7 +127,7 @@ set(meshOperators # construct operator inputs foreach (operator ${meshOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND meshSrcs operators/${operator}.cxx) list(APPEND meshHeaders operators/${operator}.h) diff --git a/smtk/model/CMakeLists.txt b/smtk/model/CMakeLists.txt index 6a5a0a5439..93c7cc83e2 100644 --- a/smtk/model/CMakeLists.txt +++ b/smtk/model/CMakeLists.txt @@ -119,7 +119,7 @@ set(modelHeaders ) foreach (operator ${modelOps}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND modelSrcs operators/${operator}.cxx) list(APPEND modelHeaders operators/${operator}.h) diff --git a/smtk/operation/CMakeLists.txt b/smtk/operation/CMakeLists.txt index 48e0e28dd8..5fb238b531 100644 --- a/smtk/operation/CMakeLists.txt +++ b/smtk/operation/CMakeLists.txt @@ -60,11 +60,11 @@ set(operationOperators WriteResource ) -smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/Operation.sbt" +smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/Operation.sbt" TARGET_OUTPUT targetName) list(APPEND _operationDependencies ${targetName}) foreach (operator ${operationOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND operationSrcs operators/${operator}.cxx) list(APPEND operationHeaders operators/${operator}.h) diff --git a/smtk/session/CMakeLists.txt b/smtk/session/CMakeLists.txt index 61693a673d..26e68a59e5 100644 --- a/smtk/session/CMakeLists.txt +++ b/smtk/session/CMakeLists.txt @@ -36,6 +36,9 @@ endif() # Build Multiscale session ################################################################################ if (SMTK_ENABLE_MULTISCALE_SESSION) + message(FATAL_ERROR + "multiscale session must be updated to use smtk_add_plugin") + set(SMTK_MULTISCALE_SESSION_ENABLED "True") add_subdirectory(multiscale) endif() diff --git a/smtk/session/discrete/CMakeLists.txt b/smtk/session/discrete/CMakeLists.txt index 45fb10c225..1b637b2faa 100644 --- a/smtk/session/discrete/CMakeLists.txt +++ b/smtk/session/discrete/CMakeLists.txt @@ -149,7 +149,7 @@ include(SMTKOperationXML) # construct operator inputs foreach (operator ${discreteSessionOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND discreteSessionSrcs operators/${operator}.cxx) list(APPEND discreteSessionHeaders operators/${operator}.h) diff --git a/smtk/session/mesh/CMakeLists.txt b/smtk/session/mesh/CMakeLists.txt index 5dc89ed432..6fcd9cd5f7 100644 --- a/smtk/session/mesh/CMakeLists.txt +++ b/smtk/session/mesh/CMakeLists.txt @@ -35,7 +35,7 @@ set(meshOperators # Operations which have XML descriptions in separate files # need to have it encoded as a string in a header. foreach (operator ${meshOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND meshSrcs operators/${operator}.cxx) list(APPEND meshHeaders operators/${operator}.h) diff --git a/smtk/session/multiscale/CMakeLists.txt b/smtk/session/multiscale/CMakeLists.txt index f919c7a2a1..4c3bf2d400 100644 --- a/smtk/session/multiscale/CMakeLists.txt +++ b/smtk/session/multiscale/CMakeLists.txt @@ -18,7 +18,7 @@ set(multiscaleOperators # Operations which have XML descriptions in separate files # need to have it encoded as a string in a header. foreach (operator ${multiscaleOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND multiscaleSrcs operators/${operator}.cxx) list(APPEND multiscaleHeaders operators/${operator}.h) @@ -84,8 +84,9 @@ configureStringAsPyVariable(AFRL_DIR list(APPEND multiscale_pyxmlfiles ${CMAKE_CURRENT_BINARY_DIR}/AFRLDir.py) +# TODO consider updating to smtk_encode_file() if multiscale is re-enabled. smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/import_from_deform.sbt" multiscale_pyxmlfiles - EXT "py" + PYTHON ) foreach(pyfile ${multiscalePySrcs}) diff --git a/smtk/session/oscillator/CMakeLists.txt b/smtk/session/oscillator/CMakeLists.txt index 8ca8ae42a3..d04844fe01 100644 --- a/smtk/session/oscillator/CMakeLists.txt +++ b/smtk/session/oscillator/CMakeLists.txt @@ -23,7 +23,7 @@ set(oscillatorOperators # Operators which have XML descriptions in separate files # need to have it encoded as a string in a header. foreach (operator ${oscillatorOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND oscillatorSrcs operators/${operator}.cxx) list(APPEND oscillatorHeaders operators/${operator}.h) @@ -31,7 +31,7 @@ foreach (operator ${oscillatorOperators}) endforeach() # This is not an operation but a simulation attribute. However, we can use # the XML encoding the same way: -smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/SimulationAttribute.sbt" +smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/SimulationAttribute.sbt" TARGET_OUTPUT targetName) list(APPEND _oscillatorDependencies ${targetName}) diff --git a/smtk/session/polygon/CMakeLists.txt b/smtk/session/polygon/CMakeLists.txt index 39bfe59d0c..516dc80d56 100644 --- a/smtk/session/polygon/CMakeLists.txt +++ b/smtk/session/polygon/CMakeLists.txt @@ -68,7 +68,7 @@ set(polygonOperators # construct operator inputs foreach (operator ${polygonOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND polygonSrcs operators/${operator}.cxx) list(APPEND polygonHeaders operators/${operator}.h) @@ -84,7 +84,7 @@ if(SMTK_ENABLE_VTK_SUPPORT) Import ) foreach (operator ${polygonOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND polygonSrcs operators/${operator}.cxx) list(APPEND polygonHeaders operators/${operator}.h) diff --git a/smtk/session/vtk/CMakeLists.txt b/smtk/session/vtk/CMakeLists.txt index 7f3cb595d4..fb7dd097c5 100644 --- a/smtk/session/vtk/CMakeLists.txt +++ b/smtk/session/vtk/CMakeLists.txt @@ -27,7 +27,7 @@ set(vtkOperators # Operations which have XML descriptions in separate files # need to have it encoded as a string in a header. foreach (operator ${vtkOperators}) - smtk_operation_xml_new("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" + smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/operators/${operator}.sbt" TARGET_OUTPUT targetName) list(APPEND vtkSrcs operators/${operator}.cxx) list(APPEND vtkHeaders operators/${operator}.h) -- GitLab