ProjectBuilder.st
changeset 2909 da16870432b5
parent 2905 d02db91a0938
child 2911 e12e4a47cfaa
equal deleted inserted replaced
2908:178288821f0a 2909:da16870432b5
    62     |builder|
    62     |builder|
    63 
    63 
    64     Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true.
    64     Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true.
    65 
    65 
    66     builder := self new.
    66     builder := self new.
    67     builder package:'stx:clients/Demos/foxCalcApplication'.
    67     builder 
    68     builder build.
    68         package:'stx:clients/Demos/foxCalcApplication';
       
    69         build.
    69 
    70 
    70     UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    71     UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
       
    72 
       
    73     "Modified: / 03-09-2012 / 19:23:53 / cg"
    71 ! !
    74 ! !
    72 
    75 
    73 !ProjectBuilder class methodsFor:'queries'!
    76 !ProjectBuilder class methodsFor:'queries'!
    74 
    77 
    75 defaultUsedCompiler
    78 defaultUsedCompiler
    87     "Created: / 21-01-2012 / 14:06:51 / cg"
    90     "Created: / 21-01-2012 / 14:06:51 / cg"
    88 !
    91 !
    89 
    92 
    90 listOfPossibleCompilers
    93 listOfPossibleCompilers
    91     OperatingSystem isMSWINDOWSlike ifTrue:[
    94     OperatingSystem isMSWINDOWSlike ifTrue:[
    92         ^ #('bcc' 'vc' 'lcc' 'gcc' )
    95         ^ #('bcc' 'vc' 'tcc' 'lcc' 'gcc'  )
    93     ].
    96     ].
    94     ^ #('gcc')
    97     ^ #('gcc')
    95 
    98 
    96     "Created: / 21-01-2012 / 14:04:15 / cg"
    99     "Created: / 21-01-2012 / 14:04:15 / cg"
    97 ! !
   100 ! !
   285         packageDef := packageId projectDefinitionClass.
   288         packageDef := packageId projectDefinitionClass.
   286         libraryName := packageDef libraryName.
   289         libraryName := packageDef libraryName.
   287 
   290 
   288         "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
   291         "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
   289         dllSourceDir := myTopDirectory / packageModule / packageDirectory.
   292         dllSourceDir := myTopDirectory / packageModule / packageDirectory.
       
   293 
   290         OperatingSystem isMSWINDOWSlike ifTrue:[
   294         OperatingSystem isMSWINDOWSlike ifTrue:[
   291             objDir := self objDirForUsedCompiler.
   295             objDir := self objDirForUsedCompiler:usedCompiler.
       
   296 
   292 "/            dllRelativePath := objDir,'/',(libraryName,'.dll').
   297 "/            dllRelativePath := objDir,'/',(libraryName,'.dll').
   293 "/            (dllSourceDir / dllRelativePath) exists 
   298 "/            (dllSourceDir / dllRelativePath) exists 
   294             dllRelativePaths := Array with:(objDir,'\', libraryName, '.dll').
   299             dllRelativePaths := Array with:(objDir,'\', libraryName, '.dll').
   295         ] ifFalse:[
   300         ] ifFalse:[
   296             dllRelativePaths := Array with:(libraryName,'.so').
   301             dllRelativePaths := Array with:(libraryName,'.so').
   313                 source copyTo:dest.    
   318                 source copyTo:dest.    
   314             ].
   319             ].
   315         ].
   320         ].
   316     ].
   321     ].
   317 
   322 
   318     "Modified: / 20-08-2012 / 17:00:33 / cg"
   323     "Modified: / 03-09-2012 / 20:07:23 / cg"
   319 !
   324 !
   320 
   325 
   321 copyDirectory:relativepath
   326 copyDirectory:relativepath
   322     "/ need rules in stx
   327     "/ need rules in stx
   323     ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   328     ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   683     ].
   688     ].
   684 
   689 
   685 "/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
   690 "/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
   686 !
   691 !
   687 
   692 
       
   693 makeCommandOfCompiler:usedCompiler
       
   694     usedCompiler = 'bcc' ifTrue:[ 
       
   695         ^ 'bmake'.
       
   696     ].
       
   697     usedCompiler = 'vc' ifTrue:[ 
       
   698         ^ 'vcmake'. "/ compilerFlag := '-DUSEVC' 
       
   699     ].
       
   700     usedCompiler = 'lcc' ifTrue:[ 
       
   701         ^ 'lccmake'. "/ compilerFlag := '-DUSELCC' 
       
   702     ].
       
   703     usedCompiler = 'tcc' ifTrue:[ 
       
   704         ^ 'tccmake'. "/ compilerFlag := '-DUSELCC' 
       
   705     ].
       
   706     usedCompiler = 'gcc' ifTrue:[ 
       
   707         ^ 'make'. 
       
   708     ].
       
   709     usedCompiler = 'gcc' ifTrue:[ 
       
   710         ^ 'make'. 
       
   711     ].
       
   712     self error:'unknown compiler specified'.
       
   713 
       
   714     "Created: / 03-09-2012 / 19:46:07 / cg"
       
   715 !
       
   716 
   688 makeWithOutputTo:stdOut errorTo:stdErr
   717 makeWithOutputTo:stdOut errorTo:stdErr
   689     |module directory compilerFlag makeCommand|
   718     |module directory makeCommand|
   690 
   719 
   691     module := package module.
   720     module := package module.
   692     directory := package directory.
   721     directory := package directory.
   693 
   722 
   694     makeCommand := ParserFlags makeCommand.
   723     makeCommand := ParserFlags makeCommand.
   695     usedCompiler isNil ifTrue:[
   724     usedCompiler isNil ifTrue:[
   696         usedCompiler := ParserFlags usedCompiler.
   725         usedCompiler := ParserFlags usedCompiler.
   697     ].
   726     ].
   698     usedCompiler = 'vc' ifTrue:[ 
   727     makeCommand := self makeCommandOfCompiler:usedCompiler.
   699         makeCommand := 'vcmake'. "/ compilerFlag := '-DUSEVC' 
       
   700     ] ifFalse:[
       
   701         usedCompiler = 'lcc' ifTrue:[ 
       
   702             makeCommand := 'lcmake'. "/ compilerFlag := '-DUSELCC' 
       
   703         ] ifFalse:[
       
   704             usedCompiler = 'gcc' ifTrue:[ 
       
   705                 makeCommand := 'make'. 
       
   706             ] ifFalse:[
       
   707                 usedCompiler = 'bcc' ifTrue:[ 
       
   708                     makeCommand := 'bmake'.
       
   709                 ] ifFalse:[
       
   710                     self error:'no compiler specified'.
       
   711                 ]
       
   712             ]
       
   713         ]
       
   714     ].
       
   715 
   728 
   716     "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
   729     "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
   717 
   730 
   718     OperatingSystem isUNIXlike ifTrue:[
   731     OperatingSystem isUNIXlike ifTrue:[
   719         OperatingSystem
   732         OperatingSystem
   751                 inDirectory:(buildDirectory / module / directory)
   764                 inDirectory:(buildDirectory / module / directory)
   752                 onError:[:status| self error:'make failed'].
   765                 onError:[:status| self error:'make failed'].
   753         ]
   766         ]
   754     ]
   767     ]
   755 
   768 
   756     "Modified: / 20-07-2012 / 12:13:29 / cg"
   769     "Modified: / 03-09-2012 / 19:47:15 / cg"
   757 !
   770 !
   758 
   771 
   759 objDirForUsedCompiler
   772 objDirForUsedCompiler
       
   773     ^ self objDirForUsedCompiler:usedCompiler
       
   774 
       
   775     "Created: / 20-08-2012 / 17:01:13 / cg"
       
   776 !
       
   777 
       
   778 objDirForUsedCompiler:usedCompiler
   760     usedCompiler = 'bcc' ifTrue:[^ 'objbc'].
   779     usedCompiler = 'bcc' ifTrue:[^ 'objbc'].
   761     usedCompiler = 'vc' ifTrue:[^ 'objvc'].
   780     usedCompiler = 'vc' ifTrue:[^ 'objvc'].
       
   781     usedCompiler = 'tcc' ifTrue:[^ 'objtcc'].
       
   782     usedCompiler = 'lcc' ifTrue:[^ 'objlcc'].
       
   783     usedCompiler = 'gcc' ifTrue:[^ 'obj'].
   762     self halt:'please fill in here'.
   784     self halt:'please fill in here'.
   763     ^ 'objbc'
   785     ^ 'objbc'
   764 
   786 
   765     "Created: / 20-08-2012 / 17:01:13 / cg"
   787     "Created: / 03-09-2012 / 19:55:34 / cg"
   766 !
   788 !
   767 
   789 
   768 recursiveCopyDirectoryForBuild:subdir
   790 recursiveCopyDirectoryForBuild:subdir
   769     |targetDir|
   791     |targetDir|
   770 
   792