[nostalgia,olympic,studio] Add Olympic applib system, convert Studio to use it
This commit is contained in:
parent
b6b59e77f5
commit
393259a010
@ -1,9 +1,12 @@
|
||||
include_directories(".")
|
||||
|
||||
set(OLYMPIC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/olympic")
|
||||
|
||||
if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
||||
add_subdirectory(glutils)
|
||||
add_subdirectory(studio)
|
||||
endif()
|
||||
add_subdirectory(keel)
|
||||
add_subdirectory(nostalgia)
|
||||
add_subdirectory(olympic)
|
||||
add_subdirectory(turbine)
|
||||
|
@ -3,7 +3,6 @@
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(scene)
|
||||
|
||||
|
||||
# module libraries
|
||||
|
||||
# Keel
|
||||
@ -17,6 +16,12 @@ target_link_libraries(
|
||||
NostalgiaCore-Keel
|
||||
NostalgiaScene-Keel
|
||||
)
|
||||
target_compile_definitions(
|
||||
NostalgiaKeelModules PUBLIC
|
||||
OLYMPIC_PROJECT_NAME="Nostalgia"
|
||||
OLYMPIC_PROJECT_NAMESPACE=nostalgia
|
||||
OLYMPIC_PROJECT_DATADIR=".nostalgia"
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
keelmodules.hpp
|
||||
|
@ -2,7 +2,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_executable(
|
||||
nostalgia-studio WIN32 MACOSX_BUNDLE
|
||||
main.cpp
|
||||
${OLYMPIC_PATH}/applib/applib.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
@ -12,6 +12,14 @@ target_link_libraries(
|
||||
StudioAppLib
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
nostalgia-studio
|
||||
RUNTIME DESTINATION
|
||||
${NOSTALGIA_DIST_BIN}
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT WIN32)
|
||||
# enable LTO
|
||||
set_property(TARGET nostalgia-studio PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
@ -27,11 +35,3 @@ install(
|
||||
DESTINATION
|
||||
${NOSTALGIA_DIST_RESOURCES}/icons
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
nostalgia-studio
|
||||
RUNTIME DESTINATION
|
||||
${NOSTALGIA_DIST_BIN}
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/modules/keelmodules.hpp>
|
||||
#include <nostalgia/modules/studiomodules.hpp>
|
||||
|
||||
#include <studioapp/studioapp.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
int WinMain() {
|
||||
auto const argc = __argc;
|
||||
auto const argv = const_cast<const char**>(__argv);
|
||||
#else
|
||||
int main(int argc, const char **argv) {
|
||||
#endif
|
||||
nostalgia::registerKeelModules();
|
||||
nostalgia::registerStudioModules();
|
||||
return studio::main("Nostalgia Studio", ".nostalgia", argc, argv);
|
||||
}
|
1
src/olympic/CMakeLists.txt
Normal file
1
src/olympic/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(applib)
|
0
src/olympic/applib/CMakeLists.txt
Normal file
0
src/olympic/applib/CMakeLists.txt
Normal file
52
src/olympic/applib/applib.cpp
Normal file
52
src/olympic/applib/applib.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/logconn/def.hpp>
|
||||
#include <ox/logconn/logconn.hpp>
|
||||
|
||||
#ifndef OLYMPIC_PROJECT_NAME
|
||||
#define OLYMPIC_PROJECT_NAME "OlympicProject"
|
||||
#endif
|
||||
|
||||
#ifndef OLYMPIC_PROJECT_NAMESPACE
|
||||
#define OLYMPIC_PROJECT_NAMESPACE project
|
||||
#endif
|
||||
|
||||
#ifndef OLYMPIC_PROJECT_DATADIR
|
||||
#define OLYMPIC_PROJECT_DATADIR ".keel"
|
||||
#endif
|
||||
|
||||
ox::Error run(
|
||||
ox::StringView appName,
|
||||
ox::StringView projectDataDir,
|
||||
int argc,
|
||||
const char **argv) noexcept;
|
||||
|
||||
namespace olympic {
|
||||
[[nodiscard]]
|
||||
ox::StringView appName() noexcept;
|
||||
}
|
||||
|
||||
namespace OLYMPIC_PROJECT_NAMESPACE {
|
||||
void registerKeelModules() noexcept;
|
||||
void registerStudioModules() noexcept;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int WinMain() {
|
||||
auto const argc = __argc;
|
||||
auto const argv = const_cast<const char**>(__argv);
|
||||
#else
|
||||
int main(int argc, const char **argv) {
|
||||
#endif
|
||||
OX_INIT_DEBUG_LOGGER(loggerConn, olympic::appName())
|
||||
OLYMPIC_PROJECT_NAMESPACE::registerKeelModules();
|
||||
OLYMPIC_PROJECT_NAMESPACE::registerStudioModules();
|
||||
auto const err = run(olympic::appName(), OLYMPIC_PROJECT_DATADIR, argc, argv);
|
||||
oxAssert(err, "Something went wrong...");
|
||||
if (err) {
|
||||
oxErrf("Failure: {}\n", toStr(err));
|
||||
}
|
||||
return static_cast<int>(err);
|
||||
}
|
18
src/olympic/applib/applib.hpp
Normal file
18
src/olympic/applib/applib.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/stringview.hpp>
|
||||
|
||||
#define OLYMPIC_APP_PROVIDERS(projectName, projectNamespace) \
|
||||
namespace projectNamespace { \
|
||||
void registerKeelModules() noexcept; \
|
||||
void registerStudioModules() noexcept; \
|
||||
} \
|
||||
namespace olympic { \
|
||||
ox::StringView appName() noexcept {return projectName OLYMPIC_APP;} \
|
||||
void loadKeelModules() noexcept {projectNamespace::registerKeelModules();} \
|
||||
void loadStudioModules() noexcept {projectNamespace::registerStudioModules();} \
|
||||
}
|
@ -17,9 +17,9 @@ struct StudioOptions {
|
||||
ox::String projectDataDir;
|
||||
};
|
||||
|
||||
int main(StudioOptions&&);
|
||||
ox::Error run(StudioOptions&&);
|
||||
|
||||
int main(
|
||||
ox::Error run(
|
||||
ox::CRStringView appName,
|
||||
ox::CRStringView projectDataDir,
|
||||
int argc,
|
||||
|
@ -62,7 +62,7 @@ static ox::Error runApp(
|
||||
return err;
|
||||
}
|
||||
|
||||
int main(
|
||||
ox::Error run(
|
||||
ox::CRStringView appName,
|
||||
ox::CRStringView projectDataDir,
|
||||
int,
|
||||
@ -77,12 +77,27 @@ int main(
|
||||
// run app
|
||||
const auto err = runApp(appName, projectDataDir, ox::UniquePtr<ox::FileSystem>(nullptr));
|
||||
oxAssert(err, "Something went wrong...");
|
||||
return static_cast<int>(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
int main(StudioOptions &&opts, int argc = 0, const char **argv = nullptr) {
|
||||
return main(opts.appName, opts.projectDataDir, argc, argv);
|
||||
ox::Error run(StudioOptions &&opts, int argc = 0, const char **argv = nullptr) {
|
||||
return run(opts.appName, opts.projectDataDir, argc, argv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace olympic {
|
||||
[[nodiscard]]
|
||||
ox::StringView appName() noexcept {
|
||||
return "Nostalgia Studio";
|
||||
}
|
||||
}
|
||||
|
||||
ox::Error run(
|
||||
ox::StringView appName,
|
||||
ox::StringView projectDataDir,
|
||||
int argc,
|
||||
const char **argv) noexcept {
|
||||
return studio::run(appName, projectDataDir, argc, argv);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user