palladium/CMakeLists.txt
tobid7 d815bb5674 # Rewrite Stage 1
- Switch to CMake build system
- delete everything for a new structure
- Add SmartCtor class and saperate New func
- New Faster and Open Lithium Command API
- Rewritten Text Renderer to ghet rid of all that janky code
- New TimeTrace System and use of NanoTime using GetTimeNano
- Overall going to a more Object oriented way
- Updated vec api to support vec2 input on vec3
## Todo
- Support vec2 and vec3 in vec4 as inputs
- Continue UI7
- Fix SystemFont on 3ds freezing the system
- Fix TTF Font UV Mapping
## Warning
Creating Apps for the 3ds is not possible yet as the 3ds is Freezing and this is only stage 1 of ?   Emulator works perfect
2025-01-09 20:22:49 +01:00

82 lines
2.2 KiB
CMake

cmake_minimum_required(VERSION 3.18)
# Setup Toolchain if not specified
# Could propably avoided by using arm-none-eabi-cmake
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(DEFINED ENV{DEVKITPRO})
set(CMAKE_TOOLCHAIN_FILE "$ENV{DEVKITPRO}/cmake/3DS.cmake" CACHE PATH "toolchain file")
else()
message(FATAL_ERROR "Please define DEVKITPRO to point to your SDK path!")
endif()
endif()
# Set Project
project(palladium LANGUAGES C CXX VERSION 1.0.0)
# Enable Compile Command Export
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Force C++ 20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# Set Special C and CXX flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-psabi -O3")
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/strings.cpp
source/common/timetrace.cpp
source/common/sys.cpp
source/common/lang.cpp
source/common/error.cpp
# Maths
source/maths/color.cpp
source/maths/bit_util.cpp
source/maths/img_convert.cpp
# Graphics
source/graphics/texture.cpp
source/graphics/li7_shader.cpp
source/graphics/lithium.cpp
# External
source/external/stb.cpp
)
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
-DVERSION="${PROJECT_VERSION}"
-DBUILD_CTR=1
)
add_executable(test test/main.cpp)
target_include_directories(test PUBLIC include)
target_link_directories(test PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(test PUBLIC palladium citro3d ctru m)
# Generate 3DSX
ctr_generate_smdh(
${CMAKE_BINARY_DIR}/test.smdh
NAME "${APP_NAME}"
DESCRIPTION "Palladium test app"
AUTHOR "tobid7"
ICON "test/romfs/icon.png"
)
ctr_create_3dsx(
test
OUTPUT "${CMAKE_BINARY_DIR}/test.3dsx"
SMDH "${CMAKE_BINARY_DIR}/test.smdh"
ROMFS "${CMAKE_SOURCE_DIR}/test/romfs"
)
install(TARGETS ${TARGET_NAME})
install(DIRECTORY include DESTINATION ".")