-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Animeshz/jni-setup
Set up JNI along with cross compilations of C/C++ code with docker.
- Loading branch information
Showing
11 changed files
with
361 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM dockcross/linux-x64 | ||
|
||
LABEL maintainer="Animesh Sahu animeshsahu19@yahoo.com" | ||
|
||
ENV DEFAULT_DOCKCROSS_IMAGE animeshz/keyboard-mouse-kt:jni-build-linux-x64 | ||
ENV WORK_DIR=/work | ||
ENV JNI_HEADERS_DIR=${WORK_DIR}/support-files/headers/jni | ||
ENV X11_HEADERS_DIR=/usr/include/X11/ | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends --yes \ | ||
curl \ | ||
libx11-dev \ | ||
libxi-dev && \ | ||
mkdir -p ${JNI_HEADERS_DIR} && \ | ||
cd ${JNI_HEADERS_DIR} && \ | ||
curl 'https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/native/include/jni.h' > jni.h && \ | ||
curl 'https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/unix/native/include/jni_md.h' > jni_md.h | ||
|
||
WORKDIR ${WORK_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM dockcross/windows-shared-x64 | ||
|
||
LABEL maintainer="Animesh Sahu animeshsahu19@yahoo.com" | ||
|
||
ENV DEFAULT_DOCKCROSS_IMAGE animeshz/keyboard-mouse-kt:jni-build-windows-x64 | ||
ENV WORK_DIR=/work | ||
ENV JNI_HEADERS_DIR=${WORK_DIR}/support-files/headers/jni | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends --yes curl && \ | ||
mkdir -p ${JNI_HEADERS_DIR} && \ | ||
cd ${JNI_HEADERS_DIR} && \ | ||
curl 'https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/native/include/jni.h' > jni.h && \ | ||
curl 'https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/windows/native/include/jni_md.h' > jni_md.h | ||
|
||
WORKDIR ${WORK_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
keyboard/src/jvmMain/generated/jni/com_github_animeshz_keyboard_JvmKeyboardHandler.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(KeyboardKtx64) | ||
|
||
include_directories(KeyboardKtx64 PRIVATE $ENV{JNI_HEADERS_DIR}) | ||
include_directories(KeyboardKtx64 PRIVATE "../../generated/jni") | ||
|
||
include_directories($ENV{X11_HEADERS_DIR}) | ||
include_directories($ENV{X11_HEADERS_DIR}/extensions) | ||
|
||
add_library( | ||
KeyboardKtx64 SHARED | ||
JvmKeyboardHandler.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "com_github_animeshz_keyboard_JvmKeyboardHandler.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
JNIEXPORT jboolean JNICALL Java_com_github_animeshz_keyboard_JvmKeyboardHandler_isCapsLockOn | ||
(JNIEnv *env, jobject obj) { | ||
return 1; | ||
} | ||
|
||
JNIEXPORT jboolean JNICALL Java_com_github_animeshz_keyboard_JvmKeyboardHandler_isNumLockOn | ||
(JNIEnv *env, jobject obj) { | ||
return 1; | ||
} | ||
|
||
JNIEXPORT jboolean JNICALL Java_com_github_animeshz_keyboard_JvmKeyboardHandler_isScrollLockOn | ||
(JNIEnv *env, jobject obj) { | ||
return 1; | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(KeyboardKtx64) | ||
|
||
include_directories(KeyboardKtx64 PRIVATE $ENV{JNI_HEADERS_DIR}) | ||
include_directories(KeyboardKtx64 PRIVATE "../../generated/jni") | ||
|
||
add_library( | ||
KeyboardKtx64 SHARED | ||
JvmKeyboardHandler.cpp | ||
) |
24 changes: 24 additions & 0 deletions
24
keyboard/src/jvmMain/jni/windows-x64/JvmKeyboardHandler.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "com_github_animeshz_keyboard_JvmKeyboardHandler.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
JNIEXPORT jboolean JNICALL Java_com_github_animeshz_keyboard_JvmKeyboardHandler_isCapsLockOn | ||
(JNIEnv *env, jobject obj) { | ||
return 1; | ||
} | ||
|
||
JNIEXPORT jboolean JNICALL Java_com_github_animeshz_keyboard_JvmKeyboardHandler_isNumLockOn | ||
(JNIEnv *env, jobject obj) { | ||
return 1; | ||
} | ||
|
||
JNIEXPORT jboolean JNICALL Java_com_github_animeshz_keyboard_JvmKeyboardHandler_isScrollLockOn | ||
(JNIEnv *env, jobject obj) { | ||
return 1; | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.