8000 Export · orange-cpp/omath@075c553 · GitHub
[go: up one dir, main page]

Skip to content

Commit 075c553

Browse files
authored
Export
1 parent c0efa35 commit 075c553

File tree

20 files changed

+72
-38
lines changed

20 files changed

+72
-38
lines changed

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.26)
22

33
project(omath VERSION 1.0.0)
44

5-
5+
include(CMakePackageConfigHelpers)
66

77
set(CMAKE_CXX_STANDARD 26)
88

@@ -19,10 +19,16 @@ else()
1919
add_library(omath STATIC source/Vector3.cpp)
2020
endif()
2121

22+
target_compile_definitions(omath PUBLIC OMATH_EXPORT)
23+
24+
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
25+
target_compile_options(omath PRIVATE /Zc:static_assert-)
26+
endif()
27+
2228
add_subdirectory(source)
23-
add_subdirectory(extlibs)
2429

2530
if(OMATH_BUILD_TESTS)
31+
add_subdirectory(extlibs)
2632
add_subdirectory(tests)
2733
endif()
2834

@@ -79,4 +85,4 @@ install(FILES
7985
"${CMAKE_CURRENT_BINARY_DIR}/omathConfig.cmake"
8086
"${CMAKE_CURRENT_BINARY_DIR}/omathConfigVersion.cmake"
8187
DESTINATION lib/cmake/omath
82-
)
88+
)

include/omath/Angle.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "omath/Angles.hpp"
77

88
#include <algorithm>
9-
9+
#include "omath_export.h"
1010

1111
namespace omath
1212
{
@@ -18,7 +18,7 @@ namespace omath
1818

1919
template<class Type = float, Type min = Type(0), Type max = Type(360), AngleFlags flags = AngleFlags::Normalized>
2020
requires std::is_arithmetic_v<Type>
21-
class Angle
21+
class OMATH_API Angle
2222
{
2323
Type m_angle;
2424
constexpr Angle(const Type& degrees)

include/omath/Angles.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <numbers>
77
#include <cmath>
88

9-
109
namespace omath::angles
1110
{
1211
template<class Type>

include/omath/Color.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
#include "omath/Vector3.hpp"
88
#include <cstdint>
99
#include "omath/Vector4.hpp"
10-
10+
#include "omath_export.h"
1111

1212
namespace omath
1313
{
14-
struct HSV
14+
struct OMATH_API HSV
1515
{
1616
float m_hue{};
1717
float m_saturation{};
1818
float m_value{};
1919
};
2020

2121

22-
class Color final : public Vector4
22+
class OMATH_API Color final : public Vector4
2323
{
2424
public:
2525
constexpr Color(float r, float g, float b, float a) : Vector4(r,g,b,a)

include/omath/Mat.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
#include <stdexcept>
99
#include <utility>
1010
#include "Vector3.hpp"
11-
11+
#include "omath_export.h"
1212

1313
namespace omath
1414
{
15-
struct MatSize
15+
struct OMATH_API MatSize
1616
{
1717
size_t rows, columns;
1818
};
@@ -25,7 +25,7 @@ namespace omath
2525

2626
template<size_t Rows = 0, size_t Columns = 0, class Type = float, MatStoreType StoreType = MatStoreType::ROW_MAJOR>
2727
requires std::is_arithmetic_v<Type>
28-
class Mat final
28+
class OMATH_API Mat final
2929
{
3030
public:
3131
constexpr Mat()

include/omath/Matrix.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
#include <initializer_list>
33
#include <memory>
44
#include <string>
5+
#include "omath_export.h"
56

67
namespace omath
78
{
89
class Vector3;
910

10-
class Matrix final
11+
class OMATH_API Matrix final
1112
{
1213
public:
1314
Matrix();

include/omath/Triangle3d.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
//
44
#pragma once
55
#include "omath/Vector3.hpp"
6+
#include "omath_export.h"
67

78
namespace omath
89
{
9-
class Triangle3d final
10+
class OMATH_API Triangle3d final
1011
{
1112
public:
1213
Triangle3d(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3);

include/omath/Vector2.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#pragma once
66
#include <tuple>
77
#include <cmath>
8-
8+
#include "omath_export.h"
99

1010
namespace omath
1111
{
12-
class Vector2
12+
class OMATH_API Vector2
1313
{
1414
public:
1515
float x = 0.f;

include/omath/Vector3.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include <cstdint>
88
#include <functional>
99
#include "omath/Vector2.hpp"
10-
10+
#include "omath_export.h"
1111

1212
namespace omath
1313
{
14-
class Vector3 : public Vector2
14+
class OMATH_API Vector3 : public Vector2
1515
{
1616
public:
1717
float z = 0.f;

include/omath/Vector4.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
#include <omath/Vector3.hpp>
77
#include <algorithm>
8-
8+
#include "omath_export.h"
99

1010
namespace omath
1111
{
12-
class Vector4 : public Vector3
12+
class OMATH_API Vector4 : public Vector3
1313
{
1414
public:
1515
float w;

include/omath/ViewAngles.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
//
44
#pragma once
55

6+
#include "omath_export.h"
7+
68
namespace omath
79
{
810
template<class PitchType, class YawType, class RollType>
9-
struct ViewAngles
11+
struct OMATH_API ViewAngles
1012
{
1113
PitchType pitch;
1214
YawType yaw;

include/omath/collision/LineTracer.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
#include "omath/Vector3.hpp"
77
#include "omath/Triangle3d.hpp"
8-
8+
#include "../omath_export.h"
99

1010
namespace omath::collision
1111
{
12-
class Ray
12+
class OMATH_API Ray
1313
{
1414
public:
1515
Vector3 start;
@@ -21,7 +21,7 @@ namespace omath::collision
2121
[[nodiscard]]
2222
Vector3 DirectionVectorNormalized() const;
2323
};
24-
class LineTracer
24+
class OMATH_API LineTracer
2525
{
2626
public:
2727
LineTracer() = delete;

include/omath/engines/Source/Camera.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
#pragma once
55
#include "Constants.h"
66
#include "omath/projection/Camera.hpp"
7+
#include "../../omath_export.h"
78

89
namespace omath::source
910
{
10-
class Camera final : public projection::Camera<Mat4x4, ViewAngles>
11+
class OMATH_API Camera final : public projection::Camera<Mat4x4, ViewAngles>
1112
{
1213
public:
1314
Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort,

include/omath/omath_export.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
/* Export prefix for functions */
4+
#ifdef _MSC_VER
5+
/* MSVC */
6+
# define OMATH_API_EXPORT __declspec(dllexport)
7+
#else
8+
/* GCC/Clang */
9+
# define OMATH_API_EXPORT __attribute__((visibility("default")))
10+
#endif
11+
12+
/* Import prefix for functions */
13+
#ifdef _MSC_VER
14+
# define OMATH_API_IMPORT __declspec(dllimport)
15+
#else
16+
# define OMATH_API_IMPORT extern
17+
#endif
18+
19+
/* Resolve import/export */
20+
#ifdef OMATH_EXPORT
21+
# define OMATH_API OMATH_API_EXPORT
22+
#else
23+
# define OMATH_API OMATH_API_IMPORT
24+
#endif

include/omath/pathfinding/Astar.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
#include <vector>
77
#include "NavigationMesh.hpp"
88
#include "omath/Vector3.hpp"
9-
9+
#include "../omath_export.h"
1010

1111
namespace omath::pathfinding
1212
{
13-
class Astar final
13+
class OMATH_API Astar final
1414
{
1515
public:
1616
[[nodiscard]]

include/omath/pathfinding/NavigationMesh.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <expected>
99
#include <vector>
1010
#include <string>
11-
11+
#include "../omath_export.h"
1212

1313
namespace omath::pathfinding
1414
{
@@ -18,7 +18,7 @@ namespace omath::pathfinding
1818

1919
};
2020

21-
class NavigationMesh final
21+
class OMATH_API NavigationMesh final
2222
{
2323
public:
2424

include/omath/prediction/Engine.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
#include "omath/Vector3.hpp"
99
#include "omath/prediction/Projectile.hpp"
1010
#include "omath/prediction/Target.hpp"
11-
11+
#include "../omath_export.h"
1212

1313
namespace omath::prediction
1414
{
15-
class Engine final
15+
class OMATH_API Engine final
1616
{
1717
public:
1818
explicit Engine(float gravityConstant, float simulationTimeStep,

include/omath/prediction/Projectile.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#pragma once
66
#include "omath/Vector3.hpp"
7-
7+
#include "../omath_export.h"
88

99
namespace omath::prediction
1010
{
11-
class Projectile final
11+
class OMATH_API Projectile final
1212
{
1313
public:
1414

include/omath/prediction/Target.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#pragma once
66
#include "omath/Vector3.hpp"
7-
7+
#include "../omath_export.h"
88

99
namespace omath::prediction
1010
{
11-
class Target final
11+
class OMATH_API Target final
1212
{
1313
public:
1414

include/omath/projection/Camera.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#include "ErrorCodes.hpp"
1111
#include <omath/Angle.hpp>
1212
#include <type_traits>
13-
13+
#include "../omath_export.h"
1414

1515
namespace omath::projection
1616
{
17-
class ViewPort final
17+
class OMATH_API ViewPort final
1818
{
1919
public:
2020
float m_width;
@@ -28,7 +28,7 @@ namespace omath::projection
2828
using FieldOfView = const Angle<float, 0.f, 180.f, AngleFlags::Clamped>;
2929

3030
template<class Mat4x4Type, class ViewAnglesType>
31-
class Camera
31+
class OMATH_API Camera
3232
{
3333

3434
public:

0 commit comments

Comments
 (0)
0