def get_extension_modules():
    extension_modules = []

    """
    Extension module which is actually a plain C++ library without Python bindings
    """
    turbodbc_sources = _get_source_files('cpp_odbc') + _get_source_files('turbodbc')
    turbodbc_library = Extension('libturbodbc',
                                 sources=turbodbc_sources,
                                 include_dirs=include_dirs,
                                 extra_compile_args=extra_compile_args,
                                 extra_link_args=base_library_link_args,
                                 libraries=[odbclib],
                                 library_dirs=library_dirs)
    if sys.platform == "win32":
        turbodbc_libs = []
    else:
        turbodbc_libs = [_get_turbodbc_libname()]
        extension_modules.append(turbodbc_library)

    """
    An extension module which contains the main Python bindings for turbodbc
    """
    turbodbc_python_sources = _get_source_files('turbodbc_python')
    if sys.platform == "win32":
        turbodbc_python_sources = turbodbc_sources + turbodbc_python_sources
    turbodbc_python = Extension('turbodbc_intern',
                                sources=turbodbc_python_sources,
                                include_dirs=include_dirs,
                                extra_compile_args=extra_compile_args + hidden_visibility_args,
                                libraries=[odbclib] + turbodbc_libs,
                                extra_link_args=python_module_link_args,
                                library_dirs=library_dirs)
    extension_modules.append(turbodbc_python)

    """
    An extension module which contains Python bindings which require numpy support
    to work. Not included in the standard Python bindings so this can stay optional.
    """
    if _has_numpy_headers():
        import numpy
        turbodbc_numpy_sources = _get_source_files('turbodbc_numpy')
        if sys.platform == "win32":
            turbodbc_numpy_sources = turbodbc_sources + turbodbc_numpy_sources
        turbodbc_numpy = Extension('turbodbc_numpy_support',
                                   sources=turbodbc_numpy_sources,
                                   include_dirs=include_dirs + [numpy.get_include()],
                                   extra_compile_args=extra_compile_args + hidden_visibility_args,
                                   libraries=[odbclib] + turbodbc_libs,
                                   extra_link_args=python_module_link_args,
                                   library_dirs=library_dirs)
        extension_modules.append(turbodbc_numpy)

    """
    An extension module which contains Python bindings which require Apache Arrow
    support to work. Not included in the standard Python bindings so this can
    stay optional.
    """
    if _has_arrow_headers():
        import pyarrow
        pyarrow_location = os.path.dirname(pyarrow.__file__)
        # For now, assume that we build against bundled pyarrow releases.
        pyarrow_include_dir = os.path.join(pyarrow_location, 'include')
        turbodbc_arrow_sources = _get_source_files('turbodbc_arrow')
        pyarrow_module_link_args = list(python_module_link_args)
        if sys.platform == "win32":
            turbodbc_arrow_sources = turbodbc_sources + turbodbc_arrow_sources
        elif sys.platform == "darwin":
            pyarrow_module_link_args.append('-Wl,-rpath,@loader_path/pyarrow')
        else:
            pyarrow_module_link_args.append("-Wl,-rpath,$ORIGIN/pyarrow")
        turbodbc_arrow = Extension('turbodbc_arrow_support',
                                   sources=turbodbc_arrow_sources,
                                   include_dirs=include_dirs + [pyarrow_include_dir],
                                   extra_compile_args=extra_compile_args + hidden_visibility_args,
                                   libraries=[odbclib, 'arrow', 'arrow_python'] + turbodbc_libs,
                                   extra_link_args=pyarrow_module_link_args,
                                   library_dirs=library_dirs + [pyarrow_location])
        extension_modules.append(turbodbc_arrow)

    return extension_modules
Extension module which is actually a plain C++ library without Python bindings