diff --git a/.gitignore b/.gitignore index 98060db..85d8c2c 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -build/ +build*/ .cache .vscode \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b03e41..b0622ae 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.22) +include(GNUInstallDirs) + # Set Project project(palladium LANGUAGES C CXX VERSION 0.6.0) @@ -10,6 +12,9 @@ include(cmake/palladium.cmake) option(PD_BUILD_TESTS "Sets if TestApp and TestBench get build" OFF) option(PD_BUILD_SHARED "Build Shared Library" OFF) option(PD_BUILD_TOOLS "Build Palladium Tools" OFF) +option(PD_BUILD_DESKTOP "Build Desktop Backend" OFF) +option(PD_BUILD_3DS "Build 3ds Backend" OFF) +option(PD_BUNDLE_GLFW "Bundle GLFW in install" OFF) if(${PD_BUILD_TOOLS}) add_subdirectory(tools) @@ -73,7 +78,13 @@ else() target_compile_definitions(palladium PUBLIC -DPD_BUILD_STATIC) endif() -target_include_directories(palladium PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +add_library(palladium::palladium ALIAS palladium) + +target_include_directories(palladium + PUBLIC + $ + $ +) if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS") target_compile_options(palladium PRIVATE @@ -88,8 +99,47 @@ target_compile_options(palladium PRIVATE $<$:-O3> ) -install(DIRECTORY include DESTINATION ".") -install(TARGETS palladium) +if(PD_BUILD_DESKTOP AND NOT PD_BUILD_3DS) + add_subdirectory(backends/desktop) +endif() +if(PD_BUILD_3DS AND NOT PD_BUILD_DESKTOP) + add_subdirectory(backends/3ds) +endif() + +install(TARGETS palladium + EXPORT palladiumTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install(DIRECTORY include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +install(EXPORT palladiumTargets + FILE palladiumTargets.cmake + NAMESPACE palladium:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/palladium +) + +include(CMakePackageConfigHelpers) +configure_package_config_file( + cmake/palladiumConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/palladiumConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/palladium +) + +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/palladiumConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/palladiumConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/palladiumConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/palladium +) + find_program(CLANG_FORMAT clang-format) diff --git a/LICENSE b/LICENSE index cd25609..0895478 100755 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 - 2025 René Amthor tobid7 +Copyright (c) 2024 - 2026 René Amthor tobid7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/backends/3ds/CMakeLists.txt b/backends/3ds/CMakeLists.txt index ddaa935..186e136 100755 --- a/backends/3ds/CMakeLists.txt +++ b/backends/3ds/CMakeLists.txt @@ -8,6 +8,30 @@ set(SRC source/pd-3ds.cpp ) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libpicasso) -pd_add_lib(pd-3ds SRC_FILES ${SRC}) -target_include_directories(pd-3ds PUBLIC include) +add_library(pd-3ds STATIC ${SRC}) +target_include_directories(pd-3ds PUBLIC + PUBLIC + $ + $ + ) target_link_libraries(pd-3ds PUBLIC m palladium ctru citro3d pica::pica) +add_library(palladium::pd-3ds ALIAS pd-3ds) +install(TARGETS pd-3ds + EXPORT palladiumTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +install(DIRECTORY include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +install(TARGETS pica + EXPORT palladiumTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) \ No newline at end of file diff --git a/backends/desktop/CMakeLists.txt b/backends/desktop/CMakeLists.txt index 36ed6f7..3397ea7 100755 --- a/backends/desktop/CMakeLists.txt +++ b/backends/desktop/CMakeLists.txt @@ -5,7 +5,7 @@ project(pd-desktop LANGUAGES CXX VERSION 0.5.0) set(PD_GL_VERSION 21 CACHE STRING "OpenGL Version (2.1 -> 21, 3.3 -> 33)") if(APPLE) -set(PD_GL_VERSION 33 CACHE STRING "33" FORCE) + set(PD_GL_VERSION 33 CACHE STRING "33" FORCE) endif() message("Using OpenGL: " ${PD_GL_VERSION}) @@ -19,10 +19,44 @@ set(SRC source/pd-desktop.cpp ) -pd_add_lib(pd-desktop SRC_FILES ${SRC}) -target_include_directories(pd-desktop PUBLIC include) +add_library(pd-desktop STATIC ${SRC}) +target_include_directories(pd-desktop + PUBLIC + $ + $ +) target_link_libraries(pd-desktop PUBLIC palladium glad glfw) target_compile_definitions(pd-desktop PRIVATE PD_OPENGL=${PD_GL_VERSION} -) \ No newline at end of file +) + +add_library(palladium::pd-desktop ALIAS pd-desktop) + +install(TARGETS pd-desktop + EXPORT palladiumTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +install(DIRECTORY include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +install(TARGETS glad + EXPORT palladiumTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +if(PD_BUNDLE_GLFW) + install(TARGETS glfw + EXPORT palladiumTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endif() \ No newline at end of file diff --git a/backends/desktop/glad/CMakeLists.txt b/backends/desktop/glad/CMakeLists.txt index f496bb3..b7f7d5d 100755 --- a/backends/desktop/glad/CMakeLists.txt +++ b/backends/desktop/glad/CMakeLists.txt @@ -1,4 +1,8 @@ cmake_minimum_required(VERSION 3.22) add_library(glad source/glad.c) -target_include_directories(glad PUBLIC include) \ No newline at end of file +target_include_directories(glad + PUBLIC + $ + $ +) diff --git a/cmake/palladiumConfig.cmake.in b/cmake/palladiumConfig.cmake.in new file mode 100644 index 0000000..0efbb38 --- /dev/null +++ b/cmake/palladiumConfig.cmake.in @@ -0,0 +1,6 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/palladiumTargets.cmake") +if(NOT TARGET palladium::pd-desktop AND PALLADIUM_FIND_DESKTOP) + find_dependency(palladium::pd-desktop OPTIONAL) +endif() \ No newline at end of file diff --git a/include/pd/ui7/layout.hpp b/include/pd/ui7/layout.hpp index 9a20c1d..b6cbaef 100644 --- a/include/pd/ui7/layout.hpp +++ b/include/pd/ui7/layout.hpp @@ -34,7 +34,7 @@ SOFTWARE. namespace PD { namespace UI7 { - class Context; +class Context; class PD_API Layout { public: Layout(const ID& id, IO::Ref io) : ID(id) { diff --git a/source/drivers/hid.cpp b/source/drivers/hid.cpp index 87618db..d88e14b 100755 --- a/source/drivers/hid.cpp +++ b/source/drivers/hid.cpp @@ -24,7 +24,9 @@ SOFTWARE. #include namespace PD { -PD_API 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; +} PD_API bool HidDriver::IsEvent(Event e, KbKey keys) { return KbKeyEvents[0][e].Has(keys); diff --git a/source/drivers/os.cpp b/source/drivers/os.cpp index 91ec6b1..098ea2d 100755 --- a/source/drivers/os.cpp +++ b/source/drivers/os.cpp @@ -34,7 +34,9 @@ PD_API TT::Res::Ref& OsDriver::GetTraceRef(const std::string& id) { PD_API TraceMap& OsDriver::GetTraceMap() { return pTraces; } -PD_API bool OsDriver::TraceExist(const std::string& id) { return pTraces.count(id); } +PD_API bool OsDriver::TraceExist(const std::string& id) { + return pTraces.count(id); +} /** Standart Driver */ PD_API u64 OsDriver::GetTime() {