Commit ddd0485b authored by David Gobbi's avatar David Gobbi
Browse files

COMP: Trying to fix java parallel build hiccups in modular.

This is a follow-up to pre-modular commit 875f8232, which was a
temporary fix to the java parallel build failure.  When the build
fails, errors of the form "class file contains wrong class" are
seen.  This patch reorganizes and comments the cmake code for
clarity.  It will probably not fix the problem, but it should at
least assist in determining the cause.

This commit also puts vtkBuildAllDriver.class back in java/vtk,
the modularization commit 0c1471f1 moved it from the java/vtk
dir to the java dir.

Change-Id: Icee402497f2d64a4dd6314a2f31e05c4e0805b91
parent 840b82d2
......@@ -197,37 +197,42 @@ MACRO(VTK_GENERATE_JAVA_DEPENDENCIES TARGET)
SET (OUT_TEXT)
SET (sources)
SET (driver)
# get the classes for this lib
FOREACH(srcName ${ARGN})
# what is the filename without the extension
GET_FILENAME_COMPONENT(srcNameWe ${srcName} NAME_WE)
GET_FILENAME_COMPONENT(srcNameWe "${srcName}" NAME_WE)
# the input file might be full path so handle that
GET_FILENAME_COMPONENT(srcPath ${srcName} PATH)
GET_FILENAME_COMPONENT(srcPath "${srcName}" PATH)
SET (className "${srcPath}/${srcNameWe}.class")
SET (OUT_TEXT ${OUT_TEXT} "\n dummy = new ${srcNameWe}()")
SET (driver "${srcPath}/vtk${TARGET}Driver.class")
SET (sources ${sources} ${srcName})
SET (sources ${sources} "${srcName}")
ENDFOREACH(srcName)
ADD_CUSTOM_COMMAND(
OUTPUT ${driver}
COMMAND "${JAVA_COMPILE}"
-source 5 -classpath "${javaPath}" "${srcPath}/vtk${TARGET}Driver.java"
DEPENDS ${sources}
)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} SOURCE ${TARGET} DEPENDS ${driver})
# each lib will have an associated driver class
SET (driverSrc "${javaPath}/vtk/vtk${TARGET}Driver.java")
SET (driverClass "${javaPath}/vtk/vtk${TARGET}Driver.class")
# generate vtk${TARGET}Driver.java using TARGET_NAME and OUT_TEXT
SET (TARGET_NAME ${TARGET})
CONFIGURE_FILE(
${VTK_CMAKE_DIR}/vtkJavaDriver.java.in
"${VTK_BINARY_DIR}/java/vtk/vtk${TARGET}Driver.java"
"${VTK_CMAKE_DIR}/vtkJavaDriver.java.in"
"${driverSrc}"
COPY_ONLY
IMMEDIATE
)
# add a custom command to compile the generated file
ADD_CUSTOM_COMMAND(
OUTPUT "${driverClass}"
COMMAND "${JAVA_COMPILE}"
-source 5 -classpath "${javaPath}" "${driverSrc}"
DEPENDS ${sources}
)
# make the library target depend on vtk${TARGET}Driver.class
ADD_CUSTOM_COMMAND(TARGET ${TARGET} SOURCE ${TARGET} DEPENDS "${driverClass}")
ENDMACRO()
......@@ -89,18 +89,18 @@ CONFIGURE_FILE(${VTK_SOURCE_DIR}/Wrapping/Java/vtk/vtkSettings.java.in
ADD_CUSTOM_COMMAND(
TARGET VTKBuildAll
OUTPUTS ${VTK_BINARY_DIR}/java/vtkBuildAllDriver.class
OUTPUTS ${VTK_BINARY_DIR}/java/vtk/vtkBuildAllDriver.class
DEPENDS ${VTK_BUILD_ALL_DEPENDS}
SOURCE ${VTK_BINARY_DIR}/java/vtk/vtkBuildAllDriver.java
COMMAND ${JAVA_COMPILE}
ARGS -classpath ${VTK_JAVA_HOME}/.. -d ${VTK_JAVA_HOME}/..
${VTK_BINARY_DIR}/java/vtk/vtkBuildAllDriver.java
-source 5 -classpath ${VTK_JAVA_HOME}/.. -d ${VTK_BINARY_DIR}/java/vtk
${VTK_BINARY_DIR}/java/vtk/vtkBuildAllDriver.java
)
ADD_CUSTOM_COMMAND(
TARGET VTKBuildAll
SOURCE VTKBuildAll
DEPENDS ${VTK_BINARY_DIR}/java/vtkBuildAllDriver.class
DEPENDS ${VTK_BINARY_DIR}/java/vtk/vtkBuildAllDriver.class
)
ADD_DEPENDENCIES(VTKJavaJar VTKBuildAll)
......
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