def _header_targets(self, name): if name not in self.__header_targets: include_dir = str( self.absolute_source_path('libs', name, 'include') ) res = [] for pat in ['*.h', '*.[hi]pp']: for h in tools.rglob(pat, include_dir): res.append(self.build.fs.copy( h, dest = str(self.build_path( 'install', 'include', path.relative(h, start = include_dir) )) )) self.__header_targets[name] = res return self.__header_targets[name]
def __init__(self, build, c_compiler, source_directory, shared = False, build_config = []): super().__init__( build, name = "Freetype2", source_directory = source_directory, build_config = build_config or [c_compiler.name, ], ) if c_compiler.lang != 'c': raise Exception( "Freetype needs a C compiler, got %s" % c_compiler ) self.compiler = c_compiler self.shared = shared ext = self.compiler.library_extension(shared) self.library_filename = 'libfreetype.%s' % ext self.env = {'CC': c_compiler.binary} sources = [ "src/base/ftsystem.c", # "src/base/ftinit.c", # "src/base/ftdebug.c", # "src/base/ftbase.c", # "src/base/ftbbox.c", # -- recommended, see <freetype/ftbbox.h> "src/base/ftglyph.c", # -- recommended, see <freetype/ftglyph.h> "src/base/ftbdf.c", # -- optional, see <freetype/ftbdf.h> "src/base/ftbitmap.c", # -- optional, see <freetype/ftbitmap.h> "src/base/ftcid.c", # -- optional, see <freetype/ftcid.h> "src/base/ftfstype.c", # -- optional "src/base/ftgasp.c", # -- optional, see <freetype/ftgasp.h> "src/base/ftgxval.c", # -- optional, see <freetype/ftgxval.h> "src/base/ftlcdfil.c", # -- optional, see <freetype/ftlcdfil.h> "src/base/ftmm.c", # -- optional, see <freetype/ftmm.h> "src/base/ftotval.c", # -- optional, see <freetype/ftotval.h> "src/base/ftpatent.c", # -- optional "src/base/ftpfr.c", # -- optional, see <freetype/ftpfr.h> "src/base/ftstroke.c", # -- optional, see <freetype/ftstroke.h> "src/base/ftsynth.c", # -- optional, see <freetype/ftsynth.h> "src/base/fttype1.c", # -- optional, see <freetype/t1tables.h> "src/base/ftwinfnt.c", # -- optional, see <freetype/ftwinfnt.h> "src/base/ftxf86.c", # -- optional, see <freetype/ftxf86.h> "src/bdf/bdf.c", # -- BDF font driver "src/cff/cff.c", # -- CFF/OpenType font driver "src/cid/type1cid.c", # -- Type 1 CID-keyed font driver "src/pcf/pcf.c", # -- PCF font driver "src/pfr/pfr.c", # -- PFR/TrueDoc font driver "src/sfnt/sfnt.c", # -- SFNT files support (TrueType & OpenType) "src/truetype/truetype.c", # -- TrueType font driver "src/type1/type1.c", # -- Type 1 font driver "src/type42/type42.c", # -- Type 42 font driver "src/winfonts/winfnt.c", # -- Windows FONT / FNT font driver "src/raster/raster.c", # -- monochrome rasterizer "src/smooth/smooth.c", # -- anti-aliasing rasterizer "src/autofit/autofit.c", # -- auto hinting module "src/cache/ftcache.c", # -- cache sub-system (in beta) "src/gzip/ftgzip.c", # -- support for compressed fonts (.gz) "src/lzw/ftlzw.c", # -- support for compressed fonts (.Z) "src/bzip2/ftbzip2.c", # -- support for compressed fonts (.bz2) "src/gxvalid/gxvalid.c", # -- TrueTypeGX/AAT table validation "src/otvalid/otvalid.c", # -- OpenType table validation "src/psaux/psaux.c", # -- PostScript Type 1 parsing "src/pshinter/pshinter.c", # -- PS hinting module "src/psnames/psnames.c", # -- PostScript glyph names support ] if platform.IS_MACOSX: sources.append( "src/base/ftmac.c" # -- only on the Macintosh ) self.__sources = [ path.relative( self.source_path(s), start = self.compiler.project.directory ) for s in sources ] self.__targets = None self.libraries = [ Library( 'freetype2', self.compiler, shared = self.shared, search_binary_files = False, include_directories = [ self.absolute_source_path('include') ], directories = [self.absolute_build_path('install/lib')], files = [self.absolute_build_path('install/lib', self.library_filename)], save_env_vars = False, ) ]
def component_sources(self, component): if component in self.__component_sources: return self.__component_sources[component] srcs = None if component == 'thread': srcs = [ 'future.cpp', ] if not platform.IS_WINDOWS: srcs.extend([ 'pthread/once.cpp', 'pthread/once_atomic.cpp', 'pthread/thread.cpp', ]) else: srcs.extend([ 'win32/thread.cpp', 'win32/tss_dll.cpp', 'win32/tss_pe.cpp', ]) elif component == 'coroutine': srcs = [ 'exceptions.cpp', 'detail/coroutine_context.cpp', #'detail/segmented_stack_allocator.cpp', ( platform.IS_WINDOWS and 'windows/stack_traits.cpp' or 'posix/stack_traits.cpp' ), ] elif component == 'context': all_srcs = [ 'asm/jump_arm_aapcs_elf_gas.S', 'asm/jump_arm_aapcs_macho_gas.S', 'asm/jump_arm_aapcs_pe_armasm.asm', 'asm/jump_i386_ms_pe_masm.asm', 'asm/jump_i386_sysv_elf_gas.S', 'asm/jump_i386_sysv_macho_gas.S', 'asm/jump_mips32_o32_elf_gas.S', 'asm/jump_ppc32_sysv_elf_gas.S', 'asm/jump_ppc64_sysv_elf_gas.S', 'asm/jump_sparc64_sysv_elf_gas.S', 'asm/jump_sparc_sysv_elf_gas.S', 'asm/jump_x86_64_ms_pe_masm.asm', 'asm/jump_x86_64_sysv_elf_gas.S', 'asm/jump_x86_64_sysv_macho_gas.S', 'asm/make_arm_aapcs_elf_gas.S', 'asm/make_arm_aapcs_macho_gas.S', 'asm/make_arm_aapcs_pe_armasm.asm', 'asm/make_i386_ms_pe_masm.asm', 'asm/make_i386_sysv_elf_gas.S', 'asm/make_i386_sysv_macho_gas.S', 'asm/make_mips32_o32_elf_gas.S', 'asm/make_ppc32_sysv_elf_gas.S', 'asm/make_ppc64_sysv_elf_gas.S', 'asm/make_sparc64_sysv_elf_gas.S', 'asm/make_sparc_sysv_elf_gas.S', 'asm/make_x86_64_ms_pe_masm.asm', 'asm/make_x86_64_sysv_elf_gas.S', 'asm/make_x86_64_sysv_macho_gas.S', ] if platform.IS_WINDOWS: abi = 'ms' else: abi = 'sysv' processor = { 'i386': 'i386', 'i686': 'i386', 'AMD64': 'i386', 'x86_64': 'x86_64', }[platform.PROCESSOR] binary_format = platform.BINARY_FORMAT.lower() pattern = '_%s_%s_%s' % (processor, abi, binary_format) srcs = [s for s in all_srcs if pattern in s] elif component == 'serialization': srcs = [ 'basic_archive.cpp', 'basic_iarchive.cpp', 'basic_iserializer.cpp', 'basic_oarchive.cpp', 'basic_oserializer.cpp', 'basic_pointer_iserializer.cpp', 'basic_pointer_oserializer.cpp', 'basic_serializer_map.cpp', 'basic_text_iprimitive.cpp', 'basic_text_oprimitive.cpp', 'basic_xml_archive.cpp', 'binary_iarchive.cpp', 'binary_oarchive.cpp', 'extended_type_info.cpp', 'extended_type_info_typeid.cpp', 'extended_type_info_no_rtti.cpp', 'polymorphic_iarchive.cpp', 'polymorphic_oarchive.cpp', 'stl_port.cpp', 'text_iarchive.cpp', 'text_oarchive.cpp', 'void_cast.cpp', 'archive_exception.cpp', 'xml_grammar.cpp', 'xml_iarchive.cpp', 'xml_oarchive.cpp', 'xml_archive_exception.cpp', ] if srcs is not None: srcs = list( path.relative( str(self.absolute_source_path('libs', component, 'src', src)), start = self.project.directory ) for src in srcs ) else: srcs = list(tools.rglob( '*.cpp', path.relative( str(self.absolute_source_path('libs', component, 'src')), start = self.project.directory ) )) self.__component_sources[component] = srcs return srcs