Skip to content

Commit 09bedf2

Browse files
authored
Merge pull request #95 from fjtrujy/addResourcesToArtifacts
Add resources to artifacts
2 parents a7b3bf5 + c3d239a commit 09bedf2

File tree

14 files changed

+125
-82
lines changed

14 files changed

+125
-82
lines changed

.github/workflows/compilation.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,13 @@ jobs:
3838
uses: actions/upload-artifact@v4
3939
with:
4040
name: gsKit-samples-${{ steps.slug.outputs.sha8 }}
41-
path: build/*.elf
41+
path: |
42+
build/**/*.elf
43+
build/**/*.bmp
44+
build/**/*.jpg
45+
build/**/*.png
46+
build/**/*.tiff
47+
build/**/*.raw
48+
build/**/*.fnt
49+
build/**/*.dat
50+
build/**/*.ppm

CMakeLists.txt

Lines changed: 96 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,41 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
334334
install(FILES ${GSKIT_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
335335
endif()
336336

337-
if(NOT SKIP_BUILD_EXAMPLES)
337+
# All available examples
338+
set(GSKIT_SAMPLE_DIRS
339+
alpha
340+
atlas
341+
basic
342+
bigtex
343+
coverflow
344+
clut
345+
clutcsm
346+
cube
347+
fb
348+
fhdbg
349+
font
350+
fontm
351+
modetest
352+
modetesthires
353+
pixelperfect
354+
texstream
355+
textures
356+
vsync
357+
)
358+
set(GSKIT_SPECIAL_EXAMPLES hires linuz-texture png-texture)
359+
set(GSKIT_ALL_EXAMPLES ${GSKIT_SAMPLE_DIRS} ${GSKIT_SPECIAL_EXAMPLES})
360+
361+
# Option to build specific examples (empty list = skip all, default = build all)
362+
set(BUILD_EXAMPLES "${GSKIT_ALL_EXAMPLES}" CACHE STRING "List of examples to build (e.g., -DBUILD_EXAMPLES='atlas;cube'). Empty list skips all examples.")
363+
364+
if(BUILD_EXAMPLES)
365+
# Validate requested examples
366+
foreach(example IN LISTS BUILD_EXAMPLES)
367+
if(NOT example IN_LIST GSKIT_ALL_EXAMPLES)
368+
message(FATAL_ERROR "Example '${example}' not found. Available examples: ${GSKIT_ALL_EXAMPLES}")
369+
endif()
370+
endforeach()
371+
338372
set(CMAKE_EXECUTABLE_SUFFIX .elf)
339373
set(GSKIT_SAMPLE_LIBS "")
340374
list(APPEND GSKIT_SAMPLE_LIBS gskit_toolkit gskit dmakit ${GSKIT_EXTERNAL_LIBS})
@@ -349,70 +383,70 @@ if(NOT SKIP_BUILD_EXAMPLES)
349383
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples/${targetname}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING REGEX "\\.(bmp|dat|fnt|jpg|png|ppm|raw|s|tiff)$")
350384
endmacro (add_executable_example)
351385

352-
set(GSKIT_SAMPLE_DIRS "")
353-
list(APPEND GSKIT_SAMPLE_DIRS
354-
alpha
355-
atlas
356-
basic
357-
bigtex
358-
coverflow
359-
clut
360-
clutcsm
361-
cube
362-
fb
363-
fhdbg
364-
font
365-
fontm
366-
modetest
367-
modetesthires
368-
pixelperfect
369-
texstream
370-
textures
371-
vsync
372-
)
373-
374-
foreach(arg IN ITEMS ${GSKIT_SAMPLE_DIRS})
375-
add_executable_example(${arg})
386+
# Build standard examples from the list
387+
foreach(example IN LISTS BUILD_EXAMPLES)
388+
if(example IN_LIST GSKIT_SAMPLE_DIRS)
389+
add_executable_example(${example})
390+
endif()
376391
endforeach()
377392

378-
target_link_libraries(cube
379-
draw
380-
math3d
381-
)
382-
set_property(TARGET modetest APPEND PROPERTY SOURCES examples/modetest/pad.c)
383-
target_link_libraries(modetest
384-
pad
385-
)
386-
set_property(TARGET modetesthires APPEND PROPERTY SOURCES examples/modetesthires/pad.c)
387-
target_link_libraries(modetesthires
388-
pad
389-
)
393+
# Additional configuration for specific examples
394+
if(TARGET cube)
395+
target_link_libraries(cube
396+
draw
397+
math3d
398+
)
399+
endif()
390400

391-
add_executable(hires
392-
examples/hires/main.c
393-
)
394-
target_link_libraries(hires
395-
${GSKIT_SAMPLE_LIBS}
396-
draw
397-
graph
398-
math3d
399-
packet
400-
dma
401-
)
401+
if(TARGET modetest)
402+
set_property(TARGET modetest APPEND PROPERTY SOURCES examples/modetest/pad.c)
403+
target_link_libraries(modetest
404+
pad
405+
)
406+
endif()
402407

403-
add_executable(linuz-texture
404-
examples/linuz-texture/sample.c
405-
examples/linuz-texture/testorig.s
406-
examples/linuz-texture/texture.c
407-
)
408-
target_link_libraries(linuz-texture
409-
${GSKIT_SAMPLE_LIBS}
410-
)
408+
if(TARGET modetesthires)
409+
set_property(TARGET modetesthires APPEND PROPERTY SOURCES examples/modetesthires/pad.c)
410+
target_link_libraries(modetesthires
411+
pad
412+
)
413+
endif()
411414

412-
add_executable(png-texture
413-
examples/png-texture/textures.c
414-
)
415-
target_link_libraries(png-texture
416-
${GSKIT_SAMPLE_LIBS}
417-
)
415+
# Special examples with custom source configurations
416+
if("hires" IN_LIST BUILD_EXAMPLES)
417+
add_executable(hires
418+
examples/hires/main.c
419+
)
420+
target_link_libraries(hires
421+
${GSKIT_SAMPLE_LIBS}
422+
draw
423+
graph
424+
math3d
425+
packet
426+
dma
427+
)
428+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples/hires/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING REGEX "\\.(bmp|dat|fnt|jpg|png|ppm|raw|s|tiff)$")
429+
endif()
430+
431+
if("linuz-texture" IN_LIST BUILD_EXAMPLES)
432+
add_executable(linuz-texture
433+
examples/linuz-texture/sample.c
434+
examples/linuz-texture/testorig.s
435+
examples/linuz-texture/texture.c
436+
)
437+
target_link_libraries(linuz-texture
438+
${GSKIT_SAMPLE_LIBS}
439+
)
440+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples/linuz-texture/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING REGEX "\\.(bmp|dat|fnt|jpg|png|ppm|raw|s|tiff)$")
441+
endif()
442+
443+
if("png-texture" IN_LIST BUILD_EXAMPLES)
444+
add_executable(png-texture
445+
examples/png-texture/textures.c
446+
)
447+
target_link_libraries(png-texture
448+
${GSKIT_SAMPLE_LIBS}
449+
)
450+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples/png-texture/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING REGEX "\\.(bmp|dat|fnt|jpg|png|ppm|raw|s|tiff)$")
451+
endif()
418452
endif()

examples/alpha/alpha.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
5757
gsKit_init_screen(gsGlobal);
5858
#ifdef HAVE_LIBTIFF
5959
Sprite.Delayed = 1;
60-
if(gsKit_texture_tiff(gsGlobal, &Sprite, "host:alpha.tiff") < 0)
60+
if(gsKit_texture_tiff(gsGlobal, &Sprite, "alpha.tiff") < 0)
6161
{
6262
printf("Loading Failed!\n");
6363
}

examples/bigtex/bigtex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ int main(int argc, char *argv[])
4747
bigtex.Filter = GS_FILTER_NEAREST;
4848
bigtex.Delayed = 1;
4949

50-
// gsKit_texture_raw(gsGlobal, &bigtex, "host:bigtex.raw");
51-
gsKit_texture_bmp(gsGlobal, &bigtex, "host:bigtex.bmp");
52-
// gsKit_texture_jpeg(gsGlobal, &bigtex, "host:bigtex.jpg");
50+
// gsKit_texture_raw(gsGlobal, &bigtex, "bigtex.raw");
51+
gsKit_texture_bmp(gsGlobal, &bigtex, "bigtex.bmp");
52+
// gsKit_texture_jpeg(gsGlobal, &bigtex, "bigtex.jpg");
5353

5454

5555
x = 0.0f;

examples/coverflow/coverflow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
116116
// Load textures
117117
for (i = 0; i < TEXTURE_COUNT; i++) {
118118
Tex[i].Delayed = 1;
119-
snprintf(filename, 80, "host:covers/game%d_%d_%d_08bit.bmp", i+1, 512, 512);
119+
snprintf(filename, 80, "covers/game%d_%d_%d_08bit.bmp", i+1, 512, 512);
120120
gsKit_texture_bmp(gsGlobal, &Tex[i], filename);
121121
Tex[i].Filter = GS_FILTER_LINEAR;
122122
}

examples/fb/fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
138138

139139
#ifdef USEBMP
140140
backtex.Delayed = 0;
141-
gsKit_texture_bmp(gsGlobal, &backtex, "host:bsdgirl.bmp");
141+
gsKit_texture_bmp(gsGlobal, &backtex, "bsdgirl.bmp");
142142
#endif
143143

144144
/* print out useless debug information */

examples/fhdbg/fhdbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
5757
// Load textures
5858
for (iTexId = 0; iTexId < TEXTURE_COUNT; iTexId++) {
5959
Tex[iTexId].Delayed = 1;
60-
snprintf(filename, 80, "host:images/fhdbg_0%d.jpg", iTexId + 1);
60+
snprintf(filename, 80, "images/fhdbg_0%d.jpg", iTexId + 1);
6161
gsKit_texture_jpeg(gsGlobal, &Tex[iTexId], filename);
6262
gsKit_hires_prepare_bg(gsGlobal, &Tex[iTexId]);
6363
}

examples/font/font.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ int main(int argc, char *argv[])
2323

2424
gsGlobal = gsKit_init_global();
2525

26-
gsFont = gsKit_init_font(GSKIT_FTYPE_BMP_DAT, "host:dejavu.bmp");
27-
// gsFont = gsKit_init_font(GSKIT_FTYPE_PNG_DAT, "host:dejavu.png");
26+
gsFont = gsKit_init_font(GSKIT_FTYPE_BMP_DAT, "dejavu.bmp");
27+
// gsFont = gsKit_init_font(GSKIT_FTYPE_PNG_DAT, "dejavu.png");
2828

2929
dmaKit_init(D_CTRL_RELE_OFF,D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
3030
D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF);

examples/fontm/fontm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
7878
gsFontM->Spacing = 0.95f;
7979

8080
test.Delayed = 1;
81-
gsKit_texture_bmp(gsGlobal, &test, "host:test.bmp");
81+
gsKit_texture_bmp(gsGlobal, &test, "test.bmp");
8282
test.Filter = GS_FILTER_LINEAR;
8383

8484
gsKit_mode_switch(gsGlobal, GS_ONESHOT);

examples/hires/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ int render(GSGLOBAL *gsGlobal)
8989
#ifdef TEX_BG
9090
bigtex.Filter = GS_FILTER_LINEAR;
9191
bigtex.Delayed = 1;
92-
gsKit_texture_jpeg(gsGlobal, &bigtex, "host:bigtex.jpg");
92+
gsKit_texture_jpeg(gsGlobal, &bigtex, "bigtex.jpg");
9393
#endif
9494

9595
#ifdef FHD_BG
9696
fhdbg.Filter = GS_FILTER_LINEAR;
9797
fhdbg.Delayed = 1;
9898
fhdbg.Vram = GSKIT_ALLOC_ERROR;
99-
gsKit_texture_jpeg(gsGlobal, &fhdbg, "host:fhdbg.jpg");
99+
gsKit_texture_jpeg(gsGlobal, &fhdbg, "fhdbg.jpg");
100100
gsKit_hires_prepare_bg(gsGlobal, &fhdbg);
101101
gsKit_hires_set_bg(gsGlobal, &fhdbg);
102102
#endif

0 commit comments

Comments
 (0)