Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
Bump recommended Ubuntu version to 24.04 to fix problem with D3DCompile
failing in Wine from standard repo in head-less environment in Ubuntu 22.04
  • Loading branch information
rafalh committed Sep 1, 2024
1 parent a85a651 commit 9c0c6d6
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 15 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ env:

jobs:
build-mingw:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

- name: Install packages
run: sudo apt-get install mingw-w64 ninja-build
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends g++-mingw-w64-i686-posix ninja-build wine32 wine
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CMake by default selects Win64 target platform. Please change it manually to Win
Linux
-----

Building on Ubuntu 22.04 based distribution is recommended.
Building on Ubuntu 24.04 based distribution is recommended.
Building on other Linux distributions should be possible but may require different/additional steps that are not
covered by this instruction.

Expand Down
2 changes: 1 addition & 1 deletion game_patch/graphics/d3d11/gr_d3d11_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ namespace df::gr::d3d11
v3d_ib_.clear();
}

BufferWrapper::BufferWrapper(unsigned initial_capacity, unsigned el_size, D3D11_BIND_FLAG bind_flag, ID3D11Device* device) :
BufferWrapper::BufferWrapper(unsigned initial_capacity, unsigned el_size, UINT bind_flag, ID3D11Device* device) :
bind_flag_(bind_flag), capacity_(initial_capacity), el_size_(el_size)
{
create_buffer(device);
Expand Down
4 changes: 2 additions & 2 deletions game_patch/graphics/d3d11/gr_d3d11_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace df::gr::d3d11
class BufferWrapper
{
public:
BufferWrapper(unsigned initial_capacity, unsigned el_size, D3D11_BIND_FLAG bind_flag, ID3D11Device* device);
BufferWrapper(unsigned initial_capacity, unsigned el_size, UINT bind_flag, ID3D11Device* device);
void write(void* data, unsigned n, RenderContext& render_context);
void reserve(unsigned n, RenderContext& render_context);

Expand All @@ -82,7 +82,7 @@ namespace df::gr::d3d11
private:
ComPtr<ID3D11Buffer> buffer_;
unsigned size_ = 0;
D3D11_BIND_FLAG bind_flag_;
UINT bind_flag_;
unsigned capacity_;
unsigned el_size_;

Expand Down
2 changes: 1 addition & 1 deletion game_patch/hud/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ ConsoleCommand2 bighud_cmd{
"bighud",
};

#ifdef DEBUG
#ifndef NDEBUG
ConsoleCommand2 hud_coords_cmd{
"d_hud_coords",
[](int idx, std::optional<int> x, std::optional<int> y) {
Expand Down
2 changes: 1 addition & 1 deletion launcher_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ target_include_directories(LauncherCommon
${CMAKE_CURRENT_SOURCE_DIR}/include/launcher_common
)

target_link_libraries(LauncherCommon Common Xlog sha1 ed25519 base64)
target_link_libraries(LauncherCommon windowscodecs Common Xlog sha1 ed25519 base64)
19 changes: 12 additions & 7 deletions resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ else()
endif()

function(add_packfile packfile_name)

list(TRANSFORM ARGN REPLACE "([^:]*):.*" "\\1" OUTPUT_VARIABLE input_deps)
list(TRANSFORM ARGN REPLACE "[^:]*:(.*)" "\\1" OUTPUT_VARIABLE input_paths)

add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/${packfile_name}
COMMAND ${VPP_TOOL} -c ${CMAKE_BINARY_DIR}/bin/${packfile_name} ${ARGN}
DEPENDS ${ARGN}
COMMAND ${VPP_TOOL} -c ${CMAKE_BINARY_DIR}/bin/${packfile_name} ${input_paths}
DEPENDS ${input_deps}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(${packfile_name} ALL DEPENDS ${CMAKE_BINARY_DIR}/bin/${packfile_name})
endfunction()


add_packfile(dashfaction.vpp
maps_df.txt

Expand Down Expand Up @@ -83,11 +88,11 @@ add_packfile(dashfaction.vpp
meshes/coffeesmokedtbl2.v3m
meshes/coffeesmokedtblAlt.v3m

${CMAKE_BINARY_DIR}/shaders/standard_vs.bin
${CMAKE_BINARY_DIR}/shaders/character_vs.bin
${CMAKE_BINARY_DIR}/shaders/transformed_vs.bin
${CMAKE_BINARY_DIR}/shaders/standard_ps.bin
${CMAKE_BINARY_DIR}/shaders/ui_ps.bin
standard_vs:${CMAKE_BINARY_DIR}/shaders/standard_vs.bin
character_vs:${CMAKE_BINARY_DIR}/shaders/character_vs.bin
transformed_vs:${CMAKE_BINARY_DIR}/shaders/transformed_vs.bin
standard_ps:${CMAKE_BINARY_DIR}/shaders/standard_ps.bin
ui_ps:${CMAKE_BINARY_DIR}/shaders/ui_ps.bin
)

# Copy licensing-info.txt
Expand Down
1 change: 1 addition & 0 deletions resources/shaders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()

function(add_shader TARGET_NAME SRC_FILE TARGET_LEVEL)
set(SHADER_OUTPUT ${CMAKE_BINARY_DIR}/shaders/${TARGET_NAME}.bin)
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/shaders")
add_custom_command(
OUTPUT ${SHADER_OUTPUT}
COMMAND ${SHADER_COMPILER} -O3 -t ${TARGET_LEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} -o ${SHADER_OUTPUT}
Expand Down
4 changes: 4 additions & 0 deletions tools/shader_compiler/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ int main(int argc, char* argv[])
auto shader_size = shader_bytecode->GetBufferSize();
auto shader_data = shader_bytecode->GetBufferPointer();
std::fstream output_file{output_filename.c_str(), std::ios_base::out | std::ios_base::binary};
if (!output_file) {
printf("Failed to open output file: %s\n", output_filename.c_str());
return 1;
}
output_file.write(static_cast<char*>(shader_data), shader_size);
shader_bytecode->Release();
printf("Shader byte code size: %ld\n", shader_size);
Expand Down

0 comments on commit 9c0c6d6

Please sign in to comment.