Changeset View
Changeset View
Standalone View
Standalone View
bin/BuildSystem/BoostBuildSystem.py
Show All 17 Lines | 16 | class BoostBuildSystem(BuildSystemBase): | |||
---|---|---|---|---|---|
18 | def __init__( self ): | 18 | def __init__( self ): | ||
19 | """constructor. configureOptions are added to the configure command line and makeOptions are added to the make command line""" | 19 | """constructor. configureOptions are added to the configure command line and makeOptions are added to the make command line""" | ||
20 | BuildSystemBase.__init__(self, "boost") | 20 | BuildSystemBase.__init__(self, "boost") | ||
21 | self.subinfo.options.package.packSources = False | 21 | self.subinfo.options.package.packSources = False | ||
22 | 22 | | |||
23 | def configureOptions( self, defines="" ): | 23 | def configureOptions( self, defines="" ): | ||
24 | """returns default configure options""" | 24 | """returns default configure options""" | ||
25 | options = BuildSystemBase.configureOptions(self) | 25 | options = BuildSystemBase.configureOptions(self) | ||
26 | 26 | | |||
27 | if OsUtils.isWin(): | 27 | if OsUtils.isWin(): | ||
28 | options += " -j"+ os.getenv("NUMBER_OF_PROCESSORS") | 28 | options += " -j"+ os.getenv("NUMBER_OF_PROCESSORS") | ||
29 | options += " --build-dir=" + self.buildDir() | 29 | options += " --build-dir=" + self.buildDir() | ||
30 | else: | 30 | else: | ||
31 | # TODO: real value | 31 | # TODO: real value | ||
32 | options += " install --prefix=%s" % self.buildDir() | 32 | options += " install --prefix=%s" % self.buildDir() | ||
33 | options += " -j10" | 33 | options += " -j10" | ||
34 | 34 | | |||
35 | 35 | | |||
36 | options += (" --build-type=minimal" | 36 | options += (" --build-type=minimal" | ||
37 | # " --debug-configuration" | 37 | # " --debug-configuration" | ||
38 | " threading=multi" | 38 | " threading=multi" | ||
39 | ) | 39 | ) | ||
40 | 40 | | |||
41 | if not self.subinfo.options.buildStatic: | 41 | if not self.subinfo.options.buildStatic: | ||
42 | options += (" link=shared" | 42 | options += (" link=shared" | ||
43 | " runtime-link=shared") | 43 | " runtime-link=shared") | ||
44 | else: | 44 | else: | ||
45 | options += (" link=static" | 45 | options += (" link=static" | ||
46 | " runtime-link=static") | 46 | " runtime-link=static") | ||
47 | if compiler.isX64(): | 47 | if craftCompiler.isX64(): | ||
48 | options += " address-model=64 architecture=x86" | 48 | options += " address-model=64 architecture=x86" | ||
49 | else: | 49 | else: | ||
50 | options += " address-model=32 architecture=x86" | 50 | options += " address-model=32 architecture=x86" | ||
51 | 51 | | |||
52 | if self.buildType() == "Debug": | 52 | if self.buildType() == "Debug": | ||
53 | options += " variant=debug" | 53 | options += " variant=debug" | ||
54 | else: | 54 | else: | ||
55 | options += " variant=release" | 55 | options += " variant=release" | ||
56 | 56 | | |||
57 | options += " toolset=" | 57 | options += " toolset=" | ||
58 | if compiler.isClang(): | 58 | if craftCompiler.isClang(): | ||
59 | options += "clang" | 59 | options += "clang" | ||
60 | if compiler.isGCC(): | 60 | if craftCompiler.isGCC(): | ||
61 | options += " threadapi=pthread" | 61 | options += " threadapi=pthread" | ||
62 | elif compiler.isMinGW(): | 62 | elif craftCompiler.isMinGW(): | ||
63 | options += "gcc" | 63 | options += "gcc" | ||
64 | elif compiler.isMSVC(): | 64 | elif craftCompiler.isMSVC(): | ||
65 | platform = str(compiler.msvcPlatformToolset()) | 65 | platform = str(craftCompiler.msvcPlatformToolset()) | ||
66 | if compiler.isMSVC2017(): | 66 | if craftCompiler.isMSVC2017(): | ||
67 | options += f"msvc-{platform[:2]}.0" | 67 | options += f"msvc-{platform[:2]}.0" | ||
68 | else: | 68 | else: | ||
69 | options += f"msvc-{platform[:2]}.{platform[2:]}" | 69 | options += f"msvc-{platform[:2]}.{platform[2:]}" | ||
70 | elif compiler.isIntel(): | 70 | elif craftCompiler.isIntel(): | ||
71 | options += "intel" | 71 | options += "intel" | ||
72 | options += " -sINTEL_PATH=\"%s\"" % os.path.join( os.getenv( "INTELDIR" ), "bin", os.getenv( "TARGET_ARCH" ) ) | 72 | options += " -sINTEL_PATH=\"%s\"" % os.path.join( os.getenv( "INTELDIR" ), "bin", os.getenv( "TARGET_ARCH" ) ) | ||
73 | options += " -sINTEL_BASE_MSVC_TOOLSET=vc-%s" % ({ "vs2008" : "9_0", "vs2010" : "10_0", "vs2012" : "11_0" }[os.getenv("INTEL_VSSHELL")]) | 73 | options += " -sINTEL_BASE_MSVC_TOOLSET=vc-%s" % ({ "vs2008" : "9_0", "vs2010" : "10_0", "vs2012" : "11_0" }[os.getenv("INTEL_VSSHELL")]) | ||
74 | options += " -sINTEL_VERSION=%s" % os.getenv("PRODUCT_NAME")[-2:] | 74 | options += " -sINTEL_VERSION=%s" % os.getenv("PRODUCT_NAME")[-2:] | ||
75 | craftUserConfig = os.path.join( CraftStandardDirs.craftRoot(), "etc", "craft-boost-config.jam" ) | 75 | craftUserConfig = os.path.join( CraftStandardDirs.craftRoot(), "etc", "craft-boost-config.jam" ) | ||
76 | if os.path.exists( craftUserConfig ): | 76 | if os.path.exists( craftUserConfig ): | ||
77 | options += " --user-config=" + os.path.join( craftUserConfig ) | 77 | options += " --user-config=" + os.path.join( craftUserConfig ) | ||
78 | return options | 78 | return options | ||
79 | 79 | | |||
80 | def configure( self, defines=""): | 80 | def configure( self, defines=""): | ||
81 | return True | 81 | return True | ||
82 | 82 | | |||
83 | def make( self ): | 83 | def make( self ): | ||
84 | """implements the make step for cmake projects""" | 84 | """implements the make step for cmake projects""" | ||
85 | self.boost = portage.getPackageInstance('win32libs', 'boost-headers') | 85 | self.boost = portage.getPackageInstance('win32libs', 'boost-headers') | ||
86 | self.subinfo.targetInstSrc[ self.subinfo.buildTarget ] = os.path.join(self.boost.sourceDir(),"libs",self.subinfo.targetInstSrc[ self.subinfo.buildTarget ],"build") | 86 | self.subinfo.targetInstSrc[ self.subinfo.buildTarget ] = os.path.join(self.boost.sourceDir(),"libs",self.subinfo.targetInstSrc[ self.subinfo.buildTarget ],"build") | ||
87 | 87 | | |||
88 | self.enterSourceDir() | 88 | self.enterSourceDir() | ||
89 | cmd = "bjam" | 89 | cmd = "bjam" | ||
90 | cmd += self.configureOptions(self.subinfo.options.configure.args) | 90 | cmd += self.configureOptions(self.subinfo.options.configure.args) | ||
91 | craftDebug.log.debug(cmd) | 91 | craftDebug.log.debug(cmd) | ||
92 | return self.system(cmd) | 92 | return self.system(cmd) | ||
93 | 93 | | |||
94 | def install( self ): | 94 | def install( self ): | ||
95 | """install the target""" | 95 | """install the target""" | ||
96 | if OsUtils.isUnix(): | 96 | if OsUtils.isUnix(): | ||
97 | if not os.path.exists(self.installDir()): | 97 | if not os.path.exists(self.installDir()): | ||
98 | os.makedirs(self.installDir()) | 98 | os.makedirs(self.installDir()) | ||
99 | utils.copyDir(self.buildDir(), self.installDir()) | 99 | utils.copyDir(self.buildDir(), self.installDir()) | ||
100 | return BuildSystemBase.install(self) | 100 | return BuildSystemBase.install(self) | ||
101 | else: | 101 | else: | ||
102 | if not BuildSystemBase.install(self): | 102 | if not BuildSystemBase.install(self): | ||
103 | return False | 103 | return False | ||
104 | 104 | | |||
105 | 105 | | |||
106 | for root, dirs, files in os.walk( self.buildDir() ): | 106 | for root, dirs, files in os.walk( self.buildDir() ): | ||
107 | for f in files: | 107 | for f in files: | ||
108 | if f.endswith( ".dll" ): | 108 | if f.endswith( ".dll" ): | ||
109 | utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "lib", f ) ) | 109 | utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "lib", f ) ) | ||
110 | utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "bin", f ) ) | 110 | utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "bin", f ) ) | ||
111 | elif f.endswith( ".a" ) or f.endswith( ".lib" ): | 111 | elif f.endswith( ".a" ) or f.endswith( ".lib" ): | ||
112 | utils.copyFile( os.path.join( root, f ), os.path.join( self.imageDir(), "lib", f ) ) | 112 | utils.copyFile( os.path.join( root, f ), os.path.join( self.imageDir(), "lib", f ) ) | ||
113 | 113 | | |||
114 | 114 | | |||
115 | 115 | | |||
116 | return True | 116 | return True | ||
117 | 117 | | |||
118 | def unittest( self ): | 118 | def unittest( self ): | ||
119 | return True | 119 | return True | ||
120 | 120 | |