@@ -45,7 +45,7 @@ import {
4545 ConfigMap , FileGroup ,
4646 ProjectConfiguration , ProjectConfigData , WorkspaceConfiguration ,
4747 CreateOptions ,
48- ProjectConfigEvent , ProjectFileGroup , FileItem , EIDE_CONF_VERSION , ProjectTargetInfo , VirtualFolder , VirtualFile , CppConfigItem , ProjectBaseApi , ProjectType
48+ ProjectConfigEvent , ProjectFileGroup , FileItem , EIDE_CONF_VERSION , ProjectTargetInfo , VirtualFolder , VirtualFile , CppConfigItem , ProjectBaseApi , ProjectType , BuilderConfigData
4949} from './EIDETypeDefine' ;
5050import { ToolchainName , IToolchian , ToolchainManager } from './ToolchainManager' ;
5151import { GlobalEvent } from './GlobalEvents' ;
@@ -57,7 +57,7 @@ import { WebPanelManager } from './WebPanelManager';
5757import { DependenceManager } from './DependenceManager' ;
5858import * as platform from './Platform' ;
5959import { IDebugConfigGenerator } from './DebugConfigGenerator' ;
60- import { md5 , copyObject , compareVersion } from './utility' ;
60+ import { md5 , copyObject , compareVersion , isGccFamilyToolchain } from './utility' ;
6161import { ResInstaller } from './ResInstaller' ;
6262import {
6363 view_str$prompt$not_found_compiler , view_str$operation$name_can_not_be_blank ,
@@ -1827,7 +1827,10 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
18271827 return optFile ;
18281828 }
18291829
1830- genLibsMakefileContent ( makefileName : string ) : string | undefined {
1830+ /**
1831+ * @param makefile_repath a path relative from build output dir, like: '.lib/Makefile'
1832+ */
1833+ genLibsMakefileContent ( makefile_repath : string ) : string | undefined {
18311834
18321835 const fcfg = this . getLibsGeneratorCfgFile ( true ) ;
18331836 if ( ! fcfg . IsFile ( ) )
@@ -1906,6 +1909,9 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
19061909
19071910 for ( const name in cfg ) {
19081911
1912+ if ( name . startsWith ( '$' ) )
1913+ continue ; // skip internal vars
1914+
19091915 let exprs : string [ ] = cfg [ name ] ;
19101916 if ( ! Array . isArray ( exprs ) ) continue ;
19111917
@@ -1931,6 +1937,11 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
19311937 }
19321938 }
19331939
1940+ if ( cfg [ '$AR_PATH' ] )
1941+ AR_PATH = File . ToUnixPath ( this . toAbsolutePath ( cfg [ '$AR_PATH' ] ) ) ;
1942+ if ( cfg [ '$AR_CMD' ] )
1943+ AR_PARAMS = cfg [ '$AR_CMD' ] ;
1944+
19341945 // --------------------------
19351946 // - gen makefile
19361947 // --------------------------
@@ -1945,7 +1956,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
19451956 . replace ( '${out}' , outname ) ;
19461957 let rule_tmp = `# ${ libname }
19471958lib${ libname } _OBJS += ${ objs . join ( AR_OBJ_SEP ) }
1948- lib${ libname } : $(lib${ libname } _OBJS) ${ makefileName }
1959+ lib${ libname } : $(lib${ libname } _OBJS) ${ makefile_repath }
19491960\t@echo -e $(COLOR_BLUE)-------------------------$(COLOR_END)
19501961\t@echo -e $(COLOR_BLUE)AR "${ outname } "$(COLOR_END)
19511962\t@echo -e $(COLOR_BLUE)-------------------------$(COLOR_END)
@@ -1990,7 +2001,7 @@ $(OUT_DIR):
19902001
19912002 mk_tmp = mk_tmp
19922003 . replace ( '<LIB_TARGETS>' , lib_rules . join ( '\n' ) )
1993- . replace ( '<LIB_OUT_DIR>' , '.lib' ) ;
2004+ . replace ( '<LIB_OUT_DIR>' , NodePath . dirname ( makefile_repath ) ) ;
19942005
19952006 return mk_tmp ;
19962007 }
@@ -3557,6 +3568,18 @@ class EIDEProject extends AbstractProject {
35573568 }
35583569 }
35593570
3571+ private _getCompilerIntrDefsForCpptools < T extends BuilderConfigData > (
3572+ toolchain : IToolchian , builderCfg : T , builderOpts : ICompileOptions ) : string [ ] {
3573+
3574+ if ( [ 'AC5' , 'AC6' ] . includes ( toolchain . name ) || isGccFamilyToolchain ( toolchain . name ) ) {
3575+ // we have provide a xxx-intr.h for cpptools,
3576+ // so return empty list.
3577+ return [ ] ;
3578+ } else {
3579+ return toolchain . getInternalDefines ( builderCfg , builderOpts ) ;
3580+ }
3581+ }
3582+
35603583 private doUpdateCpptoolsConfig ( ) {
35613584
35623585 const builderOpts = this . getBuilderOptions ( ) ;
@@ -3566,7 +3589,7 @@ class EIDEProject extends AbstractProject {
35663589 // get project includes and defines
35673590 const depMerge = prjConfig . GetAllMergeDep ( ) ;
35683591 const defMacros : string [ ] = [ '__VSCODE_CPPTOOL' ] ; // it's for internal force include header
3569- const intrDefs = toolchain . getInternalDefines ( < any > prjConfig . config . compileConfig , builderOpts ) ;
3592+ const intrDefs = this . _getCompilerIntrDefsForCpptools ( toolchain , < any > prjConfig . config . compileConfig , builderOpts ) ;
35703593 const defLi = defMacros . concat ( depMerge . defineList , intrDefs ) ;
35713594 depMerge . incList = depMerge . incList . concat ( this . getSourceIncludeList ( ) ) . map ( p => this . ToAbsolutePath ( p ) ) ;
35723595
0 commit comments