Linux CI builds

This commit is contained in:
rjindael 2023-07-17 23:18:01 -07:00
parent be6751d46b
commit a88215a95b
No known key found for this signature in database
GPG Key ID: D069369C906CCF31
9 changed files with 89 additions and 7 deletions

View File

@ -2,6 +2,63 @@ name: Build
on: [ push ]
jobs:
linux:
strategy:
matrix:
configuration: [ Release, Debug ]
name: Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Clone repository
with:
submodules: recursive
- name: Install required packages
run: apt install -y
git
clang
cmake
ninja-build
libboost-dev
libogre-1.12-dev
libpugixml-dev
qt6-base-dev
- name: Generate Ninja build files
run: cmake -G Ninja -B build -D CI -D CMAKE_BUILD_TYPE=${{ matrix.configuration == 'Release' && 'MinSizeRel' || matrix.configuration }} .
- name: Build (Ninja)
run: ninja -C build
# ouch - unless and until we start using CMake's install command, these next few steps are a necessary evil
- name: Organize binaries
run: mkdir build/dist && find build -perm /a+x -exec mv {} build/dist \;
- name: Add OGRE plugins
run: cp -R build/plugins build/dist && cp Content/linux_plugins.cfg build/dist/plugins.cfg
- name: Add OGRE shaders
run: cp -R build/shaders build/dist
- name: Add resources
run: cp -R Content/RNR build/dist/content && cp LICENSE build/dist
- name: Set output variables
id: vars
run: |
echo "configuration=${{ matrix.configuration }}" | awk '{print tolower($0)}' >> $GITHUB_OUTPUT
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload
uses: actions/upload-artifact@v3
with:
name: rnr-${{ steps.vars.outputs.hash }}-linux_x64-${{ steps.vars.outputs.configuration }}
path: build/dist
windows:
strategy:
matrix:
@ -27,6 +84,8 @@ jobs:
with:
msystem: ${{ matrix.sys }}
install: >-
git
mingw-w64-${{ matrix.env }}-${{ matrix.sys == 'clang64' && 'clang' || 'gcc' }}
mingw-w64-${{ matrix.env }}-cmake
mingw-w64-${{ matrix.env }}-ninja
@ -36,14 +95,14 @@ jobs:
mingw-w64-${{ matrix.env }}-qt6
- name: Generate Ninja build files
run: cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration == 'Release' && 'MinSizeRel' || matrix.configuration }} .
run: cmake -G Ninja -B build -D CMAKE_BUILD_TYPE=${{ matrix.configuration == 'Release' && 'MinSizeRel' || matrix.configuration }} .
- name: Build (Ninja)
run: ninja -C build
# ouch - unless and until we start using CMake's install command, these next few steps are a necessary evil
- name: Organize binaries
run: mkdir build/dist && mv build/*.exe build/dist && cd build/dist && for x in *.exe; do mv $x "RNR.$x"; done
run: mkdir build/dist && mv build/*.exe build/dist
- name: Add Qt dependencies
run: windeployqt6 build/dist/*.exe
@ -55,7 +114,7 @@ jobs:
run: cp Content/win32_plugins.cfg build/dist/plugins.cfg && mkdir build/dist/plugins/ && cat build/dist/plugins.cfg | grep "Plugin=" | sed -e "s/Plugin=//" | xargs -I '{}' cp -v '/${{ matrix.sys }}/bin/{}.dll' build/dist/plugins/
- name: Add OGRE shaders
run: mkdir build/dist/ShaderCache && mkdir build/dist/shaders && cp -R /${{ matrix.sys }}/share/OGRE/Media/Main build/dist/shaders && cp -R /${{ matrix.sys }}/share/OGRE/Media/RTShaderLib build/dist/shaders
run: mkdir build/dist/shaders && cp -R /${{ matrix.sys }}/share/OGRE/Media/Main/* build/dist/shaders && cp -R /${{ matrix.sys }}/share/OGRE/Media/RTShaderLib/* build/dist/shaders
- name: Add resources
run: cp -R Content/RNR build/dist/content && cp LICENSE build/dist
@ -69,5 +128,5 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: rnr-win_x64-${{ steps.vars.outputs.configuration }}-${{ steps.vars.outputs.hash }}
name: rnr-${{ steps.vars.outputs.hash }}-win_x64-${{ steps.vars.outputs.configuration }}
path: build/dist

View File

@ -17,4 +17,10 @@ find_package(Boost REQUIRED)
find_package(OGRE REQUIRED COMPONENTS Bites CONFIG)
find_package(pugixml REQUIRED)
add_subdirectory(Projects)
add_subdirectory(Projects)
if(CI AND UNIX)
file(COPY ${OGRE_MEDIA_DIR}/Main/ DESTINATION ${CMAKE_BINARY_DIR}/shaders)
file(COPY ${OGRE_MEDIA_DIR}/RTShaderLib/ DESTINATION ${CMAKE_BINARY_DIR}/shaders)
file(COPY ${OGRE_PLUGIN_DIR}/ DESTINATION ${CMAKE_BINARY_DIR}/plugins)
endif()

View File

@ -1,4 +1,4 @@
PluginFolder=/usr/lib/OGRE
PluginFolder=plugins
Plugin=RenderSystem_GL
Plugin=RenderSystem_GL3Plus

View File

@ -6,6 +6,7 @@ add_subdirectory(${DEPENDENCIES_DIR}/Luau ${CMAKE_BINARY_DIR}/Dependencies/Luau)
# RNR
add_link_options(-static)
link_libraries(-static-libgcc -static-libstdc++)
add_subdirectory(Engine)
add_subdirectory(Client)

View File

@ -22,6 +22,8 @@ target_include_directories(Player PRIVATE Header)
target_link_libraries(Player PRIVATE Common Engine)
set_target_properties(Player PROPERTIES
OUTPUT_NAME "RNR.Player"
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <filesystem>
#include <QApplication>
@ -6,6 +7,10 @@
int main(int argc, char** argv)
{
if (!fs::is_directory("ShaderCache") || !fs::exists("ShaderCache"))
fs::create_directory("ShaderCache");
}
QApplication app(argc, argv);
MainWindow window = MainWindow();

View File

@ -10,4 +10,6 @@ endif()
add_executable(Server ${SOURCE} ${HEADER})
target_include_directories(Server PRIVATE Header)
target_link_libraries(Server PRIVATE Engine)
target_link_libraries(Server PRIVATE Engine)
set_target_properties(Server PROPERTIES OUTPUT_NAME "RNR.Server")

View File

@ -24,6 +24,8 @@ target_include_directories(Studio PRIVATE Header)
target_link_libraries(Studio PRIVATE Common Engine)
set_target_properties(Studio PROPERTIES
OUTPUT_NAME "RNR.Studio"
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <filesystem>
#include <QApplication>
#include <QSurfaceFormat>
@ -9,6 +10,10 @@
int main(int argc, char** argv)
{
if (!fs::is_directory("ShaderCache") || !fs::exists("ShaderCache"))
fs::create_directory("ShaderCache");
}
QSurfaceFormat format;
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);