prepare dx dev
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
add_library(BasaltShared STATIC "")
|
||||
target_sources(BasaltShared
|
||||
PRIVATE
|
||||
# Sources
|
||||
pipe_operator.cpp
|
||||
engine.cpp
|
||||
deliver.cpp
|
||||
)
|
||||
target_sources(BasaltShared
|
||||
PUBLIC
|
||||
@@ -9,17 +12,16 @@ FILE_SET HEADERS
|
||||
FILES
|
||||
# Headers
|
||||
basalt_char.hpp
|
||||
basalt_export.hpp
|
||||
pipe_operator.hpp
|
||||
engine.hpp
|
||||
deliver.hpp
|
||||
)
|
||||
target_include_directories(BasaltShared
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
# target_link_libraries(BasaltShared
|
||||
# PRIVATE
|
||||
# BasaltShared
|
||||
# )
|
||||
target_compile_definitions(BasaltShared
|
||||
PUBLIC
|
||||
$<$<PLATFORM_ID:Windows>:BASALT_OS_WINDOWS>
|
||||
|
||||
36
BasaltPresenter/Shared/basalt_export.hpp
Normal file
36
BasaltPresenter/Shared/basalt_export.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
// Reference: https://stackoverflow.com/questions/2164827/explicitly-exporting-shared-library-functions-in-linux
|
||||
// Generate macro for import and export respectively.
|
||||
#if defined(_MSC_VER)
|
||||
// Microsoft
|
||||
#define BS_RAW_EXPORT __declspec(dllexport)
|
||||
#define BS_RAW_IMPORT __declspec(dllimport)
|
||||
#elif defined(__GNUC__)
|
||||
// GCC
|
||||
#define BS_RAW_EXPORT __attribute__((visibility("default")))
|
||||
#define BS_RAW_IMPORT
|
||||
#elif defined(__clang__)
|
||||
// Clang
|
||||
#define BS_RAW_EXPORT __attribute__((visibility("default")))
|
||||
#define BS_RAW_IMPORT
|
||||
#else
|
||||
// Do nothing and hope for the best?
|
||||
#define BS_RAW_EXPORT
|
||||
#define BS_RAW_IMPORT
|
||||
#error "Unknown dynamic link import/export semantics."
|
||||
#endif
|
||||
|
||||
// Choosee import or export command according to special macro.
|
||||
#if defined(BS_EXPORTING)
|
||||
#define BS_NAKED_EXPORT BS_RAW_EXPORT
|
||||
#else
|
||||
#define BS_NAKED_EXPORT BS_RAW_IMPORT
|
||||
#endif
|
||||
|
||||
// Create real export macro according to whether in C++ environment.
|
||||
#if defined(__cplusplus)
|
||||
#define BS_EXPORT extern "C" BS_NAKED_EXPORT
|
||||
#else
|
||||
#define BS_EXPORT BS_NAKED_EXPORT
|
||||
#endif
|
||||
9
BasaltPresenter/Shared/deliver.cpp
Normal file
9
BasaltPresenter/Shared/deliver.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "deliver.hpp"
|
||||
|
||||
namespace Basalt::Shared::Deliver {
|
||||
|
||||
IDeliver::IDeliver() {}
|
||||
|
||||
IDeliver::~IDeliver() {}
|
||||
|
||||
} // namespace Basalt::Shared::Deliver
|
||||
18
BasaltPresenter/Shared/deliver.hpp
Normal file
18
BasaltPresenter/Shared/deliver.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
namespace Basalt::Shared::Deliver {
|
||||
|
||||
struct DeliverConfig {
|
||||
|
||||
};
|
||||
|
||||
class IDeliver {
|
||||
public:
|
||||
IDeliver();
|
||||
virtual ~IDeliver();
|
||||
|
||||
public:
|
||||
virtual void Transmit() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
9
BasaltPresenter/Shared/engine.cpp
Normal file
9
BasaltPresenter/Shared/engine.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "engine.hpp"
|
||||
|
||||
namespace Basalt::Shared::Engine {
|
||||
|
||||
IEngine::IEngine(EngineConfig&& config) : config(std::move(config)) {}
|
||||
|
||||
IEngine::~IEngine() {}
|
||||
|
||||
} // namespace Basalt::Shared::Engine
|
||||
36
BasaltPresenter/Shared/engine.hpp
Normal file
36
BasaltPresenter/Shared/engine.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include "basalt_char.hpp"
|
||||
#include <string>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace Basalt::Shared::Engine {
|
||||
|
||||
enum class EngineKind {
|
||||
DirectX8,
|
||||
DirectX9,
|
||||
DirectX11,
|
||||
DirectX12,
|
||||
OpenGL,
|
||||
Vulkan,
|
||||
};
|
||||
|
||||
struct EngineConfig {
|
||||
bool is_headless; ///< Whether enable headless mode (No Window created).
|
||||
std::basic_string<BSCHAR> title; ///< Window title.
|
||||
std::uint32_t width; ///< Window width.
|
||||
std::uint32_t height; ///< Window height.
|
||||
};
|
||||
|
||||
class IEngine {
|
||||
public:
|
||||
IEngine(EngineConfig&& config);
|
||||
virtual ~IEngine();
|
||||
|
||||
public:
|
||||
virtual void Tick() = 0;
|
||||
|
||||
protected:
|
||||
EngineConfig config;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user