Skip to content

Commit

Permalink
ggwave : Windows Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
guilt committed Jul 21, 2023
1 parent 55a0e2b commit 571a102
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "examples/third-party/imgui/imgui"]
path = examples/third-party/imgui/imgui
url = https://github.com/ocornut/imgui
[submodule "examples/third-party/ggsock"]
path = examples/third-party/ggsock
url = https://github.com/ggerganov/ggsock
[submodule "bindings/ios"]
path = bindings/ios
url = https://github.com/ggerganov/ggwave-spm
[submodule "examples/third-party/ggsock"]
path = examples/third-party/ggsock
url = https://github.com/ggerganov/ggsock
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (EMSCRIPTEN)
option(GGWAVE_WASM_SINGLE_FILE "ggwave: embed WASM inside the generated ggwave.js" ON)
else()
set(GGWAVE_SUPPORT_SDL2_DEFAULT ON)
if (MINGW)
if (WIN32)
set(BUILD_SHARED_LIBS_DEFAULT OFF)
else()
set(BUILD_SHARED_LIBS_DEFAULT ON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/sdl2/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ endif()
set(SDL2_LIBRARIES ${SDL2_LIBRARY})
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARIES SDL2_INCLUDE_DIRS
VERSION_VAR SDL2_VERSION_STRING)

Expand Down
2 changes: 2 additions & 0 deletions examples/ggwave-common.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "ggwave-common.h"

#if !defined(_WIN32)
#include <dlfcn.h>
#include <unistd.h>
#endif

#include <cstring>
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion examples/third-party/ggsock
Submodule ggsock updated 1 files
+3 −3 src/communicator.cpp
2 changes: 1 addition & 1 deletion examples/third-party/imgui/imgui-extra/imgui_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
#endif

#include <SDL.h>
#include <SDL2/SDL.h>

#include <cstdio>

Expand Down
4 changes: 2 additions & 2 deletions examples/third-party/imgui/imgui-extra/imgui_impl_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
#include "imgui_impl_sdl.h"

// SDL
#include <SDL.h>
#include <SDL_syswm.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
#if defined(__APPLE__)
#include "TargetConditionals.h"
#endif
Expand Down
4 changes: 3 additions & 1 deletion tests/test-ggwave.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ int main() {
char decoded[16];

int n = ggwave_encode(instance, payload, 4, GGWAVE_PROTOCOL_AUDIBLE_FASTEST, 50, NULL, 1);
char waveform[n];
char *waveform = malloc(n);
CHECK(waveform != NULL);

int ne = ggwave_encode(instance, payload, 4, GGWAVE_PROTOCOL_AUDIBLE_FASTEST, 50, waveform, 0);
CHECK(ne > 0);
Expand Down Expand Up @@ -71,6 +72,7 @@ int main() {
CHECK(strcmp(decoded, payload) == 0);

ggwave_free(instance);
free(waveform);

return 0;
}

0 comments on commit 571a102

Please sign in to comment.