libeuropa: Add DLL export stuff

Also allows us to re-add -fvisibility=hidden to Linux builds
This commit is contained in:
Lily Tsuru 2025-01-17 23:08:51 -05:00
parent e978c975b0
commit b58117a5e7
6 changed files with 33 additions and 6 deletions

View file

@ -1,6 +1,6 @@
# TODO: This currently assumes libstdc++, later on we should *probably* set this with some detection
# also TODO: Use a list so that this isn't one giant line (list JOIN should help.)
set(EUROPA_CORE_COMPILE_ARGS "-Wall -Wextra -Wformat=2 -Wimplicit-fallthrough")
set(EUROPA_CORE_COMPILE_ARGS "-Wall -Wextra -Wformat=2 -Wimplicit-fallthrough -fvisibility=hidden")
set(EUROPA_CORE_LINKER_ARGS "-fuse-ld=${EUROPA_LINKER}")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") # OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"

View file

@ -11,13 +11,14 @@
#include <europa/io/pak/File.hpp>
#include <europa/structs/Pak.hpp>
#include <europa/util/DllExport.hpp>
#include <iosfwd>
#include <string>
namespace europa::io::pak {
/// Reader for Europa package files (.pak).
struct Reader {
struct LIBEUROPA_EXPORT Reader {
using FlatType = std::pair<std::string, File>;
using MapType = std::vector<FlatType>;

View file

@ -15,12 +15,13 @@
#include <string>
#include <utility>
#include "europa/structs/Pak.hpp"
#include <europa/structs/Pak.hpp>
#include <europa/util/DllExport.hpp>
namespace europa::io::pak {
/// A efficient writer for Europa package (.pak) files.
struct Writer {
struct LIBEUROPA_EXPORT Writer {
/// Vocabulary type for making sector alignment stuff a bit easier to see.
enum class SectorAlignment {
DoNotAlign, /// Do not align to a sector boundary

View file

@ -10,6 +10,7 @@
#define EUROPA_IO_YATFREADER_H
#include <europa/structs/Yatf.hpp>
#include <europa/util/DllExport.hpp>
#include <iosfwd>
namespace europa::util {
@ -19,7 +20,7 @@ namespace europa::util {
namespace europa::io::yatf {
/// Reader for PS2 Europa .tex (YATF - Yet Another Texture Format) files.
struct Reader {
struct LIBEUROPA_EXPORT Reader {
explicit Reader(std::istream& is);
/// Read image. The image output to [surface] is converted to RGBA8888 implicitly.

View file

@ -0,0 +1,23 @@
//
// EuropaTools
//
// (C) 2021-2025 modeco80 <lily.modeco80@protonmail.ch>
//
// SPDX-License-Identifier: MIT
//
#pragma once
#ifdef europa_EXPORTS
#ifdef _WIN32
#define LIBEUROPA_EXPORT __declspec(dllexport)
#else
#define LIBEUROPA_EXPORT __attribute__((visibility("default")))
#endif
#else
#ifdef _WIN32
#define LIBEUROPA_EXPORT __declspec(dllimport)
#else
#define LIBEUROPA_EXPORT
#endif
#endif

View file

@ -11,6 +11,7 @@
#include <cstddef>
#include <cstdint>
#include <europa/util/UniqueArray.hpp>
#include <europa/util/DllExport.hpp>
namespace europa::util {
@ -66,7 +67,7 @@ namespace europa::util {
#endif
/// A RGBA8888 image surface.
struct ImageSurface {
struct LIBEUROPA_EXPORT ImageSurface {
ImageSurface();
explicit ImageSurface(Size size);