Skip to content

Commit 6d57faa

Browse files
committed
action fixes
1 parent 6d2521d commit 6d57faa

7 files changed

Lines changed: 141 additions & 32 deletions

File tree

.github/workflows/cmake-multi-platform.yml

Lines changed: 121 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ jobs:
3030
- os: windows-latest
3131
c_compiler: cl
3232
cpp_compiler: cl
33+
generator: "Visual Studio 17 2022"
3334
- os: ubuntu-latest
3435
c_compiler: clang
3536
cpp_compiler: clang++
37+
generator: "Unix Makefiles"
3638
- os: macos-latest
3739
c_compiler: clang
3840
cpp_compiler: clang++
41+
generator: "Ninja"
3942
exclude:
4043
- os: windows-latest
4144
c_compiler: clang
@@ -47,6 +50,16 @@ jobs:
4750
steps:
4851
- uses: actions/checkout@v4
4952

53+
- name: Install Linux build dependencies
54+
if: matrix.os == 'ubuntu-latest'
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install -y build-essential cmake make pkg-config
58+
sudo apt-get install -y libgl1-mesa-dev libx11-dev
59+
sudo apt-get install -y autoconf automake libtool gettext
60+
sudo apt-get install -y libsdl3-dev libsdl3-image-dev
61+
sudo apt-get install -y libcrypt-dev
62+
5063
- name: Set reusable strings
5164
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
5265
id: strings
@@ -58,53 +71,138 @@ jobs:
5871
- name: Setup vcpkg
5972
uses: lukka/run-vcpkg@v11
6073
with:
61-
# Optional: specify the vcpkg commit id to use, defaults to the latest one of the vcpkg repository.
62-
vcpkgCommitId: 'a0f95bc760ed5c8f6d553aaff7dde3a9c4f605a2'
6374
# Optional: specify the vcpkg arguments, e.g. to specify the triplet or use a custom vcpkg repository.
6475
vcpkgArguments: '@vcpkg.json'
65-
76+
- name: Submodule update
77+
run: git submodule update --init --recursive
78+
6679
- name: Configure CMake
6780
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
6881
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
6982
run: >
7083
cmake -B ${{ steps.strings.outputs.build-output-dir }}
84+
-G "${{ matrix.generator }}"
7185
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
7286
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
7387
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
7488
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
89+
-DVCPKG_TARGET_TRIPLET=${{ matrix.os == 'windows-latest' && 'x64-windows' || matrix.os == 'macos-latest' && 'x64-osx' || 'x64-linux' }}
7590
-S ${{ github.workspace }}
76-
7791
- name: Build
7892
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
7993
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
8094

81-
- name: Find built executables
82-
id: find-binaries
95+
- name: Find Windows binaries
96+
if: matrix.os == 'windows-latest'
97+
id: find-windows
98+
shell: pwsh
99+
run: |
100+
$buildDir = "${{ steps.strings.outputs.build-output-dir }}"
101+
Write-Host "Looking for binaries in: $buildDir"
102+
103+
if (Test-Path $buildDir) {
104+
# Find executables
105+
$exes = Get-ChildItem -Path $buildDir -Recurse -Filter "*.exe" -File
106+
# Find DLLs
107+
$dlls = Get-ChildItem -Path $buildDir -Recurse -Filter "*.dll" -File
108+
# Find static libraries
109+
$libs = Get-ChildItem -Path $buildDir -Recurse -Filter "*.lib" -File
110+
111+
$allBinaries = $exes + $dlls + $libs
112+
113+
if ($allBinaries) {
114+
foreach ($binary in $allBinaries) {
115+
Write-Host "Found binary: $($binary.FullName)"
116+
}
117+
# Set output for upload - include all binary types
118+
echo "artifact-path=$buildDir/**/*.exe,$buildDir/**/*.dll,$buildDir/**/*.lib" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
119+
echo "has-binaries=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
120+
} else {
121+
Write-Host "No binaries found"
122+
echo "artifact-path=" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
123+
echo "has-binaries=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
124+
}
125+
} else {
126+
Write-Host "Build directory not found: $buildDir"
127+
echo "artifact-path=" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
128+
echo "has-binaries=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
129+
}
130+
131+
- name: Find Unix binaries
132+
if: matrix.os != 'windows-latest'
133+
id: find-unix
83134
shell: bash
84135
run: |
85-
# Find all executable files in the build directory
86-
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
87-
# On Windows, look for .exe files
88-
find ${{ steps.strings.outputs.build-output-dir }} -name "*.exe" -type f | while read file; do
89-
echo "Found executable: $file"
90-
done
91-
# Prepare artifact path for Windows
92-
echo "artifact-path=${{ steps.strings.outputs.build-output-dir }}/**/*.exe" >> "$GITHUB_OUTPUT"
93-
else
94-
# On Linux/macOS, look for executable files without extension
95-
find ${{ steps.strings.outputs.build-output-dir }} -type f -executable | while read file; do
96-
# Exclude directories and non-binary files
97-
if [[ ! -d "$file" ]] && file "$file" | grep -q "ELF\|Mach-O"; then
136+
BUILD_DIR="${{ steps.strings.outputs.build-output-dir }}"
137+
echo "Looking for binaries in: $BUILD_DIR"
138+
139+
if [ -d "$BUILD_DIR" ]; then
140+
# Find executables
141+
echo "=== Executables ==="
142+
find "$BUILD_DIR" -type f -executable | while read file; do
143+
if [[ ! -d "$file" ]] && ( file "$file" 2>/dev/null | grep -q "ELF\|Mach-O" || [[ "$file" == *".so"* ]] ); then
98144
echo "Found executable: $file"
99145
fi
100146
done
101-
# Prepare artifact path for Unix-like systems
102-
echo "artifact-path=${{ steps.strings.outputs.build-output-dir }}/**/*" >> "$GITHUB_OUTPUT"
147+
148+
# Find shared libraries (.so, .dylib)
149+
echo "=== Shared Libraries ==="
150+
find "$BUILD_DIR" -type f \( -name "*.so" -o -name "*.so.*" -o -name "*.dylib" -o -name "*.dylib.*" \) | while read file; do
151+
if [[ ! -d "$file" ]]; then
152+
echo "Found shared library: $file"
153+
fi
154+
done
155+
156+
# Find static libraries (.a)
157+
echo "=== Static Libraries ==="
158+
find "$BUILD_DIR" -type f -name "*.a" | while read file; do
159+
if [[ ! -d "$file" ]]; then
160+
echo "Found static library: $file"
161+
fi
162+
done
163+
164+
# Set artifact path to include all binary types
165+
echo "artifact-path=$BUILD_DIR/**/*" >> "$GITHUB_OUTPUT"
166+
echo "has-binaries=true" >> "$GITHUB_OUTPUT"
167+
else
168+
echo "Build directory not found: $BUILD_DIR"
169+
echo "artifact-path=" >> "$GITHUB_OUTPUT"
170+
echo "has-binaries=false" >> "$GITHUB_OUTPUT"
103171
fi
104172
105173
- name: Upload build artifacts
174+
if: steps.find-windows.outputs.has-binaries == 'true' || steps.find-unix.outputs.has-binaries == 'true'
106175
uses: actions/upload-artifact@v4
107176
with:
108-
name: ${{ steps.strings.outputs.artifact-name }}
109-
path: ${{ steps.find-binaries.outputs.artifact-path }}
177+
name: ${{ steps.strings.outputs.artifact-name }}-binaries
178+
path: ${{ steps.find-windows.outputs.artifact-path || steps.find-unix.outputs.artifact-path }}
110179
retention-days: 7
180+
181+
- name: Upload complete build directory
182+
if: always()
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: ${{ steps.strings.outputs.artifact-name }}-build-dir
186+
path: ${{ steps.strings.outputs.build-output-dir }}
187+
retention-days: 3
188+
189+
- name: Debug build output
190+
if: failure()
191+
run: |
192+
echo "=== Debugging build output ==="
193+
echo "Workspace: ${{ github.workspace }}"
194+
echo "Build dir: ${{ steps.strings.outputs.build-output-dir }}"
195+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
196+
BUILD_DIR=$(echo "${{ steps.strings.outputs.build-output-dir }}" | sed 's/\\/\//g')
197+
else
198+
BUILD_DIR="${{ steps.strings.outputs.build-output-dir }}"
199+
fi
200+
echo "Checking if build directory exists: $BUILD_DIR"
201+
if [ -d "$BUILD_DIR" ]; then
202+
echo "Build directory exists. Contents:"
203+
find "$BUILD_DIR" -type f -name "*.exe" -o -name "*.dll" -o -type f -executable | head -20
204+
else
205+
echo "Build directory does not exist"
206+
echo "Workspace contents:"
207+
ls -la "${{ github.workspace }}" || echo "ls failed"
208+
fi

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "imgui"]
22
path = imgui
3-
url = https://github.com/ocornut/imgui.git
3+
url = https://github.com/Kade-github/imgui.git

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ include_directories(${CURL_INCLUDE_DIRS})
3232

3333
target_link_libraries(EncounterMaster PRIVATE
3434
SDL3::SDL3
35-
SDL3_image::SDL3_image-shared
35+
SDL3_image::SDL3_image
3636
CURL::libcurl
3737
nlohmann_json::nlohmann_json
3838
)

Creature.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dnd::Creature parse_creature(const json& j) {
1919
else if (size_str == "large")
2020
size = Size::LARGE;
2121
else if (size_str == "huge")
22-
size = Size::HUGE;
22+
size = Size::S_HUGE;
2323
else if (size_str == "gargantuan")
2424
size = Size::GARGANTUAN;
2525
else
@@ -278,11 +278,22 @@ dnd::Creature parse_creature(const json& j) {
278278
save.set_dc(dmg["save"].value("dc", 0));
279279
damage.set_save(save);
280280
} else if (dmg.contains("saveDC")) {
281-
Save& s = damage.get_save().value_or(Save());
281+
if (!damage.get_save().has_value()) {
282+
Save save;
283+
damage.set_save(save);
284+
}
285+
Save s = damage.get_save().value();
282286
s.set_save_dc(dmg.value("saveDC", 0));
287+
damage.set_save(s);
283288
} else if (dmg.contains("dc")) {
284-
Save& s = damage.get_save().value_or(Save());
289+
if (!damage.get_save().has_value())
290+
{
291+
Save save;
292+
damage.set_save(save);
293+
}
294+
Save s = damage.get_save().value();
285295
s.set_dc(dmg.value("dc", 0));
296+
damage.set_save(s);
286297
}
287298
damages.push_back(damage);
288299
}

Creature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class Modifiers {
343343
}
344344
};
345345

346-
enum class Size : int { GARGANTUAN = 0, HUGE = 1, LARGE = 2, MEDIUM = 3, SMALL = 4, TINY = 5 };
346+
enum class Size : int { GARGANTUAN = 0, S_HUGE = 1, LARGE = 2, MEDIUM = 3, SMALL = 4, TINY = 5 };
347347

348348
class Speed {
349349
public:
@@ -548,7 +548,7 @@ class CreatureElement {
548548
if (size.has_value()) {
549549
switch (size.value()) {
550550
case Size::GARGANTUAN: j["size"] = "gargantuan"; break;
551-
case Size::HUGE: j["size"] = "huge"; break;
551+
case Size::S_HUGE: j["size"] = "huge"; break;
552552
case Size::LARGE: j["size"] = "large"; break;
553553
case Size::MEDIUM: j["size"] = "medium"; break;
554554
case Size::SMALL: j["size"] = "small"; break;

CreatureEdit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void imageCallbacks(void* s)
143143
void checkImage(ToolState* state)
144144
{
145145
std::string url = state->current_creature.get_image_url().value_or("");
146-
if (url._Starts_with("http")) {
146+
if (url.find("http://") == 0 || url.find("https://") == 0) {
147147
std::filesystem::create_directories("images");
148148
// Check if the image is already downloaded
149149
if (std::filesystem::exists("images/" +

vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sdl3",
66
{
77
"name": "sdl3-image",
8-
"features": [ "png", "jpeg", "webp" ]
8+
"features": [ "png", "jpeg" ]
99
},
1010
"curl",
1111
"nlohmann-json"

0 commit comments

Comments
 (0)