0

I am trying to build VTK under Windows 10 for use in Java using Visual Studio 2019 basically according to this this and this tutorial. The cmake part seems to work fine. I end up with the following config:

enter image description here

The build step (Build ALL_BUILD) in Visual Studio with Release solution configuration for x64 as admin seemingly also does work:

========== Build: 437 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

However, executing INSTALL ends with an error:

225>CMake Error at Wrapping/Java/cmake_install.cmake:1215 (file):
225>  file INSTALL cannot find
225>  "[PATH]/VTK-9.0.1/Binaries/lib/java/Release/vtk.jar":
225>  File exists.
225>Call Stack (most recent call first):
225>  cmake_install.cmake:486 (include)
225>
225>
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: The command "setlocal
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: D:\Programme\CMake\3.20.3\bin\cmake.exe -DBUILD_TYPE=Release -P cmake_install.cmake
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
225>D:\Programme\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd" exited with code 1.
225>Done building project "INSTALL.vcxproj" -- FAILED.

and indeed, there are lots of *.exp and *.lib files in [PATH]/VTK-9.0.1/Binaries/lib/java/Release/ but a vtk.jar is missing.

Any ideas what I did wrong?

raedma
  • 293
  • 1
  • 12

1 Answers1

-1

Ok, better should have searched 3 minutes longer. But for sake of completeness, here is the solution:

https://discourse.vtk.org/t/vtk-9-and-java-vtk-jar-not-automatically-generated-also-location-of-wrapper-dlls/3354/19

The essence:

The VS cmake does not know how to build java files so the last stage of building the jar file has to be done manually since vtk 9.0.0

The relevant code from the link

cd $vtk_build_dir\Wrapping\Java
dir /s/B *.java >javafiles
javac -d ..\..\java @javafiles
cd ..\..\java
jar --create -f  ..\lib\java\vtk.jar vtk\*.class
raedma
  • 293
  • 1
  • 12