build: update build directories for RESTinio and OpenDHT
The build.py script was not using the intended build directories for
RESTinio and OpenDHT, and as a result many of the files created during
the build process were not ignored by Git even though they should have
been.
Change-Id: Iba1d2447cf35dd3a7de7cd1de81955440cf83dfd
diff --git a/dependencies/build.py b/dependencies/build.py
index eeadb07..e3c3499 100755
--- a/dependencies/build.py
+++ b/dependencies/build.py
@@ -27,8 +27,12 @@
install_dir = os.path.abspath("install")
def build_and_install_restinio():
+ # Setting flush=True because this script is called by CMake via the
+ # execute_process function, which by default doesn't print the content
+ # of standard output until the executed process returns.
+ print("\nBuilding and installing RESTinio...", flush=True)
try:
- restino_build_dir = restinio_dir + "/dev/"
+ restino_build_dir = os.path.join(restinio_dir, "dev", "cmake_build")
cmake_command = [
"cmake",
f"-DCMAKE_INSTALL_PREFIX={install_dir}",
@@ -40,23 +44,25 @@
"-DRESTINIO_FIND_DEPS=ON",
"-DRESTINIO_ALLOW_SOBJECTIZER=Off",
"-DRESTINIO_USE_BOOST_ASIO=none",
- "."
+ ".."
]
+ os.makedirs(restino_build_dir, exist_ok=True)
subprocess.run(cmake_command, cwd=restino_build_dir, check=True)
subprocess.run(["make", "-j8"], cwd=restino_build_dir, check=True)
subprocess.run(["make", "install"], cwd=restino_build_dir, check=True)
- print("restinio built and installed successfully.")
+ print("RESTinio built and installed successfully.")
return True
- except subprocess.CalledProcessError as e:
- print("Error building or installing restinio: %s", e)
+ except (subprocess.CalledProcessError, OSError) as e:
+ print("Error building or installing restinio:", e)
return False
def build_and_install_opendht():
- print("Building and installing OpenDHT...")
+ print("\nBuilding and installing OpenDHT...", flush=True)
try:
- # Configure OpenDHT with CMake
- subprocess.run(["cmake", ".",
+ opendht_build_dir = os.path.join(opendht_dir, "build")
+ cmake_command = [
+ "cmake", "..",
"-DCMAKE_INSTALL_PREFIX=" + install_dir,
"-DCMAKE_PREFIX_PATH=" + install_dir, # For finding restinio
"-DCMAKE_BUILD_TYPE=Release",
@@ -67,18 +73,18 @@
"-DOPENDHT_DOCUMENTATION=OFF",
"-DOPENDHT_HTTP=ON",
"-DOPENDHT_PROXY_CLIENT=ON",
- ], cwd=opendht_dir, check=True)
-
- # Build and install OpenDHT
- subprocess.run(["make", "install"], cwd=opendht_dir, check=True)
+ ]
+ os.makedirs(opendht_build_dir, exist_ok=True)
+ subprocess.run(cmake_command, cwd=opendht_build_dir, check=True)
+ subprocess.run(["make", "install"], cwd=opendht_build_dir, check=True)
print("OpenDHT installed successfully.")
return True
- except subprocess.CalledProcessError as e:
- print("Error building or installing OpenDHT: %s", e)
+ except (subprocess.CalledProcessError, OSError) as e:
+ print("Error building or installing OpenDHT:", e)
return False
def build_and_install_pjproject():
- # Build PJSIP libraries
+ print("\nBuilding and installing PJSIP...", flush=True)
try:
configure_command = [
"./configure",