From 6b482c6d405f1468eaac3059b3353eb0805cca9c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 26 Nov 2019 08:20:55 +0200 Subject: Use switch in buildfile --- libbutl/buildfile | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'libbutl/buildfile') diff --git a/libbutl/buildfile b/libbutl/buildfile index e6841ab..1a6b599 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -22,12 +22,7 @@ lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \ tclass = $cxx.target.class tsys = $cxx.target.system -linux = ($tclass == 'linux') -macos = ($tclass == 'macos') windows = ($tclass == 'windows') -freebsd = ($tsys == 'freebsd') - -mingw = ($tsys == 'mingw32') # Exclude these from compilation on non-Windows targets. # @@ -41,19 +36,33 @@ lib{butl}: file{*.c *.h} # Platform-specific UUID implementations. # -lib{butl}: cxx{uuid-linux}: include = $linux -lib{butl}: cxx{uuid-macos}: include = $macos +lib{butl}: cxx{uuid-linux}: include = ($tclass == 'linux') +lib{butl}: cxx{uuid-macos}: include = ($tclass == 'macos') lib{butl}: cxx{uuid-windows}: include = $windows -lib{butl}: cxx{uuid-freebsd}: include = $freebsd +lib{butl}: cxx{uuid-freebsd}: include = ($tsys == 'freebsd') + +# Additional system libraries. +# +switch $tclass, $tsys +{ + case 'linux' + cxx.libs += -ldl + + case 'macos' + cxx.libs += -framework CoreFoundation + + case 'windows', 'mingw32' + cxx.libs += -lrpcrt4 -limagehlp + + case 'windows' + cxx.libs += rpcrt4.lib imagehlp.lib -if $linux - cxx.libs += -ldl -elif $macos - cxx.libs += -framework CoreFoundation -elif $windows - cxx.libs += ($mingw ? -lrpcrt4 : rpcrt4.lib) -elif $freebsd - cxx.libs += -lexecinfo + case 'bsd', 'freebsd' + cxx.libs += -lexecinfo +} + +if! $windows + cxx.libs += -lpthread # Include the generated version header into the distribution (so that we don't # pick up an installed one) and don't remove it when cleaning in src (so that @@ -73,13 +82,6 @@ cxx.poptions =+ "-I$out_root" "-I$src_root" obja{*} bmia{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD objs{*} bmis{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD -# Additional system libraries. -# -if $windows - cxx.libs += ($mingw ? -limagehlp : imagehlp.lib) -else - cxx.libs += -lpthread - # Export options. # lib{butl}: cxx.export.poptions = "-I$out_root" "-I$src_root" -- cgit v1.1