Commit 59d1c73a authored by Chris Harris's avatar Chris Harris Committed by Code Review
Browse files

Merge topic 'per-target-includes' into master

2b57d792 Use per-target include directories when available
parents 036936b1 2b57d792
......@@ -19,50 +19,55 @@ if(VTK_WRAP_JAVA)
ENDFOREACH(__java_library)
ENDIF(JAVA_AWT_LIBRARY)
include_directories(
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
)
endif()
function(vtk_add_java_wrapping module_name module_srcs)
string(REGEX REPLACE "^vtk" "" wrap_name "${module_name}")
# FIXME: These must be here for now, should be fixed in the wrap hierarchy stuff
set(_java_include_dirs
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
${vtkWrappingJavaCore_SOURCE_DIR}
${vtkWrappingJavaCore_BINARY_DIR})
if(NOT CMAKE_HAS_TARGET_INCLUDES)
include_directories(${_java_include_dirs})
endif()
set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.txt)
vtk_wrap_java3(vtk${wrap_name}Java ModuleJava_SRCS "${module_srcs};${Kit_JAVA_EXTRA_WRAP_SRCS}")
vtk_wrap_java3(${module_name}Java ModuleJava_SRCS
"${module_srcs};${Kit_JAVA_EXTRA_WRAP_SRCS}")
add_library(vtk${wrap_name}Java SHARED ${ModuleJava_SRCS} ${Kit_JAVA_EXTRA_SRCS})
add_library(${module_name}Java SHARED ${ModuleJava_SRCS} ${Kit_JAVA_EXTRA_SRCS})
if(CMAKE_HAS_TARGET_INCLUDES)
set_property(TARGET ${module_name}Java APPEND
PROPERTY INCLUDE_DIRECTORIES ${_java_include_dirs})
endif()
# Force JavaClasses to build in the right order by adding a depenency.
add_dependencies(vtk${wrap_name}JavaJavaClasses vtk${wrap_name}Java)
add_dependencies(${module_name}JavaJavaClasses ${module_name}Java)
if(VTK_MODULE_${module_name}_IMPLEMENTS)
set_property(TARGET ${module_name}Java PROPERTY COMPILE_DEFINITIONS
"${module_name}_AUTOINIT=1(${module_name})")
endif()
target_link_libraries(vtk${wrap_name}Java ${module_name} vtkWrappingJavaCore)
include_directories(${vtkWrappingJavaCore_SOURCE_DIR}
${vtkWrappingJavaCore_BINARY_DIR}
)
target_link_libraries(${module_name}Java ${module_name} vtkWrappingJavaCore)
# Do we need to link to AWT?
if(${module_name} STREQUAL "vtkRenderingCore")
target_link_libraries(vtk${wrap_name}Java ${JAVA_AWT_LIBRARY})
target_link_libraries(${module_name}Java ${JAVA_AWT_LIBRARY})
endif()
foreach(dep ${VTK_MODULE_${module_name}_DEPENDS})
if(NOT VTK_MODULE_${dep}_EXCLUDE_FROM_WRAPPING)
target_link_libraries(vtk${wrap_name}Java ${dep}Java)
target_link_libraries(${module_name}Java ${dep}Java)
endif()
endforeach()
IF(NOT VTK_INSTALL_NO_LIBRARIES)
INSTALL(TARGETS vtk${wrap_name}Java
EXPORT ${VTK_INSTALL_EXPORT_NAME}
RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
add_dependencies(vtk${wrap_name}Java vtk${wrap_name})
if(NOT VTK_INSTALL_NO_LIBRARIES)
install(TARGETS ${module_name}Java
EXPORT ${VTK_INSTALL_EXPORT_NAME}
RUNTIME DESTINATION ${VTK_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${VTK_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${VTK_INSTALL_ARCHIVE_DIR} COMPONENT Development)
endif()
endfunction()
......@@ -6,14 +6,17 @@ function(vtk_add_python_wrapping module_name module_srcs)
message(FATAL_ERROR "VTK must be built with Python wrapping turned on.")
endif()
# Need to add the Wrapping/Python to the include directory
include_directories(
set(_python_include_dirs
${VTK_SOURCE_DIR}/Wrapping/PythonCore
${VTK_BINARY_DIR}/Wrapping/PythonCore
${VTK_SOURCE_DIR}/Wrapping
${VTK_BINARY_DIR}/Wrapping
${PYTHON_INCLUDE_DIRS})
# FIXME: These must be here for now, should be fixed in the wrap hierarchy stuff
if(NOT CMAKE_HAS_TARGET_INCLUDES)
include_directories(${_python_include_dirs})
endif()
set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.txt)
string(REGEX REPLACE "^vtk" "" kit_name "${module_name}")
set(KIT ${kit_name})
......@@ -40,6 +43,10 @@ function(vtk_add_python_wrapping module_name module_srcs)
vtk_wrap_python3(${module_name}Python Python_SRCS "${module_srcs}")
vtk_add_library(${module_name}PythonD ${Python_SRCS} ${extra_srcs})
if(CMAKE_HAS_TARGET_INCLUDES)
set_property(TARGET ${module_name}PythonD APPEND
PROPERTY INCLUDE_DIRECTORIES ${_python_include_dirs})
endif()
if(VTK_MODULE_${module_name}_IMPLEMENTS)
set_property(TARGET ${module_name}PythonD PROPERTY COMPILE_DEFINITIONS
"${module_name}_AUTOINIT=1(${module_name})")
......@@ -49,5 +56,9 @@ function(vtk_add_python_wrapping module_name module_srcs)
python_add_module(${module_name}Python ${module_name}PythonInit.cxx)
if(PYTHON_ENABLE_MODULE_${module_name}Python)
target_link_libraries(${module_name}Python ${module_name}PythonD)
if(CMAKE_HAS_TARGET_INCLUDES)
set_property(TARGET ${module_name}Python APPEND
PROPERTY INCLUDE_DIRECTORIES ${_python_include_dirs})
endif()
endif()
endfunction()
......@@ -10,11 +10,15 @@ function(vtk_add_tcl_wrapping module_name module_srcs)
message(FATAL_ERROR "VTK must be built with Tcl wrapping turned on.")
endif()
# Need to add the Wrapping directory to the include directory
include_directories(
set(_tcl_include_dirs
${VTK_SOURCE_DIR}/Wrapping
${VTK_BINARY_DIR}/Wrapping
${TCL_INCLUDE_PATH})
if(NOT CMAKE_HAS_TARGET_INCLUDES)
include_directories(${_tcl_include_dirs})
endif()
# FIXME: These must be here for now, should be fixed in the wrap hierarchy stuff
set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.txt)
string(REGEX REPLACE "^vtk" "" kit_name "${module_name}")
......@@ -61,8 +65,12 @@ function(vtk_add_tcl_wrapping module_name module_srcs)
endif()
vtk_wrap_tcl3(${tcl_module}TCL Tcl_SRCS "${module_srcs}" "")
vtk_add_library(${tcl_module}TCL ${Tcl_SRCS} ${extra_srcs})
if(CMAKE_HAS_TARGET_INCLUDES)
set_property(TARGET ${tcl_module}TCL APPEND
PROPERTY INCLUDE_DIRECTORIES ${_tcl_include_dirs})
endif()
if(VTK_MODULE_${module_name}_IMPLEMENTS)
set_property(TARGET ${module_name}TCL PROPERTY COMPILE_DEFINITIONS
set_property(TARGET ${tcl_module}TCL PROPERTY COMPILE_DEFINITIONS
"${module_name}_AUTOINIT=1(${module_name})")
endif()
target_link_libraries(${tcl_module}TCL ${module_name}
......
......@@ -15,6 +15,10 @@ endif()
include(vtkWrapHierarchy)
if(${CMAKE_VERSION} VERSION_GREATER 2.8.7.20120314)
set(CMAKE_HAS_TARGET_INCLUDES TRUE)
endif()
# This is the main function, always called from the vtk_module_library function
# when a new module library is added.
function(vtk_add_wrapping module_name module_srcs)
......
......@@ -25,14 +25,6 @@
#cmakedefine VTK_USE_VOLUMEPRO_1000
/*--------------------------------------------------------------------------*/
/* Wrapping Configuration */
#cmakedefine VTK_WRAP_TCL
#cmakedefine VTK_WRAP_PYTHON
#cmakedefine VTK_WRAP_JAVA
#cmakedefine VTK_WRAP_PYTHON_SIP
/*--------------------------------------------------------------------------*/
/* Other Configuration Options */
......
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
# what does this do!
SET(__inst_files ${__inst_files}
vtkJavaUtil.h
)
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
set(JavaCore_SRCS
vtkJavaUtil.cxx
......
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