diff options
Diffstat (limited to 'java/CMakeLists.txt')
-rw-r--r-- | java/CMakeLists.txt | 99 |
1 files changed, 43 insertions, 56 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 05d77e4d..c640da87 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -7,14 +7,14 @@ endif() find_package(Java) -set(DEFAULT_JAVACFLAGS "-source 1.5 -target 1.5 -Xlint:all,-serial,-cast,-fallthrough,-dep-ann,-deprecation") +set(DEFAULT_JAVACFLAGS "-source 1.5 -target 1.5 -Xlint:all,-serial,-cast,-unchecked,-fallthrough,-dep-ann,-deprecation,-rawtypes") set(JAVACFLAGS ${DEFAULT_JAVACFLAGS} CACHE STRING "Java compiler flags (Default: ${DEFAULT_JAVACFLAGS})") message(STATUS "Java compiler flags = ${JAVACFLAGS}") set(CLASSPATH com/tigervnc/vncviewer) -set(JAVA_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${CLASSPATH}) -set(JAVA_BINDIR ${CMAKE_CURRENT_BINARY_DIR}/${CLASSPATH}) +set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(BINDIR ${CMAKE_CURRENT_BINARY_DIR}) if(NOT BUILD) execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) @@ -25,26 +25,8 @@ string(REGEX REPLACE "\n" "" JAVA_DATE ${JAVA_DATE}) string(REGEX REPLACE "\n" "" JAVA_TIME ${JAVA_TIME}) string(REGEX REPLACE "\n" "" BUILD ${BUILD}) -set(JAVA_CLASSNAMES - CConn - ClipboardDialog - DesktopWindow - Dialog - F8Menu - OptionsDialogCallback - PasswdDialog - PlatformPixelBuffer - OptionsDialog - ServerDialog - VncViewer) - set(JAVA_SOURCES "") -set(JAVA_CLASSES_FULL "") -foreach(class ${JAVA_CLASSNAMES}) - set(JAVA_SOURCES ${JAVA_SOURCES} ${JAVA_SRCDIR}/${class}.java) - set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL} - ${CMAKE_CURRENT_BINARY_DIR}/${CLASSPATH}/${class}.class) -endforeach() +set(JAVA_CLASSES "") set(JSCH_CLASSNAMES DH @@ -88,55 +70,61 @@ set(JSCH_CLASSNAMES jcraft/HMACMD5 jcraft/HMACSHA196 jcraft/HMACSHA1) -set(JSCH_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/com/jcraft/jsch) + foreach(class ${JSCH_CLASSNAMES}) - set(JAVA_SOURCES ${JAVA_SOURCES} ${JSCH_SRCDIR}/${class}.java) - set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL} - ${CMAKE_CURRENT_BINARY_DIR}/com/jcraft/jsch/${class}.class) + set(JAVA_SOURCES ${JAVA_SOURCES} com/jcraft/jsch/${class}.java) + set(JAVA_CLASSES ${JAVA_CLASSES} + ${BINDIR}/com/jcraft/jsch/${class}.class) endforeach() file(GLOB DEPEND_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/com/tigervnc/rfb/*.java - ${CMAKE_CURRENT_SOURCE_DIR}/com/tigervnc/rdr/*.java - ${CMAKE_CURRENT_SOURCE_DIR}/com/tigervnc/network/*.java - ${CMAKE_CURRENT_SOURCE_DIR}/com/jcraft/jsch/*.java - ${CMAKE_CURRENT_SOURCE_DIR}/com/jcraft/jsch/jcraft/*.java - ${CMAKE_CURRENT_SOURCE_DIR}/com/jcraft/jsch/jgss/*.java - ${CMAKE_CURRENT_SOURCE_DIR}/com/jcraft/jzlib/*.java) + ${SRCDIR}/${CLASSPATH}/*.java + ${SRCDIR}/com/tigervnc/rfb/*.java + ${SRCDIR}/com/tigervnc/rdr/*.java + ${SRCDIR}/com/tigervnc/network/*.java + ${SRCDIR}/com/jcraft/jsch/*.java + ${SRCDIR}/com/jcraft/jsch/jcraft/*.java + ${SRCDIR}/com/jcraft/jsch/jgss/*.java + ${SRCDIR}/com/jcraft/jzlib/*.java) string(REGEX REPLACE " " ";" JAVACFLAGS "${JAVACFLAGS}") -add_custom_command(OUTPUT ${JAVA_CLASSES_FULL} +add_custom_command(OUTPUT ${JAVA_CLASSES} DEPENDS ${JAVA_SOURCES} ${DEPEND_SOURCES} COMMAND ${JAVA_COMPILE} - ARGS ${JAVACFLAGS} -sourcepath ${CMAKE_CURRENT_SOURCE_DIR} - -d ${CMAKE_CURRENT_BINARY_DIR} ${JAVA_SOURCES}) + ARGS ${JAVACFLAGS} -sourcepath ${SRCDIR} -d ${BINDIR} + ${CLASSPATH}/VncViewer.java ${JAVA_SOURCES} + WORKING_DIRECTORY ${SRCDIR}) configure_file(${CLASSPATH}/timestamp.in ${CLASSPATH}/timestamp) -add_custom_command(OUTPUT ${JAVA_BINDIR}/tigervnc.png +if(NOT "${SRCDIR}" STREQUAL "${BINDIR}") + +add_custom_command(OUTPUT ${BINDIR}/${CLASSPATH}/tigervnc.png COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${JAVA_SRCDIR}/tigervnc.png ${JAVA_BINDIR}/tigervnc.png - DEPENDS ${JAVA_SRCDIR}/tigervnc.png) + ${SRCDIR}/${CLASSPATH}/tigervnc.png ${BINDIR}/${CLASSPATH}/tigervnc.png + DEPENDS ${SRCDIR}/${CLASSPATH}/tigervnc.png) -add_custom_command(OUTPUT ${JAVA_BINDIR}/tigervnc.ico +add_custom_command(OUTPUT ${BINDIR}/${CLASSPATH}/tigervnc.ico COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${JAVA_SRCDIR}/tigervnc.ico ${JAVA_BINDIR}/tigervnc.ico - DEPENDS ${JAVA_SRCDIR}/tigervnc.ico) + ${SRCDIR}/${CLASSPATH}/tigervnc.ico ${BINDIR}/${CLASSPATH}/tigervnc.ico + DEPENDS ${SRCDIR}/${CLASSPATH}/tigervnc.ico) + +endif() string(REGEX REPLACE "jar" "" Java_PATH ${Java_JAR_EXECUTABLE}) string(REGEX REPLACE ".exe" "" Java_PATH ${Java_PATH}) add_custom_command(OUTPUT VncViewer.jar - DEPENDS ${JAVA_CLASSES_FULL} - ${JAVA_SRCDIR}/MANIFEST.MF - ${JAVA_BINDIR}/timestamp - ${JAVA_BINDIR}/tigervnc.png - ${JAVA_BINDIR}/tigervnc.ico + DEPENDS ${JAVA_CLASSES} + ${SRCDIR}/${CLASSPATH}/MANIFEST.MF + ${BINDIR}/${CLASSPATH}/timestamp + ${BINDIR}/${CLASSPATH}/tigervnc.png + ${BINDIR}/${CLASSPATH}/tigervnc.ico COMMAND ${JAVA_ARCHIVE} ARGS cfm VncViewer.jar - ${JAVA_SRCDIR}/MANIFEST.MF - com/tigervnc/vncviewer/timestamp - com/tigervnc/vncviewer/*.class + ${SRCDIR}/${CLASSPATH}/MANIFEST.MF + ${CLASSPATH}/timestamp + ${CLASSPATH}/*.class com/tigervnc/rfb/*.class com/tigervnc/rdr/*.class com/tigervnc/network/*.class @@ -147,17 +135,16 @@ add_custom_command(OUTPUT VncViewer.jar com/tigervnc/vncviewer/tigervnc.png com/tigervnc/vncviewer/tigervnc.ico COMMAND ${CMAKE_COMMAND} - ARGS -DJava_PATH=${Java_PATH} - -DJAR_FILE=${CMAKE_CURRENT_BINARY_DIR}/VncViewer.jar - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/SignJar.cmake) + ARGS -DJava_PATH=${Java_PATH} -DJAR_FILE=${BINDIR}/VncViewer.jar + -P ${SRCDIR}/cmake/SignJar.cmake) add_custom_target(java ALL DEPENDS VncViewer.jar) if(NOT WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/VncViewer.jar - ${JAVA_SRCDIR}/README - ${JAVA_SRCDIR}/index.vnc - ${JAVA_SRCDIR}/favicon.ico + ${SRCDIR}/README + ${SRCDIR}/index.vnc + ${SRCDIR}/favicon.ico DESTINATION ${DATA_DIR}/vnc/classes) endif() |