mirror of https://gitlab.com/ita1024/waf.git
add file includes
This commit is contained in:
parent
816f466e32
commit
c7b2a5628e
|
@ -0,0 +1,4 @@
|
|||
#ifndef HEADER_H
|
||||
#define HEADER_H
|
||||
#define HELLO_WORLD "Hello World"
|
||||
#endif /* HEADER_H */
|
|
@ -4,5 +4,6 @@ extern void foo();
|
|||
|
||||
int main() {
|
||||
foo();
|
||||
printf("%s", HELLO_WORLD);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ def build(bld):
|
|||
bld.shlib(source='a.cpp', target='mylib', vnum='9.8.7')
|
||||
bld.shlib(source='a.cpp', target='mylib2', vnum='9.8.7', cnum='9.8')
|
||||
bld.shlib(source='a.cpp', target='mylib3')
|
||||
bld.program(source='main.cpp', target='app', use='mylib')
|
||||
bld.program(source='main.cpp', target='app', include_files='file-include/inc-file/header.h', use='mylib')
|
||||
bld.stlib(target='foo', source='b.cpp')
|
||||
|
||||
# just a test to check if the .c is compiled as c++ when no c compiler is found
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef HEADER_H
|
||||
#define HEADER_H
|
||||
#define HELLO_WORLD "Hello World"
|
||||
#endif /* HEADER_H */
|
|
@ -0,0 +1,7 @@
|
|||
#include<stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%s", HELLO_WORLD);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
bld(features='c cprogram', source='main.c', include_files='inc-file/header.h', target='app')
|
|
@ -78,7 +78,7 @@ def configure(conf):
|
|||
def build(bld):
|
||||
bld.env.DEFINES=['WAF=1']
|
||||
|
||||
bld.recurse('program stlib stlib-deps shlib')
|
||||
bld.recurse('program stlib stlib-deps shlib file-include')
|
||||
#bld.install_files('/tmp/foo', 'wscript')
|
||||
#bld.env.PREFIX='/tmp/foo'
|
||||
bld.install_files('${PREFIX}/', 'program/a.h program/main.c', relative_trick=False)
|
||||
|
|
|
@ -518,6 +518,22 @@ class Node(object):
|
|||
else:
|
||||
return self.abspath()
|
||||
|
||||
def is_file(self):
|
||||
"""
|
||||
Returns True if the Node object is a file.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return os.path.isfile(self.abspath())
|
||||
|
||||
def is_directory(self):
|
||||
"""
|
||||
Returns True if the Node object is a directory.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return os.path.isdir(self.abspath())
|
||||
|
||||
def abspath(self):
|
||||
"""
|
||||
Returns the absolute path. A cache is kept in the context as ``cache_node_abspath``
|
||||
|
|
|
@ -17,7 +17,7 @@ def c_hook(self, node):
|
|||
|
||||
class c(Task.Task):
|
||||
"Compiles C files into object files"
|
||||
run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
|
||||
run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${CPPFILES_ST:INCFILES} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
|
||||
vars = ['CCDEPS'] # unused variable to depend on, just in case
|
||||
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
|
||||
scan = c_preproc.scan
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,7 +18,7 @@ if not '.c' in TaskGen.task_gen.mappings:
|
|||
|
||||
class cxx(Task.Task):
|
||||
"Compiles C++ files into object files"
|
||||
run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
|
||||
run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${CPPFILES_ST:INCFILES} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
|
||||
vars = ['CXXDEPS'] # unused variable to depend on, just in case
|
||||
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
|
||||
scan = c_preproc.scan
|
||||
|
|
|
@ -36,6 +36,7 @@ def gcc_common_flags(conf):
|
|||
v.CCLNK_SRC_F = []
|
||||
v.CCLNK_TGT_F = ['-o']
|
||||
v.CPPPATH_ST = '-I%s'
|
||||
v.CPPFILES_ST = '-include%s'
|
||||
v.DEFINES_ST = '-D%s'
|
||||
|
||||
v.LIB_ST = '-l%s' # template for adding libs
|
||||
|
|
|
@ -36,6 +36,7 @@ def gxx_common_flags(conf):
|
|||
v.CXXLNK_SRC_F = []
|
||||
v.CXXLNK_TGT_F = ['-o']
|
||||
v.CPPPATH_ST = '-I%s'
|
||||
v.CPPFILES_ST = '-include%s'
|
||||
v.DEFINES_ST = '-D%s'
|
||||
|
||||
v.LIB_ST = '-l%s' # template for adding libs
|
||||
|
|
|
@ -909,7 +909,8 @@ def msvc_common_flags(conf):
|
|||
v.CC_TGT_F = ['/FC'] + v.CC_TGT_F
|
||||
v.CXX_TGT_F = ['/FC'] + v.CXX_TGT_F
|
||||
|
||||
v.CPPPATH_ST = '/I%s' # template for adding include paths
|
||||
v.CPPPATH_ST = '/I%s' # template for adding include paths
|
||||
v.CPPFILES_ST = '/FI%s'
|
||||
|
||||
v.AR_TGT_F = v.CCLNK_TGT_F = v.CXXLNK_TGT_F = '/OUT:'
|
||||
|
||||
|
|
Loading…
Reference in New Issue