Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
minrt: add cmakelists
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarLambda committed Feb 5, 2023
1 parent 9503285 commit e2ac164
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('sdk-seven', 'c',
version: '0.17.0',
version: '0.17.1',
license: 'Zlib',
meson_version: '>=0.55.0',
default_options: ['warning_level=2', 'c_std=c99'])
Expand Down
60 changes: 60 additions & 0 deletions minrt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#

cmake_minimum_required(VERSION 3.0)

project(minrt C ASM)
set(CMAKE_INCLUDE_FLAG_ASM "-Wa,-I")

add_library(minrt STATIC
src/gba/crt0.s
src/gba/ram.c
src/gba/rom_header.s
)

target_include_directories(minrt PUBLIC include/)
target_include_directories(minrt PRIVATE src/gba/)

target_compile_options(minrt PRIVATE
$<$<COMPILE_LANGUAGE:C>:-Os -g3 -gdwarf-4 -ffunction-sections -fdata-sections -std=c99 -Wall -Wpedantic -mabi=aapcs -mcpu=arm7tdmi -mthumb>
)

target_link_options(minrt INTERFACE
-mthumb
-specs=lib/nocrt0.specs
-L${CMAKE_CURRENT_LIST_DIR}/lib
-Trom.mem
-Tgba.x
)

add_library(minrt_multiboot STATIC
src/gba/crt0.s
src/gba/ram.c
src/gba/multiboot_header.s
)

target_include_directories(minrt_multiboot PUBLIC include/)
target_include_directories(minrt_multiboot PRIVATE src/gba/)

target_compile_options(minrt_multiboot PRIVATE
$<$<COMPILE_LANGUAGE:C>:-Os -g3 -gdwarf-4 -ffunction-sections -fdata-sections -std=c99 -Wall -Wpedantic -mabi=aapcs -mcpu=arm7tdmi -mthumb>
)

target_link_options(minrt_multiboot INTERFACE
-mthumb
-specs=lib/nocrt0.specs
-L${CMAKE_CURRENT_LIST_DIR}/lib
-Tmultiboot.mem
-Tgba.x
)

add_library(minrt_mb ALIAS minrt_multiboot)

if(EXISTS $ENV{DEVKITPRO})
install(TARGETS minrt minrt_multiboot DESTINATION "$ENV{DEVKITPRO}/minrt/lib")
install(DIRECTORY include/ DESTINATION "$ENV{DEVKITPRO}/minrt/include")
install(FILES LICENSE.txt DESTINATION "$ENV{DEVKITPRO}/minrt")
endif()

0 comments on commit e2ac164

Please sign in to comment.