[nostalgia/core] Cleanup CMake config

This commit is contained in:
Gary Talent 2019-10-31 00:22:58 -05:00
parent 3a0b41d2cc
commit 73377068c6
8 changed files with 80 additions and 49 deletions

View File

@ -1,35 +1,5 @@
if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA")
enable_language(C ASM)
set(
CPP
gba/core.cpp
gba/gfx.cpp
gba/media.cpp
gba/mem.cpp
gba/panic.cpp
)
elseif(NOSTALGIA_BUILD_STUDIO)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(
CPP
#qt/gfx.cpp
userland/media.cpp
userland/mem.cpp
)
else()
set(
CPP
#qt/gfx.cpp # does not currently use any Qt stuff, but will need to replace with SDL version
userland/media.cpp
userland/mem.cpp
)
endif()
add_library(
NostalgiaCore
${CPP}
core.cpp
)
@ -39,8 +9,11 @@ target_link_libraries(
OxFS
)
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA")
add_subdirectory(gba)
elseif(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
add_subdirectory(sdl)
add_subdirectory(userland)
endif()
if(NOSTALGIA_BUILD_STUDIO)
add_subdirectory(studio)
@ -49,10 +22,12 @@ endif()
install(
FILES
consts.hpp
context.hpp
core.hpp
gfx.hpp
media.hpp
gba/gba.hpp
mem.hpp
types.hpp
DESTINATION
include/nostalgia/core
)

View File

@ -0,0 +1,22 @@
add_library(
NostalgiaCore-GBA
core.cpp
gfx.cpp
media.cpp
mem.cpp
panic.cpp
)
target_link_libraries(
NostalgiaCore-GBA PUBLIC
GbaStartup
OxFS
OxStd
)
install(
TARGETS
NostalgiaCore-GBA
DESTINATION
include/nostalgia/core
)

View File

@ -0,0 +1,19 @@
/*
* Copyright 2016 - 2019 gtalent2@gmail.com
*
* 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 http://mozilla.org/MPL/2.0/.
*/
#include <nostalgia/core/core.hpp>
namespace nostalgia::core {
ox::Error run() {
while (1) {
}
return OxError(0);
}
}

View File

@ -215,7 +215,7 @@ ox::Error loadTileSheet(Context*,
ox::FileAddress) {
auto inode = tilesheetPath.getInode().value;
ox::Error err(0);
const auto PaletteStart = sizeof(GbaImageDataHeader);
constexpr auto PaletteStart = sizeof(GbaImageDataHeader);
GbaImageDataHeader imgData;
ox::FileStore32 fs(loadRom(), 32 * 1024 * 1024);

View File

@ -9,11 +9,12 @@ target_link_libraries(
SDL2::Main
OxFS
OxStd
NostalgiaCore-Userspace
)
install(
TARGETS
NostalgiaCore-SDL
DESTINATION
${NOSTALGIA_DIST_PLUGIN}
include/nostalgia/core
)

View File

@ -123,6 +123,7 @@ ox::Error loadTileSheet(Context *ctx,
}
void drawBackground(SDL_Texture *tex) {
constexpr auto DstSize = 32;
//oxTrace("nostalgia::core::drawBackground") << "Drawing background";
SDL_Rect src = {}, dst = {};
src.x = 0;
@ -130,16 +131,16 @@ void drawBackground(SDL_Texture *tex) {
src.h = 8;
dst.x = 0;
dst.y = 0;
dst.w = 64;
dst.h = 64;
dst.w = DstSize;
dst.h = DstSize;
if (tex) {
for (auto &m : bgTileMaps) {
for (auto t : m) {
src.y = t * 8;
SDL_RenderCopy(renderer, tex, &src, &dst);
dst.y += 64;
dst.y += DstSize;
}
dst.x += 64;
dst.x += DstSize;
dst.y = 0;
}
}

View File

@ -0,0 +1,18 @@
add_library(
NostalgiaCore-Userspace
media.cpp
mem.cpp
)
target_link_libraries(
NostalgiaCore-Userspace PUBLIC
OxFS
OxStd
)
install(
TARGETS
NostalgiaCore-Userspace
DESTINATION
include/nostalgia/core
)

View File

@ -1,17 +1,12 @@
add_executable(
nostalgia
main.cpp
)
if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA")
enable_language(C ASM)
add_executable(
nostalgia
main.cpp
startup.s
)
set(NOSTALGIA_PLAYER_DEPS "")
set(NOSTALGIA_PLAYER_DEPS "NostalgiaCore-GBA")
else()
add_executable(
nostalgia
main.cpp
)
set(NOSTALGIA_PLAYER_DEPS "NostalgiaCore-SDL")
endif()