Commit 4558576f authored by Brad King's avatar Brad King
Browse files

ENH: Updated to modern VTK CMake code standards.

parent 482f97da
CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
#
# Set the project name.
#
PROJECT (VTKMY)
#
# Assume everything is set up correctly for build.
#
# If some requirements are not met, set it to 0.
# In that case, the build won't be done.
#
SET (VTKMY_CAN_BUILD 1)
#
# Load CMake commands that you probably should not modify.
#
......@@ -20,54 +13,45 @@ SET (VTKMY_CAN_BUILD 1)
INCLUDE (${VTKMY_SOURCE_DIR}/CMakeOptions.cmake)
#
# If everything is OK, then go into the sub directories and build.
# 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.
#
IF (VTKMY_CAN_BUILD)
#
# 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.
#
SUBDIRS (
Common
Imaging
Unsorted
Utilities
)
#
# You can put your include path(s) here
#
SUBDIRS (
Common
Imaging
Unsorted
Utilities
)
INCLUDE_DIRECTORIES(${VTKMY_SOURCE_DIR}/Common)
INCLUDE_DIRECTORIES (${VTKMY_SOURCE_DIR}/Imaging)
INCLUDE_DIRECTORIES (${VTKMY_SOURCE_DIR}/Unsorted)
#
# Build examples too ?
#
#
# You can put your include path(s) here
#
OPTION(BUILD_EXAMPLES "Build examples." ON)
IF (BUILD_EXAMPLES)
SUBDIRS(Examples)
ENDIF (BUILD_EXAMPLES)
INCLUDE_DIRECTORIES(${VTKMY_SOURCE_DIR}/Common)
INCLUDE_DIRECTORIES (${VTKMY_SOURCE_DIR}/Imaging)
INCLUDE_DIRECTORIES (${VTKMY_SOURCE_DIR}/Unsorted)
#
# Build examples too ?
#
#
# Common configuration settings
#
# Do not worry about this one.
#
OPTION(BUILD_EXAMPLES "Build examples." ON)
IF (BUILD_EXAMPLES)
SUBDIRS(Examples)
ENDIF (BUILD_EXAMPLES)
CONFIGURE_FILE(
${VTKMY_SOURCE_DIR}/vtkmyConfigure.h.in
${VTKMY_BINARY_DIR}/vtkmyConfigure.h
)
#
# Common configuration settings
#
# Do not worry about this one.
#
INCLUDE_DIRECTORIES(${VTKMY_BINARY_DIR})
CONFIGURE_FILE(
${VTKMY_SOURCE_DIR}/vtkmyConfigure.h.in
${VTKMY_BINARY_DIR}/vtkmyConfigure.h
)
ENDIF (VTKMY_CAN_BUILD)
INCLUDE_DIRECTORIES(${VTKMY_BINARY_DIR})
#
# Try to find VTK and include its settings (otherwise complain)
# 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)
INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF (USE_VTK_FILE)
INCLUDE (${USE_VTK_FILE})
ELSE (USE_VTK_FILE)
SET (VTKMY_CAN_BUILD 0)
ENDIF (USE_VTK_FILE)
#
# Try to find VTK and include its settings (otherwise complain)
#
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
#
# Build shared libs ?
......@@ -16,63 +19,45 @@ ENDIF (USE_VTK_FILE)
# Defaults to the same VTK setting.
#
IF (USE_VTK_FILE)
# 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})
#
# Output path(s)
#
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
)
# 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 (USE_VTK_OUTPUT_PATHS)
ENDIF (EXISTS ${VTK_DIR}/bin)
ENDIF (USE_VTK_FILE)
# 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 (USE_VTK_OUTPUT_PATHS)
ENDIF (EXISTS ${VTK_DIR}/bin)
#
# Wrap Tcl, 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
# 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).
#
#
# Tcl
#
#
IF (VTK_WRAP_TCL)
OPTION(VTKMY_WRAP_TCL
"Wrap classes into the TCL interpreted language."
OPTION(VTKMY_WRAP_TCL
"Wrap classes into the TCL interpreted language."
ON)
IF(VTKMY_WRAP_TCL)
......@@ -93,12 +78,12 @@ ENDIF (VTK_WRAP_TCL)
#
# Python
#
#
IF (VTK_WRAP_PYTHON)
OPTION(VTKMY_WRAP_PYTHON
"Wrap classes into the Python interpreted language."
OPTION(VTKMY_WRAP_PYTHON
"Wrap classes into the Python interpreted language."
ON)
IF (VTKMY_WRAP_PYTHON)
......@@ -106,9 +91,9 @@ IF (VTK_WRAP_PYTHON)
INCLUDE(${VTK_CMAKE_DIR}/vtkWrapPython.cmake)
IF (WIN32)
IF (NOT BUILD_SHARED_LIBS)
MESSAGE("Error. Python support requires BUILD_SHARED_LIBS to be ON.")
MESSAGE(FATAL_ERROR "Python support requires BUILD_SHARED_LIBS to be ON.")
SET (VTKMY_CAN_BUILD 0)
ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF (WIN32)
ENDIF (VTKMY_WRAP_PYTHON)
......@@ -125,12 +110,12 @@ ENDIF (VTK_WRAP_PYTHON)
#
# Java
#
#
IF (VTK_WRAP_JAVA)
OPTION(VTKMY_WRAP_JAVA
"Wrap classes into the Java interpreted language."
OPTION(VTKMY_WRAP_JAVA
"Wrap classes into the Java interpreted language."
ON)
IF (VTKMY_WRAP_JAVA)
......@@ -138,9 +123,9 @@ IF (VTK_WRAP_JAVA)
INCLUDE(${VTK_CMAKE_DIR}/vtkWrapJava.cmake)
IF (WIN32)
IF (NOT BUILD_SHARED_LIBS)
MESSAGE("Error. Java support requires BUILD_SHARED_LIBS to be ON.")
MESSAGE(FATAL_ERROR "Java support requires BUILD_SHARED_LIBS to be ON.")
SET (VTKMY_CAN_BUILD 0)
ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF (WIN32)
# Tell the java wrappers where to go.
......
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