Commit c64ed564 authored by Brian Panneton's avatar Brian Panneton Committed by Kenneth Leiter

ENH: Added 'make clean' support for SWIG Python and SWIG Java extra files

parent fac174cd
......@@ -51,6 +51,10 @@ if(XDMF_WRAP_PYTHON)
set_source_files_properties(${python_name}.i PROPERTIES CPLUSPLUS ON)
swig_add_module(${python_name} python ${python_name}.i)
swig_link_libraries(${python_name} ${python_name} ${PYTHON_LIBRARIES})
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${CMAKE_BINARY_DIR}/${python_name}.pyc
)
if("${ARGN}" STRGREATER "")
add_dependencies(${python_name} "${ARGN}")
endif("${ARGN}" STRGREATER "")
......@@ -76,19 +80,16 @@ if(XDMF_WRAP_JAVA)
# 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(XDMF_JAVA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${XDMF_JAVA_PACKAGE_DIR})
file(MAKE_DIRECTORY ${XDMF_JAVA_DIR})
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})
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}
......@@ -98,6 +99,20 @@ if(XDMF_WRAP_JAVA)
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}
)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${CMAKE_BINARY_DIR}/${java_name}.jar
${XDMF_JAVA_DIR}
)
ENDMACRO(XDMF_SWIG_JAVA)
endif(XDMF_WRAP_JAVA)
......
......@@ -42,10 +42,6 @@ set(XdmfCoreSources
add_library(XdmfCore ${XdmfCoreSources})
target_link_libraries(XdmfCore ${HDF5_LIBRARIES} ${LIBXML2_LIBRARIES})
if(XDMF_BUILD_TESTING)
add_subdirectory(tests)
endif(XDMF_BUILD_TESTING)
if(XDMF_WRAP_JAVA)
XDMF_SWIG_JAVA(XdmfCore)
set(XDMF_CORE_JAVA_JAR ${CMAKE_BINARY_DIR}/XdmfCore.jar CACHE INTERNAL "")
......@@ -60,3 +56,7 @@ install(FILES ${XdmfCoreHeaders} DESTINATION include)
install(TARGETS XdmfCore LIBRARY DESTINATION lib)
set(XdmfCore_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${HDF5_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} CACHE INTERNAL "")
if(XDMF_BUILD_TESTING)
add_subdirectory(tests)
endif(XDMF_BUILD_TESTING)
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