removed win32 platform support

This commit is contained in:
Benji Trosch 2023-03-07 15:56:05 -05:00 committed by Benjamin Trosch
parent 9feb4b8512
commit 5d87875491
6 changed files with 642 additions and 1705 deletions

View File

@ -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

View File

@ -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,19 +58,14 @@ 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 # Emscripten can import SDL2 directly
# Link and create SDL2 Definition if (EMSCRIPTEN)
if (BLAH_PLATFORM_SDL2)
add_compile_definitions(BLAH_PLATFORM_SDL2)
# Emscripten can import SDL2 directly
if (EMSCRIPTEN)
set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2") set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
target_link_libraries(blah "-s USE_SDL=2 -s USE_WEBGL2=1") target_link_libraries(blah "-s USE_SDL=2 -s USE_WEBGL2=1")
# Pull SDL2 from its Github repo # Pull SDL2 from its Github repo
else() else()
if (NOT DEFINED BLAH_SDL2_LIBS) if (NOT DEFINED BLAH_SDL2_LIBS)
include(FetchContent) include(FetchContent)
set(FETCHCONTENT_QUIET FALSE) set(FETCHCONTENT_QUIET FALSE)
@ -92,13 +84,6 @@ if (BLAH_PLATFORM_SDL2)
# statically link SDL2 since we're building it ourselves # statically link SDL2 since we're building it ourselves
set(LIBS ${LIBS} ${BLAH_SDL2_LIBS}) set(LIBS ${LIBS} ${BLAH_SDL2_LIBS})
target_include_directories(blah PRIVATE ${BLAH_SDL2_INCLUDE}) target_include_directories(blah PRIVATE ${BLAH_SDL2_INCLUDE})
endif()
# use the Win32 Platform Backend
elseif (BLAH_PLATFORM_WIN32)
add_compile_definitions(BLAH_PLATFORM_WIN32)
endif() endif()
target_link_libraries(blah PRIVATE ${LIBS}) target_link_libraries(blah PRIVATE ${LIBS})

View File

@ -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`

View File

@ -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

View File

@ -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