[Vm-dev] VM Maker: CMakeVMMakerSqueak-tty.96.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 4 16:54:12 UTC 2014


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

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

Name: CMakeVMMakerSqueak-tty.96
Author: tty
Time: 4 December 2014, 11:54:31.236 am
UUID: f627c6b0-637e-4c5d-96ba-2e30003d3bfe
Ancestors: CMakeVMMakerSqueak-tty.95

postBuildActions converted to CMake Templates

Test modified to support it.

Now on to plugins converted to CMake templates

=============== Diff against CMakeVMMakerSqueak-tty.95 ===============

Item was added:
+ CMakeTemplate subclass: #CMakeAppendConfigHIn
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMakerSqueak-CMakeCustomTemplates'!
+ 
+ !CMakeAppendConfigHIn commentStamp: 'tty 12/4/2014 11:13' prior: 0!
+ A CMakeAppendConfigHIn looks like this:
+ 
+ FOREACH (var ${config_vars})
+   FILE (APPEND ${CMAKE_BINARY_DIR}/config.h.in "#cmakedefine ${var} @${var}@\n")
+ ENDFOREACH (var)'.!

Item was added:
+ ----- Method: CMakeAppendConfigHIn>>initialize (in category 'initialize-release') -----
+ initialize
+ 	self content:'
+ FOREACH (var ${config_vars})
+   FILE (APPEND ${CMAKE_BINARY_DIR}/config.h.in "#cmakedefine ${var} @${var}@\n")
+ ENDFOREACH (var)'.
+ !

Item was added:
+ CMakeTemplate subclass: #CMakeAppendConfigStatus
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMakerSqueak-CMakeCustomTemplates'!
+ 
+ !CMakeAppendConfigStatus commentStamp: 'tty 12/4/2014 11:27' prior: 0!
+ A CMakeAppendConfigStatus looks like this:
+ 
+ FILE (WRITE ${CMAKE_BINARY_DIR}/config.status "")
+ FOREACH (var ${tmp})
+   FILE (APPEND ${CMAKE_BINARY_DIR}/config.status "${var}=${${var}}\n")
+ ENDFOREACH ()'
+ !

Item was added:
+ ----- Method: CMakeAppendConfigStatus>>initialize (in category 'initialize-release') -----
+ initialize
+ 	self content:'
+ FOREACH (var ${config_vars})
+   FILE (APPEND ${CMAKE_BINARY_DIR}/config.h.in "#cmakedefine ${var} @${var}@\n")
+ ENDFOREACH (var)'.
+ !

Item was added:
+ CMakeTemplate subclass: #CMakeCommand
+ 	instanceVariableNames: 'command params'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMakerSqueak-CMakeTemplates'!
+ 
+ !CMakeCommand commentStamp: '<historical>' prior: 0!
+ A CMakeSetTemplate 's contents look like
+ 
+ 
+ 	CONFIG_DEFINE (SQ_VERSION)
+ 
+ 
+ CONFIG_DEFINE is a Macro Ian Piumarta wrote that looks like this:
+ 
+ MACRO (CONFIG_DEFINE var)
+   LIST (APPEND config_vars "${var}")
+ ENDMACRO (CONFIG_DEFINE var)
+ 
+ You can see it in CPlatformConfigForSqueak class utilsCMake
+ 
+ !

Item was added:
+ ----- Method: CMakeCommand>>command:params: (in category 'accessing') -----
+ command: cString params: pString
+ 	command:=cString.
+ 	params:=pString.
+ 	self content: command,'(', params ,')'
+ 
+ !

Item was added:
+ ----- Method: CMakeCommand>>initialize (in category 'initialize-release') -----
+ initialize
+ 	command:='foo'.
+ 	params:='bar'.
+ 	self content: command,'(', params ,')'!

Item was changed:
  ----- Method: CMakeVMGeneratorForSqueak>>generateByTemplate (in category 'code generation') -----
  generateByTemplate
  	"attempt to move way from string based writing to  template based. Think Seaside renderOn composition"
  	| extPlugins intPlugins |
  	self flag: 'tty'. "refactor so that the cascade reflects CMake terminilogy"
+ 
  	output := String new writeStream.
  	config templates: OrderedCollection new. 
  	config 
  		setGlobalOptions: self;    
  		cmakePrefixPath;
  		cmakeIncludePath;
  		cmakeLibraryPath;
+ 		cmakeIncludeModules;
- 		cmakeIncludeModules;          
  		cmakeCFlags;          
  		cmakeAddDefinitions;
  		cmakeWriteDirectoriesDotCmake:  self;
  		cmakeIncludeDirectories:  self;   "<---"
  		preferredIncludes;                      "<---why 3  of em?"
  		standardIncludes;                       "<---"
  		setGlobalOptionsAfterDetermineSystem: self;    
  		extraVMSettings: self;                "<--catch-all method. os/platform specific"
  		setCoreSources: self;
  		setPlatformSources: self;
  		setCrossSources: self;
  		setExtraSources;
  		cmakeSetSourceFilesProperties;
  		cmakeListAppend:'LINKLIBS' elements: (config externalLibs);
  		cmakeAddExecutableNameOptionSource: self;
  	      setExecutableOutputPath;
  		addVMPlugins: self.
  	config templates do: [:each | self puts: each content].
+ 	config templates: OrderedCollection new. 
  	extPlugins := self generatePluginConfigs: config internalPlugins internal: true.
  	 intPlugins := self generatePluginConfigs: config externalPlugins internal: false.
+ 	self processThirdpartyLibraries.                       "<--unused in Pharo code? What exactly does this do?"
- 	self processThirdpartyLibraries.
  	self processPlugins:  intPlugins, extPlugins.
+ 	self config templates	addLast:((CMakeCommand new) command:'target_link_libraries' params:(self moduleName , ' ${LINKLIBS}')).
+ "	self cmd: 'target_link_libraries'
+ 		params: self moduleName , ' ${LINKLIBS}'."
- 	self cmd: 'target_link_libraries'
- 		params: self moduleName , ' ${LINKLIBS}'.
  	config postBuildActions: self..
+ 	config templates do: [:each | self puts: each content].
  	self saveFile.
  	self generateBuildScript!

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: CMakeVMMakerSqueakRedirectMethodsWithArgTest>>testSetPostBuildActions (in category 'as yet unclassified') -----
  testSetPostBuildActions
+ 	self flag:'tty'. "This test will probably fail if the oscogvm/cmake.build.xzy/language.vm.memorymanager/buildtype/ directory is not in place"
- 	self flag:'tty'. "Is the self shouldnt sufficient?"
  	#(#SqueakMacintoshConfig #SqueakUnixConfig #SqueakWindowsConfig ) 
  		do:[:each | 
  			(Smalltalk at:each) 
  				allSubclassesDo:[:configuration | | o buildTypes vmGenerator|
  					o:= configuration basicNew.
  					(o excludeFromBuild not) & (configuration isAbstractBaseClass not)
  						ifTrue:[
  							buildTypes:=o availableBuildTypes copyWithoutAll:#(#buildNone).
  							buildTypes do:[:buildType |
  								o configureForBuildType: buildType.
+ 								o enabledebugmessages: true.
+ 								o templates: OrderedCollection new.
  								vmGenerator:=CMakeVMGeneratorForSqueak new.
  								vmGenerator config: o.
  								vmGenerator output:(String new writeStream).
  								self shouldnt: [o postBuildActions: vmGenerator] raise: Error]]]].
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildAssert: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildAssert: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildAssertITimerHeartbeat: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildAssertITimerHeartbeat: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildDebug: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildDebug: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildDebugITimerHeartbeat: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildDebugITimerHeartbeat: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildITimerHeartbeat: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildITimerHeartbeat: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildMultiThreaded: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildMultiThreaded: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildMultiThreadedAssert: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildMultiThreadedAssert: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: CPlatformConfigForSqueak>>postBuildActionsBuildMultiThreadedDebug: (in category 'cmake buildType redirects') -----
  postBuildActionsBuildMultiThreadedDebug: aMaker
  	"
  	SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActions'"
  
+ 	self postBuildActionsBuild: aMaker
- 	^self postBuildActionsBuild: aMaker
  !

Item was changed:
  ----- Method: Linux64x86w32BitConfig>>defaultExternalPlugins (in category 'plugins') -----
  defaultExternalPlugins
+ "developing template model for plugins one at a time"
+ 	^ #()
+ !
- 	^ #(
- 		B3DAcceleratorPlugin
- 		ThreadedIA32FFIPlugin "SqueakFFIPrims"
- 		"UUIDPlugin"
- 		"UnixOSProcessPlugin ?? "	
- 		JPEGReaderPlugin 
- 		JPEGReadWriter2Plugin 			
- 		RePlugin
- 		InternetConfigPlugin
- 	)
- 
- "debug"!

Item was changed:
  ----- Method: Linux64x86w32BitConfig>>postBuildActionsBuild: (in category 'cmake buildType redirects') -----
  postBuildActionsBuild: aMaker
  	"SystemNavigation default browseMethodsWhoseNamesContain: 'postBuildActionsBuild:'"
+ 	(aMaker config enabledebugmessages)
+ 		ifTrue:[	
+ 	aMaker config templates 
+ 		addLast: ((CMakeMessage new) message: (self class name), ' postBuildActionsBuild' )
+ 	].
+ 	aMaker config templates 
+ 		addLast: ((CMakeMessage new) message: 'postBuildActionsBuild: aMaker' );
+ 		addLast:((CMakeCommand new) command:'include' params:'config.cmake');                                                 "cmake --help-command include "
+ 		addLast:((CMakeCommand new) command:'LIST' params:'REMOVE_DUPLICATES config_vars');                      "cmake --help-command LIST"
+ 		addLast:((CMakeCommand new) command:'FILE' params:'WRITE ${CMAKE_BINARY_DIR}/config.h.in ""');          "cmake --help-command FILE"
+ 		addLast:(CMakeAppendConfigHIn new);
+ 		addLast:((CMakeCommand new) command:'CONFIGURE_FILE' params:'${CMAKE_BINARY_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h');
+ 		addLast:((CMakeCommand new) command:'GET_CMAKE_PROPERTY' params:'tmp VARIABLES');
+ 		addLast:((CMakeCommand new) command:'LIST' params:'REMOVE_ITEM tmp tmp');
+ 		addLast:((CMakeCommand new) command:'LIST' params:'SORT tmp');
+ 		addLast:((CMakeCommand new) command:'FILE' params:'WRITE ${CMAKE_BINARY_DIR}/config.h.status ""');
+ 		addLast:(CMakeAppendConfigStatus new).
- 	aMaker message: 'postBuildActionsBuild: aMaker'.
- 	aMaker  include: 'config.cmake'.
- 	"# CONFIGURE_PLUGINS"
- 	aMaker cmd: 'LIST' params:'REMOVE_DUPLICATES config_vars'.
- 	aMaker cmd: 'FILE' params: 'WRITE ${CMAKE_BINARY_DIR}/config.h.in ""'.
- 	aMaker puts:'
- FOREACH (var ${config_vars})
-   FILE (APPEND ${CMAKE_BINARY_DIR}/config.h.in "#cmakedefine ${var} @${var}@\n")
- ENDFOREACH (var)'.
- 	aMaker cmd: 'CONFIGURE_FILE' params:'${CMAKE_BINARY_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h'.
- 	"# INCLUDE(build.cmake) <--this tells me the config needs to be up higher
- 	# BUILD PLUGINS
- 	#ADD_SUBDIRECTORY (${unix}/npsqueak)
- 	#SET (cmake ${unix}/../../cmake)
- 	#IF (EXISTS ${cmake}/Packages.cmake)
- 	#  INCLUDE (${cmake}/Packages.cmake)
- 	#ENDIF ()
- 	"
- 	aMaker cmd: 'GET_CMAKE_PROPERTY' params: 'tmp VARIABLES'.
- 	aMaker cmd: 'LIST' params: 'REMOVE_ITEM tmp tmp'.
- 	aMaker cmd: 'LIST' params: 'SORT tmp'.
- 	aMaker cmd: 'FILE' params: 'WRITE ${CMAKE_BINARY_DIR}/config.h.status ""'.
- 	aMaker puts:'
- FILE (WRITE ${CMAKE_BINARY_DIR}/config.status "")
- FOREACH (var ${tmp})
-   FILE (APPEND ${CMAKE_BINARY_DIR}/config.status "${var}=${${var}}\n")
- ENDFOREACH ()'
  
  !

Item was changed:
  ----- Method: Linux64x86w32BitSqueakCogV3Config>>compilerDefinitions (in category 'compiling') -----
  compilerDefinitions
  	^#(
  	 '-DNDEBUG'          
   	 '-DDEBUGVM=0'
  	 ' -DLSB_FIRST=1'
  	 '-D_GNU_SOURCE'
   	 '-D_FILE_OFFSET_BITS=64'
+ "	  '-DUSE_GLOBAL_STRUCT=0'"
- 	  '-DUSE_GLOBAL_STRUCT=0'
   	 '-DCOGMTVM=0') 
  !

Item was changed:
  ----- Method: Linux64x86w32BitSqueakCogV3Config>>compilerFlags (in category 'compiling') -----
  compilerFlags
  	^#("'-Wall'"
  		'-w'
  		'-m32'
  		'-msse2'
+ "		'-g3'                      extra debugging info"
- 		'-g3'                      "extra debugging info"
  		'-O1'
+ "	 	'-fno-caller-saves'
+ 		'-fno-tree-pre'") 
- 	 	'-fno-caller-saves'
- 		'-fno-tree-pre') 
  !

Item was changed:
  ----- Method: SqueakCMThirdpartyLibrary>>generateFor: (in category 'as yet unclassified') -----
  generateFor: aVMGenerator
  
  	| libDir stream contents |
+ 	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.
  	!



More information about the Vm-dev mailing list