VM Maker: CMakeVMMakerSqueak-tty.102.mcz

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

VM Maker: CMakeVMMakerSqueak-tty.102.mcz

commits-2
 
Timothy M uploaded a new version of CMakeVMMakerSqueak to project VM Maker:
http://source.squeak.org/VMMaker/CMakeVMMakerSqueak-tty.102.mcz

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

Name: CMakeVMMakerSqueak-tty.102
Author: tty
Time: 8 December 2014, 1:53:08.458 pm
UUID: 19f526f3-9c73-49d3-a515-73e5f653c217
Ancestors: CMakeVMMakerSqueak-tty.101

'generate' methods are removed from CMakeVMMakerSqueak generator classes in favor of generateByTemplate methods.

EXCEPT FOR SqueakCMThirdpartyLibrary generateFor: aVMGenerator  which I will have to figure out when I use a 3'rd party library. I have flagged that method.

This radically diverges from the Pharo approach but I have strong reasons for it. as described in the class comment for
CMakeTemplate

The SqueakCMakeVMMakerAbstractBuilder generateSources call is broken at the pharo level in
 CPlaformConfig>>generateSources  at 'maker cogitClass: cg

Next up
1. build a pure 32 bit linux config and submit it
2. clean up the Developer Help while doing 1 such that others can build their own configs systematically.
3. QA the image build scripts.
4. investigate pharo issue
5. solve the 3'rd party library issue.

=============== Diff against CMakeVMMakerSqueak-tty.101 ===============

Item was removed:
- ----- Method: CMakePluginGeneratorForSqueak>>generate (in category 'squeak compatibility') -----
- generate
- | name |
-
- output := String new writeStream.
-
- name := plugin moduleName.
- #( vmGen config setGlobalOptions: self.
- self
- printHeader;
- project: name;
- "include directories generated for build"
- include: '../directories.cmake'.
- self set: 'CMAKE_CONFIGURATION_TYPES' to: 'Release'.
- ).
-
- self message: (internal ifTrue: [ 'Adding internal plugin: '] ifFalse: ['Adding external plugin: '])  , name.
- self
- set: #pluginName toString: name;
- set: #pluginSrc toString: '${srcPluginsDir}/', name;
- set: #pluginCross toString: '${crossDir}/plugins/', name;
- set: #pluginPlatform toString: '${targetPlatform}/plugins/', name.
-
- self set: #LINKLIBS to: ''. "clear LINKLIBS variable"
-
- internal ifTrue: [ self puts: 'add_definitions(-DSQUEAK_BUILTIN_PLUGIN)'].
-
- self addSources: { name , '.c' } prefixed: '${pluginSrc}/'.
- self includeDirectories: '${pluginSrc} ${pluginCross} ${targetPlatform}/plugins/${pluginName}'. " default include directories for plugin "
- "self addDefinitions: vmGen config compilerFlags."   "Not needed because there are already there (inherited from main configuration)"
- " perform config's configureXYZ: message to apply per-plugin custom rules, if any "
-
- vmGen config configurePlugin: plugin with: self.
- extraRules ifNotNil: [ extraRules value: self ].
- " generate a static lib for internal plugin, or shared for external"
- internal
- ifTrue: [ self cmd: 'add_library' params:  name , ' STATIC ${sources}'.]
- ifFalse: [self cmd: 'add_library' params: name , ' SHARED ${sources}'.].
- vmGen config extraPluginSettings: self.
- self isExternal
- ifTrue: [ self cmd: 'target_link_libraries' params: self moduleName , ' ${LINKLIBS}'.].
-
- self cmd: 'set_property'  params: 'TARGET ', name, ' PROPERTY LINK_FLAGS "${linkFlags}"'. " see senders of #linkFlags "
- self puts: 'IF (',self moduleName , '_dependencies)'. "set dependencies"
- self cmd: 'add_dependencies' params: name , ' ${', self moduleName , '_dependencies}'.
- self puts: 'ENDIF (',self moduleName , '_dependencies)'.
- self saveFile.
-
-
- !

Item was removed:
- ----- Method: CMakeVMGeneratorForSqueak class>>generate: (in category 'as yet unclassified') -----
- generate: aConfigOrClass  
- ^self new
- generate: aConfigOrClass;
- yourself  !

Item was removed:
- ----- Method: CMakeVMGeneratorForSqueak>>generate (in category 'code generation') -----
- generate
- | intPlugins extPlugins |
- output := String new writeStream.
- config setGlobalOptions: self.
-
- self
- printHeader;
- project: config executableName.
-
- config setGlobalOptionsAfterDetermineSystem: self.
- "I NEED COMPILER FLAGS, DEFINITIONS, LINKS, INCLUDES HERE"
- config setupDirectories: self.
-
- self message: '${CMAKE_MODULE_PATH}'.
- self set: 'CMAKE_CONFIGURATION_TYPES' to: 'Release'.
-
- config preferredIncludes do: [ :each | self includeDirectories: each ].
- self includeDirectories: self includeDirs.
- config standardIncludes do: [:each | self includeDirectories: each ].
-
- self addDefinitions: config compilerFlags. "<--- this needs to be definitions, not compiler flags"
-
- config extraVMSettings: self.
-
- self puts: 'add_executable(' , config executableName, ' ', config executableType, ' ' , self sources , ')'.
- intPlugins := self generatePluginConfigs: config internalPlugins internal: true.
- extPlugins := self generatePluginConfigs: config externalPlugins internal: false.
-
- self processThirdpartyLibraries.
-
- self processPlugins:  intPlugins, extPlugins.
-
- config setExtraTargetProperties: self.
-
- self cmd: 'target_link_libraries'
- params: self moduleName , ' ${LINKLIBS}'.
-
- config postBuildActions: self.
-
- self saveFile.
- self generateBuildScript.!

Item was removed:
- ----- Method: CMakeVMGeneratorForSqueak>>generate: (in category 'as yet unclassified') -----
- generate: aConfigOrClass
-
- config := aConfigOrClass isBehavior ifTrue: [ aConfigOrClass new ] ifFalse: [aConfigOrClass].
- ^ self generate!

Item was changed:
  ----- Method: CMakeVMGeneratorForSqueak>>processPlugins: (in category 'as yet unclassified') -----
  processPlugins: pluginGenerators
  | libs libDeps |
  libs := OrderedCollection new.
  libDeps := Dictionary new.
- self break.
  pluginGenerators do: [:gen |
  gen doNotGenerate ifFalse: [
  self  puts: (gen configDotCMake at: (gen plugin name) ifAbsent:[gen configDotCmakeEmpty]).
  gen isInternal
  ifTrue: [
  libs add: gen plugin moduleName ]
  ifFalse: [
  "make main module to depend on external plugin, just to make sure it is built
  before main module built"
  self
  cmd: 'add_dependencies'
  params: config executableName, ' ' , gen plugin moduleName ].
  gen externalDependencies
  ifNotEmpty: [ :deps |
  libDeps
  at: gen plugin moduleName
  put: (deps fold: [ :a :b | a, ' ', b ]) ].
  self addSubdirectory: gen plugin moduleName ] ].
 
  self cmd: 'target_link_libraries' params:  config executableName , ' ' ,
  (libs inject: '' into: [:res :ea | res, ' ' , ea ]).
 
  libDeps keysAndValuesDo: [ :moduleName :dependencies |
  self
  cmd: 'add_dependencies'
  params: moduleName, ' ', dependencies ].  
 
  self generateExportsH: libs.!

Item was changed:
  ----- Method: CMakeVMGeneratorForSqueak>>processThirdpartyLibraries (in category 'as yet unclassified') -----
  processThirdpartyLibraries
+ self flag:'tty'. "This generate call must be transformed to generateByTemplateFor:"
-
  config thirdpartyLibs do: [:each |
  each generateFor: self ]
 
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>configureByTemplatePlugin:with: (in category 'source generation') -----
  configureByTemplatePlugin: aPlugin with: generator
+
- "by-pass the pharo's CPlatformConf>>configurePlugin: with: so that I can use templates"
  ^ self perform: ( 'configureByTemplate' , aPlugin name , ':' ) asSymbol with: generator.
  !

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>generate (in category 'source generation') -----
- generate
- self
- generatePluginsList;
- generateLicense;
- generateUtilsCmake;
- generatePluginsCmake;
- generateVmBuildCmake;
- generateVmConfigCmake;
- generateVmConfigIn;
- generateTestDoubleWordAlignmentC;
- generateTestDoubleWordOrderC;
- generateTestLanginfoCodesetC.
- ^ CMakeVMGeneratorForSqueak generate: self !

Item was changed:
  ----- Method: SqueakCMThirdpartyLibrary>>generateFor: (in category 'as yet unclassified') -----
  generateFor: aVMGenerator
 
  | libDir stream contents |
+ self flag:'tty'. "This l must be transformed to generateByTemplateFor: and the output converted to CMakeTemplates"
  self break.
  vmGen := aVMGenerator.
 
  gen := CMakeGenerator new
  output: (String new writeStream).
 
  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  / gen outputFileName) fullName 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"
  (FileStream forceNewFileNamed: (libDir  / gen outputFileName) pathName) nextPutAll: contents; close.
  ].
 
 
  vmGen addSubdirectory:  vmGen thirdpartyDirName , '/' , self canonicalName.
  self defineGlobalTargets.
  !

Item was removed:
- ----- Method: SqueakCMakeVMMakerAbstractBuilder class>>generate (in category 'building') -----
- generate
- default ifNil:[default:= self new].
- ^default  generate!

Item was removed:
- ----- Method: SqueakCMakeVMMakerAbstractBuilder>>generate (in category 'building') -----
- generate
- (config isKindOf: CPlatformConfig)
- ifTrue:[config generate]
- !

Item was changed:
  ----- Method: SqueakCMakeVMMakerAbstractBuilder>>generateSources (in category 'building') -----
  generateSources
+ self flag: 'tty'. "This used to work, but it looks like CPlaformConfig>>generateSources breaks at 'maker cogitClass: cg'"
+ self error:'Pharo CPlatformConfig is broken. Will fix later'.
  (config isKindOf: CPlatformConfig)
  ifTrue:[config generateSources]
  !

Item was removed:
- ----- Method: SqueakIOSConfig>>configurePlugin:with: (in category 'plugin extra rules') -----
- configurePlugin: aPlugin with: generator
-
- generator isExternal ifTrue: [
- " set output directory for dynamic library to Resources subdir in .app bundle location "
- generator
- set: 'CMAKE_LIBRARY_OUTPUT_DIRECTORY'
- toString: '${externalModulesDir}'
- ].
- ^ super configurePlugin: aPlugin with: generator
- !

Item was removed:
- ----- Method: SqueakMacOSXPowerPCConfig>>configurePlugin:with: (in category 'plugin extra rules') -----
- configurePlugin: aPlugin with: generator
-
- generator isExternal ifTrue: [
- " set output directory for dynamic library to Resources subdir in .app bundle location "
- generator
- set: 'CMAKE_LIBRARY_OUTPUT_DIRECTORY'
- toString: '${externalModulesDir}'
- ].
- ^ super configurePlugin: aPlugin with: generator
- !

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: CMakeVMMakerSqueak-tty.102.mcz

Eliot Miranda-2
 
Hi Timothy,

On Mon, Dec 8, 2014 at 10:52 AM, <[hidden email]> wrote:

Timothy M uploaded a new version of CMakeVMMakerSqueak to project VM Maker:
http://source.squeak.org/VMMaker/CMakeVMMakerSqueak-tty.102.mcz

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

Name: CMakeVMMakerSqueak-tty.102
Author: tty
Time: 8 December 2014, 1:53:08.458 pm
UUID: 19f526f3-9c73-49d3-a515-73e5f653c217
Ancestors: CMakeVMMakerSqueak-tty.101

'generate' methods are removed from CMakeVMMakerSqueak generator classes in favor of generateByTemplate methods.

EXCEPT FOR SqueakCMThirdpartyLibrary generateFor: aVMGenerator  which I will have to figure out when I use a 3'rd party library. I have flagged that method.

This radically diverges from the Pharo approach but I have strong reasons for it. as described in the class comment for
CMakeTemplate

The SqueakCMakeVMMakerAbstractBuilder generateSources call is broken at the pharo level in
 CPlaformConfig>>generateSources  at 'maker cogitClass: cg

Next up
1. build a pure 32 bit linux config and submit it
2. clean up the Developer Help while doing 1 such that others can build their own configs systematically.
3. QA the image build scripts.
4. investigate pharo issue
5. solve the 3'rd party library issue.

=============== Diff against CMakeVMMakerSqueak-tty.101 ===============

 [snip]
 
Item was changed:
  ----- Method: SqueakCMakeVMMakerAbstractBuilder>>generateSources (in category 'building') -----
  generateSources
+       self flag: 'tty'. "This used to work, but it looks like CPlaformConfig>>generateSources breaks at 'maker cogitClass: cg'"
+       self error:'Pharo CPlatformConfig is broken. Will fix later'.
        (config isKindOf: CPlatformConfig)
                ifTrue:[config generateSources]
                !

define the Cogit class using options, as in

VMMaker
generate: CoInterpreter
with: #( Cogit StackToRegisterMappingCogit
NewspeakVM true
MULTIPLEBYTECODESETS true)

...
--
cheers,
Eliot