diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index c39c4c714..b2691f7a7 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -13,6 +13,7 @@ on: jobs: build-linux-x86_64: runs-on: ubuntu-latest + name: linux-x86_64 steps: - uses: actions/checkout@v2 @@ -38,3 +39,44 @@ jobs: with: name: target path: "**/target/" + + build-windows: + runs-on: windows-2016 + name: windows-x86_64 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: x86_64-pc-windows-msvc + override: true + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Configuring Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x86_amd64 + + - name: Install tools + uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install ninja nasm + + - name: Build project + run: mvn --file pom.xml clean package + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: build-windows-target + path: "**/target/" diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 929569791..ca834e743 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -10,6 +10,7 @@ on: jobs: build-linux-x86_64: runs-on: ubuntu-latest + name: linux-x86_64 steps: - uses: actions/checkout@v2 @@ -38,3 +39,44 @@ jobs: with: name: target path: "**/target/" + + build-pr-windows: + runs-on: windows-2016 + name: windows-x86_64 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: x86_64-pc-windows-msvc + override: true + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Configuring Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x86_amd64 + + - name: Install tools + uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install ninja nasm + + - name: Build project + run: mvn --file pom.xml clean package + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: build-pr-windows-target + path: "**/target/" diff --git a/pom.xml b/pom.xml index 1a80711f3..768d307ea 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,7 @@ io.netty.incubator.codec.quic ${project.basedir}/src/main/c + ${project.build.directory}/native-lib-only false 4.1.59.Final-SNAPSHOT 28 @@ -93,6 +94,7 @@ master 5092e4d1e8ae2773a56eddda6a8205f5e65b4b37 ${project.build.directory}/generated-sources + ${project.build.directory}/template -std=c99 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value -O3 -I${quicheHomeIncludeDir} -I${boringsslHomeIncludeDir} -L${quicheHomeBuildDir} -lquiche -L${boringsslHomeBuildDir} -lssl -lcrypto @@ -109,6 +111,29 @@ + + windows + + + windows + + + + ${boringsslHomeDir}/build/RelWithDebInfo + x86_64-pc-windows-msvc + --target=${quicheTarget} + ${quicheSourceDir}/target/${quicheTarget}/release + + + /MT + + /MT /wd4091 + ssl.lib + crypto.lib + quiche.lib + META-INF/native/${jniLibName}.dll;osname=win32;processor=${os.detected.arch} + + mac @@ -368,17 +393,33 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -410,6 +451,66 @@ + + + + setup-template + generate-sources + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + copy-native-lib + process-test-resources + + run + + + + + + + + + + + + + @@ -612,20 +713,19 @@ org.fusesource.hawtjni - maven-hawtjni-plugin - 1.14 + hawtjni-maven-plugin + 1.18 build-native-lib ${jniLibName} ${generatedSourcesDir} - ${project.build.outputDirectory} - - . - true + ${templateDir} + msbuild + true + v140 + ${nativeLibOnlyDir} ${extraConfigureArg} CFLAGS=${cflags} @@ -647,6 +747,7 @@ default-jar + META-INF/native/** diff --git a/src/main/c/netty_quic_boringssl.h b/src/main/c/netty_quic_boringssl.h index 6ea233f93..ea2e2d5de 100644 --- a/src/main/c/netty_quic_boringssl.h +++ b/src/main/c/netty_quic_boringssl.h @@ -18,6 +18,6 @@ // JNI initialization hooks. Users of this file are responsible for calling these in the JNI_OnLoad and JNI_OnUnload methods. jint netty_boringssl_JNI_OnLoad(JNIEnv* env, const char* packagePrefix); -void netty_boringssl_JNI_OnUnLoad(JNIEnv* env, const char* packagePrefix); +void netty_boringssl_JNI_OnUnload(JNIEnv* env, const char* packagePrefix); #endif /* NETTY_BORINGSSL_H_ */ diff --git a/src/main/c/netty_quic_quiche.c b/src/main/c/netty_quic_quiche.c index a46c9094a..b645dfbce 100644 --- a/src/main/c/netty_quic_quiche.c +++ b/src/main/c/netty_quic_quiche.c @@ -581,7 +581,7 @@ static jint netty_quiche_JNI_OnLoad(JNIEnv* env, const char* packagePrefix) { netty_jni_util_unregister_natives(env, packagePrefix, QUICHE_CLASSNAME); } if (boringsslLoaded == 1) { - netty_boringssl_JNI_OnUnLoad(env, packagePrefix); + netty_boringssl_JNI_OnUnload(env, packagePrefix); } NETTY_JNI_UTIL_UNLOAD_CLASS(env, quiche_logger_class); @@ -591,7 +591,7 @@ static jint netty_quiche_JNI_OnLoad(JNIEnv* env, const char* packagePrefix) { } static void netty_quiche_JNI_OnUnload(JNIEnv* env, const char* packagePrefix) { - netty_boringssl_JNI_OnUnLoad(env, packagePrefix); + netty_boringssl_JNI_OnUnload(env, packagePrefix); NETTY_JNI_UTIL_UNLOAD_CLASS(env, quiche_logger_class); diff --git a/src/main/native-package/vs2010.custom.props.template b/src/main/native-package/vs2010.custom.props.template new file mode 100644 index 000000000..1f9049d9c --- /dev/null +++ b/src/main/native-package/vs2010.custom.props.template @@ -0,0 +1,26 @@ + + + + + + $(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;@BORINGSSL_INCLUDE_DIR@;@QUICHE_INCLUDE_DIR@;%(AdditionalIncludeDirectories) + + + ws2_32.lib;crypt32.lib;userenv.lib;@BORINGSSL_LIB_DIR@\@SSL_LIB@;@BORINGSSL_LIB_DIR@\@CRYPTO_LIB@;@QUICHE_LIB_DIR@\@QUICHE_LIB@;%(AdditionalDependencies) + + + \ No newline at end of file