diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7c069f76e..e4418953d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,14 +6,12 @@ on: branches: [master] paths-ignore: - "**.md" - - "*.txt" - ".gitignore" - "docs/*" pull_request: branches: [master] paths-ignore: - "**.md" - - "*.txt" - ".gitignore" - "docs/*" release: @@ -44,27 +42,29 @@ jobs: uses: microsoft/setup-msbuild@v1.1 - name: Create Build Environment - run: cmake -E make_directory ${{ runner.workspace }}/build + run: cmake -E make_directory ${{ github.workspace }}/build - name: Configure CMake shell: bash - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build run: | + OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=bin" if [ "${{ matrix.portable }}" == "Portable" ]; then - OPTIONS="-DCMAKE_BUILD_TYPE=${{ runner.build_type }} -DBuildPortableVersion=ON -DCMAKE_INSTALL_PREFIX=bin" + OPTIONS+=" -DBuildPortableVersion=ON" else - OPTIONS="-DCMAKE_BUILD_TYPE=${{ runner.build_type }} -DBuildPortableVersion=OFF -DCMAKE_INSTALL_PREFIX=bin" + OPTIONS+=" -DBuildPortableVersion=OFF" fi + OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" cmake $GITHUB_WORKSPACE -A ${{ matrix.platform }} $OPTIONS - name: Build - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash - run: cmake --build . --config ${{ matrix.build_type }} + run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS - name: Install if: ${{ matrix.build_type == 'Release' }} - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash run: cmake --install . --config ${{ matrix.build_type }} @@ -72,7 +72,14 @@ jobs: if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} - path: ${{ runner.workspace }}/build/bin + path: ${{ github.workspace }}/build/bin/JediAcademy + if-no-files-found: error + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: OpenJO-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} + path: ${{ github.workspace }}/build/bin/JediOutcast if-no-files-found: error msvcxp: @@ -110,36 +117,44 @@ jobs: uses: microsoft/setup-msbuild@v1.1 - name: Create Build Environment - run: cmake -E make_directory ${{ runner.workspace }}/build + run: cmake -E make_directory ${{ github.workspace }}/build - name: Configure CMake shell: bash - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build run: | + OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=bin" if [ "${{ matrix.portable }}" == "Portable" ]; then - OPTIONS="-DCMAKE_BUILD_TYPE=${{ runner.build_type }} -DBuildPortableVersion=ON -DCMAKE_INSTALL_PREFIX=bin" + OPTIONS+=" -DBuildPortableVersion=ON" else - OPTIONS="-DCMAKE_BUILD_TYPE=${{ runner.build_type }} -DBuildPortableVersion=OFF -DCMAKE_INSTALL_PREFIX=bin" + OPTIONS+=" -DBuildPortableVersion=OFF" fi + OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" cmake $GITHUB_WORKSPACE -T v141_xp -A ${{ matrix.platform }} $OPTIONS - name: Build - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash - run: cmake --build . --config ${{ matrix.build_type }} + run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS - name: Install if: ${{ matrix.build_type == 'Release' }} - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash - run: | - cmake --install . --config ${{ matrix.build_type }} + run: cmake --install . --config ${{ matrix.build_type }} - uses: actions/upload-artifact@v3 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-windowsxp-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} - path: ${{ runner.workspace }}/build/bin + path: ${{ github.workspace }}/build/bin/JediAcademy + if-no-files-found: error + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: OpenJO-windowsxp-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} + path: ${{ github.workspace }}/build/bin/JediOutcast if-no-files-found: error ubuntu: @@ -168,52 +183,59 @@ jobs: sudo apt-get -qq update sudo apt-get install libjpeg-dev libpng-dev zlib1g-dev libsdl2-dev fi - cmake -E make_directory ${{ runner.workspace }}/build + cmake -E make_directory ${{ github.workspace }}/build - name: Configure CMake shell: bash - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build run: | + OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install" if [ "${{ matrix.portable }}" == "Portable" ]; then - OPTIONS="-DUseInternalLibs=ON -DBuildPortableVersion=ON -DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/install" + OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON" else - OPTIONS="-DUseInternalLibs=OFF -DBuildPortableVersion=OFF -DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/install" + OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF" fi - if [ ${{ matrix.arch }} == "x86" ]; then - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $OPTIONS -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/linux-i686.cmake - else - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $OPTIONS + OPTIONS+=" -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/linux-i686.cmake" fi + OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" + cmake $GITHUB_WORKSPACE $OPTIONS - name: Build - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash - run: cmake --build . + run: cmake --build . -j $(nproc) - name: Install if: ${{ matrix.build_type == 'Release' }} - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash run: cmake --install . - - name: Create binary archive - if: ${{ matrix.build_type == 'Release'}} - working-directory: ${{ runner.workspace }}/install/JediAcademy + - name: Create OpenJK binary archive + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }}/install/JediAcademy shell: bash - run: | - if [ ${{ matrix.arch }} == "x86" ]; then - chmod +x openjk.i386 - else - chmod +x openjk.${{ matrix.arch }} - fi - tar -czvf OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + run: tar -czvf OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + + - name: Create OpenJO binary archive + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }}/install/JediOutcast + shell: bash + run: tar -czvf OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * - uses: actions/upload-artifact@v3 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} - path: ${{runner.workspace}}/install/JediAcademy/OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz + path: ${{github.workspace}}/install/JediAcademy/OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz + if-no-files-found: error + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} + path: ${{github.workspace}}/install/JediOutcast/OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz if-no-files-found: error macos: @@ -232,43 +254,60 @@ jobs: - name: Create Build Environment run: | brew install zlib libjpeg libpng sdl2 - cmake -E make_directory ${{ runner.workspace }}/build + cmake -E make_directory ${{ github.workspace }}/build - name: Configure CMake shell: bash - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build run: | + OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install" if [ "${{ matrix.portable }}" == "Portable" ]; then - OPTIONS="-DCMAKE_BUILD_TYPE=${{ runner.build_type }} -DUseInternalLibs=ON -DBuildPortableVersion=ON -DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/install" + OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON" else - OPTIONS="-DCMAKE_BUILD_TYPE=${{ runner.build_type }} -DUseInternalLibs=OFF -DBuildPortableVersion=OFF -DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/install" + OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF" fi + OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" cmake $GITHUB_WORKSPACE $OPTIONS - name: Build - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash - run: cmake --build . + run: cmake --build . -j $(getconf _NPROCESSORS_ONLN) - name: Install if: ${{ matrix.build_type == 'Release' }} - working-directory: ${{ runner.workspace }}/build + working-directory: ${{ github.workspace }}/build shell: bash run: cmake --install . - - name: Create binary archive + - name: Create OpenJK binary archive if: ${{ matrix.build_type == 'Release' }} - working-directory: ${{ runner.workspace }}/install/JediAcademy + working-directory: ${{ github.workspace }}/install/JediAcademy shell: bash run: | chmod +x openjk.x86_64.app/Contents/MacOS/openjk.x86_64 - tar -czvf openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + tar -czvf openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + + - name: Create OpenJO binary archive + if: ${{ matrix.build_type == 'Release' }} + working-directory: ${{ github.workspace }}/install/JediOutcast + shell: bash + run: | + chmod +x openjo_sp.x86_64.app/Contents/MacOS/openjo_sp.x86_64 + tar -czvf openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * - uses: actions/upload-artifact@v3 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} - path: ${{ runner.workspace }}/install/JediAcademy/openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz + path: ${{ github.workspace }}/install/JediAcademy/openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz + if-no-files-found: error + + - uses: actions/upload-artifact@v3 + if: ${{ matrix.build_type == 'Release' }} + with: + name: OpenJO-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} + path: ${{ github.workspace }}/install/JediOutcast/openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz if-no-files-found: error create-latest: @@ -285,11 +324,17 @@ jobs: - name: Create binary archives run: | - 7z a -r OpenJK-windows-x86.zip ./OpenJK-windows-x86-Release-Non-Portable/JediAcademy/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' - 7z a -r OpenJK-windows-x86_64.zip ./OpenJK-windows-x86_64-Release-Non-Portable/JediAcademy/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' - mv ./OpenJK-linux-x86-Release-Non-Portable/* OpenJK-linux-x86.tar.gz - mv ./OpenJK-linux-x86_64-Release-Non-Portable/* OpenJK-linux-x86_64.tar.gz - mv ./OpenJK-macos-x86_64-Release-Non-Portable/* OpenJK-macos-x86_64.tar.gz + 7z a -r OpenJK-windows-x86.zip ./OpenJK-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' + 7z a -r OpenJK-windows-x86_64.zip ./OpenJK-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' + mv ./OpenJK-linux-x86-Release-Non-Portable/* OpenJK-linux-x86.tar.gz + mv ./OpenJK-linux-x86_64-Release-Non-Portable/* OpenJK-linux-x86_64.tar.gz + mv ./OpenJK-macos-x86_64-Release-Non-Portable/* OpenJK-macos-x86_64.tar.gz + + 7z a -r OpenJO-windows-x86.zip ./OpenJO-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' + 7z a -r OpenJO-windows-x86_64.zip ./OpenJO-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' + mv ./OpenJO-linux-x86-Release-Non-Portable/* OpenJO-linux-x86.tar.gz + mv ./OpenJO-linux-x86_64-Release-Non-Portable/* OpenJO-linux-x86_64.tar.gz + mv ./OpenJO-macos-x86_64-Release-Non-Portable/* OpenJO-macos-x86_64.tar.gz - name: Create latest build uses: marvinpinto/action-automatic-releases@latest @@ -330,6 +375,26 @@ jobs: artifact_name: OpenJK-macos-x86_64.tar.gz zip: false + - artifact_dir: OpenJO-windows-x86-Release-Non-Portable/JediOutcast + artifact_name: OpenJO-windows-x86.zip + zip: true + + - artifact_dir: OpenJO-windows-x86_64-Release-Non-Portable/JediOutcast + artifact_name: OpenJO-windows-x86_64.zip + zip: true + + - artifact_dir: OpenJO-linux-x86-Release-Non-Portable + artifact_name: OpenJO-linux-x86.tar.gz + zip: false + + - artifact_dir: OpenJO-linux-x86_64-Release-Non-Portable + artifact_name: OpenJO-linux-x86_64.tar.gz + zip: false + + - artifact_dir: OpenJO-macos-x86_64-Release-Non-Portable + artifact_name: OpenJO-macos-x86_64.tar.gz + zip: false + steps: - uses: actions/checkout@v3 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index b0aeb6dce8..d32ed22ab8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,17 @@ #============================================================================ # Copyright (C) 2013 - 2018, OpenJK contributors -# +# # This file is part of the OpenJK source code. -# +# # OpenJK is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, see . #============================================================================ @@ -65,7 +65,7 @@ set(UseInternalPNGDefault OFF) set(UseInternalJPEGDefault OFF) set(UseInternalSDL2Default OFF) -if(WIN32) +if(UseInternalLibs OR WIN32) set(UseInternalOpenALDefault ON) set(UseInternalZlibDefault ON) set(UseInternalPNGDefault ON) @@ -248,7 +248,7 @@ elseif (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" M # enable somewhat modern C++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment") diff --git a/cmake/Modules/InstallConfig.cmake b/cmake/Modules/InstallConfig.cmake index a25f87f0f5..c8c493b61b 100644 --- a/cmake/Modules/InstallConfig.cmake +++ b/cmake/Modules/InstallConfig.cmake @@ -1,17 +1,17 @@ #============================================================================ # Copyright (C) 2015, OpenJK contributors -# +# # This file is part of the OpenJK source code. -# +# # OpenJK is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, see . #============================================================================ @@ -71,7 +71,7 @@ if(WIN32) set(CPACK_NSIS_PACKAGE_NAME "OpenJK") set(CPACK_NSIS_MUI_ICON "${SharedDir}/icons/icon.ico") set(CPACK_NSIS_MUI_UNIICON "${SharedDir}/icons/icon.ico") - set(CPACK_NSIS_URL_INFO_ABOUT "http://openjk.org") + set(CPACK_NSIS_URL_INFO_ABOUT "https://openjk.org") set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) include(InstallRequiredSystemLibraries) @@ -121,8 +121,8 @@ if(WIN32) endif() # Don't run this for now until we have JK2 SP working - if(FALSE AND BuildJK2SPEngine) - string(REPLACE "/" "\\\\" ICON "${SPDir}/win32/starwars.ico") + if(BuildJK2SPEngine) + string(REPLACE "/" "\\\\" ICON "${JK2SPDir}/win32/starwars.ico") set(CPACK_NSIS_CREATE_ICONS_EXTRA "${CPACK_NSIS_CREATE_ICONS_EXTRA} CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Jedi Outcast SP.lnk' \\\\ diff --git a/codeJK2/win32/starwars.ico b/codeJK2/win32/starwars.ico new file mode 100644 index 0000000000..c07f6c314e Binary files /dev/null and b/codeJK2/win32/starwars.ico differ