feat: dynamic library support
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
add_library(${ENGINE_TARGET} STATIC
|
||||
add_library(${ENGINE_TARGET} SHARED
|
||||
src/IO/parser.cpp
|
||||
src/IO/file_manager.cpp
|
||||
|
||||
@ -24,6 +24,8 @@ set_target_properties(${ENGINE_TARGET} PROPERTIES
|
||||
VISIBILITY_INLINES_HIDDEN YES
|
||||
)
|
||||
|
||||
target_compile_definitions(${ENGINE_TARGET} PRIVATE ENGINE_BUILD_SHARED)
|
||||
|
||||
target_include_directories(${ENGINE_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define APPLICATION_H_
|
||||
|
||||
#include "engine/window/events/window.h"
|
||||
#include "engine/export.h"
|
||||
|
||||
class IApplication {
|
||||
class ENGINE_API IApplication {
|
||||
public:
|
||||
virtual ~IApplication() = default;
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
#define COMPONENT_BATCH_H_
|
||||
|
||||
#include "engine/renderer/renderer.h"
|
||||
#include "engine/export.h"
|
||||
|
||||
// requires mesh component
|
||||
struct batch {
|
||||
struct ENGINE_API batch {
|
||||
friend class Renderer;
|
||||
public:
|
||||
// requires transform component
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef COMPONENTS_PLAYER_H_
|
||||
#define COMPONENTS_PLAYER_H_
|
||||
|
||||
struct camera {};
|
||||
#include "engine/export.h"
|
||||
|
||||
struct ENGINE_API camera {};
|
||||
|
||||
#endif // COMPONENTS_PLAYER_H_
|
@ -2,9 +2,11 @@
|
||||
#define COMPONENTS_LIGHT_H_
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include "engine/renderer/renderer.h"
|
||||
|
||||
struct light {
|
||||
#include "engine/renderer/renderer.h"
|
||||
#include "engine/export.h"
|
||||
|
||||
struct ENGINE_API light {
|
||||
friend class Renderer;
|
||||
public:
|
||||
enum LightType {
|
||||
|
@ -2,9 +2,11 @@
|
||||
#define COMPONENTS_MESH_H_
|
||||
|
||||
#include <memory>
|
||||
#include "engine/renderer/wavefront.h"
|
||||
|
||||
struct mesh {
|
||||
#include "engine/renderer/wavefront.h"
|
||||
#include "engine/export.h"
|
||||
|
||||
struct ENGINE_API mesh {
|
||||
std::shared_ptr<Object> object;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef COMPONENT_ROTATE_H_
|
||||
#define COMPONENT_ROTATE_H_
|
||||
|
||||
struct rotate {};
|
||||
#include "engine/export.h"
|
||||
|
||||
struct ENGINE_API rotate {};
|
||||
|
||||
#endif // COMPONENT_ROTATE_H_
|
@ -2,8 +2,9 @@
|
||||
#define COMPONENTS_TRANSFORM_H_
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include "engine/export.h"
|
||||
|
||||
struct transform {
|
||||
struct ENGINE_API transform {
|
||||
glm::vec3 position;
|
||||
glm::vec3 rotation;
|
||||
glm::vec3 scale;
|
||||
|
9
engine/include/engine/export.h
Normal file
9
engine/include/engine/export.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) && defined(ENGINE_BUILD_SHARED)
|
||||
#define ENGINE_API __declspec(dllexport)
|
||||
#elif defined(_WIN32)
|
||||
#define ENGINE_API __declspec(dllimport)
|
||||
#else
|
||||
#define ENGINE_API __attribute__((visibility("default")))
|
||||
#endif
|
@ -8,8 +8,9 @@
|
||||
#include "engine/window/events/window.h"
|
||||
|
||||
#include "engine/app/app.h"
|
||||
#include "engine/export.h"
|
||||
|
||||
class Engine {
|
||||
class ENGINE_API Engine {
|
||||
public:
|
||||
static void Run(std::unique_ptr<IApplication> app);
|
||||
private:
|
||||
|
@ -5,9 +5,10 @@
|
||||
#include <entt/entity/registry.hpp>
|
||||
|
||||
#include "engine/renderer/shader.h"
|
||||
#include "engine/export.h"
|
||||
|
||||
// TODO: make static or singleton
|
||||
class Renderer {
|
||||
class ENGINE_API Renderer {
|
||||
public:
|
||||
Renderer(entt::registry& registry);
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Shader
|
||||
#include "engine/export.h"
|
||||
|
||||
class ENGINE_API Shader
|
||||
{
|
||||
public:
|
||||
Shader();
|
||||
|
@ -12,10 +12,12 @@
|
||||
#include "engine/renderer/material.h"
|
||||
#include "engine/renderer/mesh.h"
|
||||
|
||||
#include "engine/export.h"
|
||||
|
||||
enum ObjElement { OHASH, MTLLIB, USEMTL, O, V, VN, VT, F, OUNKNOWN };
|
||||
enum MtlElement { MHASH, NEWMTL, NS, KA, KS, KD, NI, D, ILLUM, MAP_KD, MAP_KA, MUNKNOWN };
|
||||
|
||||
class Object {
|
||||
class ENGINE_API Object {
|
||||
friend class Renderer;
|
||||
private:
|
||||
static inline int NormalizeIndex(int idx, int baseCount);
|
||||
|
Reference in New Issue
Block a user