Commit 3388ac80 authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot

Merge topic 'reenable-examples'

bf7ab013 Fix the doxygen support for vtkMy
632af72c Enable the vtkMy example
862a323a Update the vtkMy build example for VTK 9
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !6247
parents 8e430b3e bf7ab013
Pipeline #153174 running with stage
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
#
# Set the project name.
# Set the project name. The version number is optional.
#
project (VTKMY)
project(VTKMY VERSION 1.0.0)
#
# Find VTK, get all required components
#
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
#
# Load CMake commands that you probably should not modify.
# Check if VTK is shared or static, and default to the same.
#
include (${VTKMY_SOURCE_DIR}/CMakeOptions.cmake)
get_target_property(_vtk_lib_type VTK::CommonCore TYPE)
if(_vtk_lib_type STREQUAL SHARED_LIBRARY)
set(_default ON)
else()
set(_default OFF)
endif()
option(BUILD_SHARED_LIBS "Build shared libraries." ${_default})
include_directories(${VTKMY_BINARY_DIR})
#
# Check the system for the proper install locations for libraries,
# headers, documentation, etcetera. This will set the variables
# CMAKE_INSTALL_LIBDIR/BINDIR/INCLUDEDIR/DOCDIR/DATAROOTDIR, etc.,
# which are used by the vtk_module macros.
#
include(GNUInstallDirs)
#
# You can put your include path(s) here
# Set the directories where executables and libraries will be put.
# The "archive" directory tells cmake where to put static libraries,
# so we set it exactly the same as the "library" directory.
#
include_directories(${VTKMY_SOURCE_DIR}/Common)
include_directories(${VTKMY_SOURCE_DIR}/Imaging)
include_directories(${VTKMY_SOURCE_DIR}/Unsorted)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
#
# Build examples too ?
# Set the directory where cmake configuration files are installed.
#
set(my_config_name vtkmy)
if(WIN32)
set(my_config_dir cmake/${my_config_name})
else()
set(my_config_dir ${CMAKE_INSTALL_LIBDIR}/cmake/${my_config_name})
endif()
option(BUILD_EXAMPLES "Build examples." ON)
if (BUILD_EXAMPLES)
add_subdirectory(Examples)
endif ()
#
# Search for "vtk.module" files in all subdirectories.
#
vtk_module_find_modules(vtk_module_files ${CMAKE_CURRENT_SOURCE_DIR})
#
# Common configuration settings
# Scan the module files.
#
# Do not worry about this one.
vtk_module_scan(
MODULE_FILES ${vtk_module_files}
REQUEST_MODULES VTKMY::Common VTKMY::Imaging VTKMY::Unsorted
PROVIDES_MODULES my_modules
ENABLE_TESTS "${BUILD_TESTING}")
#
# Set up the module build.
#
vtk_module_build(
MODULES ${my_modules}
INSTALL_EXPORT VTKMY
CMAKE_DESTINATION "${my_config_dir}"
VERSION "${VTKMY_VERSION}"
SOVERSION "1")
#
# Perform the wrapping
#
if(VTK_WRAP_PYTHON)
find_package(PythonInterp ${VTK_PYTHON_VERSION} QUIET)
vtk_module_wrap_python(
MODULES ${my_modules}
INSTALL_EXPORT VTKMY
PYTHON_PACKAGE "vtkmy"
CMAKE_DESTINATION "${my_config_dir}"
BUILD_STATIC OFF)
endif()
configure_file(
${VTKMY_SOURCE_DIR}/vtkmyConfigure.h.in
${VTKMY_BINARY_DIR}/vtkmyConfigure.h
)
#
# Build examples too ?
#
option(BUILD_EXAMPLES "Build examples." ON)
if(BUILD_EXAMPLES)
add_subdirectory(Examples)
endif()
#
# Here is where you can list the sub-directories holding your local
# classes. Sorting classes by 'package' type like VTK does (Common,
# Rendering, Filtering, Imaging, IO, etc.) is a good thing and prevents
# numerous dependencies problems.
# Utilities folder creates doxygen documentation
#
add_subdirectory(Common)
add_subdirectory(Imaging)
add_subdirectory(Unsorted)
add_subdirectory(Utilities)
#
# Configure output paths for libraries and executables.
#
set(LIBRARY_OUTPUT_PATH ${VTKMY_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all libraries.")
set(EXECUTABLE_OUTPUT_PATH ${VTKMY_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all executables.")
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
#
# Try to find VTK and include its settings (otherwise complain)
#
if(NOT VTK_BINARY_DIR)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
endif()
#
# Build shared libs ?
#
# Defaults to the same VTK setting.
#
# Standard CMake option for building libraries shared or static by default.
option(BUILD_SHARED_LIBS
"Build with shared libraries."
${VTK_BUILD_SHARED_LIBS})
# Copy the CMake option to a setting with VTKMY_ prefix for use in
# our project. This name is used in vtkmyConfigure.h.in.
set(VTKMY_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
# If this is a build tree, provide an option for putting
# this project's executables and libraries in with VTK's.
if (EXISTS ${VTK_DIR}/bin)
option(USE_VTK_OUTPUT_PATHS
"Use VTK's output directory for this project's executables and libraries."
OFF)
MARK_AS_ADVANCED (USE_VTK_OUTPUT_PATHS)
if (USE_VTK_OUTPUT_PATHS)
set (LIBRARY_OUTPUT_PATH ${VTK_DIR}/bin)
set (EXECUTABLE_OUTPUT_PATH ${VTK_DIR}/bin)
endif ()
endif ()
#
# Wrap Java, Python
#
# Rational: even if your VTK was wrapped, it does not mean that you want to
# wrap your own local classes.
# Default value is OFF as the VTK cache might have set them to ON but
# the wrappers might not be present (or yet not found).
#
#
# Python
#
if (VTK_WRAP_PYTHON AND (NOT WIN32 OR BUILD_SHARED_LIBS))
option(VTKMY_WRAP_PYTHON
"Wrap classes into the Python interpreted language."
ON)
if (VTKMY_WRAP_PYTHON)
set(VTK_WRAP_PYTHON_FIND_LIBS ON)
include(${VTK_CMAKE_DIR}/vtkWrapPython.cmake)
endif ()
else ()
if (VTKMY_WRAP_PYTHON)
message("Warning. VTKMY_WRAP_PYTHON is ON but the VTK version you have "
"chosen has not support for Python (VTK_WRAP_PYTHON is OFF). "
"Please set VTKMY_WRAP_PYTHON to OFF.")
set (VTKMY_WRAP_PYTHON OFF)
endif ()
endif ()
#
# Java
#
if (VTK_WRAP_JAVA)
option(VTKMY_WRAP_JAVA
"Wrap classes into the Java interpreted language."
ON)
if (VTKMY_WRAP_JAVA)
set(VTK_WRAP_JAVA3_INIT_DIR "${VTKMY_SOURCE_DIR}/Wrapping")
include(${VTK_CMAKE_DIR}/vtkWrapJava.cmake)
if (WIN32)
if (NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "Java support requires BUILD_SHARED_LIBS to be ON.")
set (VTKMY_CAN_BUILD 0)
endif ()
endif ()
# Tell the java wrappers where to go.
set(VTK_JAVA_HOME ${VTKMY_BINARY_DIR}/java/vtkmy)
file(MAKE_DIRECTORY ${VTK_JAVA_HOME})
endif ()
else ()
if (VTKMY_WRAP_JAVA)
message("Warning. VTKMY_WRAP_JAVA is ON but the VTK version you have "
"chosen has not support for Java (VTK_WRAP_JAVA is OFF). "
"Please set VTKMY_WRAP_JAVA to OFF.")
set (VTKMY_WRAP_JAVA OFF)
endif ()
endif ()
......@@ -3,14 +3,12 @@
#
# Here is where you can add the name of your local common classes.
#
set (Common_SRCS
vtkBar.cxx
set(classes
vtkBar
)
# --------------------------------------------------------------------------
# You probably do not need to modify anything below this line
#
# Create the vtkmyCommon C++ library.
add_library (vtkmyCommon ${Common_SRCS})
target_link_libraries (vtkmyCommon ${VTK_LIBRARIES})
#
vtk_module_add_module(VTKMY::Common
CLASSES ${classes})
NAME
VTKMY::Common
LIBRARY_NAME
vtkmyCommon
DEPENDS
VTK::CommonCore
TEST_DEPENDS
VTK::TestingCore
......@@ -23,9 +23,9 @@
#define vtkBar_h
#include "vtkObject.h"
#include "vtkmyCommonWin32Header.h"
#include "vtkmyCommonModule.h" // For export macro
class VTK_MY_COMMON_EXPORT vtkBar : public vtkObject
class VTKMYCOMMON_EXPORT vtkBar : public vtkObject
{
public:
static vtkBar* New();
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkmyCommonWin32Header.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
=========================================================================*/
/**
* @class vtkmyCommonWin32Header
* @brief manage Windows system differences
*
* The vtkmyCommonWin32Header captures some system differences between Unix
* and Windows operating systems.
*/
#ifndef vtkmyCommonWin32Header_h
#define vtkmyCommonWin32Header_h
#include <vtkmyConfigure.h>
#if defined(_WIN32) && !defined(VTKMY_STATIC)
#if defined(vtkmyCommon_EXPORTS)
#define VTK_MY_COMMON_EXPORT __declspec(dllexport)
#else
#define VTK_MY_COMMON_EXPORT __declspec(dllimport)
#endif
#else
#define VTK_MY_COMMON_EXPORT
#endif
#endif
......@@ -3,4 +3,4 @@
#
add_executable(vtkmyEx1 vtkmyEx1.cxx)
target_link_libraries(vtkmyEx1 vtkmyUnsorted vtkmyCommon vtkmyImaging)
target_link_libraries(vtkmyEx1 VTKMY::Unsorted VTKMY::Common VTKMY::Imaging)
......@@ -3,4 +3,16 @@
#
add_executable(vtkmyEx2 vtkmyEx2.cxx)
target_link_libraries(vtkmyEx2 vtkmyUnsorted)
target_link_libraries(vtkmyEx2
VTKMY::Unsorted
VTK::FiltersSources VTK::RenderingCore VTK::RenderingOpenGL2)
#
# Because VTK rendering uses factory classes, it is necessary to
# declare that we want to use classes in RenderingOpenGL2 to
# implement the factory classes in RenderingCore
#
vtk_module_autoinit(
TARGETS vtkmyEx2
MODULES VTK::RenderingCore VTK::RenderingOpenGL2)
......@@ -3,14 +3,12 @@
#
# Here is where you can add the name of your local imaging classes.
#
set (Imaging_SRCS
vtkImageFoo.cxx
set(classes
vtkImageFoo
)
# --------------------------------------------------------------------------
# You probably do not need to modify anything below this line
# Create the vtkmyImaging C++ library
add_library (vtkmyImaging ${Imaging_SRCS})
target_link_libraries(vtkmyImaging vtkmyCommon ${VTK_LIBRARIES})
#
# Create the vtkmyImaging C++ library.
#
vtk_module_add_module(VTKMY::Imaging
CLASSES ${classes})
NAME
VTKMY::Imaging
LIBRARY_NAME
vtkmyImaging
DEPENDS
VTKMY::Common
VTK::CommonExecutionModel
TEST_DEPENDS
VTK::TestingCore
......@@ -23,11 +23,11 @@
#define vtkImageFoo_h
#include "vtkThreadedImageAlgorithm.h"
#include "vtkmyImagingWin32Header.h"
#include "vtkmyImagingModule.h" // For export macro
class vtkBar;
class VTK_MY_IMAGING_EXPORT vtkImageFoo : public vtkThreadedImageAlgorithm
class VTKMYIMAGING_EXPORT vtkImageFoo : public vtkThreadedImageAlgorithm
{
public:
static vtkImageFoo* New();
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkmyImagingWin32Header.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
=========================================================================*/
/**
* @class vtkmyImagingWin32Header
* @brief manage Windows system differences
*
* The vtkmyImagingWin32Header captures some system differences between Unix
* and Windows operating systems.
*/
#ifndef vtkmyImagingWin32Header_h
#define vtkmyImagingWin32Header_h
#include <vtkmyConfigure.h>
#if defined(_WIN32) && !defined(VTKMY_STATIC)
#if defined(vtkmyImaging_EXPORTS)
#define VTK_MY_IMAGING_EXPORT __declspec(dllexport)
#else
#define VTK_MY_IMAGING_EXPORT __declspec(dllimport)
#endif
#else
#define VTK_MY_IMAGING_EXPORT
#endif
#endif
......@@ -3,7 +3,7 @@ Introduction:
This directory demonstrates how to organize a local source repository
where local VTK classes can be compiled and wrapped into
C++/Java/Python libraries without interfering with the main VTK
C++/Python libraries without interfering with the main VTK
source dir.
It might be good thing to sort local classes into different 'package'
......@@ -54,12 +54,7 @@ were to choose vtksb, then you should take care of the following:
- Search for the vtkmy string and replace it with vtksb in all files.
- In the same way, replace VTKMY by VTKSB.
- Rename all vtkmy* files *and* directories to vtksb* (this should
only concern files like vtkmy*Win32Header.h for example).
- In all *Win32Header.h files and VTK headers, change
VTK_MY_*_EXPORT to VTK_SB_*_EXPORT. Sorry for the inconvenience, but
the wrappers expect this symbol to start with VTK_, thus
VTKMY_*_EXPORT could not be used.
- In all VTK headers, change VTKMY_*_EXPORT to VTKSB_*_EXPORT.
Any prefix should work, but make sure that your class names start with
'vtk', otherwise the wrappers will fail (hence the vtksb or vtkmy
......
......@@ -3,14 +3,12 @@
#
# Here is where you can add the name of your local unsorted classes.
#
set (Unsorted_SRCS
vtkBar2.cxx
set(classes
vtkBar2
)
# --------------------------------------------------------------------------
# You probably do not need to modify anything below this line
#
# Create the vtkmyUnsorted C++ library.
add_library (vtkmyUnsorted ${Unsorted_SRCS})
target_link_libraries (vtkmyUnsorted ${VTK_LIBRARIES})
#
vtk_module_add_module(VTKMY::Unsorted
CLASSES ${classes})
NAME
VTKMY::Unsorted
LIBRARY_NAME
vtkmyUnsorted
DEPENDS
VTK::CommonCore
TEST_DEPENDS
VTK::TestingCore
......@@ -23,9 +23,9 @@
#define vtkBar2_h
#include "vtkObject.h"
#include "vtkmyUnsortedWin32Header.h"
#include "vtkmyUnsortedModule.h" // For export macro
class VTK_MY_UNSORTED_EXPORT vtkBar2 : public vtkObject
class VTKMYUNSORTED_EXPORT vtkBar2 : public vtkObject
{
public:
static vtkBar2* New();
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkmyUnsortedWin32Header.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
=========================================================================*/
/**
* @class vtkmyUnsortedWin32Header
* @brief manage Windows system differences
*
* The vtkmyUnsortedWin32Header captures some system differences between Unix
* and Windows operating systems.
*/
#ifndef vtkmyUnsortedWin32Header_h
#define vtkmyUnsortedWin32Header_h
#include <vtkmyConfigure.h>
#if defined(_WIN32) && !defined(VTKMY_STATIC)
#if defined(vtkmyUnsorted_EXPORTS)
#define VTK_MY_UNSORTED_EXPORT __declspec(dllexport)
#else
#define VTK_MY_UNSORTED_EXPORT __declspec(dllimport)
#endif
#else
#define VTK_MY_UNSORTED_EXPORT
#endif
#endif
......@@ -2,35 +2,41 @@
# Build the documentation
#
INCLUDE (${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
include(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
if(BUILD_DOCUMENTATION)
IF (BUILD_DOCUMENTATION)
OPTION (DOCUMENTATION_DOWNLOAD_VTK_TAGFILE
"Download the VTK tag file." ON)
MARK_AS_ADVANCED (
DOCUMENTATION_DOWNLOAD_VTK_TAGFILE
)
#
# The needed perl scripts are in Utilities/Doxygen in VTK_SOURCE_DIR
#
if(NOT DEFINED VTK_SOURCE_DIR)
# go up three directories from vtkMy source directory
get_filename_component(_tmp "${VTKMY_SOURCE_DIR}" DIRECTORY)
get_filename_component(_tmp "${_tmp}" DIRECTORY)
get_filename_component(_tmp "${_tmp}" DIRECTORY)
set(VTK_SOURCE_DIR "${_tmp}" CACHE PATH "VTK Source Directory")
endif()
option(DOCUMENTATION_DOWNLOAD_VTK_TAGFILE "Download the VTK tag file." ON)
mark_as_advanced(DOCUMENTATION_DOWNLOAD_VTK_TAGFILE)
#
# Configure the script and the doxyfile, then add target
#
IF(NOT DOT_PATH)
GET_FILENAME_COMPONENT(DOT_PATH ${DOT} PATH)
ENDIF()
if(DOT AND NOT DOT_PATH)
get_filename_component(DOT_PATH "${DOT}" DIRECTORY)
endif()
CONFIGURE_FILE(
${VTKMY_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in
${VTKMY_BINARY_DIR}/Utilities/Doxygen/doxyfile)
configure_file(
"${VTKMY_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in"
"${VTKMY_BINARY_DIR}/Utilities/Doxygen/doxyfile")
CONFIGURE_FILE(
${VTKMY_SOURCE_DIR}/Utilities/Doxygen/doc_makeall.sh.in
${VTKMY_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh)
configure_file(
"${VTKMY_SOURCE_DIR}/Utilities/Doxygen/doc_makeall.sh.in"
"${VTKMY_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh")
ADD_CUSTOM_TARGET(vtkMyDoxygenDoc
${BASH}
${VTKMY_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh)
add_custom_target(vtkMyDoxygenDoc
"${BASH}"
"${VTKMY_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh")
ENDIF ()
endif()
# This file is automatically generated by CMake VTK_WRAP_JAVA
set(VTK_JAVA_DEPENDENCIES ${VTK_JAVA_DEPENDENCIES}
@VTK_JAVA_DEPENDENCIES_FILE@
)
/*
* Here is where system computed values get stored.
* These values should only change when the target compile platform changes.
*/
#cmakedefine VTKMY_BUILD_SHARED_LIBS
#ifndef VTKMY_BUILD_SHARED_LIBS
#define VTKMY_STATIC
#endif
#if defined(_MSC_VER) && !defined(VTKMY_STATIC)
#pragma warning ( disable : 4275 )
#endif
......@@ -42,7 +42,7 @@ else ()
add_example(Annotation/Cxx/LabeledMesh)
#add_example(Array/Cxx)
#add_example(Build/vtkLocal)
#add_example(Build/vtkMy)
add_example(Build/vtkMy)
add_example(Charts/Cxx)
add_example(DataManipulation/Cxx)
add_example(GUI/Qt/FourPaneViewer)
......
Markdown is supported
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