From 39c69bab5a6ce74f70190467a200a32cb54b1e78 Mon Sep 17 00:00:00 2001 From: Daid Date: Fri, 21 Oct 2022 15:43:14 +0200 Subject: [PATCH] Add option to build SeriousProton as shared library to save on linking time --- CMakeLists.txt | 7 ++++++- src/graphics/renderTarget.cpp | 5 +++++ src/graphics/renderTarget.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c37b9489..ddfd9539 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ endif() # User-settings option(WARNING_IS_ERROR "Enable warning as errors." OFF) +option(SHARED_SP "Build SeriousProton as a shared library, to speed up mingw linking times" OFF) set(STEAMSDK "" CACHE PATH "Path to steam SDK, if not supplied steam features will not be available. Steam features are NOT required.") # @@ -356,7 +357,11 @@ if(NOT ANDROID) endif() ## Object list -add_library(seriousproton_objects OBJECT ${source_files}) +if (SHARED_SP) + add_library(seriousproton_objects SHARED ${source_files}) +else() + add_library(seriousproton_objects OBJECT ${source_files}) +endif() target_compile_options(seriousproton_objects PRIVATE "$<$,$>:-Werror>" diff --git a/src/graphics/renderTarget.cpp b/src/graphics/renderTarget.cpp index f62464a4..80bfc32a 100644 --- a/src/graphics/renderTarget.cpp +++ b/src/graphics/renderTarget.cpp @@ -195,6 +195,11 @@ void RenderTarget::setDefaultFont(sp::Font* font) default_font = font; } +sp::Font* RenderTarget::getDefaultFont() +{ + return default_font; +} + void RenderTarget::drawSprite(std::string_view texture, glm::vec2 center, float size, glm::u8vec4 color) { auto info = getTextureInfo(texture); diff --git a/src/graphics/renderTarget.h b/src/graphics/renderTarget.h index f2f6ad03..57034e39 100644 --- a/src/graphics/renderTarget.h +++ b/src/graphics/renderTarget.h @@ -24,6 +24,7 @@ class RenderTarget : sp::NonCopyable friend class ::Window; public: static void setDefaultFont(sp::Font* font); + static sp::Font* getDefaultFont(); void drawSprite(std::string_view texture, glm::vec2 center, float size, glm::u8vec4 color={255,255,255,255}); void drawRotatedSprite(std::string_view texture, glm::vec2 center, float size, float rotation, glm::u8vec4 color={255,255,255,255});