mirror of
https://github.com/NoelFB/blah.git
synced 2024-11-25 16:18:57 +08:00
Merge pull request #36 from benjitrosch/remove-platform-abstraction
remove platform abstraction layer
This commit is contained in:
commit
176b11e08e
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -34,7 +34,7 @@ jobs:
|
||||||
|
|
||||||
- name: Create binary directory
|
- name: Create binary directory
|
||||||
run: |
|
run: |
|
||||||
cmake -B build -DBLAH_PLATFORM_WIN32=OFF -DBLAH_PLATFORM_SDL2=ON
|
cmake -B build
|
||||||
- name: Build project binary
|
- name: Build project binary
|
||||||
run: |
|
run: |
|
||||||
cmake --build build --config Release
|
cmake --build build --config Release
|
||||||
|
|
|
@ -25,8 +25,7 @@ add_library(blah
|
||||||
src/blah_audio.cpp
|
src/blah_audio.cpp
|
||||||
src/internal/blah_renderer_opengl.cpp
|
src/internal/blah_renderer_opengl.cpp
|
||||||
src/internal/blah_renderer_d3d11.cpp
|
src/internal/blah_renderer_d3d11.cpp
|
||||||
src/internal/blah_platform_sdl2.cpp
|
src/internal/blah_platform.cpp
|
||||||
src/internal/blah_platform_win32.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(blah
|
target_include_directories(blah
|
||||||
|
@ -37,8 +36,6 @@ target_include_directories(blah
|
||||||
)
|
)
|
||||||
|
|
||||||
# Platform Variables
|
# Platform Variables
|
||||||
option(BLAH_PLATFORM_SDL2 "Use SDL2 Platform Backend" ON)
|
|
||||||
option(BLAH_PLATFORM_WIN32 "Use Win32 Platform Backend" OFF)
|
|
||||||
option(BLAH_RENDERER_OPENGL "Make OpenGL Renderer available" ON)
|
option(BLAH_RENDERER_OPENGL "Make OpenGL Renderer available" ON)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
option(BLAH_RENDERER_D3D11 "Make D3D11 Renderer available" ON)
|
option(BLAH_RENDERER_D3D11 "Make D3D11 Renderer available" ON)
|
||||||
|
@ -61,11 +58,6 @@ if (BLAH_RENDERER_D3D11)
|
||||||
set(LIBS ${LIBS} d3d11.lib dxguid.lib D3Dcompiler.lib)
|
set(LIBS ${LIBS} d3d11.lib dxguid.lib D3Dcompiler.lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# use the SDL2 Platform Backend
|
|
||||||
# Link and create SDL2 Definition
|
|
||||||
if (BLAH_PLATFORM_SDL2)
|
|
||||||
add_compile_definitions(BLAH_PLATFORM_SDL2)
|
|
||||||
|
|
||||||
# Emscripten can import SDL2 directly
|
# Emscripten can import SDL2 directly
|
||||||
if (EMSCRIPTEN)
|
if (EMSCRIPTEN)
|
||||||
|
|
||||||
|
@ -94,13 +86,6 @@ if (BLAH_PLATFORM_SDL2)
|
||||||
target_include_directories(blah PRIVATE ${BLAH_SDL2_INCLUDE})
|
target_include_directories(blah PRIVATE ${BLAH_SDL2_INCLUDE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# use the Win32 Platform Backend
|
|
||||||
elseif (BLAH_PLATFORM_WIN32)
|
|
||||||
|
|
||||||
add_compile_definitions(BLAH_PLATFORM_WIN32)
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(blah PRIVATE ${LIBS})
|
target_link_libraries(blah PRIVATE ${LIBS})
|
||||||
|
|
||||||
# toggle options
|
# toggle options
|
||||||
|
|
|
@ -39,10 +39,6 @@ int main()
|
||||||
|
|
||||||
#### building
|
#### building
|
||||||
- Requires C++17 and CMake 3.14+
|
- Requires C++17 and CMake 3.14+
|
||||||
- A single **Platform** implementation must be enabled in CMake:
|
|
||||||
- [SDL2](https://github.com/NoelFB/blah/blob/master/src/internal/platform_sdl2.cpp) (Default) `BLAH_PLATFORM_SDL2`
|
|
||||||
- [WIN32](https://github.com/NoelFB/blah/blob/master/src/internal/platform_win32.cpp) (Unfinished) `BLAH_PLATFORM_WIN32`
|
|
||||||
- Additional platforms can be added by implementing the [Platform Backend](https://github.com/NoelFB/blah/blob/master/src/internal/platform.h)
|
|
||||||
- At least one **Renderer** implementation must be enabled in CMake:
|
- At least one **Renderer** implementation must be enabled in CMake:
|
||||||
- [OpenGL](https://github.com/NoelFB/blah/blob/master/src/internal/renderer_gl.cpp) (Default on Linux/macOS) `BLAH_RENDERER_OPENGL`
|
- [OpenGL](https://github.com/NoelFB/blah/blob/master/src/internal/renderer_gl.cpp) (Default on Linux/macOS) `BLAH_RENDERER_OPENGL`
|
||||||
- [D3D11](https://github.com/NoelFB/blah/blob/master/src/internal/renderer_d3d11.cpp) (Default on Windows) `BLAH_RENDERER_D3D11`
|
- [D3D11](https://github.com/NoelFB/blah/blob/master/src/internal/renderer_d3d11.cpp) (Default on Windows) `BLAH_RENDERER_D3D11`
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
#define STB_VORBIS_HEADER_ONLY
|
#define STB_VORBIS_HEADER_ONLY
|
||||||
#include "third_party/stb_vorbis.c"
|
#include "third_party/stb_vorbis.c"
|
||||||
|
|
||||||
#ifdef BLAH_PLATFORM_SDL2
|
|
||||||
#define CUTE_SOUND_FORCE_SDL
|
#define CUTE_SOUND_FORCE_SDL
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CUTE_SOUND_IMPLEMENTATION
|
#define CUTE_SOUND_IMPLEMENTATION
|
||||||
#define CUTE_SOUND_SCALAR_MODE
|
#define CUTE_SOUND_SCALAR_MODE
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#ifdef BLAH_PLATFORM_SDL2
|
|
||||||
|
|
||||||
#include "blah_platform.h"
|
#include "blah_platform.h"
|
||||||
#include "blah_renderer.h"
|
#include "blah_renderer.h"
|
||||||
#include "blah_internal.h"
|
#include "blah_internal.h"
|
||||||
|
@ -618,5 +616,3 @@ void Platform::open_url(const char* url)
|
||||||
{
|
{
|
||||||
SDL_OpenURL(url);
|
SDL_OpenURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLAH_PLATFORM_SDL2
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user