Add hello world

This commit is contained in:
Madeline Busig 2025-02-15 21:59:24 -08:00
parent 6f93b23554
commit ad83cce1ad
2 changed files with 60 additions and 0 deletions

44
CMakeLists.txt Normal file
View File

@ -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)

16
src/main.cpp Normal file
View File

@ -0,0 +1,16 @@
#include <tonc.h>
#include <mtl/log.hpp>
using namespace mtl;
int main(void) {
REG_DISPCNT = DCNT_MODE3 | DCNT_BG2;
log::debug << "Hello world!" << mtl::endl;
while (true) {
vid_vsync();
}
return 0;
}