From b17f409b36024a585054c5920ac333c636a5f7b3 Mon Sep 17 00:00:00 2001 From: suhrm Date: Tue, 28 Nov 2023 05:37:21 -0800 Subject: [PATCH] wscript build wip --- wscript | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/wscript b/wscript index b92240a..39f4307 100644 --- a/wscript +++ b/wscript @@ -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" + @@ -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(): @@ -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" ], ) @@ -47,6 +54,7 @@ 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", @@ -54,12 +62,12 @@ def CMakeBuildTask(task): "-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