Add Windows build project and reference platform.h

JNI-172
Thomas 1 year ago committed by Newgitea
parent 8029ef2ec0
commit 138bee2566
  1. 7
      .gitignore
  2. 38
      build-windows/generate_code.cmd
  3. 31
      build-windows/pEpJNIAdapter.sln
  4. 210
      build-windows/pEpJNIAdapter.vcxproj
  5. 75
      build-windows/pEpJNIAdapter.vcxproj.filters
  6. 1
      src/cxx/jniutils.cc
  7. 1
      src/cxx/jniutils.hh

7
.gitignore vendored

@ -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/

@ -0,0 +1,38 @@
@ECHO OFF
SET current_directory=%~dp0
SET dist_directory=%current_directory:~0,-15%\dist
SET marker_dir=%current_directory:~0,-15%\build\marker
SET exceptions_directory=%current_directory:~0,-15%\src\java\foundation\pEp\jniadapter\exceptions
SET java_build_root=%current_directory:~0,-15%\build\java
SET java_pkg_basename=foundation\pEp\jniadapter
:: Create directories as necessary
MKDIR %marker_dir%
MKDIR %exceptions_directory%
:: Generate YML2 code
PUSHD ..
CD src
CD codegen
@ECHO ON
PY -m yml2.yml2proc -E utf-8 -y gen_java_Engine.ysl2 pEp.yml2
PY -m yml2.yml2proc -E utf-8 -y gen_java_Message.ysl2 pEp.yml2
PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Engine.ysl2 pEp.yml2
PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Message.ysl2 pEp.yml2
PY -m yml2.yml2proc -E utf-8 -y gen_throw_pEp_exception.ysl2 pEp.yml2
@ECHO OFF
:: Compile the Java part
CD ..
CD java
javac -encoding UTF-8 -d "%java_build_root%" -h ..\cxx %java_pkg_basename%\*.java
javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\*.java
javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\exceptions\*.java
javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\interfaces\*.java
"C:\Program Files\Java\jdk-16\bin\jar" -cvf ..\..\build\java\pEp.jar -C "%java_build_root%" foundation
POPD

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31410.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pEpJNIAdapter", "pEpJNIAdapter.vcxproj", "{2A1167BE-F438-4E08-B32E-25F130D97C33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x64.ActiveCfg = Debug|x64
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x64.Build.0 = Debug|x64
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x86.ActiveCfg = Debug|Win32
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x86.Build.0 = Debug|Win32
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x64.ActiveCfg = Release|x64
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x64.Build.0 = Release|x64
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x86.ActiveCfg = Release|Win32
{2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {429CC90F-89C3-4737-918E-5BCEC8C5C485}
EndGlobalSection
EndGlobal

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\cxx\basic_api.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Engine.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Message.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter__Blob.cc" />
<ClCompile Include="..\src\cxx\get_header.cc" />
<ClCompile Include="..\src\cxx\identity_api.cc" />
<ClCompile Include="..\src\cxx\jniutils.cc" />
<ClCompile Include="..\src\cxx\throw_pEp_exception.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Engine.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Identity.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Message.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter__Blob.h" />
<ClInclude Include="..\src\cxx\jniutils.hh" />
<ClInclude Include="..\src\cxx\passphrase_callback.hh" />
<ClInclude Include="..\src\cxx\passphrase_callback.hxx" />
<ClInclude Include="..\src\cxx\throw_pEp_exception.hh" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\libpEpAdapter\build-windows\libpEpAdapter.vcxproj">
<Project>{ec44fec9-2f3a-4a0c-b60e-0f22aa43ef58}</Project>
</ProjectReference>
<ProjectReference Include="..\..\pEpEngine\build-windows\pEpEngine.vcxproj">
<Project>{146e69f8-e1da-456a-b048-6dd29d9acf6b}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2a1167be-f438-4e08-b32e-25f130d97c33}</ProjectGuid>
<RootNamespace>pEpJNIAdapter</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LibraryPath>$(ProjectDir)..\..\pEpForWindowsAdapterSolution\Debug\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>__LP64__;WIN32;_DEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>IF NOT EXIST "..\build" CALL generate_code.cmd</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>__LP64__;WIN32;NDEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>IF NOT EXIST "..\build" CALL generate_code.cmd</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>IF NOT EXIST "..\build" CALL generate_code.cmd</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>IF NOT EXIST "..\build" CALL generate_code.cmd</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="CustomClean" BeforeTargets="Clean">
<RemoveDir Directories="..\build" />
</Target>
</Project>

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\cxx\basic_api.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter__Blob.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Engine.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Message.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\get_header.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\identity_api.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\jniutils.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\throw_pEp_exception.cc">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cxx\jniutils.hh">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\passphrase_callback.hh">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\passphrase_callback.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\throw_pEp_exception.hh">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter__Blob.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Engine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Identity.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Message.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -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);

@ -10,6 +10,7 @@
#include <pEp/message.h>
#include <pEp/sync_api.h>
#include <pEp/passphrase_cache.hh>
#include <pEp/platform.h>
#if 0 // Enable if log needed
#include <android/log.h>

Loading…
Cancel
Save