VM Maker: CMakeVMMaker-GuillermoPolito.207.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: CMakeVMMaker-GuillermoPolito.207.mcz

commits-2
 
Guillermo Polito uploaded a new version of CMakeVMMaker to project VM Maker:
http://source.squeak.org/VMMaker/CMakeVMMaker-GuillermoPolito.207.mcz

==================== Summary ====================

Name: CMakeVMMaker-GuillermoPolito.207
Author: GuillermoPolito
Time: 17 June 2013, 6:36:31.366 pm
UUID: 83aadf49-80c0-4fa6-bb65-9fbefb18f36a
Ancestors: CMakeVMMaker-GuillermoPolito.206

moving to use filesystem

=============== Diff against CMakeVMMaker-IgorStasenko.205 ===============

Item was changed:
- SystemOrganization addCategory: #'CMakeVMMaker-Android'!
  SystemOrganization addCategory: #CMakeVMMaker!
+ SystemOrganization addCategory: #'CMakeVMMaker-Android'!
- SystemOrganization addCategory: #'CMakeVMMaker-Unix'!
- SystemOrganization addCategory: #'CMakeVMMaker-Windows'!
- SystemOrganization addCategory: #'CMakeVMMaker-MacOS'!
- SystemOrganization addCategory: #'CMakeVMMaker-IOS'!
  SystemOrganization addCategory: #'CMakeVMMaker-FreeBSD'!
+ SystemOrganization addCategory: #'CMakeVMMaker-IOS'!
  SystemOrganization addCategory: #'CMakeVMMaker-Libs'!
+ SystemOrganization addCategory: #'CMakeVMMaker-MacOS'!
+ SystemOrganization addCategory: #'CMakeVMMaker-Unix'!
+ SystemOrganization addCategory: #'CMakeVMMaker-Windows'!
- SystemOrganization addCategory: #'CMakeVMMaker-Chipmunk'!

Item was changed:
  ----- Method: CMThirdpartyLibrary>>generateFor: (in category 'generating cmake file') -----
  generateFor: aVMGenerator
 
  | libDir stream contents |
 
  vmGen := aVMGenerator.
 
  gen := CMakeGenerator new
  output: (String new writeStream).
 
+ libDir := (aVMGenerator thirdpartyDir / self canonicalName) ensureDirectory.
- libDir := (aVMGenerator thirdpartyDir / self canonicalName) assureExistence.
 
  stream := String new writeStream.
 
  self generate.
 
  stream nextPutAll: (vmGen config fixLineEndsOf: gen output contents).
 
  contents := stream contents.
 
+ (self isFile: (libDir asFileReference / gen outputFileName) fullName hasContents: contents) ifFalse: [
- (self isFile: (libDir fullNameFor: gen outputFileName)  hasContents: contents) ifFalse: [
  "contents changed, update the file. Because fucking cmake will force rebuild everything if we change its modification date
  without changing its contents"
  (libDir forceNewFileNamed: gen outputFileName) nextPutAll: contents; close.
  ].
 
 
  vmGen addSubdirectory:  vmGen thirdpartyDirName , '/' , self canonicalName.
  self defineGlobalTargets.
  !

Item was changed:
  ----- Method: CMakeGenScripts class>>generateCocoaVM (in category 'sources generation') -----
  generateCocoaVM
  | platformDirectoryName |
+ "B3DAcceleratorPlugin"
+ "Not using it right now"
+ platformDirectoryName := (FileSystem workingDirectory parent / 'platforms') fullName.
+ VMMaker default
+ platformRootDirectoryName: platformDirectoryName;
+ sourceDirectoryName: platformDirectoryName , '/iOS/vm/src';
+ internal:
+ #(#ADPCMCodecPlugin #B3DEnginePlugin #BalloonEnginePlugin #BitBltSimulation #BMPReadWriterPlugin #ClipboardExtendedPlugin #DeflatePlugin #DSAPlugin #FFIPlugin #FFTPlugin #FilePlugin #FloatArrayPlugin #GeniePlugin #HostWindowPlugin #JPEGReaderPlugin #JPEGReadWriter2Plugin #KlattSynthesizerPlugin #LargeIntegersPlugin #Matrix2x3Plugin #MacMenubarPlugin #MiscPrimitivePlugin #NewsqueakIA32ABIPlugin #ObjectiveCPlugin #RePlugin #SecurityPlugin #SocketPlugin #SoundCodecPlugin #SoundGenerationPlugin #SoundPlugin #StarSqueakPlugin #SurfacePlugin #UUIDPlugin #DropPlugin)
+ external: #(#UnixOSProcessPlugin);
-
- "B3DAcceleratorPlugin" "Not using it right now"
-
- platformDirectoryName := (FileDirectory default
- containingDirectory
- directoryNamed: 'platforms')
- fullName.
- VMMaker default
- platformRootDirectoryName:  platformDirectoryName;
- sourceDirectoryName: platformDirectoryName, '/iOS/vm/src';
- internal: #(
- ADPCMCodecPlugin
- B3DEnginePlugin
- BalloonEnginePlugin
- BitBltSimulation
- BMPReadWriterPlugin
- ClipboardExtendedPlugin
- DeflatePlugin
- DSAPlugin
- FFIPlugin
- FFTPlugin
- FilePlugin
- FloatArrayPlugin
- GeniePlugin
- HostWindowPlugin
- JPEGReaderPlugin
- JPEGReadWriter2Plugin
- KlattSynthesizerPlugin
- LargeIntegersPlugin
- Matrix2x3Plugin
- MacMenubarPlugin
- MiscPrimitivePlugin
- NewsqueakIA32ABIPlugin
- ObjectiveCPlugin
- RePlugin
- SecurityPlugin
- SocketPlugin
- SoundCodecPlugin
- SoundGenerationPlugin
- SoundPlugin
- StarSqueakPlugin
- SurfacePlugin
- UUIDPlugin
- DropPlugin)
- external: #(
- UnixOSProcessPlugin);
  generateMainVM;
+ generateExternalPlugins. "Gnuifier"
+ (Gnuifier on: (platformDirectoryName , '/iOS/vm/src/vm') asFileReference pathName) gnuify!
- generateExternalPlugins.
-
- "Gnuifier"
- (Gnuifier on:((FileDirectory on: platformDirectoryName, '/iOS/vm/src/vm') pathName)) gnuify.
- !

Item was changed:
  ----- Method: CMakeGenScripts class>>generateCogMacOS (in category 'as yet unclassified') -----
  generateCogMacOS
  " generate sources for Stack Interpreter of Mac OS"
+
  | top |
+ top := FileSystem workingDirectory parent.
- top := FileDirectory default containingDirectory.
-
  VMMaker
  generate: CoInterpreter
  to: (top / 'src') fullName
+ platformDir: (top / 'platforms') fullName
+ excluding:
+ #(#BrokenPlugin #IA32ABIPluginSimulator #SlangTestPlugin #TestOSAPlugin #FFIPlugin #ReentrantARMFFIPlugin #ReentrantFFIPlugin #ReentrantPPCBEFFIPlugin).
+ CogMacOSConfig generate!
- platformDir: ( top / 'platforms') fullName
- excluding:#(BrokenPlugin IA32ABIPluginSimulator SlangTestPlugin TestOSAPlugin
- FFIPlugin ReentrantARMFFIPlugin ReentrantFFIPlugin ReentrantPPCBEFFIPlugin).
-
- CogMacOSConfig generate.
-
- !

Item was changed:
  ----- Method: CMakeGenScripts class>>generateCogSources (in category 'sources generation') -----
  generateCogSources
  " self generateCogSources "
 
  " generate sources for CoInterpreter"
 
  | top |
-
  CogRTLOpcodes initialize.
  CogIA32Compiler initialize.
+ top := FileSystem workingDirectory parent.
-
- top := FileDirectory default containingDirectory.
-
  VMMaker
  generate: CoInterpreter
  and: StackToRegisterMappingCogit
  to: (top / 'src') fullName
+ platformDir: (top / 'platforms') fullName
+ excluding:
+ #(#BrokenPlugin #IA32ABIPluginSimulator #SlangTestPlugin #TestOSAPlugin #FFIPlugin #ReentrantARMFFIPlugin #ReentrantFFIPlugin #ReentrantPPCBEFFIPlugin #NewsqueakIA32ABIPlugin #NewsqueakIA32ABIPluginAttic)!
- platformDir: ( top / 'platforms') fullName
- excluding:#(BrokenPlugin IA32ABIPluginSimulator SlangTestPlugin TestOSAPlugin
- FFIPlugin ReentrantARMFFIPlugin ReentrantFFIPlugin ReentrantPPCBEFFIPlugin NewsqueakIA32ABIPlugin
- NewsqueakIA32ABIPluginAttic).
- !

Item was changed:
  ----- Method: CMakeGenScripts class>>generateCogSourcesEmm40 (in category 'sources generation') -----
  generateCogSourcesEmm40
  " self generateCogSourcesEmm40 "
 
-
  " generate sources for CoInterpreter"
 
  | top |
-
  CogRTLOpcodes initialize.
  CogIA32Compiler initialize.
+ top := FileSystem workingDirectory parent.
-
- top := FileDirectory default containingDirectory.
-
  VMMaker
  generate: CoInterpreter
  and: StackToRegisterMappingCogit
  to: (top / 'src') fullName
+ platformDir: (top / 'platforms') fullName
+ excluding:
+ #(#BrokenPlugin #IA32ABIPluginSimulator #SlangTestPlugin #TestOSAPlugin #FFIPlugin #ReentrantARMFFIPlugin #ReentrantFFIPlugin #ReentrantPPCBEFFIPlugin #NewsqueakIA32ABIPlugin #NewsqueakIA32ABIPluginAttic)!
- platformDir: ( top / 'platforms') fullName
- excluding:#(BrokenPlugin IA32ABIPluginSimulator SlangTestPlugin TestOSAPlugin
- FFIPlugin ReentrantARMFFIPlugin ReentrantFFIPlugin ReentrantPPCBEFFIPlugin NewsqueakIA32ABIPlugin
- NewsqueakIA32ABIPluginAttic).
- !

Item was changed:
  ----- Method: CMakeGenScripts class>>generateStackSources (in category 'sources generation') -----
  generateStackSources
  " generate sources for Stack Interpreter of Mac OS"
+
  | top |
+ top := FileSystem workingDirectory parent.
- top := FileDirectory default containingDirectory.
-
  VMMaker
  generate: StackInterpreter
  to: (top / 'src') fullName
+ platformDir: (top / 'platforms') fullName
+ excluding:
+ #(#BrokenPlugin #IA32ABIPluginSimulator #SlangTestPlugin #TestOSAPlugin #FFIPlugin #ReentrantARMFFIPlugin #ReentrantFFIPlugin #ReentrantPPCBEFFIPlugin)!
- platformDir: ( top / 'platforms') fullName
- excluding: #(BrokenPlugin IA32ABIPluginSimulator SlangTestPlugin TestOSAPlugin
- FFIPlugin ReentrantARMFFIPlugin ReentrantFFIPlugin ReentrantPPCBEFFIPlugin).
-
-
-
- !

Item was changed:
  ----- Method: CMakePluginGenerator>>saveFile (in category 'as yet unclassified') -----
  saveFile
 
+ | reference |
+ reference := ((vmGen config dirFrom: vmGen buildDir) / plugin moduleName) ensureDirectory; yourself.
+ (FileStream forceNewFileNamed: (reference / self outputFileName) fullName)
+ nextPutAll: (self config fixLineEndsOf: output contents);
+ close.!
- (((vmGen config dirFrom: vmGen buildDir) / plugin moduleName) assureExistence forceNewFileNamed: self outputFileName)
- nextPutAll: (self config fixLineEndsOf: output contents); close.
- !

Item was changed:
  ----- Method: CMakeVMGenerator>>generateBuildScript (in category 'build script') -----
  generateBuildScript
 
+ (FileStream forceNewFileNamed: (self buildDir / 'build.sh') fullName) nextPutAll: (config fixLineEndsOf: config buildScript); close.
- (self buildDir forceNewFileNamed: 'build.sh') nextPutAll: (config fixLineEndsOf: config buildScript); close.
  !

Item was changed:
  ----- Method: CMakeVMGenerator>>generateExportsH: (in category 'as yet unclassified') -----
  generateExportsH: libs
  | content |
  content := String streamContents: [:str |
 
  str nextPutAll: '/* This is automatically generated file using CVMMaker on ',
  Date current asString, ' ' , Time current asString , ' */'; cr.
 
  str nextPutAll:
  'extern sqExport vm_exports[];
  extern sqExport os_exports[];
  '.
  libs do: [:each |
  str nextPutAll: 'extern sqExport ', each ,'_exports [];'; cr ].
 
  str cr; nextPutAll: 'sqExport *pluginExports[] = {
  vm_exports,
  os_exports,
  '.
 
  libs do: [:each |
  str nextPutAll:  each ,'_exports,'; cr ].
 
  str nextPutAll: 'NULL
  };'
 
  ].
 
+ (FileStream forceNewFileNamed: (self buildDir /'sqNamedPrims.h') fullName) nextPutAll: (config fixLineEndsOf: content); close.
- (self buildDir forceNewFileNamed: 'sqNamedPrims.h') nextPutAll: (config fixLineEndsOf: content); close.
  !

Item was changed:
  ----- Method: CMakeVMGenerator>>topDir (in category 'accessing') -----
  topDir
  | dir |
+ dir := self config topDir ifNil: [ FileSystem workingDirectory parent ].
+ dir isString
+ ifTrue: [ ^dir asFileReference ].
- dir := self config topDir ifNil: [ FileDirectory default containingDirectory ].
- dir isString ifTrue: [^ FileDirectory on: ( FileDirectory fullPathForURI: dir) ].
  ^ dir!

Item was changed:
  ----- Method: CPlatformConfig>>buildDir (in category 'directories') -----
  buildDir
 
+ ^ buildDir ifNil: [ buildDir := (self topDir / self buildDirName) ensureDirectory; yourself ].
- ^ buildDir ifNil: [ buildDir := (self topDir / self buildDirName) assureExistence ].
  !

Item was changed:
  ----- Method: CPlatformConfig>>dirFrom: (in category 'utils') -----
  dirFrom: aStringOrDir
+ ^ aStringOrDir isString
+ ifTrue: [ aStringOrDir asFileReference ]
+ ifFalse: [ aStringOrDir ]!
-
- ^ aStringOrDir isString ifTrue: [
- FileDirectory on: ( FileDirectory fullPathForURI: aStringOrDir)]
- ifFalse: [ aStringOrDir ]!

Item was changed:
  ----- Method: CPlatformConfig>>setupDirectories: (in category 'directories') -----
  setupDirectories: gen
  | dirsInclude |
 
  " write the directories in separate include file"
  dirsInclude := gen captureOutputDuring: [
  gen
  set: #topDir toString: (self topDir fullName);
  set: #buildDir toString: (self buildDir ifNil: ['${topDir}/build'] ifNotNil: [self buildDir fullName] );
  set: #thirdpartyDir toString: '${buildDir}/thirdParty';
  set: #platformsDir toString: self platformsDir;
  set: #srcDir toString: self srcDir;
  set: #srcPluginsDir toString: (pluginsDir ifNil: [ '${srcDir}/plugins' ]);
  set: #srcVMDir toString: '${srcDir}/vm';
  set: #platformName toString: self platformName;
  set: #targetPlatform to: '${platformsDir}/${platformName}';
  set: #crossDir toString: '${platformsDir}/Cross';
  set: #platformVMDir toString: '${targetPlatform}/vm';
+ set: #outputDir toString: self outputDir fullName.
- set: #outputDir toString: self outputDir.
  ].
 
  self write: dirsInclude toFile: 'directories.cmake'.
 
  gen include: 'directories.cmake'.
  !

Item was changed:
  ----- Method: CPlatformConfig>>topDir (in category 'directories') -----
  topDir
+ ^ topDir ifNil: [ topDir := FileSystem workingDirectory parent ]!
-
- ^ topDir ifNil: [ topDir := FileDirectory default containingDirectory ].
- !

Item was changed:
  ----- Method: CPlatformConfig>>topDir: (in category 'directories') -----
  topDir: pathString
+ topDir := pathString asFileReference.
+ topDir assureExistence!
-
- topDir :=
- FileDirectory on: (FileDirectory fullPathForURI: pathString).
- topDir assureExistence.!

Item was changed:
  ----- Method: CPlatformConfig>>validateSourcesPresent (in category 'source generation') -----
  validateSourcesPresent
  | sources |
+ sources := Smalltalk openSources: SmalltalkImage current sourcesName forImage: SmalltalkImage current imageName.
- sources := FileDirectory openSources: SmalltalkImage current sourcesName forImage: SmalltalkImage current imageName.
 
  ((sources == nil or: [sources atEnd])
  and: [ SmalltalkImage current checkSourcesFileAvailability])
  ifTrue: [
  self error: 'VM source code cannot be generated without .sources file'.
  ] !

Item was changed:
  ----- Method: CPlatformConfig>>write:toFile: (in category 'directories') -----
  write: aContents toFile: aFileName
-
  "write a file to current output directory (buildDir).
  use line end convention appropriate for config platform"
-
 
  | bldDir |
-
  bldDir := self buildDir.
+ bldDir isString
+ ifTrue: [ bldDir := bldDir asFileReference ].
+ bldDir ensureDirectory.
+ FileStream
+ forceNewFileNamed: (bldDir / aFileName) fullName
+ do: [ :stream | stream nextPutAll: (self fixLineEndsOf: aContents) ]!
-
-   bldDir isString ifTrue: [ bldDir := FileDirectory on: (FileDirectory fullPathForURI: bldDir) ].
- bldDir assureExistence.
-
- bldDir forceNewFileNamed: aFileName
- do: [:stream | stream nextPutAll: (self fixLineEndsOf: aContents) ].!

Item was changed:
  ----- Method: CocoaIOSConfig>>extraPluginSettings: (in category 'plugin extra rules') -----
  extraPluginSettings: maker
  maker set: 'CMAKE_OSX_ARCHITECTURES' to: 'i386'.
 
  maker
  setTargetProperty: 'COMPILE_FLAGS'
  to: '"-include \"', (self buildDir / self prefixHeaderFileName) fullName, '\""'.  
 
  maker isExternal ifTrue: [
  "copy result to results dir "
 
+ maker set: 'LIBRARY_OUTPUT_PATH' toString: self outputDir fullName.
+ maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir fullName.
- maker set: 'LIBRARY_OUTPUT_PATH' toString: self outputDir.
- maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir.
  maker puts: 'list(APPEND linkFlags "-undefined dynamic_lookup")' ].
 
  "maker addXCodeProperty: 'GCC_VERSION' value: '4.3'."
  maker addXCodeProperty: 'GCC_PREFIX_HEADER' value: '${buildDir}/' , self executableName , '_Prefix.pch'.
 
  !

Item was changed:
  ----- Method: CogFamilyCocoaIOSConfig>>setExtraTargetProperties: (in category 'settings') -----
  setExtraTargetProperties: maker
  | plist |
 
  maker addFrameworks: self frameworks.
 
  " generated and add Info.plist file "
  plist := self plistFile.
 
+ (FileStream forceNewFileNamed: (maker buildDir / 'Info.plist') fullName)
- (maker buildDir forceNewFileNamed: 'Info.plist')
  nextPutAll: plist;
  close.
 
  maker
  addProperty: 'MACOSX_BUNDLE_INFO_PLIST'
  value: '${buildDir}/Info.plist'.  
 
+ (FileStream forceNewFileNamed: (maker buildDir / self prefixHeaderFileName) fullName )
- (maker buildDir forceNewFileNamed: self prefixHeaderFileName)
  nextPutAll: self precompiledHeaders;
  close.
  maker addXCodeProperty: 'GCC_PREFIX_HEADER' value: '${buildDir}/', self prefixHeaderFileName.
 
  maker
  addXCodeProperty: 'PER_ARCH_CFLAGS_i386' value: '-DLSB_FIRST -mfpmath=sse -finline-functions  -fno-cse-follow-jumps -fno-gcse -mtune=prescott -march=pentium-m -falign-functions=16'.
 
  "maker
  addXCodeProperty: 'GCC_VERSION' value: '4.3'."
 
  maker
  cmd: 'set_target_properties'
  params: self executableName, ' PROPERTIES COMPILE_FLAGS "-include \"', (self buildDir / self prefixHeaderFileName) fullName, '\""'.
 
  " maker set: 'CMAKE_C_COMPILER' to: '/usr/bin/gcc-4.2'.
  maker set: 'CMAKE_CXX_COMPILER' to: '/usr/bin/g++-4.2'.
  "
+ maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir fullName.
+ maker set: 'RUNTIME_OUTPUT_DIRECTORY' toString: self outputDir fullName.!
- maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir.
- maker set: 'RUNTIME_OUTPUT_DIRECTORY' toString: self outputDir.!

Item was changed:
  ----- Method: MacOSConfig>>outputDir (in category 'accessing') -----
  outputDir
 
  "the directory where built binaries will be stored"
+ ^ outputDir ifNil: [ outputDir := (self buildDir parent / self outputDirName) ]
- ^ outputDir ifNil: [ outputDir := (self buildDir containingDirectory fullName , '/', self outputDirName) ]
  !