mirror of
https://github.com/boostorg/build.git
synced 2026-02-01 20:32:17 +00:00
36 lines
875 B
Plaintext
36 lines
875 B
Plaintext
import type ;
|
|
import generators ;
|
|
import os ;
|
|
import print ;
|
|
|
|
type.register FOO : foo ;
|
|
|
|
generators.register-standard foo.foo : FOO : CPP H ;
|
|
|
|
rule foo ( targets * : sources * : properties * )
|
|
{
|
|
# On NT, you need an exported symbol in order to have an import lib generated
|
|
if [ os.name ] = NT && <main-target-type>LIB in $(properties)
|
|
{
|
|
.decl = "echo void __declspec(dllexport) foo(){}" ;
|
|
}
|
|
if [ modules.peek : OS ] in CYGWIN && <main-target-type>LIB in $(properties) && $toolset != gcc
|
|
{
|
|
.decl = "echo 'void __declspec(dllexport) foo(){}'" ;
|
|
}
|
|
|
|
|
|
.decl1 on $(<) = $(.decl:E="echo //") ;
|
|
|
|
# Further files must be touched also; NT doesn't have a touch command
|
|
local i = [ print.echo-cmd "#include <z.h>" ] ;
|
|
.decl2 on $(<) = "
|
|
$(i) > " ;
|
|
}
|
|
|
|
actions foo
|
|
{
|
|
$(.decl1) > $(<[1]) $(.decl2)$(<[2-])
|
|
}
|
|
|