--- a/src/cmarkgfm/build_cmark.py +++ b/src/cmarkgfm/build_cmark.py @@ -8,12 +8,8 @@ import cffi -# Get the directory for the cmark source files. It's under the package root -# as /third_party/cmark/src HERE = os.path.dirname(os.path.abspath(__file__)) PACKAGE_ROOT = os.path.abspath(os.path.join(HERE, '../../')) -SRC_DIR = os.path.join(PACKAGE_ROOT, 'third_party/cmark/src') -EXTENSIONS_SRC_DIR = os.path.join(PACKAGE_ROOT, 'third_party/cmark/extensions') UNIX_GENERATED_SRC_DIR = os.path.join(PACKAGE_ROOT, 'generated', 'unix') WIN_GENERATED_SRC_DIR = os.path.join(PACKAGE_ROOT, 'generated', 'windows') @@ -27,20 +23,6 @@ CMARK_MODULE_H = fh.read() -def _get_sources(dir, exclude=set()): - sources = glob.iglob(os.path.join(dir, '*.c')) - return sorted([ - os.path.relpath(path, start=PACKAGE_ROOT) - for path in - sources - if os.path.basename(path) not in exclude - ]) - - -SOURCES = _get_sources(SRC_DIR, exclude=set(['main.c'])) -SOURCES.extend(_get_sources(EXTENSIONS_SRC_DIR)) - - def _compiler_type(): """ Gets the compiler type from distutils. On Windows with MSVC it will be @@ -76,8 +58,8 @@ ffibuilder.set_source( 'cmarkgfm._cmark', CMARK_MODULE_H, - sources=SOURCES, - include_dirs=[SRC_DIR, EXTENSIONS_SRC_DIR, GENERATED_SRC_DIR], + include_dirs=[GENERATED_SRC_DIR], + libraries=["cmark-gfm", "cmark-gfm-extensions"], extra_compile_args=EXTRA_COMPILE_ARGS )