feat: add shared library build and example application
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
ROOT_DIR := $(abspath ..)
|
||||
|
||||
CC := gcc
|
||||
|
||||
CXXFLAGS := -std=c++17 \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-fPIC \
|
||||
-I$(ROOT_DIR)/core/include \
|
||||
-Iinclude
|
||||
|
||||
LDFLAGS := -lstdc++
|
||||
|
||||
BUILD_DIR := $(ROOT_DIR)/build
|
||||
|
||||
TARGET := $(BUILD_DIR)/liblogger.so
|
||||
|
||||
SRC := src/logger.cpp
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
||||
$(TARGET): $(SRC)
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
|
||||
$(CC) \
|
||||
$(CXXFLAGS) \
|
||||
-shared \
|
||||
$< \
|
||||
-o $@ \
|
||||
$(LDFLAGS)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define LOGGER_API __declspec(dllexport)
|
||||
#else
|
||||
#define LOGGER_API __attribute__((visibility("default")))
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "export.hpp"
|
||||
#include "log_level.hpp"
|
||||
#include "result.hpp"
|
||||
|
||||
@@ -19,7 +20,7 @@ namespace logger {
|
||||
* Методы with* используют неизменяемый подход:
|
||||
* они создают новый экземпляр Logger с изменённой конфигурацией.
|
||||
*/
|
||||
class Logger {
|
||||
class LOGGER_API Logger {
|
||||
public:
|
||||
/**
|
||||
* @brief Создаёт объект логгера.
|
||||
|
||||
Reference in New Issue
Block a user