ProjectBuilder.st
changeset 2911 e12e4a47cfaa
parent 2909 da16870432b5
child 2912 6e62954c5f35
equal deleted inserted replaced
2910:8024f7e8f9f4 2911:e12e4a47cfaa
   260 ! !
   260 ! !
   261 
   261 
   262 !ProjectBuilder methodsFor:'building/private'!
   262 !ProjectBuilder methodsFor:'building/private'!
   263 
   263 
   264 copyDLLsForLinkage
   264 copyDLLsForLinkage
   265     |targetBuildDir preRequisites dllRelativePaths|
   265     |targetBuildDir preRequisites dllRelativeSourcePathes dllRelativeDestPathes|
   266 
   266 
   267 
   267 
   268     targetBuildDir := buildDirectory / package module / package directory.
   268     targetBuildDir := buildDirectory / package module / package directory.
   269 
   269 
   270     preRequisites := projectDefinitionClass allPreRequisites.
   270     preRequisites := projectDefinitionClass allPreRequisites.
   276                             ).
   276                             ).
   277     ].
   277     ].
   278 
   278 
   279     preRequisites do:[:eachPackageToFileout |
   279     preRequisites do:[:eachPackageToFileout |
   280         |packageId packageDef packageModule packageDirectory packageTargetDir
   280         |packageId packageDef packageModule packageDirectory packageTargetDir
   281          dllSource dllSourceDir libraryName dllRelativePath objDir|
   281          dllSource dllSourceDir libraryName dllRelativePathSource 
       
   282          dllRelativePathDest objDirSource objDirDest|
   282 
   283 
   283         packageId := eachPackageToFileout asPackageId.
   284         packageId := eachPackageToFileout asPackageId.
   284         packageModule := packageId module.
   285         packageModule := packageId module.
   285         packageDirectory := packageId directory.
   286         packageDirectory := packageId directory.
   286         packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   287         packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   290 
   291 
   291         "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
   292         "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
   292         dllSourceDir := myTopDirectory / packageModule / packageDirectory.
   293         dllSourceDir := myTopDirectory / packageModule / packageDirectory.
   293 
   294 
   294         OperatingSystem isMSWINDOWSlike ifTrue:[
   295         OperatingSystem isMSWINDOWSlike ifTrue:[
   295             objDir := self objDirForUsedCompiler:usedCompiler.
   296             objDirDest := self objDirForUsedCompiler:usedCompiler.
   296 
   297             "/ use visual-c files for tcc linkage
       
   298             usedCompiler = 'tcc' ifTrue:[
       
   299                 objDirSource := self objDirForUsedCompiler:'vc'.
       
   300             ] ifFalse:[
       
   301                 objDirSource := objDirDest
       
   302             ].
   297 "/            dllRelativePath := objDir,'/',(libraryName,'.dll').
   303 "/            dllRelativePath := objDir,'/',(libraryName,'.dll').
   298 "/            (dllSourceDir / dllRelativePath) exists 
   304 "/            (dllSourceDir / dllRelativePath) exists 
   299             dllRelativePaths := Array with:(objDir,'\', libraryName, '.dll').
   305             dllRelativeSourcePathes := Array with:(objDirSource,'\', libraryName, '.dll').
       
   306             dllRelativeDestPathes := Array with:(objDirDest,'\', libraryName, '.dll').
   300         ] ifFalse:[
   307         ] ifFalse:[
   301             dllRelativePaths := Array with:(libraryName,'.so').
   308             dllRelativeSourcePathes := Array with:(libraryName,'.so').
   302             (packageModule = 'stx' and:[packageDirectory = 'libview']) ifTrue:[
   309             (packageModule = 'stx' and:[packageDirectory = 'libview']) ifTrue:[
   303                 dllRelativePaths := dllRelativePaths, #('XWorkstation.so' 'GLXWorkstation.so').
   310                 dllRelativeSourcePathes := dllRelativeSourcePathes, #('XWorkstation.so' 'GLXWorkstation.so').
   304             ].
   311             ].
   305         ].
   312         ].
   306         dllRelativePaths do:[:dllRelativePath|
   313         dllRelativeSourcePathes with:dllRelativeDestPathes do:[:dllRelativeSourcePath :dllRelativeDestPath|
   307             |source dest|
   314             |source dest|
   308 
   315 
   309             source := dllSourceDir / dllRelativePath.
   316             source := dllSourceDir / dllRelativeSourcePath.
   310             dest := packageTargetDir / dllRelativePath.
   317             dest := packageTargetDir / dllRelativeDestPath.
   311             (dest exists not
   318             (dest exists not
   312              or:[source fileSize ~= dest fileSize
   319              or:[source fileSize ~= dest fileSize
   313              or:[source modificationTime >= dest modificationTime
   320              or:[source modificationTime >= dest modificationTime
   314              "/ or:[ ((dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath)) not ]
   321              "/ or:[ ((dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath)) not ]
   315             ]]) ifTrue:[
   322             ]]) ifTrue:[
   316                 Transcript showCR:'updating ',dllRelativePath.
   323                 Transcript showCR:'updating ',dllRelativeDestPath.
   317                 dest directory recursiveMakeDirectory.
   324                 dest directory recursiveMakeDirectory.
   318                 source copyTo:dest.    
   325                 source copyTo:dest.    
   319             ].
   326             ].
   320         ].
   327         ].
   321     ].
   328     ].
   322 
   329 
   323     "Modified: / 03-09-2012 / 20:07:23 / cg"
   330     "Modified: / 04-09-2012 / 00:30:21 / cg"
   324 !
   331 !
   325 
   332 
   326 copyDirectory:relativepath
   333 copyDirectory:relativepath
   327     "/ need rules in stx
   334     "/ need rules in stx
   328     ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   335     ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   445             files := files , #( 
   452             files := files , #( 
   446                         'librun/objvc/librun.dll'
   453                         'librun/objvc/librun.dll'
   447                         'libvc/librun.lib'
   454                         'libvc/librun.lib'
   448                     ).
   455                     ).
   449         ].
   456         ].
       
   457         usedCompiler = 'tcc' ifTrue:[
       
   458             files := files , #( 
       
   459                         'librun/objvc/librun.dll'
       
   460                         'libvc/librun.lib'
       
   461                     ).
       
   462         ].
   450     ] ifFalse:[
   463     ] ifFalse:[
   451         files := #(
   464         files := #(
   452                     'librun/main.c'
   465                     'librun/main.c'
   453                     'librun/librun.so'
   466                     'librun/librun.so'
   454                 )
   467                 )
   477         ] ifFalse:[
   490         ] ifFalse:[
   478             self error:'Missing file: ',dllRelativePath printString mayProceed:true.
   491             self error:'Missing file: ',dllRelativePath printString mayProceed:true.
   479         ].
   492         ].
   480     ].
   493     ].
   481 
   494 
   482     "Modified: / 20-08-2012 / 17:10:37 / cg"
   495     "Modified: / 04-09-2012 / 00:25:26 / cg"
   483 !
   496 !
   484 
   497 
   485 createHeaderFileFor:aClass in:packageTargetDir
   498 createHeaderFileFor:aClass in:packageTargetDir
   486     |instVarList classInstVarList classVarList bindings superclassFilename
   499     |instVarList classInstVarList classVarList bindings superclassFilename
   487      template file newContents oldContents|
   500      template file newContents oldContents|