From fe940d20611dea8c92aad3496c30c3a7c0b476d6 Mon Sep 17 00:00:00 2001 From: Neo <321592+Neo-Desktop@users.noreply.github.com> Date: Sun, 9 Jul 2023 05:21:26 -0700 Subject: [PATCH] setup automated win32+dos builds --- .github/workflows/dos-djgpp.yml | 20 +++---- .github/workflows/windows.yml | 97 ++++++++++++++++----------------- CMakeLists.txt | 10 +++- 3 files changed, 65 insertions(+), 62 deletions(-) diff --git a/.github/workflows/dos-djgpp.yml b/.github/workflows/dos-djgpp.yml index 0f6c338..91ed9dc 100644 --- a/.github/workflows/dos-djgpp.yml +++ b/.github/workflows/dos-djgpp.yml @@ -20,7 +20,8 @@ name: C/C++ CI (DOS DJGPP) -on: workflow_dispatch +on: + workflow_call: env: CMAKE_C_COMPILER: ${{ github.workspace }}/djgpp/bin/i586-pc-msdosdjgpp-gcc @@ -43,6 +44,7 @@ jobs: - name: Download and Setup DJGPP Toolchain run: | + pushd ${{ github.workspace }} wget https://github.com/andrewwutw/build-djgpp/releases/download/v3.4/djgpp-linux64-gcc1220.tar.bz2 tar xjf djgpp-linux64-gcc1220.tar.bz2 cd ${{ github.workspace }}/djgpp @@ -50,16 +52,15 @@ jobs: cd watt32/util make clean && make linux cd ../src - source ${{ github.workspace }}/djgpp/setenv.sh + source ${{ github.workspace }}/djgpp/setenv ./configur.sh djgpp make -f djgpp.mak ln -s ${{ github.workspace }}/djgpp/watt32/lib/libwatt.a ${{ github.workspace }}/djgpp/lib - - name: Checkout and Cross Compile OpenSSL 3.1 + - name: Checkout and Cross Compile OpenSSL 3.1.2 run: | git clone https://github.com/UMSKT/openssl.git openssl pushd openssl - git checkout openssl-3.1.1 source ${{ github.workspace }}/djgpp/setenv ./Configure no-threads -DOPENSSL_DEV_NO_ATOMICS --prefix=${{ github.workspace }}/djgpp DJGPP make && make install @@ -71,19 +72,18 @@ jobs: - name: Build uses: threeal/cmake-action@v1.2.0 with: - c-compiler: ${{ github.workspace }}/djgpp/i586-pc-msdosdjgpp/bin/gcc - cxx-compiler: ${{ github.workspace }}/djgpp/i586-pc-msdosdjgpp/bin/g++ - options: OPENSSL_ROOT_DIR:string=${{ github.workspace }}/djgpp DJGPP_WATT32=ON + c-compiler: ${CMAKE_C_COMPILER} + cxx-compiler: ${CMAKE_CXX_COMPILER} + options: DJGPP_WATT32=ON CMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM} CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY} CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE} CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE} WATT_ROOT=${WATT_ROOT} run-build: true - name: Move executable to upload directory run: | mkdir build/actions_upload - tar -czf WindowsXPKg_linux_x86_64.tar.gz -C build xpkey keys.json - mv WindowsXPKg_linux_x86_64.tgz build/actions_upload/ + mv build/umskt.exe build/actions_upload/ - name: Upload build artifact uses: actions/upload-artifact@v3.1.2 with: - name: Build + name: UMSKT-DOS path: build/actions_upload diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2a317fb..383be80 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -27,23 +27,34 @@ on: branches: [ "master" ] jobs: - build-32bit: + build: runs-on: windows-latest + strategy: + matrix: + include: + - arch: Win32 + OpenSSL-File: Win32OpenSSL-3_1_1.exe + msbuild-arch: Win32 + cmake-args: -D MSVC_MSDOS_STUB=umskt.exe + - arch: Win64 + OpenSSL-File: Win64OpenSSL-3_1_1.exe + msbuild-arch: x64 + cmake-args: "" steps: - - name: Install v141_xp + - name: Install Windows XP Support for Visual Studio uses: thepwrtank18/install-vs-components@v1.0.0 with: components: Microsoft.VisualStudio.Component.WinXP - - name: Download And Install 32-bit OpenSSL 3.1.1 + - name: Download And Install ${{ matrix.OpenSSL-File }} run: | $installDir = "$Env:ProgramFiles\OpenSSL" - $installerURL = "https://slproweb.com/download/Win32OpenSSL-3_1_1.exe" - $installerName = "Win32OpenSSL-3_1_1.exe" + $installerURL = "https://slproweb.com/download/${{ matrix.OpenSSL-File }}" + $installerName = "${{ matrix.OpenSSL-File }}" $installerPath = Join-Path -Path "${env:Temp}" -ChildPath "$installerName" (New-Object System.Net.WebClient).DownloadFile($installerURL, $installerPath) - + Remove-Item "$installDir" -Force -Recurse $installerArgs = '/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`"" Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru @@ -54,63 +65,49 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v1 + - name: Run DJGPP Compilation + if: ${{ matrix.arch }} == "Win32" + uses: ./.github/workflows/dos-djgpp.yaml + + - name: Download UMSKT-DJGPP compiled artifact + if: ${{ matrix.arch }} == "Win32" + uses: actions/download-artifact@v3 + with: + name: UMSKT-DOS + - name: Configure UMSKT uses: threeal/cmake-action@v1.2.0 with: working-directory: build generator: "Visual Studio 17 2022" options: CMAKE_SYSTEM_VERSION="5.1.2600" - args: -A "Win32" -T v141_xp + args: -A ${{ matrix.msbuild-arch }} -T v141_xp ${{ matrix.cmake-args }} - name: Build UMSKT working-directory: build run: msbuild ALL_BUILD.vcxproj /P:Configuration=Release /P:XPDeprecationWarning=false - - name: Upload build artifact - uses: actions/upload-artifact@v3.1.2 - with: - name: UMSKT-Win32 - path: build/Release - - build-64bit: - runs-on: windows-latest - steps: - - name: Install v141_xp - uses: thepwrtank18/install-vs-components@v1.0.0 - with: - components: Microsoft.VisualStudio.Component.WinXP - - - name: Download And Install 64-bit OpenSSL 3.1.1 + - name: Move executable to upload directory run: | - $installDir = "$Env:ProgramFiles\OpenSSL" - $installerURL = "https://slproweb.com/download/Win64OpenSSL-3_1_1.exe" - $installerName = "Win64OpenSSL-3_1_1.exe" - $installerPath = Join-Path -Path "${env:Temp}" -ChildPath "$installerName" - - (New-Object System.Net.WebClient).DownloadFile($installerURL, $installerPath) - - Remove-Item "$installDir" -Force -Recurse - $installerArgs = '/silent', '/sp-', '/suppressmsgboxes', "/DIR=`"$installDir`"" - Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru - - - name: Checkout Source Tree - uses: actions/checkout@v3 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1 - - - name: Configure UMSKT - uses: threeal/cmake-action@v1.2.0 - with: - generator: "Visual Studio 17 2022" - args: -A "x64" -T v141_xp - - - name: Build UMSKT - working-directory: build - run: msbuild ALL_BUILD.vcxproj /P:Configuration=Release /P:XPDeprecationWarning=false + mkdir build/actions_upload + Move-Item build/umskt.exe build/actions_upload - name: Upload build artifact uses: actions/upload-artifact@v3.1.2 with: - name: UMSKT-Win64 - path: build/Release + name: UMSKT-${{ matrix.arch }} + path: build/actions_upload + + - name: Move Win32+DOS executable to upload directory + if: ${{ matrix.arch }} == "Win32" + run: | + Remove-Item "build/actions_upload" -Force -Recurse + mkdir build/actions_upload + Move-Item build/umskt_win32_dos.exe build/actions_upload/umskt.exe + + - name: Upload build artifact + if: ${{ matrix.arch }} == "Win32" + uses: actions/upload-artifact@v3.1.2 + with: + name: UMSKT-Win32+DOS + path: build/actions_upload diff --git a/CMakeLists.txt b/CMakeLists.txt index 36fda23..09a9d5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,7 +141,7 @@ SET(LIBUMSKT_SRC src/libumskt/libumskt.cpp src/libumskt/pidgen3/BINK1998.cpp src IF (EMSCRIPTEN) ADD_EXECUTABLE(umskt ${LIBUMSKT_SRC}) TARGET_INCLUDE_DIRECTORIES(umskt PUBLIC ${OPENSSL_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(umskt -static OpenSSL::Crypto cryptopp::cryptopp fmt) + TARGET_LINK_LIBRARIES(umskt -static OpenSSL::Crypto fmt) SET(CMAKE_EXECUTABLE_SUFFIX ".html") SET_TARGET_PROPERTIES(umskt PROPERTIES COMPILE_FLAGS "-Os -sEXPORTED_RUNTIME_METHODS=ccall,cwrap") @@ -165,8 +165,14 @@ ELSE() TARGET_INCLUDE_DIRECTORIES(umskt PUBLIC ${OPENSSL_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(umskt _umskt OpenSSL::Crypto fmt nlohmann_json::nlohmann_json umskt::rc ${UMSKT_LINK_LIBS}) TARGET_LINK_DIRECTORIES(umskt PUBLIC ${UMSKT_LINK_DIRS}) + + ### UMSKT with specified DOS Stub compilation IF(MSVC AND MSVC_MSDOS_STUB) - SET_PROPERTY(TARGET umskt APPEND PROPERTY LINK_FLAGS /STUB:${MSVC_MSDOS_STUB}) + ADD_EXECUTABLE(umskt_win32_dos src/main.cpp src/cli.cpp ${UMSKT_EXE_WINDOWS_EXTRA}) + TARGET_INCLUDE_DIRECTORIES(umskt_win32_dos PUBLIC ${OPENSSL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(umskt_win32_dos _umskt OpenSSL::Crypto fmt nlohmann_json::nlohmann_json umskt::rc ${UMSKT_LINK_LIBS}) + TARGET_LINK_DIRECTORIES(umskt_win32_dos PUBLIC ${UMSKT_LINK_DIRS}) + SET_PROPERTY(TARGET umskt_win32_dos APPEND PROPERTY LINK_FLAGS /STUB:${MSVC_MSDOS_STUB}) ENDIF() ### Copy Shared Libraries and dependency files