Skip to content

Commit 70ada41

Browse files
committed
added notebooks to determine req'd vtk dlls
1 parent 2ccb223 commit 70ada41

File tree

3 files changed

+314
-1
lines changed

3 files changed

+314
-1
lines changed

.gitattributes

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
misc/0001-update-for-memory-leaks.patch text eol=lf
1+
misc/0001-update-for-memory-leaks.patch text eol=lf
2+
*.ipynb text eol=lf

misc/vtk-6.3.0-vs2017-x64.ipynb

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "9b752108",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"# check for vtk\n",
14+
"find_package(VTK REQUIRED)\n",
15+
"if (${VTK_VERSION} VERSION_EQUAL \"6.3\")\n",
16+
" find_package(VTK\n",
17+
" COMPONENTS\n",
18+
" vtkalglib\n",
19+
" vtkCommonColor\n",
20+
" vtkCommonComputationalGeometry\n",
21+
" vtkCommonCore\n",
22+
" vtkCommonDataModel\n",
23+
" vtkCommonExecutionModel\n",
24+
" vtkCommonMath\n",
25+
" vtkCommonMisc\n",
26+
" vtkCommonSystem\n",
27+
" vtkCommonTransforms\n",
28+
" vtkDICOMParser\n",
29+
" vtkFiltersCore\n",
30+
" vtkFiltersExtraction\n",
31+
" vtkFiltersGeneral\n",
32+
" vtkFiltersGeometry\n",
33+
" vtkFiltersModeling\n",
34+
" vtkFiltersSources\n",
35+
" vtkFiltersStatistics\n",
36+
" vtkfreetype\n",
37+
" vtkftgl\n",
38+
" vtkGUISupportMFC\n",
39+
" vtkImagingCore\n",
40+
" vtkImagingFourier\n",
41+
" vtkImagingHybrid\n",
42+
" vtkInteractionStyle\n",
43+
" vtkIOImage\n",
44+
" vtkjpeg\n",
45+
" vtkmetaio\n",
46+
" vtkpng\n",
47+
" vtkRenderingCore\n",
48+
" vtkRenderingFreeType\n",
49+
" vtkRenderingLOD\n",
50+
" vtkRenderingOpenGL\n",
51+
" vtksys\n",
52+
" vtktiff\n",
53+
" vtkzlib\n",
54+
" REQUIRED\n",
55+
" )\n",
56+
"endif()\n"
57+
]
58+
}
59+
],
60+
"source": [
61+
"# checked with http://pep8online.com/checkresult\n",
62+
"# cmake --preset vtk-6.3.0-vs2017-x64\n",
63+
"#\n",
64+
"import subprocess\n",
65+
"import re\n",
66+
"import os\n",
67+
"\n",
68+
"DUMPBIN = (os.environ['VS2019INSTALLDIR'] +\n",
69+
" '\\\\VC\\\\Tools\\\\MSVC\\\\14.29.30133\\\\bin\\\\HostX86\\\\x86\\\\dumpbin.exe')\n",
70+
"MVMF6_EXE = '..\\\\_vtk-6.3.0-vs2017-x64\\\\ModelViewer\\\\Release\\\\mvmf6.exe'\n",
71+
"MV_DLL = '..\\\\_vtk-6.3.0-vs2017-x64\\\\ModelViewer\\\\Release\\\\mv.dll'\n",
72+
"VTK_BIN = 'C:\\\\VTK-6.3.0-vs2017-x64\\\\bin'\n",
73+
"DLL_RE = re.compile('[ ].*vtk.*-6.3.dll')\n",
74+
"\n",
75+
"\n",
76+
"def depends(dll_dict, exe_or_dll):\n",
77+
" if exe_or_dll in dll_dict and dll_dict[exe_or_dll]:\n",
78+
" return dll_dict\n",
79+
" dll_dict[exe_or_dll] = True\n",
80+
" # print(f\"dumpbin /IMPORTS {exe_or_dll}\")\n",
81+
" command = [DUMPBIN, '/IMPORTS', exe_or_dll]\n",
82+
" result = subprocess.run(command, stdout=subprocess.PIPE)\n",
83+
" for line in result.stdout.decode().split('\\r\\n'):\n",
84+
" if DLL_RE.match(line):\n",
85+
" dll = line.strip()\n",
86+
" dll = f\"{VTK_BIN}\\\\{dll}\"\n",
87+
" if dll not in dll_dict:\n",
88+
" dll_dict[dll] = False\n",
89+
" for x in dll_dict:\n",
90+
" if not dll_dict[x]:\n",
91+
" return depends(dll_dict, x)\n",
92+
" return dll_dict\n",
93+
"\n",
94+
"dlls = depends(dict(), MV_DLL)\n",
95+
"dlls = depends(dlls, MVMF6_EXE)\n",
96+
"\n",
97+
"dlls.pop(MV_DLL)\n",
98+
"dlls.pop(MVMF6_EXE)\n",
99+
"\n",
100+
"split_re = re.compile('.*(vtk.*)-6.3.dll')\n",
101+
"\n",
102+
"print('# check for vtk')\n",
103+
"print('find_package(VTK REQUIRED)')\n",
104+
"print('if (${VTK_VERSION} VERSION_EQUAL \"6.3\")')\n",
105+
"print(\" find_package(VTK\")\n",
106+
"print(\" COMPONENTS\")\n",
107+
"for k in sorted(dlls.keys(), key=str.lower):\n",
108+
" m = split_re.match(k)\n",
109+
" print(f\" {m.group(1)}\")\n",
110+
"print(\" REQUIRED\")\n",
111+
"print(\" )\")\n",
112+
"print(\"endif()\")\n"
113+
]
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": null,
118+
"id": "13c7630c",
119+
"metadata": {},
120+
"outputs": [],
121+
"source": []
122+
}
123+
],
124+
"metadata": {
125+
"kernelspec": {
126+
"display_name": "Python 3",
127+
"language": "python",
128+
"name": "python3"
129+
},
130+
"language_info": {
131+
"codemirror_mode": {
132+
"name": "ipython",
133+
"version": 3
134+
},
135+
"file_extension": ".py",
136+
"mimetype": "text/x-python",
137+
"name": "python",
138+
"nbconvert_exporter": "python",
139+
"pygments_lexer": "ipython3",
140+
"version": "3.8.8"
141+
}
142+
},
143+
"nbformat": 4,
144+
"nbformat_minor": 5
145+
}

misc/vtk-9.1.0-vs2019-x64.ipynb

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 2,
6+
"id": "f3ee8cf0",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"# check for vtk\n",
14+
"find_package(VTK REQUIRED)\n",
15+
"if (${VTK_VERSION} VERSION_EQUAL \"9.1\")\n",
16+
" find_package(VTK\n",
17+
" COMPONENTS\n",
18+
" CommonColor\n",
19+
" CommonComputationalGeometry\n",
20+
" CommonCore\n",
21+
" CommonDataModel\n",
22+
" CommonExecutionModel\n",
23+
" CommonMath\n",
24+
" CommonMisc\n",
25+
" CommonSystem\n",
26+
" CommonTransforms\n",
27+
" DICOMParser\n",
28+
" doubleconversion\n",
29+
" expat\n",
30+
" FiltersCore\n",
31+
" FiltersExtraction\n",
32+
" FiltersGeneral\n",
33+
" FiltersGeometry\n",
34+
" FiltersHybrid\n",
35+
" FiltersModeling\n",
36+
" FiltersSources\n",
37+
" FiltersStatistics\n",
38+
" fmt\n",
39+
" freetype\n",
40+
" glew\n",
41+
" GUISupportMFC\n",
42+
" ImagingCore\n",
43+
" ImagingSources\n",
44+
" InteractionStyle\n",
45+
" IOCore\n",
46+
" IOImage\n",
47+
" IOLegacy\n",
48+
" IOXML\n",
49+
" IOXMLParser\n",
50+
" jpeg\n",
51+
" kissfft\n",
52+
" loguru\n",
53+
" lz4\n",
54+
" lzma\n",
55+
" metaio\n",
56+
" ParallelCore\n",
57+
" ParallelDIY\n",
58+
" png\n",
59+
" pugixml\n",
60+
" RenderingCore\n",
61+
" RenderingFreeType\n",
62+
" RenderingLOD\n",
63+
" RenderingOpenGL2\n",
64+
" RenderingUI\n",
65+
" sys\n",
66+
" tiff\n",
67+
" zlib\n",
68+
" REQUIRED\n",
69+
" )\n",
70+
"endif()\n"
71+
]
72+
}
73+
],
74+
"source": [
75+
"# checked with http://pep8online.com/checkresult\n",
76+
"# cmake --preset vtk-9.1.0-vs2019-x64\n",
77+
"#\n",
78+
"import subprocess\n",
79+
"import re\n",
80+
"import os\n",
81+
"\n",
82+
"DUMPBIN = (os.environ['VS2019INSTALLDIR'] +\n",
83+
" '\\\\VC\\\\Tools\\\\MSVC\\\\14.29.30133\\\\bin\\\\HostX86\\\\x86\\\\dumpbin.exe')\n",
84+
"MVMF6_EXE = '..\\\\_vtk-9.1.0-vs2019-x64\\\\ModelViewer\\\\Release\\\\mvmf6.exe'\n",
85+
"MV_DLL = '..\\\\_vtk-9.1.0-vs2019-x64\\\\ModelViewer\\\\Release\\\\mv.dll'\n",
86+
"VTK_BIN = 'C:\\\\VTK-9.1.0-vs2019-x64\\\\bin'\n",
87+
"DLL_RE = re.compile('[ ].*vtk.*-9.1.dll')\n",
88+
"\n",
89+
"\n",
90+
"def depends(dll_dict, exe_or_dll):\n",
91+
" if exe_or_dll in dll_dict and dll_dict[exe_or_dll]:\n",
92+
" return dll_dict\n",
93+
" dll_dict[exe_or_dll] = True\n",
94+
" # print(f\"dumpbin /IMPORTS {exe_or_dll}\")\n",
95+
" command = [DUMPBIN, '/IMPORTS', exe_or_dll]\n",
96+
" result = subprocess.run(command, stdout=subprocess.PIPE)\n",
97+
" for line in result.stdout.decode().split('\\r\\n'):\n",
98+
" if DLL_RE.match(line):\n",
99+
" dll = line.strip()\n",
100+
" dll = f\"{VTK_BIN}\\\\{dll}\"\n",
101+
" if dll not in dll_dict:\n",
102+
" dll_dict[dll] = False\n",
103+
" for x in dll_dict:\n",
104+
" if not dll_dict[x]:\n",
105+
" return depends(dll_dict, x)\n",
106+
" return dll_dict\n",
107+
"\n",
108+
"dlls = depends(dict(), MV_DLL)\n",
109+
"dlls = depends(dlls, MVMF6_EXE)\n",
110+
"\n",
111+
"dlls.pop(MV_DLL)\n",
112+
"dlls.pop(MVMF6_EXE)\n",
113+
"\n",
114+
"split_re = re.compile('.*vtk(.*)-9.1.dll')\n",
115+
"\n",
116+
"print('# check for vtk')\n",
117+
"print('find_package(VTK REQUIRED)')\n",
118+
"print('if (${VTK_VERSION} VERSION_EQUAL \"9.1\")')\n",
119+
"print(\" find_package(VTK\")\n",
120+
"print(\" COMPONENTS\")\n",
121+
"for k in sorted(dlls.keys(), key=str.lower):\n",
122+
" m = split_re.match(k)\n",
123+
" print(f\" {m.group(1)}\")\n",
124+
"print(\" REQUIRED\")\n",
125+
"print(\" )\")\n",
126+
"print(\"endif()\")"
127+
]
128+
},
129+
{
130+
"cell_type": "code",
131+
"execution_count": null,
132+
"id": "a9376e15",
133+
"metadata": {},
134+
"outputs": [],
135+
"source": []
136+
},
137+
{
138+
"cell_type": "code",
139+
"execution_count": null,
140+
"id": "a729c2b0",
141+
"metadata": {},
142+
"outputs": [],
143+
"source": []
144+
}
145+
],
146+
"metadata": {
147+
"kernelspec": {
148+
"display_name": "Python 3",
149+
"language": "python",
150+
"name": "python3"
151+
},
152+
"language_info": {
153+
"codemirror_mode": {
154+
"name": "ipython",
155+
"version": 3
156+
},
157+
"file_extension": ".py",
158+
"mimetype": "text/x-python",
159+
"name": "python",
160+
"nbconvert_exporter": "python",
161+
"pygments_lexer": "ipython3",
162+
"version": "3.8.8"
163+
}
164+
},
165+
"nbformat": 4,
166+
"nbformat_minor": 5
167+
}

0 commit comments

Comments
 (0)