diff --git a/.gitignore b/.gitignore index 4dc216c..1b8fd1b 100644 --- a/.gitignore +++ b/.gitignore @@ -89,5 +89,12 @@ org.tar.gz android/external/[?]* android/external/build + +# Ignore Windows build +build-windows/Debug +build-windows/Release +build-windows/.vs +build-windows/pEpJNIAdapter.vcxproj.user + # Default ignored files ?idea/ diff --git a/build-windows/generate_code.cmd b/build-windows/generate_code.cmd new file mode 100644 index 0000000..50817d2 --- /dev/null +++ b/build-windows/generate_code.cmd @@ -0,0 +1,52 @@ +SET current_directory=%~dp0 +SET dist_directory=%current_directory:~0,-15%\dist +SET build_directory=%current_directory:~0,-15%\build +SET marker_dir=%build_directory%\marker +SET exceptions_directory=%current_directory:~0,-15%\src\java\foundation\pEp\jniadapter\exceptions +SET java_build_root=%build_directory%\java +SET java_pkg_basename=foundation\pEp\jniadapter + +:: Create directories as necessary +MKDIR %marker_dir% +MKDIR %exceptions_directory% + +:: Generate Status files +SH ..\utils\gen_status_codes.sh ..\..\pEp\pEpEngine.h +MV passphrase_status_list.yml2 ..\src\codegen\ +MV status_list.yml2 ..\src\codegen\ + +:: Generate YML2 code +PUSHD .. +CD src +CD codegen + +PY -m yml2.yml2proc -E utf-8 -y gen_java_Engine.ysl2 pEp.yml2 +IF %ERRORLEVEL% NEQ 0 GOTO end +PY -m yml2.yml2proc -E utf-8 -y gen_java_Message.ysl2 pEp.yml2 +IF %ERRORLEVEL% NEQ 0 GOTO end +PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Engine.ysl2 pEp.yml2 +IF %ERRORLEVEL% NEQ 0 GOTO end +PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Message.ysl2 pEp.yml2 +IF %ERRORLEVEL% NEQ 0 GOTO end +PY -m yml2.yml2proc -E utf-8 -y gen_throw_pEp_exception.ysl2 pEp.yml2 +IF %ERRORLEVEL% NEQ 0 GOTO end + +:: Compile the Java part +CD .. +CD java + +javac -encoding UTF-8 -d "%java_build_root%" -h ..\cxx %java_pkg_basename%\*.java +IF %ERRORLEVEL% NEQ 0 GOTO end +javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\*.java +IF %ERRORLEVEL% NEQ 0 GOTO end +javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\exceptions\*.java +IF %ERRORLEVEL% NEQ 0 GOTO end +javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\interfaces\*.java +IF %ERRORLEVEL% NEQ 0 GOTO end + +"C:\Program Files\Java\jdk-16\bin\jar" -cvf "%java_build_root%\pEp.jar" -C "%java_build_root%" foundation +IF %ERRORLEVEL% NEQ 0 GOTO end + +:end +POPD +EXIT /B %ERRORLEVEL% diff --git a/build-windows/pEpJNIAdapter.vcxproj b/build-windows/pEpJNIAdapter.vcxproj new file mode 100644 index 0000000..a2484a4 --- /dev/null +++ b/build-windows/pEpJNIAdapter.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + {ec44fec9-2f3a-4a0c-b60e-0f22aa43ef58} + + + {146e69f8-e1da-456a-b048-6dd29d9acf6b} + + + + 16.0 + Win32Proj + {2a1167be-f438-4e08-b32e-25f130d97c33} + pEpJNIAdapter + 10.0 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\pEpForWindowsAdapterSolution\Debug\;$(LibraryPath) + + + false + + + + Level3 + true + __LP64__;WIN32;_DEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + NotUsing + + + C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\ + + + Windows + true + false + + + IF NOT EXIST "..\build" CALL generate_code.cmd + + + CP "..\build\java\pEp.jar" "$(SolutionDir)\$(Configuration)" + + + + + Level3 + true + true + true + __LP64__;WIN32;NDEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + NotUsing + + + C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\ + + + Windows + true + true + true + false + + + IF NOT EXIST "..\build" CALL generate_code.cmd + + + CP "..\build\java\pEp.jar" "$(SolutionDir)\$(Configuration)" + + + + + + + + + \ No newline at end of file diff --git a/build-windows/pEpJNIAdapter.vcxproj.filters b/build-windows/pEpJNIAdapter.vcxproj.filters new file mode 100644 index 0000000..952024d --- /dev/null +++ b/build-windows/pEpJNIAdapter.vcxproj.filters @@ -0,0 +1,75 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/cxx/jniutils.cc b/src/cxx/jniutils.cc index 3d3b2ad..82b1de4 100644 --- a/src/cxx/jniutils.cc +++ b/src/cxx/jniutils.cc @@ -237,7 +237,6 @@ jbyteArray from_string(JNIEnv *env, const char *str) { if (str && str[0]) { - jboolean isCopy; size_t l = strlen(str); jbyteArray _str = env->NewByteArray(l); env->SetByteArrayRegion(_str, 0, l, (jbyte *) str); diff --git a/src/cxx/jniutils.hh b/src/cxx/jniutils.hh index 747d55a..0b346b1 100644 --- a/src/cxx/jniutils.hh +++ b/src/cxx/jniutils.hh @@ -10,6 +10,7 @@ #include #include #include +#include #if 0 // Enable if log needed #include diff --git a/utils/gen_status_codes.sh b/utils/gen_status_codes.sh index 238db98..2bd2e83 100644 --- a/utils/gen_status_codes.sh +++ b/utils/gen_status_codes.sh @@ -23,6 +23,7 @@ OS="$(uname -s)" case "${OS}" in Linux*) SED=sed;; Darwin*) SED=gsed;; + MSYS*) SED=sed;; CYGWIN*) echo "UNSUPORTED YET" && exit;; MINGW*) echo "UNSUPORTED YET" && exit;; *) echo "UNKNOWN:${OS}" && exit;;