• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(JAR_FILE turbojpeg.jar)
2set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.MF)
3
4set(JAVA_CLASSNAMES org/libjpegturbo/turbojpeg/TJ
5  org/libjpegturbo/turbojpeg/TJCompressor
6  org/libjpegturbo/turbojpeg/TJCustomFilter
7  org/libjpegturbo/turbojpeg/TJDecompressor
8  org/libjpegturbo/turbojpeg/TJException
9  org/libjpegturbo/turbojpeg/TJScalingFactor
10  org/libjpegturbo/turbojpeg/TJTransform
11  org/libjpegturbo/turbojpeg/TJTransformer
12  org/libjpegturbo/turbojpeg/YUVImage
13  TJUnitTest
14  TJExample
15  TJBench)
16
17if(MSVC_IDE)
18  set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
19else()
20  set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
21endif()
22
23set(TURBOJPEG_DLL_NAME "turbojpeg")
24if(MINGW)
25  set(TURBOJPEG_DLL_NAME "libturbojpeg")
26endif()
27configure_file(org/libjpegturbo/turbojpeg/TJLoader.java.in
28  ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
29
30set(JAVA_SOURCES "")
31set(JAVA_CLASSES "")
32set(JAVA_CLASSES_FULL "")
33foreach(class ${JAVA_CLASSNAMES})
34  set(JAVA_SOURCES ${JAVA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${class}.java)
35  set(JAVA_CLASSES ${JAVA_CLASSES} ${class}.class)
36  set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL} ${OBJDIR}/${class}.class)
37endforeach()
38
39set(JAVA_SOURCES ${JAVA_SOURCES}
40  ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
41set(JAVA_CLASSES ${JAVA_CLASSES}
42  org/libjpegturbo/turbojpeg/TJLoader.class)
43set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL}
44  ${OBJDIR}/org/libjpegturbo/turbojpeg/TJLoader.class)
45
46string(REGEX REPLACE " " ";" JAVACFLAGS "${JAVACFLAGS}")
47add_custom_command(OUTPUT ${JAVA_CLASSES_FULL} DEPENDS ${JAVA_SOURCES}
48  COMMAND ${JAVA_COMPILE} ARGS ${JAVACFLAGS} -d ${OBJDIR} ${JAVA_SOURCES})
49
50add_custom_command(OUTPUT ${JAR_FILE} DEPENDS ${JAVA_CLASSES_FULL}
51  ${MANIFEST_FILE}
52  COMMAND ${JAVA_ARCHIVE} cfm ${JAR_FILE} ${MANIFEST_FILE} ${JAVA_CLASSES}
53  WORKING_DIRECTORY ${OBJDIR})
54
55add_custom_target(java ALL DEPENDS ${JAR_FILE})
56
57install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${JAR_FILE} DESTINATION classes)
58