Commit f3e961e3 authored by Brian Panneton's avatar Brian Panneton
Browse files

FIX: Updated Testing Suite to fix Java Parallel Build

parent b20b6486
......@@ -31,17 +31,17 @@
IF(EXISTS ${cxx_source_dir}/${executable}.cpp)
ADD_EXECUTABLE(${executable}${dup} ${cxx_source_dir}/${executable}.cpp)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cpp)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cpp)
IF(EXISTS ${cxx_source_dir}/${executable}.cxx)
ADD_EXECUTABLE(${executable}${dup} ${cxx_source_dir}/${executable}.cxx)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx)
GET_PROPERTY(cxx_dependencies GLOBAL PROPERTY CXX_TEST_DEPENDENCIES)
TARGET_LINK_LIBRARIES(${executable}${dup} ${cxx_dependencies})
SET_CORE("${cxx_binary_dir}")
ADD_TEST(Cxx${is_core}_${executable}${dup} ${executable}${dup} ${arguments})
ADD_TEST(Cxx${is_core}_${executable}${dup} ${executable}${dup} ${arguments})
ENDMACRO(ADD_TEST_CXX executable)
# CXX Clean Macro
......
......@@ -7,9 +7,8 @@ SET(java_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
# Java Add Dependencies Macro
# Author: Brian Panneton
# Description: This macro adds the java test dependencies.
# Note: The tests already depend on their own file
# Parameters:
# dependencies = any dependencies needed for java tests
# dependencies = any target dependencies needed for java tests
MACRO(ADD_TEST_JAVA_DEPENDENCIES dependencies)
IF(NOT ("${dependencies}" STREQUAL ""))
SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_DEPENDENCIES
......@@ -18,11 +17,25 @@ MACRO(ADD_TEST_JAVA_DEPENDENCIES dependencies)
ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_JAVA_DEPENDENCIES dependencies)
# Java Add File Dependencies Macro
# Author: Brian Panneton
# Description: This macro adds the java test file dependencies.
# Note: The tests already depend on their own file
# Parameters:
# dependencies = any dependencies needed for java tests
MACRO(ADD_TEST_JAVA_FILE_DEPENDENCIES dependencies)
IF(NOT ("${dependencies}" STREQUAL ""))
SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_FILE_DEPENDENCIES
"${dependencies}"
)
ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_JAVA_FILE_DEPENDENCIES dependencies)
# Java Add Classpath Macro
# Author: Brian Panneton
# Description: This macro adds the java test classpaths.
# Parameters:
# cp = any classpaths needed for java tests
# cp = any classpaths needed for java tests
MACRO(ADD_TEST_JAVA_CLASSPATH cp)
GET_PROPERTY(classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
IF(NOT ("${cp}" STREQUAL ""))
......@@ -36,7 +49,7 @@ ENDMACRO(ADD_TEST_JAVA_CLASSPATH cp)
# Author: Brian Panneton
# Description: This macro adds the java test ldpaths.
# Parameters:
# ld = any ldpaths needed for java tests
# ld = any ldpaths needed for java tests
MACRO(ADD_TEST_JAVA_LDPATH ld)
GET_PROPERTY(ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
IF("${ld}" STRGREATER "")
......@@ -59,7 +72,8 @@ MACRO(ADD_TEST_JAVA executable)
PARSE_TEST_ARGS("${ARGN}")
GET_PROPERTY(java_dependencies GLOBAL PROPERTY JAVA_TEST_DEPENDENCIES)
GET_PROPERTY(java_file_dependencies GLOBAL PROPERTY
JAVA_TEST_FILE_DEPENDENCIES)
GET_PROPERTY(java_classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
GET_PROPERTY(java_ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
......@@ -67,7 +81,7 @@ MACRO(ADD_TEST_JAVA executable)
OUTPUT ${java_binary_dir}/${executable}.class
WORKING_DIRECTORY ${java_binary_dir}
DEPENDS ${java_source_dir}/${executable}.java
${java_dependencies}
${java_file_dependencies}
COMMAND ${JAVA_COMPILE}
ARGS -cp '${java_classpath}'
-d '${java_binary_dir}'
......@@ -101,21 +115,27 @@ ENDMACRO(CLEAN_TEST_JAVA executable)
# Java Create Target Macro
# Author: Brian Panneton
# Description: This macro sets up the python test target
# Description: This macro sets up the java test target
# Parameters: none
MACRO(CREATE_TARGET_TEST_JAVA)
IF(EXISTS JavaCore_ALLTEST)
SET(JavaCore_ALLTEST JavaCore_ALLTEST)
ENDIF(EXISTS JavaCore_ALLTEST)
IF(EXISTS JavaCore_ALLTEST)
SET(JavaCore_ALLTEST JavaCore_ALLTEST)
ENDIF(EXISTS JavaCore_ALLTEST)
GET_PROPERTY(java_dependencies GLOBAL PROPERTY JAVA_TEST_DEPENDENCIES)
SET_CORE("${java_binary_dir}")
GET_PROPERTY(targets GLOBAL PROPERTY JAVA_TEST_TARGETS)
ADD_CUSTOM_TARGET(Java${is_core}_ALLTEST ALL DEPENDS
${JavaCore_ALLTEST} ${targets})
ADD_CUSTOM_TARGET(Java${is_core}_ALLTEST ALL DEPENDS
${JavaCore_ALLTEST} ${targets})
IF(NOT ("${java_dependencies}" STREQUAL ""))
ADD_DEPENDENCIES(Java${is_core}_ALLTEST ${java_dependencies})
ENDIF(NOT ("${java_dependencies}" STREQUAL ""))
IF(NOT ("${is_core}" STREQUAL ""))
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_TARGETS "")
ENDIF(NOT ("${is_core}" STREQUAL ""))
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_TARGETS "")
ENDIF(NOT ("${is_core}" STREQUAL ""))
ENDMACRO(CREATE_TARGET_TEST_JAVA)
......
......@@ -18,6 +18,20 @@ MACRO(ADD_TEST_PYTHON_DEPENDENCIES dependencies)
ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_PYTHON_DEPENDENCIES dependencies)
# Python Add Dependencies Macro
# Author: Brian Panneton
# Description: This macro adds the python test dependencies.
# Note: The tests already depend on their own file
# Parameters:
# dependencies = any dependencies needed for python tests
MACRO(ADD_TEST_PYTHON_FILE_DEPENDENCIES dependencies)
IF(NOT ("${dependencies}" STREQUAL ""))
SET_PROPERTY(GLOBAL APPEND PROPERTY PYTHON_TEST_FILE_DEPENDENCIES
"${dependencies}"
)
ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_PYTHON_FILE_DEPENDENCIES dependencies)
# Python Add PythonPath Macro
# Author: Brian Panneton
# Description: This macro adds the python test pythonpaths.
......@@ -46,8 +60,8 @@ MACRO(ADD_TEST_PYTHON executable)
PARSE_TEST_ARGS("${ARGN}")
GET_PROPERTY(python_dependencies GLOBAL
PROPERTY PYTHON_TEST_DEPENDENCIES)
GET_PROPERTY(python_file_dependencies GLOBAL
PROPERTY PYTHON_TEST_FILE_DEPENDENCIES)
GET_PROPERTY(python_pythonpath GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH)
ADD_CUSTOM_COMMAND(
......@@ -61,7 +75,7 @@ MACRO(ADD_TEST_PYTHON executable)
ARGS -mpy_compile
${python_binary_dir}/${executable}.py
DEPENDS ${python_source_dir}/${executable}.py
${python_dependencies}
${python_file_dependencies}
)
SET_PROPERTY(GLOBAL APPEND PROPERTY PYTHON_TEST_TARGETS "${python_binary_dir}/${executable}.pyc")
......@@ -99,12 +113,18 @@ MACRO(CREATE_TARGET_TEST_PYTHON)
IF(EXISTS PythonCore_ALLTEST)
SET(PythonCore_ALLTEST PythonCore_ALLTEST)
ENDIF(EXISTS PythonCore_ALLTEST)
GET_PROPERTY(python_dependencies GLOBAL PROPERTY PYTHON_TEST_DEPENDENCIES)
SET_CORE("${python_binary_dir}")
GET_PROPERTY(targets GLOBAL PROPERTY PYTHON_TEST_TARGETS)
ADD_CUSTOM_TARGET(Python${is_core}_ALLTEST ALL DEPENDS
${PythonCore_ALLTEST} ${targets})
IF(NOT ("${python_dependencies}" STREQUAL ""))
ADD_DEPENDENCIES(Python${is_core}_ALLTEST ${python_dependencies})
ENDIF(NOT ("${python_dependencies}" STREQUAL ""))
IF(NOT ("${is_core}" STREQUAL ""))
SET_PROPERTY(GLOBAL PROPERTY PYTHON_TEST_TARGETS "")
ENDIF(NOT ("${is_core}" STREQUAL ""))
......
# List of global variables needed by tests
SET(defines
JAVA_TEST_DEPENDENCIES
JAVA_TEST_CLASSPATH
JAVA_TEST_FILE_DEPENDENCIES
JAVA_TEST_CLASSPATH
JAVA_TEST_LDPATH
JAVA_TEST_TARGETS
PYTHON_TEST_DEPENDENCIES
PYTHON_TEST_FILE_DEPENDENCIES
CXX_TEST_DEPENDENCIES
)
......
......@@ -82,35 +82,32 @@ if(XDMF_WRAP_JAVA)
# Target Name = the output target name will have ${java_name}Java as its name
# Target Jar = the output target jar will have ${java_name}Java.jar as its name
MACRO(XDMF_SWIG_JAVA java_name)
set(XDMF_JAVA_PACKAGE_DIR mil/army/arl/xdmf)
set(${java_name}_JAVA_JAR ${CMAKE_BINARY_DIR}/${java_name}.jar)
set(XDMF_JAVA_PACKAGE_DIR mil/army/arl/xdmf)
set(XDMF_JAVA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${XDMF_JAVA_PACKAGE_DIR})
set(CMAKE_SWIG_OUTDIR ${XDMF_JAVA_DIR})
set(CMAKE_SWIG_FLAGS -v -make_default -package mil.army.arl.xdmf)
set_source_files_properties(${java_name}.i PROPERTIES CPLUSPLUS ON)
swig_add_module(${java_name}Java java ${java_name}.i)
swig_link_libraries(${java_name}Java ${java_name})
add_dependencies(${java_name}Java ${java_name}JavaDir)
if("${ARGN}" STRGREATER "")
add_dependencies(${java_name}Java "${ARGN}")
endif("${ARGN}" STRGREATER "")
add_custom_command(TARGET ${java_name}Java
POST_BUILD
COMMAND ${JAVA_COMPILE}
ARGS -cp "'${CMAKE_BINARY_DIR}/*'"
"${XDMF_JAVA_DIR}/*.java"
COMMAND ${JAVA_ARCHIVE}
ARGS -cvf ${CMAKE_BINARY_DIR}/${java_name}.jar
"${XDMF_JAVA_PACKAGE_DIR}/*.class"
)
add_custom_target(
${java_name}JavaDir ALL
DEPENDS ${XDMF_JAVA_DIR}
)
add_custom_command(
OUTPUT ${XDMF_JAVA_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory
${XDMF_JAVA_DIR}
)
add_custom_target(${java_name}_Java_Dir ALL DEPENDS
${XDMF_JAVA_DIR})
add_custom_command(OUTPUT ${XDMF_JAVA_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${XDMF_JAVA_DIR}
)
add_custom_target(Compiled_${java_name}_Jar ALL DEPENDS
${${java_name}_JAVA_JAR})
add_custom_command(OUTPUT ${${java_name}_JAVA_JAR}
COMMAND ${JAVA_COMPILE}
ARGS -cp "'${CMAKE_BINARY_DIR}/*'"
"${XDMF_JAVA_DIR}/*.java"
COMMAND ${JAVA_ARCHIVE}
ARGS -cvf ${${java_name}_JAVA_JAR}
"${XDMF_JAVA_PACKAGE_DIR}/*.class"
)
add_dependencies(${java_name}Java ${java_name}_Java_Dir)
add_dependencies(Compiled_${java_name}_Jar ${java_name}Java "${ARGN}")
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${CMAKE_BINARY_DIR}/${java_name}.jar
......@@ -152,8 +149,7 @@ if(NOT XDMF_BUILD_CORE_ONLY)
target_link_libraries(Xdmf XdmfCore)
if(XDMF_WRAP_JAVA)
XDMF_SWIG_JAVA(Xdmf XdmfCoreJava)
set(XDMF_JAVA_JAR ${CMAKE_BINARY_DIR}/Xdmf.jar CACHE INTERNAL "")
XDMF_SWIG_JAVA(Xdmf Compiled_XdmfCore_Jar)
endif(XDMF_WRAP_JAVA)
if(XDMF_WRAP_PYTHON)
......
......@@ -69,7 +69,6 @@ target_link_libraries(XdmfCore ${HDF5_LIBRARIES} ${HDF5DSM_LIBRARIES} ${LIBXML2_
if(XDMF_WRAP_JAVA)
XDMF_SWIG_JAVA(XdmfCore)
set(XDMF_CORE_JAVA_JAR ${CMAKE_BINARY_DIR}/XdmfCore.jar CACHE INTERNAL "")
endif(XDMF_WRAP_JAVA)
if(XDMF_WRAP_PYTHON)
......
......@@ -2,11 +2,11 @@ INCLUDE(AddTestsJava)
#Add any dependencies that the java core tests may need
# Note: The tests already depend on their own file
ADD_TEST_JAVA_DEPENDENCIES("${XDMF_CORE_JAVA_JAR}")
ADD_TEST_JAVA_DEPENDENCIES(Compiled_XdmfCore_Jar)
# Add any classpath directories that the java tests may need
# Note: JAVA_TEST_CLASSPATH is also set in core
ADD_TEST_JAVA_CLASSPATH(".:${XDMF_CORE_JAVA_JAR}")
ADD_TEST_JAVA_CLASSPATH(".:${XdmfCore_JAVA_JAR}")
# Add any ldpath directories that the java tests may need
# Note: JAVA_TEST_LDPATH is also set in core
......
......@@ -3,11 +3,11 @@ INCLUDE(AddTestsJava)
# Add any dependencies that the java tests may need
# Note: The tests already depend on their own file
# JAVA_TEST_DEPENDENCIES is also set in core
ADD_TEST_JAVA_DEPENDENCIES("${XDMF_JAVA_JAR}")
ADD_TEST_JAVA_DEPENDENCIES(Compiled_Xdmf_Jar)
# Add any classpath directories that the java tests may need
# Note: JAVA_TEST_CLASSPATH is also set in core
ADD_TEST_JAVA_CLASSPATH("${XDMF_JAVA_JAR}")
ADD_TEST_JAVA_CLASSPATH("${Xdmf_JAVA_JAR}")
# Add any ldpath directories that the java tests may need
# Note: JAVA_TEST_LDPATH is also set in core
......
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