mirror of https://gitlab.com/ita1024/waf.git
Api docs
This commit is contained in:
parent
fc02c1d42a
commit
4991120891
|
@ -35,7 +35,6 @@ Support for pure asm programs and libraries should also work::
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from waflib import Task
|
from waflib import Task
|
||||||
import waflib.Task
|
|
||||||
from waflib.Tools.ccroot import link_task, stlink_task
|
from waflib.Tools.ccroot import link_task, stlink_task
|
||||||
from waflib.TaskGen import extension
|
from waflib.TaskGen import extension
|
||||||
|
|
||||||
|
|
|
@ -10,30 +10,30 @@ from waflib.Tools.ccroot import link_task, stlink_task
|
||||||
|
|
||||||
@TaskGen.extension('.c')
|
@TaskGen.extension('.c')
|
||||||
def c_hook(self, node):
|
def c_hook(self, node):
|
||||||
"Bind the c file extension to the creation of a :py:class:`waflib.Tools.c.c` instance"
|
"Binds the c file extensions create :py:class:`waflib.Tools.c.c` instances"
|
||||||
if not self.env.CC and self.env.CXX:
|
if not self.env.CC and self.env.CXX:
|
||||||
return self.create_compiled_task('cxx', node)
|
return self.create_compiled_task('cxx', node)
|
||||||
return self.create_compiled_task('c', node)
|
return self.create_compiled_task('c', node)
|
||||||
|
|
||||||
class c(Task.Task):
|
class c(Task.Task):
|
||||||
"Compile C files into object files"
|
"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} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
|
||||||
vars = ['CCDEPS'] # unused variable to depend on, just in case
|
vars = ['CCDEPS'] # unused variable to depend on, just in case
|
||||||
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
|
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
|
||||||
scan = c_preproc.scan
|
scan = c_preproc.scan
|
||||||
|
|
||||||
class cprogram(link_task):
|
class cprogram(link_task):
|
||||||
"Link object files into a c program"
|
"Links object files into c programs"
|
||||||
run_str = '${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
|
run_str = '${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
|
||||||
ext_out = ['.bin']
|
ext_out = ['.bin']
|
||||||
vars = ['LINKDEPS']
|
vars = ['LINKDEPS']
|
||||||
inst_to = '${BINDIR}'
|
inst_to = '${BINDIR}'
|
||||||
|
|
||||||
class cshlib(cprogram):
|
class cshlib(cprogram):
|
||||||
"Link object files into a c shared library"
|
"Links object files into c shared libraries"
|
||||||
inst_to = '${LIBDIR}'
|
inst_to = '${LIBDIR}'
|
||||||
|
|
||||||
class cstlib(stlink_task):
|
class cstlib(stlink_task):
|
||||||
"Link object files into a c static library"
|
"Links object files into a c static libraries"
|
||||||
pass # do not remove
|
pass # do not remove
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ MacOSX related tools
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, shutil, platform
|
import os, shutil, platform
|
||||||
from waflib import Task, Utils, Errors
|
from waflib import Task, Utils
|
||||||
from waflib.TaskGen import taskgen_method, feature, after_method, before_method
|
from waflib.TaskGen import taskgen_method, feature, after_method, before_method
|
||||||
|
|
||||||
app_info = '''
|
app_info = '''
|
||||||
|
@ -46,7 +46,7 @@ def set_macosx_deployment_target(self):
|
||||||
@taskgen_method
|
@taskgen_method
|
||||||
def create_bundle_dirs(self, name, out):
|
def create_bundle_dirs(self, name, out):
|
||||||
"""
|
"""
|
||||||
Create bundle folders, used by :py:func:`create_task_macplist` and :py:func:`create_task_macapp`
|
Creates bundle folders, used by :py:func:`create_task_macplist` and :py:func:`create_task_macapp`
|
||||||
"""
|
"""
|
||||||
dir = out.parent.find_or_declare(name)
|
dir = out.parent.find_or_declare(name)
|
||||||
dir.mkdir()
|
dir.mkdir()
|
||||||
|
@ -112,7 +112,7 @@ def create_task_macapp(self):
|
||||||
@after_method('apply_link')
|
@after_method('apply_link')
|
||||||
def create_task_macplist(self):
|
def create_task_macplist(self):
|
||||||
"""
|
"""
|
||||||
Create a :py:class:`waflib.Tools.c_osx.macplist` instance.
|
Creates a :py:class:`waflib.Tools.c_osx.macplist` instance.
|
||||||
"""
|
"""
|
||||||
if self.env['MACAPP'] or getattr(self, 'mac_app', False):
|
if self.env['MACAPP'] or getattr(self, 'mac_app', False):
|
||||||
out = self.link_task.outputs[0]
|
out = self.link_task.outputs[0]
|
||||||
|
@ -169,7 +169,7 @@ app_dirs = ['Contents', 'Contents/MacOS', 'Contents/Resources']
|
||||||
|
|
||||||
class macapp(Task.Task):
|
class macapp(Task.Task):
|
||||||
"""
|
"""
|
||||||
Create mac applications
|
Creates mac applications
|
||||||
"""
|
"""
|
||||||
color = 'PINK'
|
color = 'PINK'
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -178,7 +178,7 @@ class macapp(Task.Task):
|
||||||
|
|
||||||
class macplist(Task.Task):
|
class macplist(Task.Task):
|
||||||
"""
|
"""
|
||||||
Create plist files
|
Creates plist files
|
||||||
"""
|
"""
|
||||||
color = 'PINK'
|
color = 'PINK'
|
||||||
ext_in = ['.bin']
|
ext_in = ['.bin']
|
||||||
|
@ -190,3 +190,4 @@ class macplist(Task.Task):
|
||||||
context = getattr(self, 'context', {})
|
context = getattr(self, 'context', {})
|
||||||
txt = txt.format(**context)
|
txt = txt.format(**context)
|
||||||
self.outputs[0].write(txt)
|
self.outputs[0].write(txt)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from waflib.Configure import conf
|
||||||
@conf
|
@conf
|
||||||
def find_clang(conf):
|
def find_clang(conf):
|
||||||
"""
|
"""
|
||||||
Find the program clang and execute it to ensure it really is clang
|
Finds the program clang and executes it to ensure it really is clang
|
||||||
"""
|
"""
|
||||||
cc = conf.find_program('clang', var='CC')
|
cc = conf.find_program('clang', var='CC')
|
||||||
conf.get_cc_version(cc, clang=True)
|
conf.get_cc_version(cc, clang=True)
|
||||||
|
|
|
@ -12,7 +12,7 @@ from waflib.Configure import conf
|
||||||
@conf
|
@conf
|
||||||
def find_clangxx(conf):
|
def find_clangxx(conf):
|
||||||
"""
|
"""
|
||||||
Find the program clang++, and execute it to ensure it really is clang++
|
Finds the program clang++, and executes it to ensure it really is clang++
|
||||||
"""
|
"""
|
||||||
cxx = conf.find_program('clang++', var='CXX')
|
cxx = conf.find_program('clang++', var='CXX')
|
||||||
conf.get_cc_version(cxx, clang=True)
|
conf.get_cc_version(cxx, clang=True)
|
||||||
|
|
|
@ -50,7 +50,7 @@ c_compiler = {
|
||||||
'default':['clang', 'gcc'],
|
'default':['clang', 'gcc'],
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
Dict mapping the platform names to Waf tools finding specific C compilers::
|
Dict mapping platform names to Waf tools finding specific C compilers::
|
||||||
|
|
||||||
from waflib.Tools.compiler_c import c_compiler
|
from waflib.Tools.compiler_c import c_compiler
|
||||||
c_compiler['linux'] = ['gcc', 'icc', 'suncc']
|
c_compiler['linux'] = ['gcc', 'icc', 'suncc']
|
||||||
|
@ -63,10 +63,14 @@ def default_compilers():
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
"""
|
"""
|
||||||
Try to find a suitable C compiler or raise a :py:class:`waflib.Errors.ConfigurationError`.
|
Detects a suitable C compiler
|
||||||
|
|
||||||
|
:raises: :py:class:`waflib.Errors.ConfigurationError` when no suitable compiler is found
|
||||||
"""
|
"""
|
||||||
try: test_for_compiler = conf.options.check_c_compiler or default_compilers()
|
try:
|
||||||
except AttributeError: conf.fatal("Add options(opt): opt.load('compiler_c')")
|
test_for_compiler = conf.options.check_c_compiler or default_compilers()
|
||||||
|
except AttributeError:
|
||||||
|
conf.fatal("Add options(opt): opt.load('compiler_c')")
|
||||||
|
|
||||||
for compiler in re.split('[ ,]+', test_for_compiler):
|
for compiler in re.split('[ ,]+', test_for_compiler):
|
||||||
conf.env.stash()
|
conf.env.stash()
|
||||||
|
@ -78,9 +82,9 @@ def configure(conf):
|
||||||
conf.end_msg(False)
|
conf.end_msg(False)
|
||||||
debug('compiler_c: %r', e)
|
debug('compiler_c: %r', e)
|
||||||
else:
|
else:
|
||||||
if conf.env['CC']:
|
if conf.env.CC:
|
||||||
conf.end_msg(conf.env.get_flat('CC'))
|
conf.end_msg(conf.env.get_flat('CC'))
|
||||||
conf.env['COMPILER_CC'] = compiler
|
conf.env.COMPILER_CC = compiler
|
||||||
conf.env.commit()
|
conf.env.commit()
|
||||||
break
|
break
|
||||||
conf.env.revert()
|
conf.env.revert()
|
||||||
|
@ -90,7 +94,7 @@ def configure(conf):
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
"""
|
"""
|
||||||
Restrict the compiler detection from the command-line::
|
This is how to provide compiler preferences on the command-line::
|
||||||
|
|
||||||
$ waf configure --check-c-compiler=gcc
|
$ waf configure --check-c-compiler=gcc
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -64,10 +64,14 @@ def default_compilers():
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
"""
|
"""
|
||||||
Try to find a suitable C++ compiler or raise a :py:class:`waflib.Errors.ConfigurationError`.
|
Detects a suitable C++ compiler
|
||||||
|
|
||||||
|
:raises: :py:class:`waflib.Errors.ConfigurationError` when no suitable compiler is found
|
||||||
"""
|
"""
|
||||||
try: test_for_compiler = conf.options.check_cxx_compiler or default_compilers()
|
try:
|
||||||
except AttributeError: conf.fatal("Add options(opt): opt.load('compiler_cxx')")
|
test_for_compiler = conf.options.check_cxx_compiler or default_compilers()
|
||||||
|
except AttributeError:
|
||||||
|
conf.fatal("Add options(opt): opt.load('compiler_cxx')")
|
||||||
|
|
||||||
for compiler in re.split('[ ,]+', test_for_compiler):
|
for compiler in re.split('[ ,]+', test_for_compiler):
|
||||||
conf.env.stash()
|
conf.env.stash()
|
||||||
|
@ -79,9 +83,9 @@ def configure(conf):
|
||||||
conf.end_msg(False)
|
conf.end_msg(False)
|
||||||
debug('compiler_cxx: %r', e)
|
debug('compiler_cxx: %r', e)
|
||||||
else:
|
else:
|
||||||
if conf.env['CXX']:
|
if conf.envCXX:
|
||||||
conf.end_msg(conf.env.get_flat('CXX'))
|
conf.end_msg(conf.env.get_flat('CXX'))
|
||||||
conf.env['COMPILER_CXX'] = compiler
|
conf.env.COMPILER_CXX = compiler
|
||||||
conf.env.commit()
|
conf.env.commit()
|
||||||
break
|
break
|
||||||
conf.env.revert()
|
conf.env.revert()
|
||||||
|
@ -91,7 +95,7 @@ def configure(conf):
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
"""
|
"""
|
||||||
Restrict the compiler detection from the command-line::
|
This is how to provide compiler preferences on the command-line::
|
||||||
|
|
||||||
$ waf configure --check-cxx-compiler=gxx
|
$ waf configure --check-cxx-compiler=gxx
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -40,10 +40,14 @@ def default_compilers():
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
"""
|
"""
|
||||||
Try to find a suitable D compiler or raise a :py:class:`waflib.Errors.ConfigurationError`.
|
Detects a suitable D compiler
|
||||||
|
|
||||||
|
:raises: :py:class:`waflib.Errors.ConfigurationError` when no suitable compiler is found
|
||||||
"""
|
"""
|
||||||
try: test_for_compiler = conf.options.check_d_compiler or default_compilers()
|
try:
|
||||||
except AttributeError: conf.fatal("Add options(opt): opt.load('compiler_d')")
|
test_for_compiler = conf.options.check_d_compiler or default_compilers()
|
||||||
|
except AttributeError:
|
||||||
|
conf.fatal("Add options(opt): opt.load('compiler_d')")
|
||||||
|
|
||||||
for compiler in re.split('[ ,]+', test_for_compiler):
|
for compiler in re.split('[ ,]+', test_for_compiler):
|
||||||
conf.env.stash()
|
conf.env.stash()
|
||||||
|
@ -57,7 +61,7 @@ def configure(conf):
|
||||||
else:
|
else:
|
||||||
if conf.env.D:
|
if conf.env.D:
|
||||||
conf.end_msg(conf.env.get_flat('D'))
|
conf.end_msg(conf.env.get_flat('D'))
|
||||||
conf.env['COMPILER_D'] = compiler
|
conf.env.COMPILER_D = compiler
|
||||||
conf.env.commit()
|
conf.env.commit()
|
||||||
break
|
break
|
||||||
conf.env.revert()
|
conf.env.revert()
|
||||||
|
@ -67,7 +71,7 @@ def configure(conf):
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
"""
|
"""
|
||||||
Restrict the compiler detection from the command-line::
|
This is how to provide compiler preferences on the command-line::
|
||||||
|
|
||||||
$ waf configure --check-d-compiler=dmd
|
$ waf configure --check-d-compiler=dmd
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,10 +27,14 @@ def default_compilers():
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
"""
|
"""
|
||||||
Try to find a suitable Fortran compiler or raise a :py:class:`waflib.Errors.ConfigurationError`.
|
Detects a suitable Fortran compiler
|
||||||
|
|
||||||
|
:raises: :py:class:`waflib.Errors.ConfigurationError` when no suitable compiler is found
|
||||||
"""
|
"""
|
||||||
try: test_for_compiler = conf.options.check_fortran_compiler or default_compilers()
|
try:
|
||||||
except AttributeError: conf.fatal("Add options(opt): opt.load('compiler_fc')")
|
test_for_compiler = conf.options.check_fortran_compiler or default_compilers()
|
||||||
|
except AttributeError:
|
||||||
|
conf.fatal("Add options(opt): opt.load('compiler_fc')")
|
||||||
for compiler in re.split('[ ,]+', test_for_compiler):
|
for compiler in re.split('[ ,]+', test_for_compiler):
|
||||||
conf.env.stash()
|
conf.env.stash()
|
||||||
conf.start_msg('Checking for %r (Fortran compiler)' % compiler)
|
conf.start_msg('Checking for %r (Fortran compiler)' % compiler)
|
||||||
|
@ -41,7 +45,7 @@ def configure(conf):
|
||||||
conf.end_msg(False)
|
conf.end_msg(False)
|
||||||
Logs.debug('compiler_fortran: %r', e)
|
Logs.debug('compiler_fortran: %r', e)
|
||||||
else:
|
else:
|
||||||
if conf.env['FC']:
|
if conf.env.FC:
|
||||||
conf.end_msg(conf.env.get_flat('FC'))
|
conf.end_msg(conf.env.get_flat('FC'))
|
||||||
conf.env.COMPILER_FORTRAN = compiler
|
conf.env.COMPILER_FORTRAN = compiler
|
||||||
conf.env.commit()
|
conf.env.commit()
|
||||||
|
@ -53,7 +57,7 @@ def configure(conf):
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
"""
|
"""
|
||||||
Restrict the compiler detection from the command-line::
|
This is how to provide compiler preferences on the command-line::
|
||||||
|
|
||||||
$ waf configure --check-fortran-compiler=ifort
|
$ waf configure --check-fortran-compiler=ifort
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -25,7 +25,6 @@ from waflib import Utils, Task, Options, Errors
|
||||||
from waflib.TaskGen import before_method, after_method, feature
|
from waflib.TaskGen import before_method, after_method, feature
|
||||||
from waflib.Tools import ccroot
|
from waflib.Tools import ccroot
|
||||||
from waflib.Configure import conf
|
from waflib.Configure import conf
|
||||||
import os, tempfile
|
|
||||||
|
|
||||||
ccroot.USELIB_VARS['cs'] = set(['CSFLAGS', 'ASSEMBLIES', 'RESOURCES'])
|
ccroot.USELIB_VARS['cs'] = set(['CSFLAGS', 'ASSEMBLIES', 'RESOURCES'])
|
||||||
ccroot.lib_patterns['csshlib'] = ['%s']
|
ccroot.lib_patterns['csshlib'] = ['%s']
|
||||||
|
|
|
@ -10,31 +10,31 @@ from waflib.Tools.ccroot import link_task, stlink_task
|
||||||
|
|
||||||
@TaskGen.extension('.cpp','.cc','.cxx','.C','.c++')
|
@TaskGen.extension('.cpp','.cc','.cxx','.C','.c++')
|
||||||
def cxx_hook(self, node):
|
def cxx_hook(self, node):
|
||||||
"Bind the c++ file extensions to the creation of a :py:class:`waflib.Tools.cxx.cxx` instance"
|
"Binds c++ file extensions to create :py:class:`waflib.Tools.cxx.cxx` instances"
|
||||||
return self.create_compiled_task('cxx', node)
|
return self.create_compiled_task('cxx', node)
|
||||||
|
|
||||||
if not '.c' in TaskGen.task_gen.mappings:
|
if not '.c' in TaskGen.task_gen.mappings:
|
||||||
TaskGen.task_gen.mappings['.c'] = TaskGen.task_gen.mappings['.cpp']
|
TaskGen.task_gen.mappings['.c'] = TaskGen.task_gen.mappings['.cpp']
|
||||||
|
|
||||||
class cxx(Task.Task):
|
class cxx(Task.Task):
|
||||||
"Compile C++ files into object files"
|
"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} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
|
||||||
vars = ['CXXDEPS'] # unused variable to depend on, just in case
|
vars = ['CXXDEPS'] # unused variable to depend on, just in case
|
||||||
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
|
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
|
||||||
scan = c_preproc.scan
|
scan = c_preproc.scan
|
||||||
|
|
||||||
class cxxprogram(link_task):
|
class cxxprogram(link_task):
|
||||||
"Link object files into a c++ program"
|
"Links object files into c++ programs"
|
||||||
run_str = '${LINK_CXX} ${LINKFLAGS} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
|
run_str = '${LINK_CXX} ${LINKFLAGS} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
|
||||||
vars = ['LINKDEPS']
|
vars = ['LINKDEPS']
|
||||||
ext_out = ['.bin']
|
ext_out = ['.bin']
|
||||||
inst_to = '${BINDIR}'
|
inst_to = '${BINDIR}'
|
||||||
|
|
||||||
class cxxshlib(cxxprogram):
|
class cxxshlib(cxxprogram):
|
||||||
"Link object files into a c++ shared library"
|
"Links object files into c++ shared libraries"
|
||||||
inst_to = '${LIBDIR}'
|
inst_to = '${LIBDIR}'
|
||||||
|
|
||||||
class cxxstlib(stlink_task):
|
class cxxstlib(stlink_task):
|
||||||
"Link object files into a c++ static library"
|
"Links object files into c++ static libraries"
|
||||||
pass # do not remove
|
pass # do not remove
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Provide a scanner for finding dependencies on d files
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from waflib import Utils, Logs
|
from waflib import Utils
|
||||||
|
|
||||||
def filter_comments(filename):
|
def filter_comments(filename):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -24,7 +24,7 @@ meths_typos = ['__call__', 'program', 'shlib', 'stlib', 'objects']
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from waflib import Logs, Build, Node, Task, TaskGen, ConfigSet, Errors, Utils
|
from waflib import Logs, Build, Node, Task, TaskGen, ConfigSet, Errors, Utils
|
||||||
import waflib.Tools.ccroot
|
from waflib.Tools import ccroot
|
||||||
|
|
||||||
def check_same_targets(self):
|
def check_same_targets(self):
|
||||||
mp = Utils.defaultdict(list)
|
mp = Utils.defaultdict(list)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
fortran support
|
fortran support
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from waflib import Utils, Task, Logs
|
from waflib import Utils, Task
|
||||||
from waflib.Tools import ccroot, fc_config, fc_scan
|
from waflib.Tools import ccroot, fc_config, fc_scan
|
||||||
from waflib.TaskGen import extension
|
from waflib.TaskGen import extension
|
||||||
from waflib.Configure import conf
|
from waflib.Configure import conf
|
||||||
|
@ -19,13 +19,13 @@ ccroot.USELIB_VARS['fcstlib'] = set(['ARFLAGS', 'LINKDEPS'])
|
||||||
|
|
||||||
@extension('.f', '.f90', '.F', '.F90', '.for', '.FOR')
|
@extension('.f', '.f90', '.F', '.F90', '.for', '.FOR')
|
||||||
def fc_hook(self, node):
|
def fc_hook(self, node):
|
||||||
"Bind the typical Fortran file extensions to the creation of a :py:class:`waflib.Tools.fc.fc` instance"
|
"Binds the Fortran file extensions create :py:class:`waflib.Tools.fc.fc` instances"
|
||||||
return self.create_compiled_task('fc', node)
|
return self.create_compiled_task('fc', node)
|
||||||
|
|
||||||
@conf
|
@conf
|
||||||
def modfile(conf, name):
|
def modfile(conf, name):
|
||||||
"""
|
"""
|
||||||
Turn a module name into the right module file name.
|
Turns a module name into the right module file name.
|
||||||
Defaults to all lower case.
|
Defaults to all lower case.
|
||||||
"""
|
"""
|
||||||
return {'lower' :name.lower() + '.mod',
|
return {'lower' :name.lower() + '.mod',
|
||||||
|
@ -35,8 +35,10 @@ def modfile(conf, name):
|
||||||
|
|
||||||
def get_fortran_tasks(tsk):
|
def get_fortran_tasks(tsk):
|
||||||
"""
|
"""
|
||||||
Obtain all other fortran tasks from the same build group. Those tasks must not have
|
Obtains all fortran tasks from the same build group. Those tasks must not have
|
||||||
the attribute 'nomod' or 'mod_fortran_done'
|
the attribute 'nomod' or 'mod_fortran_done'
|
||||||
|
|
||||||
|
:return: a list of :py:class:`waflib.Tools.fc.fc` instances
|
||||||
"""
|
"""
|
||||||
bld = tsk.generator.bld
|
bld = tsk.generator.bld
|
||||||
tasks = bld.get_tasks_group(bld.get_group_idx(tsk.generator))
|
tasks = bld.get_tasks_group(bld.get_group_idx(tsk.generator))
|
||||||
|
@ -44,17 +46,16 @@ def get_fortran_tasks(tsk):
|
||||||
|
|
||||||
class fc(Task.Task):
|
class fc(Task.Task):
|
||||||
"""
|
"""
|
||||||
The fortran tasks can only run when all fortran tasks in the current group are ready to be executed
|
Fortran tasks can only run when all fortran tasks in the current group are ready to be executed
|
||||||
This may cause a deadlock if another fortran task is waiting for something that cannot happen (circular dependency)
|
This may cause a deadlock if some fortran task is waiting for something that cannot happen (circular dependency)
|
||||||
in this case, set the 'nomod=True' on those tasks instances to break the loop
|
Should this ever happen, set the 'nomod=True' on those tasks instances to break the loop
|
||||||
"""
|
"""
|
||||||
|
|
||||||
color = 'GREEN'
|
color = 'GREEN'
|
||||||
run_str = '${FC} ${FCFLAGS} ${FCINCPATH_ST:INCPATHS} ${FCDEFINES_ST:DEFINES} ${_FCMODOUTFLAGS} ${FC_TGT_F}${TGT[0].abspath()} ${FC_SRC_F}${SRC[0].abspath()} ${FCPPFLAGS}'
|
run_str = '${FC} ${FCFLAGS} ${FCINCPATH_ST:INCPATHS} ${FCDEFINES_ST:DEFINES} ${_FCMODOUTFLAGS} ${FC_TGT_F}${TGT[0].abspath()} ${FC_SRC_F}${SRC[0].abspath()} ${FCPPFLAGS}'
|
||||||
vars = ["FORTRANMODPATHFLAG"]
|
vars = ["FORTRANMODPATHFLAG"]
|
||||||
|
|
||||||
def scan(self):
|
def scan(self):
|
||||||
"""scanner for fortran dependencies"""
|
"""Scanner for fortran dependencies"""
|
||||||
tmp = fc_scan.fortran_parser(self.generator.includes_nodes)
|
tmp = fc_scan.fortran_parser(self.generator.includes_nodes)
|
||||||
tmp.task = self
|
tmp.task = self
|
||||||
tmp.start(self.inputs[0])
|
tmp.start(self.inputs[0])
|
||||||
|
@ -62,7 +63,7 @@ class fc(Task.Task):
|
||||||
|
|
||||||
def runnable_status(self):
|
def runnable_status(self):
|
||||||
"""
|
"""
|
||||||
Set the mod file outputs and the dependencies on the mod files over all the fortran tasks
|
Sets the mod file outputs and the dependencies on the mod files over all Fortran tasks
|
||||||
executed by the main thread so there are no concurrency issues
|
executed by the main thread so there are no concurrency issues
|
||||||
"""
|
"""
|
||||||
if getattr(self, 'mod_fortran_done', None):
|
if getattr(self, 'mod_fortran_done', None):
|
||||||
|
@ -140,17 +141,21 @@ class fc(Task.Task):
|
||||||
return super(fc, self).runnable_status()
|
return super(fc, self).runnable_status()
|
||||||
|
|
||||||
class fcprogram(ccroot.link_task):
|
class fcprogram(ccroot.link_task):
|
||||||
"""Link fortran programs"""
|
"""Links fortran programs"""
|
||||||
color = 'YELLOW'
|
color = 'YELLOW'
|
||||||
run_str = '${FC} ${LINKFLAGS} ${FCLNK_SRC_F}${SRC} ${FCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FCSTLIB_MARKER} ${FCSTLIBPATH_ST:STLIBPATH} ${FCSTLIB_ST:STLIB} ${FCSHLIB_MARKER} ${FCLIBPATH_ST:LIBPATH} ${FCLIB_ST:LIB} ${LDFLAGS}'
|
run_str = '${FC} ${LINKFLAGS} ${FCLNK_SRC_F}${SRC} ${FCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FCSTLIB_MARKER} ${FCSTLIBPATH_ST:STLIBPATH} ${FCSTLIB_ST:STLIB} ${FCSHLIB_MARKER} ${FCLIBPATH_ST:LIBPATH} ${FCLIB_ST:LIB} ${LDFLAGS}'
|
||||||
inst_to = '${BINDIR}'
|
inst_to = '${BINDIR}'
|
||||||
|
|
||||||
class fcshlib(fcprogram):
|
class fcshlib(fcprogram):
|
||||||
"""Link fortran libraries"""
|
"""Links fortran libraries"""
|
||||||
inst_to = '${LIBDIR}'
|
inst_to = '${LIBDIR}'
|
||||||
|
|
||||||
|
class fcstlib(ccroot.stlink_task):
|
||||||
|
"""Links fortran static libraries (uses ar by default)"""
|
||||||
|
pass # do not remove the pass statement
|
||||||
|
|
||||||
class fcprogram_test(fcprogram):
|
class fcprogram_test(fcprogram):
|
||||||
"""Custom link task to obtain the compiler outputs for fortran configuration tests"""
|
"""Custom link task to obtain compiler outputs for Fortran configuration tests"""
|
||||||
|
|
||||||
def runnable_status(self):
|
def runnable_status(self):
|
||||||
"""This task is always executed"""
|
"""This task is always executed"""
|
||||||
|
@ -160,7 +165,7 @@ class fcprogram_test(fcprogram):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def exec_command(self, cmd, **kw):
|
def exec_command(self, cmd, **kw):
|
||||||
"""Store the compiler std our/err onto the build context, to bld.out + bld.err"""
|
"""Stores the compiler std our/err onto the build context, to bld.out + bld.err"""
|
||||||
bld = self.generator.bld
|
bld = self.generator.bld
|
||||||
|
|
||||||
kw['shell'] = isinstance(cmd, str)
|
kw['shell'] = isinstance(cmd, str)
|
||||||
|
@ -181,7 +186,3 @@ class fcprogram_test(fcprogram):
|
||||||
if bld.err:
|
if bld.err:
|
||||||
bld.to_log("err: %s\n" % bld.err)
|
bld.to_log("err: %s\n" % bld.err)
|
||||||
|
|
||||||
class fcstlib(ccroot.stlink_task):
|
|
||||||
"""Link fortran static libraries (uses ar by default)"""
|
|
||||||
pass # do not remove the pass statement
|
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ re_mod = re.compile(MOD_REGEX, re.I)
|
||||||
|
|
||||||
class fortran_parser(object):
|
class fortran_parser(object):
|
||||||
"""
|
"""
|
||||||
This parser will return:
|
This parser returns:
|
||||||
|
|
||||||
* the nodes corresponding to the module names that will be produced
|
* the nodes corresponding to the module names to produce
|
||||||
* the nodes corresponding to the include files used
|
* the nodes corresponding to the include files used
|
||||||
* the module names used by the fortran file
|
* the module names used by the fortran files
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, incpaths):
|
def __init__(self, incpaths):
|
||||||
self.seen = []
|
self.seen = []
|
||||||
"""Files already parsed"""
|
"""Files already parsed"""
|
||||||
|
@ -37,7 +36,7 @@ class fortran_parser(object):
|
||||||
|
|
||||||
def find_deps(self, node):
|
def find_deps(self, node):
|
||||||
"""
|
"""
|
||||||
Parse a fortran file to read the dependencies used and provided
|
Parses a Fortran file to obtain the dependencies used/provided
|
||||||
|
|
||||||
:param node: fortran file to read
|
:param node: fortran file to read
|
||||||
:type node: :py:class:`waflib.Node.Node`
|
:type node: :py:class:`waflib.Node.Node`
|
||||||
|
@ -63,7 +62,7 @@ class fortran_parser(object):
|
||||||
|
|
||||||
def start(self, node):
|
def start(self, node):
|
||||||
"""
|
"""
|
||||||
Start the parsing. Use the stack self.waiting to hold the nodes to iterate on
|
Start parsing. Use the stack ``self.waiting`` to hold nodes to iterate on
|
||||||
|
|
||||||
:param node: fortran file
|
:param node: fortran file
|
||||||
:type node: :py:class:`waflib.Node.Node`
|
:type node: :py:class:`waflib.Node.Node`
|
||||||
|
@ -75,8 +74,8 @@ class fortran_parser(object):
|
||||||
|
|
||||||
def iter(self, node):
|
def iter(self, node):
|
||||||
"""
|
"""
|
||||||
Process a single file in the search for dependencies, extract the files used
|
Processes a single file during dependency parsing. Extracts files used
|
||||||
the modules used, and the modules provided.
|
modules used and modules provided.
|
||||||
"""
|
"""
|
||||||
incs, uses, mods = self.find_deps(node)
|
incs, uses, mods = self.find_deps(node)
|
||||||
for x in incs:
|
for x in incs:
|
||||||
|
@ -97,7 +96,7 @@ class fortran_parser(object):
|
||||||
|
|
||||||
def tryfind_header(self, filename):
|
def tryfind_header(self, filename):
|
||||||
"""
|
"""
|
||||||
Try to find an include and add it the nodes to process
|
Adds an include file to the list of nodes to process
|
||||||
|
|
||||||
:param filename: file name
|
:param filename: file name
|
||||||
:type filename: string
|
:type filename: string
|
||||||
|
@ -113,4 +112,3 @@ class fortran_parser(object):
|
||||||
if not filename in self.names:
|
if not filename in self.names:
|
||||||
self.names.append(filename)
|
self.names.append(filename)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
# DC 2008
|
# DC 2008
|
||||||
# Thomas Nagy 2016 (ita)
|
# Thomas Nagy 2016 (ita)
|
||||||
|
|
||||||
import re
|
import os, re
|
||||||
from waflib import Utils
|
from waflib import Utils, Logs, Errors
|
||||||
from waflib.Tools import fc, fc_config, fc_scan, ar
|
from waflib.Tools import fc, fc_config, fc_scan, ar, ccroot
|
||||||
from waflib.Configure import conf
|
from waflib.Configure import conf
|
||||||
|
from waflib.TaskGen import after_method, feature
|
||||||
|
|
||||||
@conf
|
@conf
|
||||||
def find_ifort(conf):
|
def find_ifort(conf):
|
||||||
|
@ -94,13 +95,6 @@ def configure(conf):
|
||||||
conf.fc_add_flags()
|
conf.fc_add_flags()
|
||||||
conf.ifort_modifier_platform()
|
conf.ifort_modifier_platform()
|
||||||
|
|
||||||
import os, re
|
|
||||||
from waflib import Task, Logs, Errors
|
|
||||||
from waflib.TaskGen import after_method, feature
|
|
||||||
|
|
||||||
from waflib.Configure import conf
|
|
||||||
from waflib.Tools import ccroot, ar
|
|
||||||
|
|
||||||
|
|
||||||
all_ifort_platforms = [ ('intel64', 'amd64'), ('em64t', 'amd64'), ('ia32', 'x86'), ('Itanium', 'ia64')]
|
all_ifort_platforms = [ ('intel64', 'amd64'), ('em64t', 'amd64'), ('ia32', 'x86'), ('Itanium', 'ia64')]
|
||||||
"""List of icl platforms"""
|
"""List of icl platforms"""
|
||||||
|
|
|
@ -53,7 +53,7 @@ Setting PYTHONUNBUFFERED gives the unbuffered output.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, sys, re
|
import os, sys, re
|
||||||
from waflib import Utils, Task, Logs, Options, Errors
|
from waflib import Utils, Logs, Options, Errors
|
||||||
from waflib.TaskGen import after_method, feature
|
from waflib.TaskGen import after_method, feature
|
||||||
|
|
||||||
from waflib.Configure import conf
|
from waflib.Configure import conf
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Process *.rc* files for C/C++: X{.rc -> [.res|.rc.o]}"
|
"Process *.rc* files for C/C++: X{.rc -> [.res|.rc.o]}"
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from waflib import Task, Logs, Utils
|
from waflib import Task
|
||||||
from waflib.TaskGen import extension
|
from waflib.TaskGen import extension
|
||||||
from waflib.Tools import c_preproc
|
from waflib.Tools import c_preproc
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue