# Stage 2.1
- Split palladium into diffrent libraries - Fix a Logical bug in App class - Add New Flag to Init App Data Directory - Add Cmake Option for build tests - Bump Version in cmake file - Make Hid a Driver - Start moving 3ds specific stuff into pd-lib3ds - Split Lithium into more files
This commit is contained in:
181
CMakeLists.txt
181
CMakeLists.txt
@ -1,5 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
### Helper Function to Build Librarys without have always
|
||||
### These includes and definition defines
|
||||
function(add_pd_lib TARGET_NAME)
|
||||
set(opts "")
|
||||
set(one_val_args "")
|
||||
set(multi_val_args SRC_FILES DEPENDS)
|
||||
cmake_parse_arguments(ARG "${opts}" "${one_val_args}" "${multi_val_args}" ${ARGN})
|
||||
|
||||
add_library(${TARGET_NAME} STATIC ${ARG_SRC_FILES})
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
include
|
||||
${DEVKITPRO}/portlibs/3ds/include)
|
||||
target_compile_definitions(${TARGET_NAME} PUBLIC
|
||||
-D_GNU_SOURCE=1
|
||||
-DPALLADIUM_VERSION="${PROJECT_VERSION}"
|
||||
-DPALLADIUM_GIT_COMMIT="${GIT_SHORT_HASH}"
|
||||
-DBUILD_CTR=1)
|
||||
### For the libs that depend on another
|
||||
if(ARG_DEPENDS)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC ${ARG_DEPENDS})
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME})
|
||||
endfunction()
|
||||
|
||||
# Setup Toolchain if not specified
|
||||
# Could propably avoided by using arm-none-eabi-cmake
|
||||
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
@ -18,7 +42,9 @@ execute_process(
|
||||
)
|
||||
|
||||
# Set Project
|
||||
project(palladium LANGUAGES C CXX VERSION 0.1.9)
|
||||
project(palladium LANGUAGES C CXX VERSION 0.2.1)
|
||||
|
||||
option(PD_BUILD_TESTS "Sets if TestApp and TestBench get build" OFF)
|
||||
|
||||
# Enable Compile Command Export
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
@ -31,67 +57,103 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-psabi -O2")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions")
|
||||
|
||||
set(SRC_FILES
|
||||
# Core (common)
|
||||
source/common/app.cpp
|
||||
source/common/common.cpp
|
||||
source/common/strings.cpp
|
||||
source/common/timetrace.cpp
|
||||
source/common/sys.cpp
|
||||
source/common/lang.cpp
|
||||
source/common/error.cpp
|
||||
source/common/io.cpp
|
||||
# Controls
|
||||
source/controls/hid.cpp
|
||||
# Maths
|
||||
source/maths/color.cpp
|
||||
source/maths/bit_util.cpp
|
||||
source/maths/img_convert.cpp
|
||||
source/maths/img_blur.cpp
|
||||
# Graphics
|
||||
source/graphics/texture.cpp
|
||||
source/graphics/spritesheet.cpp
|
||||
source/graphics/li7_shader.cpp
|
||||
source/graphics/lithium.cpp
|
||||
# Overlays
|
||||
source/overlays/message_mgr.cpp
|
||||
source/overlays/overlay_mgr.cpp
|
||||
source/overlays/keyboard.cpp
|
||||
source/overlays/performance.cpp
|
||||
source/overlays/settings.cpp
|
||||
# Tools
|
||||
source/tools/gamepad_icons.cpp
|
||||
# UI7
|
||||
source/ui7/drawlist.cpp
|
||||
source/ui7/menu.cpp
|
||||
source/ui7/theme.cpp
|
||||
source/ui7/ui7.cpp
|
||||
source/ui7/container/container.cpp
|
||||
source/ui7/container/button.cpp
|
||||
source/ui7/container/checkbox.cpp
|
||||
source/ui7/container/image.cpp
|
||||
source/ui7/container/label.cpp
|
||||
# External
|
||||
source/external/stb.cpp
|
||||
set(CORE_SRC
|
||||
source/core/common.cpp
|
||||
source/core/io.cpp
|
||||
source/core/strings.cpp
|
||||
source/core/sys.cpp
|
||||
source/core/timetrace.cpp)
|
||||
|
||||
add_pd_lib(pd-core SRC_FILES ${CORE_SRC})
|
||||
|
||||
set(MATHS_SRC
|
||||
source/maths/bit_util.cpp
|
||||
source/maths/color.cpp
|
||||
source/maths/img_blur.cpp
|
||||
source/maths/img_convert.cpp)
|
||||
add_pd_lib(pd-maths SRC_FILES ${MATHS_SRC} DEPENDS pd-core)
|
||||
|
||||
set(EXTERNAL_SRC
|
||||
source/external/stb.cpp)
|
||||
add_pd_lib(pd-external SRC_FILES ${EXTERNAL_SRC})
|
||||
|
||||
set(DRVS_SRC
|
||||
source/drivers/hid.cpp)
|
||||
|
||||
add_pd_lib(pd-drivers SRC_FILES ${DRVS_SRC} DEPENDS pd-maths)
|
||||
|
||||
set(L3DS_SRC
|
||||
source/lib3ds/gamepad_icons.cpp
|
||||
source/lib3ds/result_decoder.cpp
|
||||
source/lib3ds/drv_hid.cpp)
|
||||
|
||||
add_pd_lib(pd-lib3ds SRC_FILES ${L3DS_SRC} DEPENDS pd-drivers)
|
||||
|
||||
set(LI_SRC
|
||||
source/lithium/li7_shader.cpp
|
||||
source/lithium/spritesheet.cpp
|
||||
source/lithium/texture.cpp
|
||||
source/lithium/font.cpp
|
||||
source/lithium/objects.cpp
|
||||
source/lithium/renderer.cpp)
|
||||
|
||||
add_pd_lib(pd-lithium SRC_FILES ${LI_SRC} DEPENDS pd-maths pd-external citro3d)
|
||||
|
||||
set(OVL_SRC
|
||||
source/overlays/keyboard.cpp
|
||||
source/overlays/message_mgr.cpp
|
||||
source/overlays/overlay_mgr.cpp
|
||||
source/overlays/performance.cpp
|
||||
source/overlays/settings.cpp)
|
||||
|
||||
add_pd_lib(pd-overlays SRC_FILES ${OVL_SRC} DEPENDS pd-lithium)
|
||||
|
||||
set(APP_SRC
|
||||
source/app/app.cpp
|
||||
source/app/lang.cpp
|
||||
source/app/error.cpp)
|
||||
|
||||
add_pd_lib(pd-app SRC_FILES ${APP_SRC} DEPENDS pd-overlays pd-drivers pd-lib3ds)
|
||||
|
||||
set(UI7_SRC
|
||||
source/ui7/drawlist.cpp
|
||||
source/ui7/menu.cpp
|
||||
source/ui7/theme.cpp
|
||||
source/ui7/ui7.cpp
|
||||
source/ui7/container/container.cpp
|
||||
source/ui7/container/button.cpp
|
||||
source/ui7/container/checkbox.cpp
|
||||
source/ui7/container/image.cpp
|
||||
source/ui7/container/label.cpp)
|
||||
|
||||
add_pd_lib(pd-ui7 SRC_FILES ${UI7_SRC} DEPENDS pd-drivers pd-lithium)
|
||||
|
||||
add_library(palladium INTERFACE)
|
||||
target_link_libraries(palladium INTERFACE
|
||||
pd-core
|
||||
pd-maths
|
||||
pd-external
|
||||
pd-drivers
|
||||
pd-lib3ds
|
||||
pd-lithium
|
||||
pd-overlays
|
||||
pd-app
|
||||
pd-ui7
|
||||
)
|
||||
|
||||
set(TARGET_NAME palladium)
|
||||
|
||||
# Set Executable and its sources
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||
|
||||
# Set dependencies, include dirs and definitions
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
include
|
||||
${DEVKITPRO}/portlibs/3ds/include
|
||||
)
|
||||
target_compile_definitions(${TARGET_NAME} PUBLIC
|
||||
-D_GNU_SOURCE=1
|
||||
-DPALLADIUM_VERSION="${PROJECT_VERSION}"
|
||||
-DPALLADIUM_GIT_COMMIT="${GIT_SHORT_HASH}"
|
||||
-DBUILD_CTR=1
|
||||
add_dependencies(palladium
|
||||
pd-core
|
||||
pd-maths
|
||||
pd-external
|
||||
pd-drivers
|
||||
pd-lib3ds
|
||||
pd-lithium
|
||||
pd-overlays
|
||||
pd-app
|
||||
pd-ui7
|
||||
)
|
||||
|
||||
if(PD_BUILD_TESTS)
|
||||
add_executable(test test/app/main.cpp)
|
||||
target_include_directories(test PUBLIC include test/app)
|
||||
target_link_directories(test PUBLIC ${CMAKE_BINARY_DIR})
|
||||
@ -121,5 +183,6 @@ ctr_create_3dsx(
|
||||
SMDH "${CMAKE_BINARY_DIR}/test.smdh"
|
||||
ROMFS "${CMAKE_SOURCE_DIR}/test/romfs"
|
||||
)
|
||||
install(TARGETS ${TARGET_NAME})
|
||||
endif()
|
||||
|
||||
install(DIRECTORY include DESTINATION ".")
|
Reference in New Issue
Block a user