Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MSVC dll import/export #229

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion include/chipmunk/chipmunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@
#endif

#ifdef _WIN32
#define CP_EXPORT __declspec(dllexport)
#ifdef CHIPMUNK_SHARED
#ifdef CHIPMUNK_BUILD
#define CP_EXPORT __declspec(dllexport)
#else
#define CP_EXPORT __declspec(dllimport)
#endif
#else
#define CP_EXPORT
#endif
#else
#define CP_EXPORT
#endif
Expand Down Expand Up @@ -111,7 +119,10 @@ typedef struct cpArbiter cpArbiter;
typedef struct cpSpace cpSpace;

#include "cpVect.h"
#include "cpRobust.h"
#include "cpHastySpace.h"
#include "cpBB.h"
#include "cpMarch.h"
#include "cpTransform.h"
#include "cpSpatialIndex.h"

Expand Down
4 changes: 2 additions & 2 deletions include/chipmunk/cpRobust.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// "Fast math" should be disabled here.

// Check if c is to the left of segment (a, b).
cpBool cpCheckPointGreater(const cpVect a, const cpVect b, const cpVect c);
CP_EXPORT cpBool cpCheckPointGreater(const cpVect a, const cpVect b, const cpVect c);

// Check if p is behind one of v0 or v1 on axis n.
cpBool cpCheckAxis(cpVect v0, cpVect v1, cpVect p, cpVect n);
CP_EXPORT cpBool cpCheckAxis(cpVect v0, cpVect v1, cpVect p, cpVect n);
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ if(BUILD_SHARED)
if(MSVC)
set_source_files_properties(${chipmunk_source_files} PROPERTIES LANGUAGE CXX)
set_target_properties(chipmunk PROPERTIES LINKER_LANGUAGE CXX)
target_compile_definitions(chipmunk PRIVATE CHIPMUNK_BUILD
PUBLIC CHIPMUNK_SHARED)
endif(MSVC)
# set the lib's version number
# But avoid on Android because symlinks to version numbered .so's don't work with Android's Java-side loadLibrary.
Expand Down
2 changes: 1 addition & 1 deletion src/cpRobust.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "chipmunk/cpRobust.h"
#include "chipmunk/chipmunk_private.h"


cpBool
Expand Down