Merge branch 'feat/visibility' into 'main'

Setup visibility handling for librotgen components


See merge request oss/rotgen!13
This commit is contained in:
Joel Falcou 2025-08-15 11:19:28 +02:00
commit 87d4bc0585
11 changed files with 71 additions and 27 deletions

View file

@ -60,13 +60,17 @@ find_package (Eigen3 3.4 REQUIRED NO_MODULE)
##======================================================================================================================
## Setup the library's build
##======================================================================================================================
if(NOT MSVC)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
endif()
add_library(rotgen SHARED ${SOURCES})
set_target_properties(rotgen PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(rotgen PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
target_compile_options(rotgen PUBLIC -std=c++20 -Werror -Wall -Wextra -Wshadow -Wunused-variable)
target_compile_definitions(rotgen PUBLIC ${ROTGEN_COMPILE_DEFS})
set_target_properties(rotgen PROPERTIES EXPORT_NAME rotgen)
add_library(rotgen::rotgen ALIAS rotgen)
target_include_directories(rotgen PUBLIC

View file

@ -0,0 +1,40 @@
//==================================================================================================
/*
ROTGEN - Runtime Overlay for Eigen
Copyright : CODE RECKONS
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
#pragma once
#ifdef ROTGEN_STATIC_DEFINE
# define ROTGEN_EXPORT
# define ROTGEN_NO_EXPORT
#else
# ifndef ROTGEN_EXPORT
# ifdef rotgen_EXPORTS
/* We are building this library */
# define ROTGEN_EXPORT __attribute__((visibility("default")))
# else
/* We are using this library */
# define ROTGEN_EXPORT __attribute__((visibility("default")))
# endif
# endif
# ifndef ROTGEN_NO_EXPORT
# define ROTGEN_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif
#ifndef ROTGEN_DEPRECATED
# define ROTGEN_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef ROTGEN_DEPRECATED_EXPORT
# define ROTGEN_DEPRECATED_EXPORT ROTGEN_EXPORT ROTGEN_DEPRECATED
#endif
#ifndef ROTGEN_DEPRECATED_NO_EXPORT
# define ROTGEN_DEPRECATED_NO_EXPORT ROTGEN_NO_EXPORT ROTGEN_DEPRECATED
#endif

View file

@ -9,6 +9,7 @@
#include <cstddef>
#include <iostream>
#include <rotgen/common/export.hpp>
namespace rotgen
{
@ -44,7 +45,7 @@ namespace rotgen
namespace detail
{
std::ostream& dynamic_info(std::ostream& os);
ROTGEN_EXPORT std::ostream& dynamic_info(std::ostream& os);
}
}

View file

@ -11,7 +11,7 @@
This file is a X-File to generate various block_impl_* declarations variant
*/
//==================================================================================================
class CLASSNAME
class ROTGEN_EXPORT CLASSNAME
{
public:
CLASSNAME(SOURCENAME& r, std::size_t i0, std::size_t j0, std::size_t ni, std::size_t nj);
@ -72,9 +72,9 @@ class CLASSNAME
SOURCENAME mul(TYPE s) const;
SOURCENAME div(TYPE s) const;
friend std::ostream& operator<<(std::ostream&,CLASSNAME const&);
friend bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT std::ostream& operator<<(std::ostream&,CLASSNAME const&);
friend ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
const TYPE* data() const;
TYPE* data();

View file

@ -11,7 +11,7 @@
This file is a X-File to generate various map_impl_* declarations variant
*/
//==================================================================================================
class CLASSNAME
class ROTGEN_EXPORT CLASSNAME
{
public:
CLASSNAME(TYPE CONST* ptr, Index r, Index c);
@ -82,7 +82,7 @@ class CLASSNAME
SOURCENAME mul(TYPE s) const;
SOURCENAME div(TYPE s) const;
friend std::ostream& operator<<(std::ostream&,CLASSNAME const&);
friend ROTGEN_EXPORT std::ostream& operator<<(std::ostream&,CLASSNAME const&);
const TYPE* data() const;
#if !defined(USE_CONST)
@ -93,8 +93,8 @@ class CLASSNAME
void setConstant(TYPE);
#endif
friend bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
private:
struct payload;

View file

@ -8,7 +8,7 @@
#pragma once
#define ROTGEN_DEF_RELOP_PAIR(OP, T1, T2) \
bool operator OP (T1 const&, T2 const&); \
ROTGEN_EXPORT bool operator OP (T1 const&, T2 const&); \
inline bool operator OP (T2 const& a, T1 const& b) { return b OP a; } \
/**/
@ -31,8 +31,6 @@ namespace rotgen
{
ROTGEN_DEF_RELOP(==)
ROTGEN_DEF_RELOP(!=)
// ROTGEN_DEF_RELOP(+)
// ROTGEN_DEF_RELOP(-)
}
#undef ROTGEN_DEF_RELOP_PAIR

View file

@ -11,7 +11,7 @@
This file is a X-File to generate various matrix_impl_* declarations variant
*/
//==================================================================================================
class CLASSNAME
class ROTGEN_EXPORT CLASSNAME
{
public:
CLASSNAME(std::size_t rows = 0, std::size_t cols = 0);
@ -67,9 +67,9 @@ class CLASSNAME
CLASSNAME& operator*=(TYPE d);
CLASSNAME& operator/=(TYPE d);
friend std::ostream& operator<<(std::ostream&,CLASSNAME const&);
friend bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT std::ostream& operator<<(std::ostream&,CLASSNAME const&);
friend ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
const TYPE* data() const;
TYPE* data();

View file

@ -126,17 +126,17 @@ struct CLASSNAME::payload
//==================================================================================================
// Operators
//==================================================================================================
std::ostream& operator<<(std::ostream& os,CLASSNAME const& m)
ROTGEN_EXPORT std::ostream& operator<<(std::ostream& os,CLASSNAME const& m)
{
return os << m.storage_->data;
}
bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs)
ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs)
{
return lhs.storage_->data == rhs.storage_->data;
}
bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs)
ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs)
{
return lhs.storage_->data != rhs.storage_->data;
}

View file

@ -7,10 +7,11 @@
*/
//==================================================================================================
#include <rotgen/config.hpp>
#include <rotgen/common/export.hpp>
namespace rotgen::detail
{
std::ostream& dynamic_info(std::ostream& os)
ROTGEN_EXPORT std::ostream& dynamic_info(std::ostream& os)
{
if constexpr(rotgen::is_forcing_dynamic_status) return os << "[ROTGEN] - Fully Dynamic mode" << std::endl;
else return os << "[ROTGEN] - Flexible mode with" << std::endl;

View file

@ -146,17 +146,17 @@
//==================================================================================================
// Operators
//==================================================================================================
std::ostream& operator<<(std::ostream& os,CLASSNAME const& m)
ROTGEN_EXPORT std::ostream& operator<<(std::ostream& os,CLASSNAME const& m)
{
return os << m.storage_->data;
}
bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs)
ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs)
{
return lhs.storage_->data == rhs.storage_->data;
}
bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs)
ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs)
{
return lhs.storage_->data != rhs.storage_->data;
}

View file

@ -130,17 +130,17 @@ TYPE CLASSNAME::lp_norm(int p) const
//==================================================================================================
// Operators
//==================================================================================================
std::ostream& operator<<(std::ostream& os,CLASSNAME const& m)
ROTGEN_EXPORT std::ostream& operator<<(std::ostream& os,CLASSNAME const& m)
{
return os << m.storage_->data;
}
bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs)
ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs)
{
return lhs.storage_->data == rhs.storage_->data;
}
bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs)
ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs)
{
return lhs.storage_->data != rhs.storage_->data;
}