diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 080cf7a..871bf58 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -21,7 +21,7 @@ jobs: name: Build run: | chmod +x compile_linux.sh - ./compile_linux.sh amd64 + ./compile_linux.sh amd64 Release - name: Export artifacts uses: actions/upload-artifact@v2 @@ -45,7 +45,7 @@ jobs: name: Build run: | chmod +x compile_linux.sh - ./compile_linux.sh 386 + ./compile_linux.sh 386 Release - name: Export artifacts uses: actions/upload-artifact@v2 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 0000000..6709032 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,39 @@ +name: build-windows + +on: + push: + branches: + - 'master' + +jobs: + amd64: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v1 + - + name: Build + run: | + compile_windows.bat amd64 Release + - + name: Export artifacts + uses: actions/upload-artifact@v2 + with: + name: windows-amd64.tar.gz + path: out/binary_distrib.tar.gz + + + i386: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v1 + - + name: Build + run: | + compile_windows.bat 386 Release + - + name: Export artifacts + uses: actions/upload-artifact@v2 + with: + name: windows-i386.tar.gz + path: out/binary_distrib.tar.gz + diff --git a/DockerfileLinux b/DockerfileLinux index 0a97ac0..ff0025c 100644 --- a/DockerfileLinux +++ b/DockerfileLinux @@ -1,9 +1,9 @@ FROM friwidev/jcefdocker:linux-latest AS stage -#Specify a type to build: Debug or Release -ENV BUILD_TYPE Release +#Declare build type argument (Release or Debug) +ARG BUILD_TYPE -#Declare architecture argument +#Declare architecture argument (386 or amd64) ARG TARGETARCH WORKDIR /builder diff --git a/DockerfileWindows b/DockerfileWindows new file mode 100644 index 0000000..440123b --- /dev/null +++ b/DockerfileWindows @@ -0,0 +1,7 @@ +FROM friwidev/jcefdocker:windows-latest + +WORKDIR C:/builder + +#Copy and launch run script +COPY scripts/run_windows.bat . +ENTRYPOINT ["run_windows.bat"] diff --git a/compile_linux.sh b/compile_linux.sh index 9f61d27..3cd1e06 100755 --- a/compile_linux.sh +++ b/compile_linux.sh @@ -1,15 +1,14 @@ #!/bin/bash -if [ $# -eq 0 ] +if [ ! $# -eq 2 ] then - echo "Usage: ./compile_linux.sh [GYP_DEFINES]" + echo "Usage: ./compile_linux.sh " echo "" echo "architecture: the target architecture to build for. Architectures are the docker architectures (e.g. 386 or amd64)." - echo "GYP_DEFINES: When defined, performs a manual CEF build. Can be used to enable proprietary codec support. Wrap value with quotation marks." - echo " To enable proprietary codecs use: proprietary_codecs=1 ffmpeg_branding=Chrome" + echo "buildType: either Release or Debug" exit 1 fi #Execute buildx with linux dockerfile and output to current directory -docker buildx build --platform=linux/$1 --build-arg TARGETARCH=$1 --file DockerfileLinux --output out . +docker buildx build --platform=linux/$1 --build-arg TARGETARCH=$1 --build-arg BUILD_TYPE=$2 --file DockerfileLinux --output out . diff --git a/compile_windows.bat b/compile_windows.bat new file mode 100755 index 0000000..6593e4f --- /dev/null +++ b/compile_windows.bat @@ -0,0 +1,15 @@ +@echo off + +if ("%2"=="")( + echo "Usage: compile_windows.bat " + echo "" + echo "architecture: the target architecture to build for. Architectures are the docker architectures (e.g. 386 or amd64)." + echo "buildType: either Release or Debug" + exit 1 +) + +#Execute build with windows Dockerfile +docker build -t jcefbuild --file DockerfileWindows . + +#Execute run with windows Dockerfile +docker run -v jcef:c:/jcef -v out:c:/out -e TARGETARCH=%1 -e BUILD_TYPE=%2 jcefbuild diff --git a/scripts/run_windows.bat b/scripts/run_windows.bat index 0a30fb9..df9c7df 100644 --- a/scripts/run_windows.bat +++ b/scripts/run_windows.bat @@ -1,29 +1,33 @@ @echo off -if "%1"=="32" (echo "Building 32-bit version") ^ +if "%TARGETARCH%"=="386" (echo "Building 32-bit version") ^ else (echo "Building 64-bit version") #Check residency of workdir cd C: if exists jcef/README.md (echo "Found existing files to build") ^ -else (echo "Did not find files to build - cloning..." && git clone https://bitbucket.org/chromiumembedded/java-cef jcef) +else (echo "Did not find files to build - cloning..." && rmdir /S /Q jcef && git clone https://bitbucket.org/chromiumembedded/java-cef jcef) cd jcef #Prepare build dir -#rmdir /S /Q jcef_build mkdir jcef_build && cd jcef_build #Load vcvars -if "%1"=="32" ("C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat") ^ +if "%TARGETARCH%"=="386" ("C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat") ^ else ("C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat") #Perform build -cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% .. ninja #Compile java classes cd ../tools -if "%1"=="32" (compile.bat win32) else (compile.bat win64) +if "%TARGETARCH%"=="386" (compile.bat win32) else (compile.bat win64) #Create distribution -if "%1"=="32" (make_distrib.bat win32) else (make_distrib.bat win64) +if "%TARGETARCH%"=="386" (make_distrib.bat win32) else (make_distrib.bat win64) + +#Zip results to C:\out +if "%TARGETARCH%"=="386" (cd ../binary_distrib/win32) else (cd ../binary_distrib/win64) +del /F C:\out\binary_distrib.tar.gz +tar -czvf C:\out\binary_distrib.tar.gz *