Skip to content

Commit

Permalink
Merge pull request #102 from hintjens/master
Browse files Browse the repository at this point in the history
  • Loading branch information
c-rack committed Dec 29, 2015
2 parents 0d33f69 + 1574ea3 commit b0c6927
Show file tree
Hide file tree
Showing 85 changed files with 1,807 additions and 115 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ set (malamute_headers
src/mlm_msg.h
src/mlm_stream_simple.h
src/mlm_mailbox_simple.h
src/zbits.h
src/mlm_server_engine.inc
src/mlm_client_engine.inc
src/mlm_client_custom.xml
Expand All @@ -139,7 +138,6 @@ set (malamute_sources
src/mlm_msg.c
src/mlm_stream_simple.c
src/mlm_mailbox_simple.c
src/zbits.c
)
source_group ("Source Files" FILES ${malamute_sources})
if (NOT DEFINED BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -206,7 +204,6 @@ set(TEST_CLASSES
mlm_msg_test
mlm_stream_simple_test
mlm_mailbox_simple_test
zbits_test
)

foreach(TEST_CLASS ${TEST_CLASSES})
Expand Down
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ EXTRA_DIST = \
src/mlm_msg.h \
src/mlm_stream_simple.h \
src/mlm_mailbox_simple.h \
src/zbits.h \
src/mlm_classes.h \
LICENSE \
README.md \
Expand Down
45 changes: 40 additions & 5 deletions bindings/jni/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,48 @@

JNI Binding for malamute

## Usage
## Building the JNI Layer for Linux

Ensure you have cmake installed
Ensure you have cmake installed, then run:

```
./grade test
```
./gradle build jar
./gradle test

This calls javah to build the headers in src/native/c, and then compiles the C and Java pieces to create a jar file a sharable library (.so).

## Building the JNI Layer for Android

See bindings/jni/android/build.sh.

You need the Android Native Development Kit (NDK) installed.

Set these environment variables, e.g:

ANDROID_NDK_ROOT=$HOME/android-ndk-r10e
TOOLCHAIN_NAME=arm-linux-androideabi-4.9
TOOLCHAIN_HOST=arm-linux-androideabi
TOOLCHAIN_ARCH=arm
TOOLCHAIN_PATH=$ANDROID_NDK_ROOT/toolchains/$TOOLCHAIN_NAME/prebuilt/linux-x86_64/bin

Then in the android directory, to build mlmjni.so run:

./build.sh

Note that this implicitly builds the Android library and all dependencies. It also builds the JNI layer for Linux.

All results are placed in bindings/jni/android/build/libs.

## Building the JNI Layer for Windows

You need MS Visual Studio 2010 or later.

You need the Java SDK. Set the JAVA_HOME environment to the installation location, e.g. C:Program FilesJavajdk1.8.0_66.

1. Check out all dependent projects from github, at the same level as this project. E.g.: libsodium, libzmq, czmq.
2. In each project, open a console in builds/msvc/vs2010 and run the build.bat batch file.
3. In this project, open a console in bindings/jni/msvc/vs2010 and run the build.bat batch file.

The resulting libraries (mlmjni.dll, mlmjni.lib) are created in bindings/jni/msvc/bin.

## License

Expand Down
4 changes: 2 additions & 2 deletions bindings/jni/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ echo "******** Building Android native libraries"
( cd ../../../builds/android && ./build.sh )

# Ensure we've built JNI interface
# echo "******** Building JNI interface & classes"
# ( cd .. && gradle build jar )
echo "******** Building JNI interface & classes"
( cd .. && gradle build jar )

rm -Rf build
mkdir build
Expand Down
2 changes: 1 addition & 1 deletion bindings/jni/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
apply plugin: 'java'
apply plugin: 'maven'
group = "org.zeromq"
version = "0.1.0"
version = "0.0.0"

repositories {
mavenLocal()
Expand Down
7 changes: 7 additions & 0 deletions bindings/jni/msvc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.opensdf
*.suo
*.sdf
*.user
*.aps
*.log
ipch/
21 changes: 21 additions & 0 deletions bindings/jni/msvc/properties/Common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Common Settings</_PropertySheetDisplayName>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="$(Platform).props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
</ItemDefinitionGroup>

</Project>
16 changes: 16 additions & 0 deletions bindings/jni/msvc/properties/DLL.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Dynamic Library</_PropertySheetDisplayName>
<DefaultLinkage>dynamic</DefaultLinkage>
<TargetExt>.dll</TargetExt>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_DLL;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

</Project>
29 changes: 29 additions & 0 deletions bindings/jni/msvc/properties/Debug.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ImportGroup Label="PropertySheets">
<Import Project="Common.props" />
</ImportGroup>

<PropertyGroup>
<_PropertySheetDisplayName>Debug Settings</_PropertySheetDisplayName>
<DebugOrRelease>Debug</DebugOrRelease>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>

</Project>
21 changes: 21 additions & 0 deletions bindings/jni/msvc/properties/DebugDEXE.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Console Debug Dynamic</_PropertySheetDisplayName>
<DefaultLinkage>dynamic</DefaultLinkage>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="Debug.props" />
<Import Project="EXE.props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<LinkIncremental>true</LinkIncremental>
</ClCompile>
</ItemDefinitionGroup>

</Project>
20 changes: 20 additions & 0 deletions bindings/jni/msvc/properties/DebugDLL.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Dynamic Debug Library</_PropertySheetDisplayName>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="Debug.props" />
<Import Project="DLL.props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<LinkIncremental>true</LinkIncremental>
</ClCompile>
</ItemDefinitionGroup>

</Project>
20 changes: 20 additions & 0 deletions bindings/jni/msvc/properties/DebugLEXE.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Console Debug Link Time Code Generation</_PropertySheetDisplayName>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="Debug.props" />
<Import Project="Link.props" />
<Import Project="EXE.props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>

</Project>
21 changes: 21 additions & 0 deletions bindings/jni/msvc/properties/DebugLIB.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Static Debug Library</_PropertySheetDisplayName>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="Debug.props" />
<Import Project="LIB.props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LinkIncremental>true</LinkIncremental>
</ClCompile>
</ItemDefinitionGroup>

</Project>
20 changes: 20 additions & 0 deletions bindings/jni/msvc/properties/DebugLTCG.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Static Debug Link Time Code Generation Library</_PropertySheetDisplayName>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="Debug.props" />
<Import Project="LTCG.props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>

</Project>
21 changes: 21 additions & 0 deletions bindings/jni/msvc/properties/DebugSEXE.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Console Debug Static</_PropertySheetDisplayName>
<DefaultLinkage>static</DefaultLinkage>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="Debug.props" />
<Import Project="EXE.props" />
</ImportGroup>

<ItemDefinitionGroup>
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LinkIncremental>true</LinkIncremental>
</ClCompile>
</ItemDefinitionGroup>

</Project>
17 changes: 17 additions & 0 deletions bindings/jni/msvc/properties/EXE.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Console Application</_PropertySheetDisplayName>
<IsExe>true</IsExe>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
</Project>
16 changes: 16 additions & 0 deletions bindings/jni/msvc/properties/LIB.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Static Library</_PropertySheetDisplayName>
<DefaultLinkage>static</DefaultLinkage>
<TargetExt>.lib</TargetExt>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

</Project>
13 changes: 13 additions & 0 deletions bindings/jni/msvc/properties/LTCG.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Link Time Code Generation Library</_PropertySheetDisplayName>
</PropertyGroup>

<ImportGroup Label="PropertySheets">
<Import Project="LIB.props" />
<Import Project="Link.props" />
</ImportGroup>

</Project>
21 changes: 21 additions & 0 deletions bindings/jni/msvc/properties/Link.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Link Time Code Generation Settings</_PropertySheetDisplayName>
<DefaultLinkage>ltcg</DefaultLinkage>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>

</Project>
15 changes: 15 additions & 0 deletions bindings/jni/msvc/properties/Messages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_PropertySheetDisplayName>Build Messages</_PropertySheetDisplayName>
</PropertyGroup>

<Target Name="ConfigInfo" BeforeTargets="PrepareForBuild">
<Message Text="ConfigurationType : $(ConfigurationType)" Importance="high"/>
<Message Text="Configuration : $(Configuration)" Importance="high"/>
<Message Text="PlatformToolset : $(PlatformToolset)" Importance="high"/>
<Message Text="TargetPath : $(TargetPath)" Importance="high"/>
</Target>

</Project>
Loading

0 comments on commit b0c6927

Please sign in to comment.