Skip to content

Commit

Permalink
waf build order
Browse files Browse the repository at this point in the history
  • Loading branch information
suhrm committed Dec 1, 2023
1 parent d674917 commit 448f127
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

import os
import shutil
import platform
from waflib import Build, Errors, Logs

APPNAME = "srt"
VERSION = "1.1.0"

CMAKE_BUILD_TYPE = "Debug"
lib_name = None

def configure(conf):
if conf.has_tool_option("cxx_debug"):
Expand All @@ -17,23 +19,32 @@ def configure(conf):




def build(bld):
def pre(bld):
bld.find_program("cmake", mandatory=True, quiet=1, output=0)
bld.post_mode = Build.POST_LAZY
root_dir = bld.dependency_node("srt-source")

if platform.system() == "Windows":
lib_name = "srt_static.lib"
elif platform.system() == "Darwin":
lib_name = "libsrt.a"
elif platform.system() == "Linux":
lib_name = "libsrt.a"
else:
Logs.error("Unsupported platform")
return -1
target = bld.bldnode.make_node("srt")
bld(rule=CMakeBuildTask, target=target.make_node('flag.lock'), source=root_dir)
bld.add_group()
lib_path = target.find_node("lib")
include_path = target.find_node("include")
print("lib path: ", lib_path)
print("include path: ", include_path)
bld(name="srt_lib",rule=CMakeBuildTask, target=target.make_node('flag.lock'), source=root_dir )



def post(bld):
lib_path = bld.path.find_node("srt/lib")
include_path = bld.path.find_node("srt/include")
bld(name="srt_includes", export_includes=[include_path])
bld.read_stlib('srt_static', paths=[lib_path], export_includes=[include_path])



bld.read_stlib(lib_name, paths=[lib_path], export_includes=[include_path])


if bld.is_toplevel():
bld.program(
features="cxx test",
Expand All @@ -43,6 +54,14 @@ def build(bld):
use=["srt_static", "srt_includes", "gtest", "platform_includes" ],
)

def build(bld):
bld.add_pre_fun(pre)
bld.add_post_fun(post)






def CMakeBuildTask(task):
output = task.outputs[0].parent
Expand Down

0 comments on commit 448f127

Please sign in to comment.