From 17a9bb0040f077a89d1327364917c94ab5fcee31 Mon Sep 17 00:00:00 2001 From: Myles Busig Date: Sat, 15 Feb 2025 21:59:24 -0800 Subject: [PATCH] Add hello world --- CMakeLists.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 16 ++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f0f1329 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.5) + +project(gba_fractal CXX C ASM) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +option(EXCEPTIONS "Enable exceptions" ON) +option(RTTI "Enable RTTI" ON) + +if (EXCEPTIONS STREQUAL OFF) + add_compile_options("-fno-exceptions") + message("NO EXCEPTIONS") +endif() + +if (EXCEPTIONS STREQUAL OFF) + add_compile_options("-fno-rtti") + message("NO RTTI") +endif() + +add_link_options("-Wl,--print-memory-usage") + +add_executable(${PROJECT_NAME}) + +# Normal source and header files +file(GLOB proj_sources LIST_DIRECTORIES false CONFIGURE_DEPENDS src/*.cpp src/*.c src/*.s) +set(proj_include "include") + +# Add sources to targe +target_sources(${PROJECT_NAME} PRIVATE "${proj_sources}") +target_include_directories(${PROJECT_NAME} PRIVATE "${proj_include}") + +# Find pkg-config packages +find_package(PkgConfig REQUIRED) +pkg_check_modules(TONC libtonc) + +# Add libtonc directories +target_link_directories(${PROJECT_NAME} PRIVATE ${TONC_LIBRARY_DIRS}) +target_include_directories(${PROJECT_NAME} PRIVATE ${TONC_INCLUDE_DIRS}) + +target_link_libraries(${PROJECT_NAME} tonc mtl) + +gba_create_rom(${PROJECT_NAME}) + +add_subdirectory(mtl) + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..76e842e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace mtl; + +int main(void) { + REG_DISPCNT = DCNT_MODE3 | DCNT_BG2; + + log::debug << "Hello world!" << mtl::endl; + + while (true) { + vid_vsync(); + } + + return 0; +}