From bfc12d1e11fc74b17766bf77637942b77fb181eb Mon Sep 17 00:00:00 2001 From: Karthik Kumar Viswanathan Date: Sat, 10 Jun 2023 17:45:29 -0700 Subject: [PATCH] ggwave : Windows Fixes. --- CMakeLists.txt | 2 +- cmake/sdl2/FindSDL2.cmake | 2 +- examples/ggwave-common.cpp | 2 ++ examples/third-party/ggsock | 2 +- tests/test-ggwave.c | 4 +++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index beddcd8..28cd09f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/sdl2/FindSDL2.cmake b/cmake/sdl2/FindSDL2.cmake index 7250e21..6179843 100644 --- a/cmake/sdl2/FindSDL2.cmake +++ b/cmake/sdl2/FindSDL2.cmake @@ -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) diff --git a/examples/ggwave-common.cpp b/examples/ggwave-common.cpp index f28240d..719fa82 100644 --- a/examples/ggwave-common.cpp +++ b/examples/ggwave-common.cpp @@ -1,7 +1,9 @@ #include "ggwave-common.h" +#if !defined(_WIN32) #include #include +#endif #include #include diff --git a/examples/third-party/ggsock b/examples/third-party/ggsock index 8f024e4..25ea970 160000 --- a/examples/third-party/ggsock +++ b/examples/third-party/ggsock @@ -1 +1 @@ -Subproject commit 8f024e4aa5dbb62d1811412f7a07c7544c39bffd +Subproject commit 25ea97004a2f6e8a416dfe99ed3de266787a50d5 diff --git a/tests/test-ggwave.c b/tests/test-ggwave.c index 7b947ba..8810e0a 100644 --- a/tests/test-ggwave.c +++ b/tests/test-ggwave.c @@ -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); @@ -71,6 +72,7 @@ int main() { CHECK(strcmp(decoded, payload) == 0); ggwave_free(instance); + free(waveform); return 0; }