Add stuff for cmake find_package
- Add build* to gitignore - Fix year in license file - other changes are result of clang-format
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
build/
|
||||
build*/
|
||||
.cache
|
||||
.vscode
|
||||
@@ -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
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS")
|
||||
target_compile_options(palladium PRIVATE
|
||||
@@ -88,8 +99,47 @@ target_compile_options(palladium PRIVATE
|
||||
$<$<CONFIG:Release>:-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)
|
||||
|
||||
|
||||
2
LICENSE
2
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
|
||||
|
||||
@@ -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
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
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}
|
||||
)
|
||||
@@ -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
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
target_link_libraries(pd-desktop PUBLIC palladium glad glfw)
|
||||
|
||||
target_compile_definitions(pd-desktop
|
||||
PRIVATE PD_OPENGL=${PD_GL_VERSION}
|
||||
)
|
||||
)
|
||||
|
||||
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()
|
||||
@@ -1,4 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
add_library(glad source/glad.c)
|
||||
target_include_directories(glad PUBLIC include)
|
||||
target_include_directories(glad
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
6
cmake/palladiumConfig.cmake.in
Normal file
6
cmake/palladiumConfig.cmake.in
Normal file
@@ -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()
|
||||
@@ -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) {
|
||||
|
||||
@@ -24,7 +24,9 @@ SOFTWARE.
|
||||
#include <pd/drivers/hid.hpp>
|
||||
|
||||
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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user