Skip to content
Snippets Groups Projects
Commit 6b4a7b6e authored by Bill Lorensen's avatar Bill Lorensen
Browse files

ENH: Qt support for new vtk modules.

Former-commit-id: 972fef6e
parent b380dbe1
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ foreach(p
CMP0025 # CMake 3.0
CMP0043 # CMake 3.0
CMP0053 # CMake 3.1
CMP0071
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
......
......@@ -315,8 +315,9 @@ def FillCMakeLists(S, Name, ExtraNames, Components):
return reg
def FillQtCMakeLists(S, Name):
reg = re.sub(r'XXX', Name, S)
def FillQtCMakeLists(S, Name, Components):
r1 = re.sub(r'XXX', Name, S)
reg = re.sub(r'ZZZ', Components, r1)
return reg
#####################################################################
......@@ -669,7 +670,17 @@ for lang, langExt in Languages.items():
CMakeFile = open(RepoDir + "/Admin/VTKQtCMakeLists", 'r')
CMakeContents = CMakeFile.read()
CMakeFile.close()
cmake = FillQtCMakeLists(CMakeContents, ExampleName)
# Create component lines
Components = ""
for component in components:
if "vtk" in component:
Components += "\n " + component
else:
Components += "\n " + "vtk" + component
# If there are no components found, assume we need then all
# This occurs when the source file includes another Cxx file
#print("Components: " + Components)
cmake = FillQtCMakeLists(CMakeContents, ExampleName, Components)
else:
CMakeFile = open(RepoDir + "/Admin/VTKCMakeLists", 'r')
CMakeContents = CMakeFile.read()
......
###CMakeLists.txt
```cmake
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
......@@ -8,8 +8,27 @@ endif()
PROJECT(XXX)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
find_package(VTK COMPONENTS ZZZ))
if (NOT VTK_FOUND)
message("Skipping XXX: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
if (VTK_VERSION VERSION_LESS "8.90.0")
# old system
include(${VTK_USE_FILE})
add_executable(XXX MACOSX_BUNDLE XXX.cxx )
target_link_libraries(XXX PRIVATE ${VTK_LIBRARIES})
else ()
# include all components
add_executable(XXX MACOSX_BUNDLE XXX.cxx )
target_link_libraries(XXX PRIVATE ${VTK_LIBRARIES})
# vtk_module_autoinit is needed
vtk_module_autoinit(
TARGETS XXX
MODULES ${VTK_LIBRARIES}
)
endif ()
if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")
# Instruct CMake to run moc automatically when needed.
......
......@@ -6,6 +6,7 @@ foreach(p
CMP0025 # CMake 3.0
CMP0043 # CMake 3.0
CMP0053 # CMake 3.1
CMP0071
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment