Skip to content

Commit

Permalink
Added Windows build step
Browse files Browse the repository at this point in the history
  • Loading branch information
gherynos committed Apr 15, 2024
1 parent 9727cf6 commit 966c9b6
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 31 deletions.
113 changes: 87 additions & 26 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,92 @@ on:
types: [created]

jobs:
windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Install dependencies
run: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
choco install cmake
refreshenv
Write-Output "$env:PATH" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: boost
run: |
Invoke-WebRequest https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.gz -OutFile boost.tar.gz
tar -xzf .\boost.tar.gz
Rename-Item -path boost_1_84_0 -NewName boost_libs
- name: MsgPack
run: |
Invoke-WebRequest https://github.com/msgpack/msgpack-c/releases/download/cpp-6.1.0/msgpack-cxx-6.1.0.tar.gz -OutFile msgpack.tar.gz
tar -xzf .\msgpack.tar.gz
cd msgpack-cxx-6.1.0
cmake -DMSGPACK_CXX14=ON -D Boost_INCLUDE_DIR=..\boost_libs .
msbuild ALL_BUILD.vcxproj -t:rebuild -property:Configuration=Release
- name: LibSodium
run: |
Invoke-WebRequest https://github.com/jedisct1/libsodium/releases/download/1.0.19-RELEASE/libsodium-1.0.19-msvc.zip -OutFile libsodium.zip
Expand-Archive libsodium.zip .
- name: LibSaltpack
run: |
Invoke-WebRequest https://github.com/gherynos/libsaltpack/archive/v1.0.0.tar.gz -OutFile libsaltpack.tar.gz
tar -xvzf .\libsaltpack.tar.gz
cd libsaltpack-1.0.0
git clone https://github.com/983/Num.git ext/Num
cmake -D Boost_INCLUDE_DIR=..\boost_libs -D MSGPACK_INCLUDE_DIR=..\msgpack-cxx-6.1.0\include -D LIBSODIUM_INCLUDE_DIRS=..\libsodium\include -D LIBSODIUM_LIBRARIES=..\libsodium\x64\Release\v143\static\libsodium.lib .
msbuild saltpack.vcxproj -t:rebuild -property:Configuration=Release
- name: Build
run: |
mvn compile
cmake -D Boost_INCLUDE_DIR=.\boost_libs -D MSGPACK_INCLUDE_DIR=.\msgpack-cxx-6.1.0\include -D LIBSODIUM_INCLUDE_DIRS=.\libsodium\include -D LIBSODIUM_LIBRARIES=.\libsodium\x64\Release\v143\static\libsodium.lib -D LIBSALTPACK_INCLUDE_DIRS=.\libsaltpack-1.0.0\include -D LIBSALTPACK_LIBRARIES=.\libsaltpack-1.0.0\Release\saltpack.lib .
msbuild saltpack-jni.vcxproj -t:rebuild -property:Configuration=Release
mvn exec:java -D"exec.mainClass"="com.gherynos.libsaltpack.Loader"
mvn test
- uses: actions/upload-artifact@v4
with:
name: windows-2022.zip
path: src/main/resources/lib/

unix:
strategy:
matrix:
os: [ubuntu-22.04, macos-13, macos-14]
include:
- os: ubuntu-22.04
java_home: /usr/lib/jvm/java-17-openjdk-amd64
library: libsaltpack-jni.so
- os: macos-13
java_home: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
library: libsaltpack-jni.dylib
- os: macos-14
java_home: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
library: libsaltpack-jni.dylib
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- if: runner.os == 'Linux'
name: Linux dependencies
run: |
sudo apt-get install -y build-essential wget cmake openjdk-17-jdk maven xz-utils m4
- if: runner.os == 'macOS'
name: macOS dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
brew tap homebrew/cask-versions
brew install --cask temurin17
sudo apt-get install -y build-essential wget cmake maven xz-utils m4
- name: boost
run: |
Expand All @@ -50,31 +104,28 @@ jobs:
run: |
wget https://github.com/msgpack/msgpack-c/releases/download/cpp-6.1.0/msgpack-cxx-6.1.0.tar.gz
tar -xvzf msgpack-cxx-6.1.0.tar.gz
pushd msgpack-cxx-6.1.0
cd msgpack-cxx-6.1.0
cmake -DMSGPACK_CXX14=ON -DBoost_INCLUDE_DIR=../boost_libs .
sudo cmake --build . --target install
popd
- name: LibSodium
run: |
wget https://github.com/jedisct1/libsodium/releases/download/1.0.19-RELEASE/libsodium-1.0.19.tar.gz
tar -xvzf libsodium-1.0.19.tar.gz
pushd libsodium-stable
cd libsodium-stable
./configure --with-pic
make
sudo make install
popd
- name: LibSaltpack
run: |
wget https://github.com/gherynos/libsaltpack/archive/v0.3.3.tar.gz
tar -xvzf v0.3.3.tar.gz
pushd libsaltpack-0.3.3
wget https://github.com/gherynos/libsaltpack/archive/v1.0.0.tar.gz
tar -xvzf v1.0.0.tar.gz
cd libsaltpack-1.0.0
git clone https://github.com/983/Num.git ext/Num
cmake -DBoost_INCLUDE_DIR=../boost_libs .
make
sudo make install
popd
- name: Build
run: |
Expand All @@ -85,9 +136,6 @@ jobs:
rm ${{ matrix.library }}
mvn test
env:
JAVA_HOME: ${{ matrix.java_home }}

- if: runner.os == 'Linux' && github.event_name == 'push'
name: Coveralls report
run: mvn jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_TOKEN }}
Expand All @@ -98,7 +146,9 @@ jobs:
path: src/main/resources/lib/

assemble:
needs: unix
needs:
- unix
- windows
runs-on: ubuntu-22.04

steps:
Expand All @@ -123,7 +173,12 @@ jobs:
name: macos-14.zip
path: src/main/resources/lib

- uses: actions/setup-java@v3
- uses: actions/download-artifact@v4
with:
name: windows-2022.zip
path: src/main/resources/lib

- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand All @@ -132,6 +187,12 @@ jobs:
run: |
mvn package
- if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: assemble.zip
path: target/*.jar

- if: github.event_name == 'release'
name: Publish
run: |
Expand Down
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.13)
project(saltpack-jni)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -Wall")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
if(MSVC)
#vc 2012 fix for vararg templates
set(MSVC_COMPILER_DEFS "-D_VARIADIC_MAX=10")
set(MSVC_COMPILER_DEFS "-D_VARIADIC_MAX=10") #vc 2012 fix for vararg templates
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()

IF(WIN32)
Expand Down
2 changes: 1 addition & 1 deletion android/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export NDK_PLATFORM=android-$NDK_PLATFORM_NUM
LIBSODIUM_VER=1.0.19
MSGPACK_VER=6.1.0
BOOST_VER=1.84.0
LIBSALTPACK_VER=v0.3.3
LIBSALTPACK_VER=v1.0.0

PT=/opt/libsaltpack-jni/android/tmp
cd $PT || exit
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/gherynos/libsaltpack/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private static String[] getPathExt() {
} else if (os.contains("win")) {

ext = "dll";
os = "windows";

} else {

Expand Down

0 comments on commit 966c9b6

Please sign in to comment.