[nostalgia,turbine] Make GBA files (other than ARM asm) build on all platforms
This commit is contained in:
parent
7c1c9a697e
commit
56e980385c
@ -45,10 +45,9 @@ add_subdirectory(deps/ox)
|
||||
include_directories(
|
||||
deps/ox/src
|
||||
)
|
||||
add_subdirectory(deps/teagba)
|
||||
|
||||
if(BUILDCORE_TARGET STREQUAL "gba")
|
||||
add_subdirectory(deps/teagba)
|
||||
else()
|
||||
if(NOT BUILDCORE_TARGET STREQUAL "gba")
|
||||
include_directories(
|
||||
SYSTEM
|
||||
deps/glfw/deps
|
||||
|
@ -3,9 +3,8 @@ add_library(
|
||||
gfx.cpp
|
||||
)
|
||||
|
||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
add_subdirectory(gba)
|
||||
else()
|
||||
add_subdirectory(gba)
|
||||
if(NOT TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
add_subdirectory(opengl)
|
||||
endif()
|
||||
|
||||
|
@ -1,12 +1,20 @@
|
||||
enable_language(CXX ASM)
|
||||
set_source_files_properties(gfx.cpp PROPERTIES COMPILE_FLAGS -marm)
|
||||
target_sources(
|
||||
NostalgiaCore PRIVATE
|
||||
add_library(
|
||||
NostalgiaCore-GBA OBJECT
|
||||
context.cpp
|
||||
gfx.cpp
|
||||
panic.cpp
|
||||
)
|
||||
target_include_directories(
|
||||
NostalgiaCore-GBA PUBLIC
|
||||
../../include
|
||||
)
|
||||
target_link_libraries(
|
||||
NostalgiaCore PUBLIC
|
||||
NostalgiaCore-GBA PUBLIC
|
||||
TeaGBA
|
||||
)
|
||||
Keel
|
||||
)
|
||||
|
||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
set_source_files_properties(gfx.cpp PROPERTIES COMPILE_FLAGS -marm)
|
||||
target_link_libraries(NostalgiaCore PUBLIC NostalgiaCore-GBA)
|
||||
endif()
|
@ -197,7 +197,7 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
|
||||
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
|
||||
const auto col = static_cast<unsigned>(column);
|
||||
for (auto i = 0u; i < str.bytes(); i++) {
|
||||
const auto c = charMap[static_cast<unsigned>(str[i])];
|
||||
const auto c = charMap[static_cast<std::size_t>(str[i])];
|
||||
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(c));
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,8 @@ add_library(
|
||||
event.cpp
|
||||
)
|
||||
|
||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
add_subdirectory(gba)
|
||||
else()
|
||||
add_subdirectory(gba)
|
||||
if(NOT TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
add_subdirectory(glfw)
|
||||
endif()
|
||||
|
||||
|
@ -1,16 +1,33 @@
|
||||
enable_language(CXX ASM)
|
||||
set_source_files_properties(turbine.arm.cpp irq.arm.cpp PROPERTIES COMPILE_FLAGS -marm)
|
||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
enable_language(CXX ASM)
|
||||
endif()
|
||||
|
||||
add_library(Turbine-GBA OBJECT)
|
||||
target_sources(
|
||||
Turbine PRIVATE
|
||||
Turbine-GBA PRIVATE
|
||||
clipboard.cpp
|
||||
gfx.cpp
|
||||
irq.arm.cpp
|
||||
irq.s
|
||||
turbine.arm.cpp
|
||||
turbine.cpp
|
||||
)
|
||||
|
||||
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
|
||||
set_source_files_properties(turbine.arm.cpp irq.arm.cpp PROPERTIES COMPILE_FLAGS -marm)
|
||||
target_sources(
|
||||
Turbine-GBA PRIVATE
|
||||
irq.s
|
||||
)
|
||||
target_link_libraries(Turbine PUBLIC Turbine-GBA)
|
||||
else()
|
||||
target_sources(
|
||||
Turbine-GBA PRIVATE
|
||||
irqstub.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
Turbine PUBLIC
|
||||
Turbine-GBA PUBLIC
|
||||
TeaGBA
|
||||
Keel
|
||||
)
|
||||
|
8
src/turbine/gba/irqstub.cpp
Normal file
8
src/turbine/gba/irqstub.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
// stub for building TeaGBA for PC targets, for purposes of not having to
|
||||
// switch back and forth between builds when editing GBA files
|
||||
|
||||
extern "C" void turbine_isr() {}
|
@ -36,6 +36,7 @@ static void initTimer() noexcept {
|
||||
REG_IE = REG_IE | teagba::Int_timer0;
|
||||
}
|
||||
|
||||
[[maybe_unused]]
|
||||
static ox::Result<std::size_t> findPreloadSection() noexcept {
|
||||
// put the header in the wrong order to prevent mistaking this code for the
|
||||
// media section
|
||||
@ -55,7 +56,9 @@ static ox::Result<std::size_t> findPreloadSection() noexcept {
|
||||
|
||||
ox::Result<ox::UniquePtr<turbine::Context>> init(ox::UPtr<ox::FileSystem> fs, ox::CRStringView appName) noexcept {
|
||||
oxRequireM(ctx, keel::init<gba::Context>(std::move(fs), appName));
|
||||
#ifdef OX_BARE_METAL
|
||||
oxReturnError(findPreloadSection().moveTo(&ctx->preloadSectionOffset));
|
||||
#endif
|
||||
oxReturnError(initGfx(*ctx));
|
||||
initTimer();
|
||||
initIrq();
|
||||
|
Loading…
Reference in New Issue
Block a user