[nostalgia,olympic] Cleanup CMake

This commit is contained in:
Gary Talent 2023-12-23 12:23:47 -06:00
parent 978f2f9c4f
commit 2dba592a42
15 changed files with 64 additions and 51 deletions

View File

@ -11,18 +11,11 @@ endif()
include(deps/buildcore/base.cmake)
set(NOSTALGIA_BUILD_PLAYER ON CACHE BOOL "Build Player")
set(NOSTALGIA_BUILD_STUDIO ON CACHE BOOL "Build Studio")
set(OLYMPIC_BUILD_STUDIO ON CACHE BOOL "Build Studio")
set(OX_ENABLE_TRACEHOOK OFF CACHE BOOL "Generate OxTraceHook shared library for uprobes")
if(BUILDCORE_TARGET STREQUAL "gba")
set(NOSTALGIA_BUILD_STUDIO OFF)
set(OLYMPIC_BUILD_STUDIO OFF)
set(TURBINE_BUILD_TYPE "GBA")
include(deps/gbabuildcore/base.cmake)
else()
set(TURBINE_BUILD_TYPE "Native")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
@ -49,7 +42,6 @@ add_subdirectory(deps/teagba)
if(NOT BUILDCORE_TARGET STREQUAL "gba")
include_directories(
SYSTEM
deps/glfw/deps
deps/glfw/include
deps/imgui
deps/imgui/backends

View File

@ -1,6 +1,15 @@
project(nostalgia CXX)
#project packages
set(NOSTALGIA_BUILD_PLAYER ON CACHE BOOL "Build Player")
set(NOSTALGIA_BUILD_STUDIO ON CACHE BOOL "Build Studio")
if(BUILDCORE_TARGET STREQUAL "gba")
set(NOSTALGIA_BUILD_STUDIO OFF)
endif()
if(APPLE)
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia")
set(NOSTALGIA_DIST_BIN NostalgiaStudio.app/Contents/MacOS)
@ -17,13 +26,13 @@ endif()
add_subdirectory(modules)
if(NOSTALGIA_BUILD_PLAYER)
if(${NOSTALGIA_BUILD_PLAYER})
add_subdirectory(player)
endif()
if(TURBINE_BUILD_TYPE STREQUAL "Native")
if(NOT BUILDCORE_TARGET STREQUAL "gba")
add_subdirectory(tools)
if(NOSTALGIA_BUILD_STUDIO)
if(${NOSTALGIA_BUILD_STUDIO})
add_subdirectory(studio)
endif()
endif()

View File

@ -23,26 +23,24 @@ install(
include/nostalgia/modules
)
if(${OLYMPIC_BUILD_STUDIO})
# Studio
if(TURBINE_BUILD_TYPE STREQUAL "Native")
add_library(
NostalgiaStudioModules STATIC
studiomodules.cpp
)
target_link_libraries(
NostalgiaStudioModules PUBLIC
StudioAppLib
NostalgiaCore-Studio-ImGui
NostalgiaScene-Studio
)
install(
FILES
studiomodules.hpp
DESTINATION
include/nostalgia/modules
)
endif()
# Studio
if(NOSTALGIA_BUILD_STUDIO)
add_library(
NostalgiaStudioModules STATIC
studiomodules.cpp
)
target_link_libraries(
NostalgiaStudioModules PUBLIC
StudioAppLib
NostalgiaCore-Studio-ImGui
NostalgiaScene-Studio
)
install(
FILES
studiomodules.hpp
DESTINATION
include/nostalgia/modules
)
endif()
add_library(NostalgiaProfile INTERFACE)

View File

@ -1,5 +1,6 @@
add_subdirectory(src)
if(NOT TURBINE_BUILD_TYPE STREQUAL "GBA")
if(NOT BUILDCORE_TARGET STREQUAL "gba")
add_subdirectory(test)
endif()

View File

@ -5,7 +5,7 @@ add_library(
)
add_subdirectory(gba)
if(NOT TURBINE_BUILD_TYPE STREQUAL "GBA")
if(NOT BUILDCORE_TARGET STREQUAL "gba")
add_subdirectory(opengl)
endif()

View File

@ -15,7 +15,7 @@ target_link_libraries(
Turbine
)
if(TURBINE_BUILD_TYPE STREQUAL "GBA")
if(BUILDCORE_TARGET STREQUAL "gba")
set_source_files_properties(gfx.cpp PROPERTIES COMPILE_FLAGS -marm)
target_link_libraries(NostalgiaCore PUBLIC NostalgiaCore-GBA)
endif()

View File

@ -2,8 +2,6 @@
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <keel/module.hpp>
#include <studioapp/studioapp.hpp>
#include <nostalgia/core/studiomodule.hpp>

View File

@ -1,3 +1,18 @@
if(BUILDCORE_TARGET STREQUAL "gba")
project(Olympic ASM CXX)
else()
project(Olympic CXX)
endif()
set(OLYMPIC_BUILD_STUDIO ON CACHE BOOL "Build Studio")
if(BUILDCORE_TARGET STREQUAL "gba")
set(OLYMPIC_BUILD_STUDIO OFF)
set(TURBINE_BUILD_TYPE "GBA")
else()
set(TURBINE_BUILD_TYPE "Native")
endif()
add_subdirectory(applib)
add_subdirectory(keel)
add_subdirectory(turbine)

View File

@ -52,7 +52,7 @@ void NewMenu::draw(turbine::Context &ctx) noexcept {
}
}
void NewMenu::addItemMaker(ox::UniquePtr<studio::ItemMaker> im) noexcept {
void NewMenu::addItemMaker(ox::UniquePtr<studio::ItemMaker> &&im) noexcept {
m_types.emplace_back(std::move(im));
std::sort(
m_types.begin(), m_types.end(),

View File

@ -51,7 +51,7 @@ class NewMenu: public studio::Popup {
template<typename T>
void addItemType(ox::String name, ox::String parentDir, ox::String fileExt, ox::ClawFormat pFmt = ox::ClawFormat::Metal) noexcept;
void addItemMaker(ox::UniquePtr<studio::ItemMaker> im) noexcept;
void addItemMaker(ox::UniquePtr<studio::ItemMaker> &&im) noexcept;
private:
void drawNewItemType(turbine::Context &ctx) noexcept;

View File

@ -44,7 +44,7 @@ void ProjectExplorer::draw(turbine::Context &ctx) noexcept {
ImGui::EndChild();
}
void ProjectExplorer::setModel(ox::UPtr<ProjectTreeModel> model) noexcept {
void ProjectExplorer::setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept {
m_treeModel = std::move(model);
}

View File

@ -21,7 +21,7 @@ class ProjectExplorer: public studio::Widget {
void draw(turbine::Context &ctx) noexcept override;
void setModel(ox::UPtr<ProjectTreeModel> model) noexcept;
void setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept;
ox::Error refreshProjectTreeModel(ox::CRStringView = {}) noexcept;

View File

@ -44,7 +44,7 @@ void ProjectTreeModel::draw(turbine::Context &ctx) const noexcept {
}
}
void ProjectTreeModel::setChildren(ox::Vector<ox::UniquePtr<ProjectTreeModel>> children) noexcept {
void ProjectTreeModel::setChildren(ox::Vector<ox::UPtr<ProjectTreeModel>> children) noexcept {
m_children = std::move(children);
}

View File

@ -16,7 +16,7 @@ class ProjectTreeModel {
class ProjectExplorer &m_explorer;
ProjectTreeModel *m_parent = nullptr;
ox::String m_name;
ox::Vector<ox::UniquePtr<ProjectTreeModel>> m_children;
ox::Vector<ox::UPtr<ProjectTreeModel>> m_children;
public:
explicit ProjectTreeModel(class ProjectExplorer &explorer, ox::String name,
ProjectTreeModel *parent = nullptr) noexcept;
@ -25,7 +25,7 @@ class ProjectTreeModel {
void draw(turbine::Context &ctx) const noexcept;
void setChildren(ox::Vector<ox::UniquePtr<ProjectTreeModel>> children) noexcept;
void setChildren(ox::Vector<ox::UPtr<ProjectTreeModel>> children) noexcept;
private:
[[nodiscard]]

View File

@ -30,8 +30,8 @@ class ItemMaker {
template<typename T>
class ItemMakerT: public ItemMaker {
private:
T const item;
ox::ClawFormat const fmt;
T const m_item;
ox::ClawFormat const m_fmt;
public:
constexpr ItemMakerT(
ox::StringView pDisplayName,
@ -39,7 +39,7 @@ class ItemMakerT: public ItemMaker {
ox::StringView fileExt,
ox::ClawFormat pFmt = ox::ClawFormat::Metal) noexcept:
ItemMaker(pDisplayName, pParentDir, fileExt),
fmt(pFmt) {
m_fmt(pFmt) {
}
constexpr ItemMakerT(
ox::StringView pDisplayName,
@ -48,8 +48,8 @@ class ItemMakerT: public ItemMaker {
T pItem,
ox::ClawFormat pFmt) noexcept:
ItemMaker(pDisplayName, pParentDir, fileExt),
item(pItem),
fmt(pFmt) {
m_item(pItem),
m_fmt(pFmt) {
}
constexpr ItemMakerT(
ox::StringView pDisplayName,
@ -58,14 +58,14 @@ class ItemMakerT: public ItemMaker {
T &&pItem,
ox::ClawFormat pFmt) noexcept:
ItemMaker(pDisplayName, pParentDir, fileExt),
item(std::move(pItem)),
fmt(pFmt) {
m_item(std::move(pItem)),
m_fmt(pFmt) {
}
ox::Error write(turbine::Context &ctx, ox::CRStringView pName) const noexcept override {
auto const path = ox::sfmt("/{}/{}.{}", parentDir, pName, fileExt);
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
keel::createUuidMapping(keelCtx(ctx), path, ox::UUID::generate().unwrap());
return sctx->project->writeObj(path, item, fmt);
return sctx->project->writeObj(path, m_item, m_fmt);
}
};