ref: 38b0a0e8cd2cb0d1f3ba0154735c6847a7cbb0c0
parent: 4a5499b5b07394b13ea64343d39136cb12c3efb5
author: Tanguy Fautre <[email protected]>
date: Sat Feb 15 08:57:52 EST 2020
Fix problems related to running on Linux
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,8 +50,8 @@
endif()
find_package(ENet REQUIRED)
-find_path(SDL2_INCLUDE_DIR SDL2/SDL.h)
-find_package(SDL2 CONFIG REQUIRED)
+find_path(SDL2_INCLUDE_DIR SDL2/SDL.h NO_SYSTEM_ENVIRONMENT_PATH)
+find_package(SDL2 CONFIG REQUIRED)
find_package(SDL2-mixer CONFIG REQUIRED)
add_subdirectory(Engine)
--- a/Engine/src/sdl_util.h
+++ b/Engine/src/sdl_util.h
@@ -18,7 +18,7 @@
#define SDL_CHECK_NOT_NULL(val, message) __checkSdlNotNull ( (val), (message), __FILE__, __LINE__ )
-inline void __checkSdlSuccess(int result, char const* func, const char* file, int line)
+inline static void __checkSdlSuccess(int result, char const* func, const char* file, int line)
{
if (result != 0)
{
@@ -25,7 +25,7 @@
Error(EXIT_FAILURE,
"BUILDSDL: %s failed!\n"
"BUILDSDL: SDL_Error: %s.\n"
- "BUILDSDL: FILE: %s\n",
+ "BUILDSDL: FILE: %s\n"
"BUILDSDL: LINE: %d",
func,
SDL_GetError(),
@@ -34,7 +34,7 @@
}
}
-inline void __checkSdlNotNull(void* handle, char const* msg, const char* file, int line)
+inline static void __checkSdlNotNull(void* handle, char const* msg, const char* file, int line)
{
if (handle == NULL)
{
@@ -41,7 +41,7 @@
Error(EXIT_FAILURE,
"BUILDSDL: Failed to %s!\n"
"BUILDSDL: SDL_Error: %s.\n"
- "BUILDSDL: FILE: %s\n",
+ "BUILDSDL: FILE: %s\n"
"BUILDSDL: LINE: %d",
msg,
SDL_GetError(),
@@ -50,7 +50,7 @@
}
}
-inline void set_sdl_scancodes(uint32_t scancodes[], size_t size)
+inline static void set_sdl_scancodes(uint32_t scancodes[], size_t size)
{
assert(size == SDL_NUM_SCANCODES);
@@ -159,4 +159,4 @@
scancodes[SDL_SCANCODE_PAGEDOWN] = 0xE051;
scancodes[SDL_SCANCODE_INSERT] = 0xE052;
scancodes[SDL_SCANCODE_DELETE] = 0xE053;
-}
\ No newline at end of file
+}
--- a/Game/src/audiolib/dsl.c
+++ b/Game/src/audiolib/dsl.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -72,7 +73,6 @@
if (SDL_InitSubSystem(SDL_INIT_AUDIO|SDL_INIT_NOPARACHUTE) < 0) {
DSL_SetErrorCode(DSL_SDLInitFailure);
-
return DSL_Error;
}
@@ -167,6 +167,7 @@
if (chunksize % blah) chunksize += blah - (chunksize % blah);
if (Mix_OpenAudio(SampleRate, format, channels, chunksize) < 0) {
+ printf("SDL: failed to open audio: %s\n", SDL_GetError());
DSL_SetErrorCode(DSL_MixerInitFailure);
return DSL_Error;
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@
**Linux (GCC Makefile)** [![Linux CI Status](https://github.com/GPSnoopy/BelgianChocolateDuke3D/workflows/Linux%20CI/badge.svg)](https://github.com/GPSnoopy/BelgianChocolateDuke3D/actions?query=workflow%3A%22Linux+CI%22)
```
+> sudo apt-get install libasound2-dev libpulse-dev
> ./vcpkg_linux.sh
> ./build_linux.sh
```