Skip to content

Commit

Permalink
explode modules using cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertObkircher committed May 31, 2021
1 parent 31b7877 commit 3b92b15
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ project(SchokoVM)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

find_package(Java 1.8 REQUIRED)
find_package(Java 11.0.11 EXACT REQUIRED COMPONENTS Runtime Development)
find_package(JNI 11.0.11 EXACT REQUIRED)
include(UseJava)

find_package(libzip)
Expand Down Expand Up @@ -102,6 +103,31 @@ else ()
target_link_libraries(SchokoVM zip)
endif ()


#
# OpenJDK
#

file(REAL_PATH ${Java_JAVAC_EXECUTABLE} JDK_HOME)
get_filename_component(JDK_HOME ${JDK_HOME} DIRECTORY)
get_filename_component(JDK_HOME ${JDK_HOME} DIRECTORY)
message(STATUS "jdk: ${JDK_HOME}")

set(JDK_BIN ${CMAKE_CURRENT_SOURCE_DIR}/jdk/jdk-11.0.11)
if(NOT IS_DIRECTORY ${JDK_BIN})
message(STATUS "Copying ${JDK_HOME} to ${JDK_BIN}")
# file(COPY ${JDK_HOME} DESTINATION ${JDK_BIN})
# this renames the target folder:
execute_process(COMMAND cp -r "${JDK_HOME}" "${JDK_BIN}")
endif()

set(JDK_EXPLODED ${CMAKE_CURRENT_SOURCE_DIR}/jdk/exploded-modules)
if(NOT IS_DIRECTORY ${JDK_EXPLODED})
message(STATUS "Exploding")
execute_process(COMMAND ${JDK_HOME}/bin/jimage extract --dir "${JDK_EXPLODED}" "${JDK_BIN}/lib/modules")
endif()


#
# Tests
#
Expand Down
2 changes: 1 addition & 1 deletion jdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/exploded-modules/
/jdk/
/jdk-11.0.11+9/
/jdk-11.0.11/
6 changes: 6 additions & 0 deletions jdk/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e

# clion doesn't want to delete the symlinks
rm -rf jdk-11.0.11
rm -rf exploded-modules
12 changes: 0 additions & 12 deletions jdk/download.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#!/bin/sh

set -e

if [ -d "jdk-11.0.11+9" ]; then
echo "Skipping download of jdk release"
else
ARCHIVE="OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz"
wget "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/$ARCHIVE"
tar -xf "$ARCHIVE"
rm "$ARCHIVE"

jimage extract --dir exploded-modules jdk-11.0.11+9/lib/modules
fi

if [ -d "jdk" ]; then
echo "Skipping download of jdk sources"
else
Expand Down
1 change: 1 addition & 0 deletions src/zip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define SCHOKOVM_ZIP_HPP

#include <memory>
#include <string>
#include <unordered_map>
#include <zip.h>

Expand Down

0 comments on commit 3b92b15

Please sign in to comment.