Skip to content

Commit

Permalink
Another attempt at dealing with cython 3.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
unhyperbolic committed Jul 19, 2023
1 parent a553d0e commit 7185c74
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/headers/SnapPea.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,11 @@ typedef struct NormalSurfaceList NormalSurfaceList;
#define CONST
/* #define CONST const */


#ifdef FORCE_C_LINKAGE
#ifdef __cplusplus
extern "C" {
#endif
#endif

/************************************************************************/

Expand Down Expand Up @@ -2731,9 +2732,11 @@ extern Real volume(Triangulation *manifold, int *precision);

#include "end_namespace.h"

#ifdef FORCE_C_LINKAGE
#ifdef __cplusplus
}
#endif
#endif

#endif
/* Local Variables: */
Expand Down
4 changes: 4 additions & 0 deletions kernel/headers/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

#include "SnapPea.h"

#ifdef FORCE_C_LINKAGE
#ifdef __cplusplus
extern "C" {
#endif
#endif

#include <string.h>
#include <math.h>
Expand All @@ -30,9 +32,11 @@ extern "C" {
#include "kernel_prototypes.h"
#include "tables.h"

#ifdef FORCE_C_LINKAGE
#ifdef __cplusplus
}
#endif
#endif

#endif
/* Local Variables: */
Expand Down
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ def add(self, source_file, dependency_mod_time=0.0):
elif platform.machine() == 'x86_64':
hp_extra_compile_args = ['-mfpmath=sse', '-msse2', '-mieee-fp']

if have_cython:
if [int(x) for x in cython_version.split('.')[:2]] < [3, 0]:
if sys.platform == 'win32':
hp_extra_compile_args.append('/DFORCE_C_LINKAGE')
else:
hp_extra_compile_args.append('-DFORCE_C_LINKAGE')

# SnapPyHP depends implicitly on the source for the main kernel, so we
# we delete certain object files to force distutils to rebuild them.
Expand Down

0 comments on commit 7185c74

Please sign in to comment.