Skip to content
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "deps/dlfcn-win32"]
path = deps/dlfcn-win32
url = https://github.com/dlfcn-win32/dlfcn-win32.git
[submodule "third-party/pybind11"]
path = third-party/pybind11
url = https://github.com/pybind/pybind11.git
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ endif()
# Compiler flags
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# Third-party
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third-party/pybind11/include)

if(WIN32)
SET(BUILD_SHARED_LIBS OFF)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/dlfcn-win32/src)
Expand Down
15 changes: 15 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ def get_build_type():
return "Release"


def check_submodule():
submodule_paths = ["third-party/pybind11/include/pybind11"]
if not all([os.path.exists(p) for p in submodule_paths]):
print("initializing submodules ...")
try:
cwd = os.path.abspath(os.path.dirname(__file__))
subprocess.check_call(["git", "submodule", "update", "--init", "--recursive"], cwd=cwd)
print("submodule initialization succeeded")
except Exception:
print("submodule initialization failed")
print(" Please run:\n\tgit submodule update --init --recursive")
exit(-1)


def get_llvm():
# tries to find system LLVM
versions = ['-11.0', '-11', '-11-64']
Expand Down Expand Up @@ -92,6 +106,7 @@ def run(self):
self.build_extension(ext)

def build_extension(self, ext):
check_submodule()
llvm_include_dir, llvm_library_dir = get_llvm()
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.path)))
# create build directories
Expand Down
Loading