mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 00:50:40 +00:00
Fix android compile errors on JDK 20+
Java 7 support was dropped since JDK 20. We should be able to target Java 8 without compatibility concerns because we run the bytecode through dex which desugars (or fails at build time which does not happen). But to be on the safe side, print a warning.
This commit is contained in:
committed by
Baldur Karlsson
parent
2b88b2c3ae
commit
4f0e117359
@@ -120,6 +120,11 @@ if(ANDROID)
|
||||
|
||||
if(${Java_VERSION} VERSION_LESS 1.8)
|
||||
message(FATAL_ERROR "Building Android requires the 'java' program in your PATH to be at least Java 8 (1.8)")
|
||||
elseif(${Java_VERSION} VERSION_LESS 20.0)
|
||||
set(JAVA_TARGET "1.7")
|
||||
else()
|
||||
message(WARNING "Building with JDK ${Java_VERSION} may cause broken Android binaries, it is recommended to build with JDK 17 or earlier")
|
||||
set(JAVA_TARGET "8")
|
||||
endif()
|
||||
message(STATUS "Using Java of version ${Java_VERSION}")
|
||||
|
||||
@@ -302,7 +307,7 @@ if(ANDROID)
|
||||
|
||||
add_custom_command(OUTPUT ${APK_FILE} APPEND
|
||||
COMMAND ${BUILD_TOOLS}/aapt package -f -m -S res -J src -M AndroidManifest.xml -I ${ANDROID_JAR}
|
||||
COMMAND ${JAVA_BIN}/javac -d ./obj -source 1.7 -target 1.7 -bootclasspath ${RT_JAR} -classpath "${CLASS_PATH}" -sourcepath src src/org/renderdoc/renderdoccmd/*.java
|
||||
COMMAND ${JAVA_BIN}/javac -d ./obj -source ${JAVA_TARGET} -target ${JAVA_TARGET} -bootclasspath ${RT_JAR} -classpath "${CLASS_PATH}" -sourcepath src src/org/renderdoc/renderdoccmd/*.java
|
||||
COMMAND ${DEX_COMMAND}
|
||||
COMMAND ${BUILD_TOOLS}/aapt package -f -M AndroidManifest.xml --version-code ${APK_VERSION_CODE} --version-name ${APK_VERSION_NAME} -S res -I ${ANDROID_JAR} -F RenderDocCmd-unaligned.apk bin libs
|
||||
COMMAND ${BUILD_TOOLS}/zipalign -f 4 RenderDocCmd-unaligned.apk RenderDocCmd.apk
|
||||
|
||||
@@ -349,6 +349,11 @@ if(ANDROID)
|
||||
|
||||
if(${Java_VERSION} VERSION_LESS 1.8)
|
||||
message(FATAL_ERROR "Building Android requires the 'java' program in your PATH to be at least Java 8 (1.8)")
|
||||
elseif(${Java_VERSION} VERSION_LESS 20.0)
|
||||
set(JAVA_TARGET "1.7")
|
||||
else()
|
||||
message(WARNING "Building with JDK ${Java_VERSION} may cause broken Android binaries, it is recommended to build with JDK 17 or earlier")
|
||||
set(JAVA_TARGET "8")
|
||||
endif()
|
||||
message(STATUS "Using Java of version ${Java_VERSION}")
|
||||
|
||||
@@ -464,7 +469,7 @@ if(ANDROID)
|
||||
add_custom_command(OUTPUT ${APK_FILE} APPEND
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${APK_FILE} # Don't package any existing artifact into the new one
|
||||
COMMAND ${BUILD_TOOLS}/aapt package -f -m -S res -J src -M AndroidManifest.xml -I ${ANDROID_JAR}
|
||||
COMMAND ${JAVA_BIN}/javac -d ./obj -source 1.7 -target 1.7 -bootclasspath ${RT_JAR} -classpath "${CLASS_PATH}" -sourcepath src src/renderdoc/org/demos/*.java
|
||||
COMMAND ${JAVA_BIN}/javac -d ./obj -source ${JAVA_TARGET} -target ${JAVA_TARGET} -bootclasspath ${RT_JAR} -classpath "${CLASS_PATH}" -sourcepath src src/renderdoc/org/demos/*.java
|
||||
COMMAND ${DEX_COMMAND}
|
||||
COMMAND ${BUILD_TOOLS}/aapt package -f -M AndroidManifest.xml --version-code ${APK_VERSION_CODE} --version-name ${APK_VERSION_NAME} -S res -I ${ANDROID_JAR} -F demos-unaligned.apk bin libs
|
||||
COMMAND ${BUILD_TOOLS}/zipalign -f 4 demos-unaligned.apk demos.apk
|
||||
|
||||
Reference in New Issue
Block a user