Skip to content

Commit cd56397

Browse files
authored
Switch CI to CMake and fix build warnings (#176)
* Switch CI from Tundra to CMake - Use cmake for all platforms instead of tundra - Update to actions/checkout@v4 - Add GTK3 and OpenGL dev packages for Linux - Use latest runners for all platforms * Fix strict prototype warnings for macOS - Use (void) for functions with no parameters - Suppress unused variable warnings in stb files * Use correct BASS library for Windows x64 * Suppress maybe-uninitialized warning in stb * Fix remaining empty prototypes in Emgui.c * Fix unused variable and unchecked fgets warnings * Fix all empty function prototypes for C23 * Fix remaining forward declarations * Remove ci-fixes from CI branch triggers
1 parent 270b65e commit cd56397

28 files changed

+193
-173
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI
42

5-
# Controls when the action will run. Triggers the workflow on push or pull request
6-
# events but only for the master branch
73
on:
84
push:
9-
branches: [ master, dev ]
5+
branches: [ master ]
106
pull_request:
11-
branches: [ master, dev ]
7+
branches: [ master ]
128

13-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
149
jobs:
1510
build_linux:
1611
runs-on: ubuntu-latest
1712
steps:
18-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1914
with:
20-
submodules: 'true'
15+
submodules: true
2116

22-
- name: Install deps
23-
run: sudo apt-get install libsdl2-dev
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y libsdl2-dev libgtk-3-dev libgl1-mesa-dev
2421
25-
- name: Install Tundra
26-
run: git clone --recursive https://github.com/deplinenoise/tundra.git && cd tundra && make -j4 && sudo make install && cd ..
22+
- name: Configure
23+
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
2724

28-
- name: Build Code
29-
run: |
30-
tundra2 --verbose linux-gcc-release
25+
- name: Build
26+
run: cmake --build build --parallel
3127

32-
# Build macOS
33-
build_macOS:
34-
runs-on: macOS-latest
28+
build_macos:
29+
runs-on: macos-latest
3530
steps:
36-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3732
with:
38-
submodules: 'true'
39-
- name: Build Code
40-
run: |
41-
bin/macos/tundra2 --verbose macosx-clang-release
33+
submodules: true
34+
35+
- name: Configure
36+
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
37+
38+
- name: Build
39+
run: cmake --build build --parallel
4240

43-
# Build Windows
4441
build_windows:
45-
runs-on: windows-2019
42+
runs-on: windows-latest
4643
steps:
47-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v4
4845
with:
49-
submodules: 'true'
50-
- name: Build Code
51-
shell: cmd
52-
run: |
53-
bin\win32\tundra2.exe --verbose --unprotected win32-msvc-release
46+
submodules: true
47+
48+
- name: Configure
49+
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
50+
51+
- name: Build
52+
run: cmake --build build --config Release --parallel

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ if (APPLE)
7878
elseif (UNIX)
7979
set(RKT_PROJECT_LIBS ${RKT_PROJECT_LIBS} ${CMAKE_SOURCE_DIR}/external/bass/linux/libbass.so)
8080
elseif (MSVC)
81-
set(RKT_PROJECT_LIBS ${RKT_PROJECT_LIBS} ${CMAKE_SOURCE_DIR}/external/bass/win32/bass.lib)
81+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
82+
set(RKT_PROJECT_LIBS ${RKT_PROJECT_LIBS} ${CMAKE_SOURCE_DIR}/external/bass/win64/bass.lib)
83+
else()
84+
set(RKT_PROJECT_LIBS ${RKT_PROJECT_LIBS} ${CMAKE_SOURCE_DIR}/external/bass/win32/bass.lib)
85+
endif()
8286
endif ()
8387

8488
##############################################################################
@@ -92,11 +96,13 @@ target_include_directories(rkt_emgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/emgui/sr
9296
if (APPLE)
9397
target_compile_definitions(rkt_emgui PUBLIC -DEMGUI_MACOSX)
9498
target_compile_options(rkt_emgui PUBLIC -Werror -pedantic-errors -Wall -Wno-format-security)
99+
set_source_files_properties(emgui/src/External/stb_image.c PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
100+
set_source_files_properties(emgui/src/External/stb_typetype.c PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
95101
elseif (UNIX)
96102
target_compile_definitions(rkt_emgui PUBLIC -DEMGUI_UNIX)
97103
target_compile_options(rkt_emgui PUBLIC -Werror -pedantic-errors -Wall -Wno-format-security)
98104
set_source_files_properties(emgui/src/External/stb_image.c PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation -Wno-unused-but-set-variable")
99-
set_source_files_properties(emgui/src/External/stb_typetype.c PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)
105+
set_source_files_properties(emgui/src/External/stb_typetype.c PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable -Wno-maybe-uninitialized")
100106
elseif (MSVC)
101107
target_compile_definitions(rkt_emgui PUBLIC -DEMGUI_WINDOWS)
102108
set_target_properties(rkt_emgui PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")

basic_example/basic_example.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int rocket_init(const char* prefix) {
9898

9999
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
100100

101-
static int rocket_update() {
101+
static int rocket_update(void) {
102102
int row = 0;
103103

104104
if (audio_is_playing)
@@ -124,7 +124,7 @@ static const struct sync_track* s_tracks[sizeof_array(s_trackNames)];
124124

125125
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
126126

127-
int main() {
127+
int main(void) {
128128
int i;
129129

130130
if (!rocket_init("data/sync"))

emgui/include/emgui/Emgui.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,21 @@ static EMGUI_INLINE uint32_t Emgui_color32_getB(uint32_t color) {
8080
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8181
// Creation and state changes the application needs to call
8282

83-
bool Emgui_create();
84-
void Emgui_destroy();
83+
bool Emgui_create(void);
84+
void Emgui_destroy(void);
8585
void Emgui_setMousePos(int posX, int posY);
8686
void Emgui_setMouseLmb(int state);
8787

88-
void Emgui_begin();
89-
void Emgui_end();
88+
void Emgui_begin(void);
89+
void Emgui_end(void);
9090

9191
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9292

9393
void Emgui_beginVerticalPanelXY(int x, int y);
9494
void Emgui_beginHorizontalPanelXY(int x, int y);
9595

96-
void Emgui_beginVerticalPanel();
97-
void Emgui_beginHorizontalPanel();
96+
void Emgui_beginVerticalPanel(void);
97+
void Emgui_beginHorizontalPanel(void);
9898

9999
void Emgui_setLayer(int layer);
100100
void Emgui_setScissor(int x, int y, int w, int h);
@@ -103,7 +103,7 @@ void Emgui_setScissor(int x, int y, int w, int h);
103103
// Font functions
104104

105105
void Emgui_setFont(uint32_t fontId);
106-
void Emgui_setDefaultFont();
106+
void Emgui_setDefaultFont(void);
107107
bool Emgui_setFontByName(const char* ttfFontname);
108108

109109
int Emgui_loadFontTTF(const char* ttfFontname, float fontHeight);
@@ -143,8 +143,8 @@ bool Emgui_buttonCoordsImage(const char* text, int x, int y);
143143
bool Emgui_button(const char* text);
144144
bool Emgui_buttonImage(const char* filename);
145145

146-
void Emgui_setFirstControlFocus();
147-
bool Emgui_hasKeyboardFocus();
146+
void Emgui_setFirstControlFocus(void);
147+
bool Emgui_hasKeyboardFocus(void);
148148

149149
void Emgui_radioButtonImage(void* image0, int size0, void* image1, int size1, enum EmguiMemoryLocation location,
150150
uint32_t color, int x, int y, bool* stateIn);

emgui/include/emgui/GFXBackend.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
#include "Types.h"
55

6-
bool EMGFXBackend_create();
7-
bool EMGFXBackend_destroy();
6+
bool EMGFXBackend_create(void);
7+
bool EMGFXBackend_destroy(void);
88
void EMGFXBackend_updateViewPort(int width, int height);
9-
void EMGFXBackend_render();
9+
void EMGFXBackend_render(void);
1010

1111
uint64_t EMGFXBackend_createFontTexture(void* imageBuffer, int w, int h);
1212
uint64_t EMGFXBackend_createTexture(void* imageBuffer, int w, int h, int comp);

emgui/src/Emgui.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ uint64_t loadImage(int* width, int* height, void* image, int length, enum EmguiM
190190

191191
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
192192

193-
void createDefaultFont() {
193+
static void createDefaultFont(void) {
194194
struct LoadedFont* loadedFont = &g_loadedFonts[0];
195195
uint8_t* tempColorData;
196196
uint8_t* colorData = tempColorData = (uint8_t*)malloc(128 * 128);
@@ -219,7 +219,7 @@ void createDefaultFont() {
219219

220220
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
221221

222-
void createStipplePattern() {
222+
static void createStipplePattern(void) {
223223
static unsigned char pattern[32 * 34];
224224
static unsigned char tempData[32 * 34] = {0};
225225
int x, y, i, startX = 8, width = 16, t = 0;
@@ -340,7 +340,7 @@ uint32_t Emgui_getTextSize(const char* text) {
340340

341341
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
342342

343-
bool Emgui_create() {
343+
bool Emgui_create(void) {
344344
const uint32_t size = 10 * 1024 * 1024; /* FIXME: refactor LinearAllocator to be growable */
345345
LinearAllocator_create(&s_allocator, malloc(size), size);
346346
createDefaultFont();
@@ -351,7 +351,7 @@ bool Emgui_create() {
351351

352352
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
353353

354-
void Emgui_begin() {
354+
void Emgui_begin(void) {
355355
g_controlId = 1;
356356
g_controls[0].type = EMGUI_DRAWTYPE_NONE;
357357

@@ -390,7 +390,7 @@ static bool Emgui_regionHit(const EmguiControlInfo* control) {
390390

391391
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
392392

393-
void Emgui_reset() {
393+
void Emgui_reset(void) {
394394
g_emguiGuiState.mouse.x = -1;
395395
g_emguiGuiState.mouse.y = -1;
396396
}
@@ -743,7 +743,7 @@ void Emgui_setFont(uint32_t fontId) {
743743

744744
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
745745

746-
void Emgui_setDefaultFont() {
746+
void Emgui_setDefaultFont(void) {
747747
Emgui_setFont(0);
748748
}
749749

@@ -919,7 +919,7 @@ void Emgui_radioButtonImage(void* image0, int size0, void* image1, int size1, en
919919

920920
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
921921

922-
void Emgui_end() {
922+
void Emgui_end(void) {
923923
if (g_emguiGuiState.mouse.down == 0) {
924924
g_emguiGuiState.activeItem = 0;
925925
} else {
@@ -1056,20 +1056,20 @@ void Emgui_setMouseLmb(int state) {
10561056

10571057
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10581058

1059-
bool Emgui_hasKeyboardFocus() {
1059+
bool Emgui_hasKeyboardFocus(void) {
10601060
return g_emguiGuiState.kbdItem != -1;
10611061
}
10621062

10631063
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10641064

1065-
void Emgui_setFirstControlFocus() {
1065+
void Emgui_setFirstControlFocus(void) {
10661066
g_emguiGuiState.kbdItem = 1;
10671067
g_emguiGuiState.keyCode = 0;
10681068
}
10691069

10701070
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10711071

1072-
void Emgui_resetFocus() {
1072+
void Emgui_resetFocus(void) {
10731073
g_emguiGuiState.kbdItem = -1;
10741074
g_emguiGuiState.keyCode = 0;
10751075
}

emgui/src/Emgui.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,21 @@ static EMGUI_INLINE uint32_t Emgui_color32_getB(uint32_t color)
8686
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8787
// Creation and state changes the application needs to call
8888

89-
bool Emgui_create();
90-
void Emgui_destroy();
89+
bool Emgui_create(void);
90+
void Emgui_destroy(void);
9191
void Emgui_setMousePos(int posX, int posY);
9292
void Emgui_setMouseLmb(int state);
9393

94-
void Emgui_begin();
95-
void Emgui_end();
94+
void Emgui_begin(void);
95+
void Emgui_end(void);
9696

9797
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9898

9999
void Emgui_beginVerticalPanelXY(int x, int y);
100100
void Emgui_beginHorizontalPanelXY(int x, int y);
101101

102-
void Emgui_beginVerticalPanel();
103-
void Emgui_beginHorizontalPanel();
102+
void Emgui_beginVerticalPanel(void);
103+
void Emgui_beginHorizontalPanel(void);
104104

105105
void Emgui_setLayer(int layer);
106106
void Emgui_setScissor(int x, int y, int w, int h);
@@ -110,7 +110,7 @@ void Emgui_setStipple(int enabled);
110110
// Font functions
111111

112112
void Emgui_setFont(uint32_t fontId);
113-
void Emgui_setDefaultFont();
113+
void Emgui_setDefaultFont(void);
114114
bool Emgui_setFontByName(const char* ttfFontname);
115115

116116
int Emgui_loadFontTTF(const char* ttfFontname, float fontHeight);
@@ -149,8 +149,8 @@ bool Emgui_buttonCoordsImage(const char* text, int x, int y);
149149
bool Emgui_button(const char* text);
150150
bool Emgui_buttonImage(const char* filename);
151151

152-
void Emgui_setFirstControlFocus();
153-
bool Emgui_hasKeyboardFocus();
152+
void Emgui_setFirstControlFocus(void);
153+
bool Emgui_hasKeyboardFocus(void);
154154

155155
void Emgui_radioButtonImage(void* image0, int size0, void* image1, int size1, enum EmguiMemoryLocation location,
156156
uint32_t color, int x, int y, bool* stateIn);

emgui/src/GFXBackend.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
#include "Types.h"
55

6-
bool EMGFXBackend_create();
7-
bool EMGFXBackend_destroy();
6+
bool EMGFXBackend_create(void);
7+
bool EMGFXBackend_destroy(void);
88
void EMGFXBackend_updateViewPort(int width, int height);
9-
void EMGFXBackend_render();
9+
void EMGFXBackend_render(void);
1010

1111
uint64_t EMGFXBackend_createFontTexture(void* imageBuffer, int w, int h);
1212
uint64_t EMGFXBackend_createTexture(void* imageBuffer, int w, int h, int comp);

emgui/src/GFXBackends/OpenGLBackend.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static void setColor(uint32_t color)
4040

4141
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4242

43-
bool EMGFXBackend_create()
43+
bool EMGFXBackend_create(void)
4444
{
4545
// set the background colour
4646
glClearColor(0.0, 0.0, 0.0, 1.0);
@@ -52,7 +52,7 @@ bool EMGFXBackend_create()
5252

5353
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5454

55-
bool EMGFXBackend_destroy()
55+
bool EMGFXBackend_destroy(void)
5656
{
5757
return true;
5858
}
@@ -386,11 +386,11 @@ static void drawImage(struct DrawImageCommand* command)
386386
}
387387

388388
extern struct RenderData s_renderData;
389-
extern void swapBuffers();
389+
extern void swapBuffers(void);
390390

391391
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
392392

393-
void EMGFXBackend_render()
393+
void EMGFXBackend_render(void)
394394
{
395395
int i = 0, layerIter = 0;
396396

emgui/src/memory/LinearAllocator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void LinearAllocator_setScratchPad(void* data, uint32_t size)
4848

4949
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5050

51-
LinearAllocator* LinearAllocator_getScratchPad()
51+
LinearAllocator* LinearAllocator_getScratchPad(void)
5252
{
5353
return &g_scratchPad;
5454
}

0 commit comments

Comments
 (0)