Skip to content

Commit db5b386

Browse files
committed
Update: FTB now uses modern C++ where possible.
Now using latest VulkanWindow
1 parent da817be commit db5b386

19 files changed

Lines changed: 1441 additions & 825 deletions

.github/workflows/BuildAndRelease.yml

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,80 @@ on:
99
- 'CMakeLists.txt'
1010

1111
jobs:
12-
build:
13-
name: ${{ matrix.os }} Release
14-
runs-on: ${{ matrix.os }}
15-
16-
strategy:
17-
fail-fast: true
18-
19-
matrix:
20-
os: [ubuntu-latest, windows-latest]
12+
build-windows:
13+
runs-on: windows-latest
2114

2215
steps:
23-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
2417
with:
2518
submodules: recursive
26-
27-
- if: ${{matrix.os == 'ubuntu-latest'}}
28-
name: Update packages
29-
uses: awalsh128/cache-apt-pkgs-action@latest
30-
with:
31-
packages: libglfw3-dev gcc-multilib g++-multilib libvulkan-dev libxkbcommon-dev libxinerama-dev libxcursor-dev libxi-dev
32-
version: 1.0
3319

34-
- if: ${{matrix.os == 'windows-latest'}}
35-
name: Install Vulkan SDK
20+
- name: Install Vulkan SDK
3621
run: |
37-
curl -O https://sdk.lunarg.com/sdk/download/latest/windows/vulkan_sdk.exe
22+
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan_sdk.exe" -OutFile .\vulkan_sdk.exe
3823
.\vulkan_sdk.exe --accept-licenses --default-answer --confirm-command install
3924
40-
- if: ${{matrix.os == 'ubuntu-latest'}}
41-
name: Configure for linux
42-
run: >
43-
cmake -B build
44-
-DCMAKE_BUILD_TYPE=Release
45-
-DCMAKE_CXX_COMPILER=g++
46-
-DCMAKE_C_COMPILER=gcc
47-
48-
- if: ${{matrix.os == 'windows-latest'}}
49-
name: Configure for windows
25+
- name: Configure for windows
5026
run: |
51-
curl -o .\windows.json https://vulkan.lunarg.com/sdk/latest/windows.json
27+
Invoke-WebRequest https://vulkan.lunarg.com/sdk/latest/windows.json -OutFile windows.json
5228
$env:VULKAN_VERSION = (Get-Content windows.json | ConvertFrom-Json).windows
5329
$env:VULKAN_SDK = "C:\VulkanSDK\$env:VULKAN_VERSION"
5430
$env:VK_SDK_PATH = "C:\VulkanSDK\$env:VULKAN_VERSION"
5531
$env:Vulkan_LIBRARY = "C:\VulkanSDK\$env:VULKAN_VERSION\Lib\vulkan-1.lib"
5632
$env:Vulkan_INCLUDE_DIR = "C:\VulkanSDK\$env:VULKAN_VERSION\Include"
5733
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
5834
refreshenv
59-
cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
35+
cmake -B build -DCMAKE_BUILD_TYPE=Release
6036
6137
- name: Build release
6238
run: cmake --build build --config Release
6339

64-
- name: Upload Artifact
65-
uses: actions/upload-artifact@v4
40+
- name: Upload artifacts
41+
uses: actions/upload-artifact@v6
42+
with:
43+
name: windows-latest
44+
path: build/Release/FileToByte.exe
45+
46+
build-linux:
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/checkout@v6
6651
with:
67-
name: ${{ matrix.os }}
68-
path: build/**/FileToByte*
52+
submodules: recursive
53+
54+
- name: Update packages
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install -y gcc-multilib g++-multilib libglfw3-dev vulkan-tools libvulkan-dev libxkbcommon-dev libxinerama-dev libxcursor-dev libxi-dev
58+
59+
- name: Configure for linux
60+
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
61+
62+
- name: Build release
63+
run: cmake --build build --config Release
64+
65+
- name: Upload artifacts
66+
uses: actions/upload-artifact@v6
67+
with:
68+
name: ubuntu-latest
69+
path: build/FileToByte
6970

7071
release:
7172
name: Release
72-
runs-on: [ubuntu-latest]
73-
needs: [build]
73+
runs-on: ubuntu-latest
74+
needs: [build-windows, build-linux]
7475

7576
steps:
76-
- uses: actions/checkout@v4
77+
- uses: actions/checkout@v6
7778

7879
- name: Download Linux Artifact
79-
uses: actions/download-artifact@v4
80+
uses: actions/download-artifact@v7
8081
with:
8182
name: ubuntu-latest
8283

8384
- name: Download Windows Artifact
84-
uses: actions/download-artifact@v4
85+
uses: actions/download-artifact@v7
8586
with:
8687
name: windows-latest
8788

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ include_directories(imgui/ imgui/backends imgui/misc/cpp)
1414

1515
file(GLOB sources
1616
source/*.cpp
17-
source/*.hpp
18-
source/fonts/*.hpp
17+
source/*.h
18+
source/fonts/*.h
1919
imgui/imgui.cpp
2020
imgui/imgui.h
2121
imgui/imgui_draw.cpp
@@ -35,5 +35,6 @@ target_sources(FileToByte PRIVATE ${sources})
3535
target_link_libraries(FileToByte PRIVATE glfw Vulkan::Vulkan)
3636

3737
if(WIN32)
38+
set_source_files_properties(source/Main.cpp PROPERTIES COMPILE_DEFINITIONS main=WinMain)
3839
set_property(TARGET FileToByte PROPERTY WIN32_EXECUTABLE true)
3940
endif()

source/Application.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
#include "VulkanRenderer.h"
3+
#include "Window.h"
4+
5+
#include <memory>
6+
7+
class Application {
8+
public:
9+
Application();
10+
Application(int width, int height);
11+
12+
~Application();
13+
14+
void run();
15+
16+
private:
17+
std::unique_ptr<Window> window;
18+
std::unique_ptr<VulkanRenderer> renderer;
19+
20+
static constexpr int DEFAULT_WIDTH = 800;
21+
static constexpr int DEFAULT_HEIGHT = 600;
22+
};

0 commit comments

Comments
 (0)