Skip to content

Commit

Permalink
wscript build wip
Browse files Browse the repository at this point in the history
  • Loading branch information
suhrm committed Nov 28, 2023
1 parent 1fa0148 commit b17f409
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ from waflib import Build, Errors, Logs
APPNAME = "srt"
VERSION = "1.1.0"

CMAKE_BUILD_TYPE = "Debug"

def configure(conf):
conf.set_cxx_std(17)
if conf.has_tool_option("cxx_debug"):
CMAKE_BUILD_TYPE = "Debug"




Expand All @@ -24,7 +28,10 @@ def build(bld):
bld.add_group()
lib_path = target.find_node("lib")
include_path = target.find_node("include")
bld.read_stlib('srt', paths=[lib_path], export_includes=[include_path])
print("lib path: ", lib_path)
print("include path: ", include_path)
bld(name="srt_includes", export_includes=[include_path])
bld.read_stlib('srt_static', paths=[lib_path], export_includes=[include_path])


if bld.is_toplevel():
Expand All @@ -33,7 +40,7 @@ def build(bld):
source= bld.path.ant_glob(
"test/**/*.cpp"),
target="srt_test",
use=["srt", "srt_includes", "gtest"],
use=["srt_static", "srt_includes", "gtest", "platform_includes" ],
)


Expand All @@ -47,19 +54,20 @@ def CMakeBuildTask(task):
if os.path.isdir(f"{source_dir}/cmake_build"):
shutil.rmtree(f"{source_dir}/cmake_build")
os.makedirs (f"{source_dir}/cmake_build")
print(CMAKE_BUILD_TYPE)
# SRT cmake flags
flags = " ".join([
"-DENABLE_SHARED=ON",
"-DENABLE_STATIC=ON",
"-DENABLE_APPS=OFF",
"-DENABLE_ENCRYPTION=OFF",
"-DENABLE_BONDING=ON",
"-DCMAKE_BUILD_TYPE=Debug",
f"-DCMAKE_BUILD_TYPE={CMAKE_BUILD_TYPE}",
])
try:
task.generator.bld.cmd_and_log(f"cmake {flags} -S {source_dir} -B {source_dir}/cmake_build", quiet=0, output=0)
task.generator.bld.cmd_and_log(f"cmake --build {source_dir}/cmake_build --parallel", quiet=0, output=0)
task.generator.bld.cmd_and_log(f"cmake --install {source_dir}/cmake_build --prefix {output}", quiet=0, output=0)
task.generator.bld.cmd_and_log(f"cmake --build {source_dir}/cmake_build --parallel --config {CMAKE_BUILD_TYPE}", quiet=0, output=0)
task.generator.bld.cmd_and_log(f"cmake --install {source_dir}/cmake_build --prefix {output} --config {CMAKE_BUILD_TYPE}", quiet=0, output=0)
except Errors.WafError as e:
Logs.error(e.stderr)
return -1
Expand Down

0 comments on commit b17f409

Please sign in to comment.