[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) 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") set(OX_ENABLE_TRACEHOOK OFF CACHE BOOL "Generate OxTraceHook shared library for uprobes")
if(BUILDCORE_TARGET STREQUAL "gba") 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) include(deps/gbabuildcore/base.cmake)
else() else()
set(TURBINE_BUILD_TYPE "Native")
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif() endif()
@ -49,7 +42,6 @@ add_subdirectory(deps/teagba)
if(NOT BUILDCORE_TARGET STREQUAL "gba") if(NOT BUILDCORE_TARGET STREQUAL "gba")
include_directories( include_directories(
SYSTEM SYSTEM
deps/glfw/deps
deps/glfw/include deps/glfw/include
deps/imgui deps/imgui
deps/imgui/backends deps/imgui/backends

View File

@ -1,6 +1,15 @@
project(nostalgia CXX)
#project packages #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) if(APPLE)
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia") set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia")
set(NOSTALGIA_DIST_BIN NostalgiaStudio.app/Contents/MacOS) set(NOSTALGIA_DIST_BIN NostalgiaStudio.app/Contents/MacOS)
@ -17,13 +26,13 @@ endif()
add_subdirectory(modules) add_subdirectory(modules)
if(NOSTALGIA_BUILD_PLAYER) if(${NOSTALGIA_BUILD_PLAYER})
add_subdirectory(player) add_subdirectory(player)
endif() endif()
if(TURBINE_BUILD_TYPE STREQUAL "Native") if(NOT BUILDCORE_TARGET STREQUAL "gba")
add_subdirectory(tools) add_subdirectory(tools)
if(NOSTALGIA_BUILD_STUDIO) if(${NOSTALGIA_BUILD_STUDIO})
add_subdirectory(studio) add_subdirectory(studio)
endif() endif()
endif() endif()

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,6 @@
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved. * Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/ */
#include <keel/module.hpp>
#include <studioapp/studioapp.hpp> #include <studioapp/studioapp.hpp>
#include <nostalgia/core/studiomodule.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(applib)
add_subdirectory(keel) add_subdirectory(keel)
add_subdirectory(turbine) 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)); m_types.emplace_back(std::move(im));
std::sort( std::sort(
m_types.begin(), m_types.end(), m_types.begin(), m_types.end(),

View File

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

View File

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

View File

@ -21,7 +21,7 @@ class ProjectExplorer: public studio::Widget {
void draw(turbine::Context &ctx) noexcept override; 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; 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); m_children = std::move(children);
} }

View File

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

View File

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