Skip to content

Commit 5fa8d3b

Browse files
willydGuillaume Dumont
authored andcommitted
Added support for compiling with MSVC
1 parent 636becd commit 5fa8d3b

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

PythonAPI/pycocotools/_mask.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# distutils: language = c
1+
# distutils: language = c++
22
# distutils: sources = ../common/maskApi.c
33

44
#**************************************************************************

PythonAPI/setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
import sys
12
from setuptools import setup, Extension
23
import numpy as np
3-
44
# To compile and install locally run "python setup.py build_ext --inplace"
55
# To install library to Python site-packages run "python setup.py build_ext install"
6+
extra_compile_args = ['-Wno-cpp', '-Wno-unused-function', '-std=c99']
7+
if sys.platform == 'win32':
8+
extra_compile_args = []
69

710
ext_modules = [
811
Extension(
912
'pycocotools._mask',
1013
sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
1114
include_dirs = [np.get_include(), '../common'],
12-
extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
15+
extra_compile_args=extra_compile_args,,
1316
)
1417
]
1518

common/maskApi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
* Licensed under the Simplified BSD License [see coco/license.txt]
66
**************************************************************************/
77
#pragma once
8+
#if defined(_MSC_VER) && _MSC_VER < 1800
9+
//typedef unsigned char bool;
10+
#else
11+
#include <stdbool.h>
12+
#endif
813

914
typedef unsigned int uint;
1015
typedef unsigned long siz;

0 commit comments

Comments
 (0)