From 683c226ce01009220a6f8f0daf4489ac004b1d41 Mon Sep 17 00:00:00 2001 From: tobid7 Date: Thu, 29 Jan 2026 20:17:04 +0100 Subject: [PATCH] Fix MSVC dll building --- CMakeLists.txt | 13 ++++++------- include/pd/drivers/hid.hpp | 3 ++- include/pd/lithium/drawlist.hpp | 2 +- include/pd/pd_p_api.hpp | 5 ++++- include/pd/ui7/layout.hpp | 3 ++- source/drivers/hid.cpp | 8 ++++---- source/lithium/drawlist.cpp | 2 ++ 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c785b8..4b03e41 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ if(${PD_BUILD_SHARED}) target_compile_definitions(palladium PRIVATE -DPD_BUILD_SHARED) else() add_library(palladium STATIC ${PD_SOURCES}) + target_compile_definitions(palladium PUBLIC -DPD_BUILD_STATIC) endif() target_include_directories(palladium PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -82,12 +83,10 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS") ) endif() -if(${CMAKE_BUILD_TYPE} STREQUAL "Release") - target_compile_options(palladium PRIVATE - $<$:-O0 -g> - $<$:-O3> - ) -endif() +target_compile_options(palladium PRIVATE + $<$:-O0 -g> + $<$:-O3> +) install(DIRECTORY include DESTINATION ".") install(TARGETS palladium) @@ -111,4 +110,4 @@ file(GLOB_RECURSE PD_FMTFILES CONFIGURE_DEPENDS add_custom_target(pd-clang-format COMMAND ${CLANG_FORMAT} --style=file -i ${PD_FMTFILES} COMMENT "Formatting Project Sources" -) \ No newline at end of file +) diff --git a/include/pd/drivers/hid.hpp b/include/pd/drivers/hid.hpp index 4a38e36..e7bdc92 100755 --- a/include/pd/drivers/hid.hpp +++ b/include/pd/drivers/hid.hpp @@ -83,7 +83,8 @@ constexpr static KbKey Kb_F11 = KbKey::Flag(47); constexpr static KbKey Kb_F12 = KbKey::Flag(48); constexpr static KbKey Kb_MouseLeft = KbKey::Flag(120); } // namespace HidKb -class HidDriver { + +class PD_API HidDriver { public: enum Flags : u32 { Flags_None = 0, diff --git a/include/pd/lithium/drawlist.hpp b/include/pd/lithium/drawlist.hpp index 5c8d6ad..4e9af96 100755 --- a/include/pd/lithium/drawlist.hpp +++ b/include/pd/lithium/drawlist.hpp @@ -91,7 +91,7 @@ class PD_API DrawList { void SetFontScale(float scale) { pFontScale = scale; } void DrawSolid(); - void DrawTexture(Texture::Ref tex) { CurrentTex = tex; } + void DrawTexture(Texture::Ref tex); // SECTION: Draw API // diff --git a/include/pd/pd_p_api.hpp b/include/pd/pd_p_api.hpp index 8d70b71..8a7c105 100755 --- a/include/pd/pd_p_api.hpp +++ b/include/pd/pd_p_api.hpp @@ -24,7 +24,7 @@ SOFTWARE. */ /** Generated with ppam */ - +#ifndef PD_BUILD_STATIC #ifdef _WIN32 // Windows (MSVC Tested) #ifdef PD_BUILD_SHARED #define PD_API __declspec(dllexport) @@ -49,3 +49,6 @@ SOFTWARE. #else #define PD_API #endif +#else +#define PD_API +#endif diff --git a/include/pd/ui7/layout.hpp b/include/pd/ui7/layout.hpp index 2ee6575..9a20c1d 100644 --- a/include/pd/ui7/layout.hpp +++ b/include/pd/ui7/layout.hpp @@ -34,6 +34,7 @@ SOFTWARE. namespace PD { namespace UI7 { + class Context; class PD_API Layout { public: Layout(const ID& id, IO::Ref io) : ID(id) { @@ -172,7 +173,7 @@ class PD_API Layout { private: friend class Menu; - friend class Context; + friend class PD::UI7::Context; friend class ReMenu; // Base Components UI7::ID ID; diff --git a/source/drivers/hid.cpp b/source/drivers/hid.cpp index db11b6c..87618db 100755 --- a/source/drivers/hid.cpp +++ b/source/drivers/hid.cpp @@ -24,13 +24,13 @@ SOFTWARE. #include namespace PD { -bool HidDriver::IsEvent(Event e, Key keys) { return KeyEvents[0][e] & keys; } +PD_API bool HidDriver::IsEvent(Event e, Key keys) { return KeyEvents[0][e] & keys; } -bool HidDriver::IsEvent(Event e, KbKey keys) { +PD_API bool HidDriver::IsEvent(Event e, KbKey keys) { return KbKeyEvents[0][e].Has(keys); } -void HidDriver::SwapTab() { +PD_API void HidDriver::SwapTab() { auto tkd = KeyEvents[1][Event_Down]; auto tkh = KeyEvents[1][Event_Held]; auto tku = KeyEvents[1][Event_Up]; @@ -46,7 +46,7 @@ void HidDriver::SwapTab() { * If this func has no verride, still clear the stats * cause if they are empty this leads to a crash */ -void HidDriver::Update() { +PD_API void HidDriver::Update() { // Clear States for (int i = 0; i < 2; i++) { KeyEvents[i][Event_Down] = 0; diff --git a/source/lithium/drawlist.cpp b/source/lithium/drawlist.cpp index 4c8347d..201b666 100644 --- a/source/lithium/drawlist.cpp +++ b/source/lithium/drawlist.cpp @@ -306,5 +306,7 @@ PD_API void DrawList::DrawLine(const fvec2& a, const fvec2& b, u32 color, PathAdd(b); PathStroke(color, t); } + +PD_API void DrawList::DrawTexture(Texture::Ref tex) { CurrentTex = tex; } } // namespace Li } // namespace PD