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
run: |
cmake -B build -DBLAH_PLATFORM_WIN32=OFF -DBLAH_PLATFORM_SDL2=ON
cmake -B build
- name: Build project binary
run: |
cmake --build build --config Release

View File

@ -25,8 +25,7 @@ add_library(blah
src/blah_audio.cpp
src/internal/blah_renderer_opengl.cpp
src/internal/blah_renderer_d3d11.cpp
src/internal/blah_platform_sdl2.cpp
src/internal/blah_platform_win32.cpp
src/internal/blah_platform.cpp
)
target_include_directories(blah
@ -37,8 +36,6 @@ target_include_directories(blah
)
# 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)
if (WIN32)
option(BLAH_RENDERER_D3D11 "Make D3D11 Renderer available" ON)
@ -61,44 +58,32 @@ if (BLAH_RENDERER_D3D11)
set(LIBS ${LIBS} d3d11.lib dxguid.lib D3Dcompiler.lib)
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
if (EMSCRIPTEN)
# Emscripten can import SDL2 directly
if (EMSCRIPTEN)
set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
target_link_libraries(blah "-s USE_SDL=2 -s USE_WEBGL2=1")
set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
target_link_libraries(blah "-s USE_SDL=2 -s USE_WEBGL2=1")
# Pull SDL2 from its Github repo
else()
if (NOT DEFINED BLAH_SDL2_LIBS)
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
# Pull SDL2 from its Github repo
else()
if (NOT DEFINED BLAH_SDL2_LIBS)
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL
GIT_TAG release-2.26.0 # grab latest stable release
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(SDL2)
set(BLAH_SDL2_LIBS SDL2main SDL2-static)
set(BLAH_SDL2_INCLUDE ${sdl2_SOURCE_DIRS}/include)
endif()
# statically link SDL2 since we're building it ourselves
set(LIBS ${LIBS} ${BLAH_SDL2_LIBS})
target_include_directories(blah PRIVATE ${BLAH_SDL2_INCLUDE})
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL
GIT_TAG release-2.26.0 # grab latest stable release
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(SDL2)
set(BLAH_SDL2_LIBS SDL2main SDL2-static)
set(BLAH_SDL2_INCLUDE ${sdl2_SOURCE_DIRS}/include)
endif()
# use the Win32 Platform Backend
elseif (BLAH_PLATFORM_WIN32)
add_compile_definitions(BLAH_PLATFORM_WIN32)
# statically link SDL2 since we're building it ourselves
set(LIBS ${LIBS} ${BLAH_SDL2_LIBS})
target_include_directories(blah PRIVATE ${BLAH_SDL2_INCLUDE})
endif()
target_link_libraries(blah PRIVATE ${LIBS})

View File

@ -39,10 +39,6 @@ int main()
#### building
- 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:
- [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`

View File

@ -5,9 +5,7 @@
#define STB_VORBIS_HEADER_ONLY
#include "third_party/stb_vorbis.c"
#ifdef BLAH_PLATFORM_SDL2
#define CUTE_SOUND_FORCE_SDL
#endif
#define CUTE_SOUND_IMPLEMENTATION
#define CUTE_SOUND_SCALAR_MODE

View File

@ -1,5 +1,3 @@
#ifdef BLAH_PLATFORM_SDL2
#include "blah_platform.h"
#include "blah_renderer.h"
#include "blah_internal.h"
@ -618,5 +616,3 @@ void Platform::open_url(const char* url)
{
SDL_OpenURL(url);
}
#endif // BLAH_PLATFORM_SDL2

File diff suppressed because it is too large Load Diff