Skip to content

Commit

Permalink
Add option to build SeriousProton as shared library to save on linkin…
Browse files Browse the repository at this point in the history
…g time
  • Loading branch information
daid committed Oct 21, 2022
1 parent 5ef69e1 commit 39c69ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

#
Expand Down Expand Up @@ -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
"$<$<AND:$<BOOL:${CMAKE_COMPILER_IS_GNUCC}>,$<BOOL:${WARNING_IS_ERROR}>>:-Werror>"
Expand Down
5 changes: 5 additions & 0 deletions src/graphics/renderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/graphics/renderTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down

0 comments on commit 39c69ba

Please sign in to comment.