Skip to content

Commit

Permalink
Fix windows dll linkage;
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbytes committed Dec 19, 2022
1 parent 3f77ce6 commit 6f7eda0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -29,6 +29,7 @@ folderize_sources(msdfgen_SOURCES ${CMAKE_SOURCE_DIR})
add_library(msdfgen ${msdfgen_SOURCES} ${msdfgen_HEADERS} "./msdfgen.h")
add_library(msdfgen::msdfgen ALIAS msdfgen)
set_target_properties(msdfgen PROPERTIES PUBLIC_HEADER "${msdfgen_HEADERS}")
target_compile_definitions(msdfgen PRIVATE _MSDFGEN_BUILD_DLL)
target_include_directories(msdfgen INTERFACE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
Expand Down
24 changes: 12 additions & 12 deletions core/msdfgen-c.cpp
Expand Up @@ -9,45 +9,45 @@ using namespace msdfgen;
extern "C" {
#endif

msShape* msShapeCreate() {
MSDFGEN_API msShape* msShapeCreate() {
Shape* shape = new Shape;
return reinterpret_cast<msShape*>(shape);
}

void msShapeDestroy(msShape* cShape) {
MSDFGEN_API void msShapeDestroy(msShape* cShape) {
delete reinterpret_cast<Shape*>(cShape);
}

msContour* msShapeAddContour(msShape* cShape) {
MSDFGEN_API msContour* msShapeAddContour(msShape* cShape) {
Shape* shape = reinterpret_cast<Shape*>(cShape);
return reinterpret_cast<msContour*>(&shape->addContour());
}

void msShapeNormalize(msShape* cShape) {
MSDFGEN_API void msShapeNormalize(msShape* cShape) {
reinterpret_cast<Shape*>(cShape)->normalize();
}

void msEdgeColoringSimple(msShape* cShape, double angleThreshold, unsigned long long seed) {
MSDFGEN_API void msEdgeColoringSimple(msShape* cShape, double angleThreshold, unsigned long long seed) {
Shape* shape = reinterpret_cast<Shape*>(cShape);
edgeColoringSimple(*shape, angleThreshold, seed);
}

void msContourAddLinearEdge(msContour* cContour, float x1, float y1, float x2, float y2) {
MSDFGEN_API void msContourAddLinearEdge(msContour* cContour, float x1, float y1, float x2, float y2) {
Contour* contour = reinterpret_cast<Contour*>(cContour);
Point2 p0(x1, y1);
Point2 p1(x2, y2);
contour->addEdge(new LinearSegment(p0, p1));
}

void msContourAddQuadraticEdge(msContour* cContour, float x1, float y1, float x2, float y2, float x3, float y3) {
MSDFGEN_API void msContourAddQuadraticEdge(msContour* cContour, float x1, float y1, float x2, float y2, float x3, float y3) {
Contour* contour = reinterpret_cast<Contour*>(cContour);
Point2 p0(x1, y1);
Point2 p1(x2, y2);
Point2 p2(x3, y3);
contour->addEdge(new QuadraticSegment(p0, p1, p2));
}

void msContourAddCubicEdge(msContour* cContour, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) {
MSDFGEN_API void msContourAddCubicEdge(msContour* cContour, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) {
Contour* contour = reinterpret_cast<Contour*>(cContour);
Point2 p0(x1, y1);
Point2 p1(x2, y2);
Expand All @@ -56,25 +56,25 @@ void msContourAddCubicEdge(msContour* cContour, float x1, float y1, float x2, fl
contour->addEdge(new CubicSegment(p0, p1, p2, p3));
}

void msGenerateSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
MSDFGEN_API void msGenerateSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
Shape* shape = reinterpret_cast<Shape*>(cShape);
const BitmapRef<float, 1> bitmap(data, w, h);
generateSDF(bitmap, *shape, range, Vector2(sx, sy), Vector2(dx, dy));
}

void msGeneratePseudoSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
MSDFGEN_API void msGeneratePseudoSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
Shape* shape = reinterpret_cast<Shape*>(cShape);
const BitmapRef<float, 1> bitmap(data, w, h);
generatePseudoSDF(bitmap, *shape, range, Vector2(sx, sy), Vector2(dx, dy));
}

void msGenerateMSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
MSDFGEN_API void msGenerateMSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
Shape* shape = reinterpret_cast<Shape*>(cShape);
const BitmapRef<float, 3> bitmap(data, w, h);
generateMSDF(bitmap, *shape, range, Vector2(sx, sy), Vector2(dx, dy));
}

void msGenerateMTSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
MSDFGEN_API void msGenerateMTSDF(float* data, int w, int h, msShape* cShape, double range, float sx, float sy, float dx, float dy) {
Shape* shape = reinterpret_cast<Shape*>(cShape);
const BitmapRef<float, 4> bitmap(data, w, h);
generateMTSDF(bitmap, *shape, range, Vector2(sx, sy), Vector2(dx, dy));
Expand Down

0 comments on commit 6f7eda0

Please sign in to comment.