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

commits at source.squeak.org commits at source.squeak.org
Sat Jul 19 14:47:08 UTC 2014


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

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

Name: CMakeVMMakerSqueak-tty.92
Author: tty
Time: 19 July 2014, 10:45:30.582 am
UUID: 2420db3f-152b-46fe-a1de-6d14aca4d8d9
Ancestors: CMakeVMMakerSqueak-tty.91

Stage where templated vm plugins/modules output compiles and runs Squeak4.6 on my machine for buildType:#build.

plugins_vm (aka modules aka VMPlugins) inject their configuration to CMake template classes and render themselves correctly.
Fixed error where I was not setting CMAKE_C_FLAGS_RELEASE.

Experiment in splitting out add_definitions for -D options and compiler flags is successful; this mimics the 'mvm' file in the gnu build system
and will make porting existing builds more straightforward--hopefully copy-n-paste

Removed explicit setting of CMAKE_EXE_LINKER_FLAGS as documentation seems to prefere set_target_libraries() cmake command and that appears to be what Ian/Igor have done.


Next up: 
	Port internal/external plugins to templating system.
	implement configure options like --without-gl or --without-newspeak --with-kitchensink-minus-potatopeeler
	re-write tests to reflect changes.
	build out methods for remaining build types on Linux64x86w32BitConfig configuration
      update/write documentation for consistent methodology.

=============== Diff against CMakeVMMakerSqueak-tty.91 ===============

Item was changed:
  ----- Method: CMakeAddDefinitions>>definitions: (in category 'accessing') -----
  definitions: anObject
  	definitions := anObject.
+ 	self content:'  add_definitions(',self definitions,')'.
- 	self content:'  add_definitions(',self definitions,')'
  !

Item was changed:
  ----- Method: CMakePluginVm>>template (in category 'accessing') -----
  template
  	|temp sourcesString cflags|
  	cflags:= String streamContents: [:stream | config compilerFlags asStringOn: stream delimiter: ' ' ].
  	cflags := '"' , cflags , '"'.
  	sourcesString := String streamContents: [:stream | sources asStringOn: stream delimiter: ' ' ].
  	temp := OrderedCollection new.
  	temp
  		addLast: ((CMakeHeader new)  configurationName:  config class name );
+ 		addLast: ((CMakeProject new)variable:  module  );
- "		addLast: ((CMakeProject new)variable:  module  ); Ian does not have this. Igor does."
  		addLast: ((CMakeMinimumRequired new) version: '3.0.0');
  		addLast: ((CMakeInclude new) file: ((config buildDir fullName), FileDirectory slash, 'directories.cmake')) ; 
+ 		addLast:((CMakeAddDefinitions new) definitions: config compilerDefinitions asOrderedCollection);
  		addLast:((CMakeAddDefinitions new) definitions: config compilerFlags asOrderedCollection);
  		addLast:((CMakeAddDefinitions new) definitions: definitions); 
+ "		addLast:((CMakeSet new) variable:'sources' quotedValue: sourcesString);"
+ 		addLast:((CMakeSet new) variable:'sources' value: sourcesString);
- 		addLast:((CMakeSet new) variable:'sources' quotedValue: sourcesString);
  		addLast:((CMakeAddLibrary new) 
  			library: module
  			type: 'SHARED' 
+ 			sources: (OrderedCollection with: '${sources}'));
- 			sources:  sources);
  		addLast: ((CMakeIncludeDirectories new) dirs: includedirectories);
  		addLast:((CMakeSet new) variable: 'LIBRARY_OUTPUT_PATH' quotedValue: (config outputDir fullName));
+ "		addLast:((CMakeListAppend new) list: 'LINKLIBS' elements: (config externalLibs));"
- 		addLast:((CMakeListAppend new) list: 'LINKLIBS' elements: (config externalLibs));
  		addLast:((CMakeTargetLinkLibraries new) target: module  items: (OrderedCollection with: '${LINKLIBS}'));
  		addLast:((CMakeSetTargetProperties new) 
  			target: module 
  			propertiesandvalues: (OrderedCollection with: 'PREFIX "" '  with: 'SUFFIX "" ' with: 'LINK_FLAGS ' , cflags)) .
  	^temp!

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;          
  		cmakeCFlags;          
  		cmakeAddDefinitions;
- 		cmakeSharedLinkerFlags;
  		setGlobalOptionsAfterDetermineSystem: self;    
  		setDirectories:  self;
  		cmakeIncludeDirectories:  self;
  		preferredIncludes;
  		standardIncludes;
  		extraVMSettings: self;
  		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].
- 
  	extPlugins := self generatePluginConfigs: config internalPlugins internal: true.
  	 intPlugins := 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 changed:
  ----- Method: CPlatformConfigForSqueak>>buildScript (in category 'squeak compatability') -----
  buildScript
  	"see standardVM/platforms/unix/cmake/configure"
  	^ '#!!/usr/bin/env bash
+ export CC=gcc
+ export CXX=g++
  cmake .
  make'
  
  "  cmake '${unix}'' -DVM_HOST=''${host}'' -DVM_VERSION=''${VM_VERSION}'' -DPLATFORM_SOURCE_VERSION=''${PLATFORM_SOURCE_VERSION}'' -DSRC=''${src}'' -DOPT--CMAKE_C_FLAGS=''${cflags}'' ${args}
  "!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlags (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlags
- 	"Route this message send to the message appropriate for my buildType "
- 	|d |
- 	d:= SqueakCMakeVMMakerAbstractBuilder default buildTypeAndDirectoryInfo copy.
- 	d 
- 		at: #build put: [self cmakeSharedLinkerFlagsBuild];
- 		at: #buildAssert  put: [self cmakeSharedLinkerFlagsBuildAssert];
- 		at: #buildAssertITimerHeartbeat  put: [self cmakeSharedLinkerFlagsBuildAssertITimerHeartbeat];
-             at:#buildDebug  put: [self cmakeSharedLinkerFlagsBuildDebug];   
- 		at: #buildDebugITimerHeartbeat  put: [self cmakeSharedLinkerFlagsBuildDebugITimerHeartbeat ];
- 		at: #buildITimerHeartbeat  put: [self cmakeSharedLinkerFlagsBuildITimerHeartbeat];
- 		at: #buildMultiThreaded  put: [self cmakeSharedLinkerFlagsBuildMultiThreaded];
- 		at: #buildMultiThreadedAssert  put: [self cmakeSharedLinkerFlagsBuildMultiThreadedAssert];
- 		at: #buildMultiThreadedDebug   put: [self cmakeSharedLinkerFlagsBuildMultiThreadedDebug ];
- 		at: #buildNone put:[self cmakeSharedLinkerFlagsNoBuildType].
- 	^(d at: buildType) value!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuild (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuild
- "
- cmake --help-variable CMAKE_SHARED_LINKER_FLAGS
- CMAKE_SHARED_LINKER_FLAGS
- -------------------------
- 
- Linker flags to be used to create shared libraries.
- 
- We want a command like this:
- 
-   set(CMAKE_SHARED_LINKER_FLAGS ''-Wl -z now'')
- 
- using the template system, it looks like this:
- 
- 	|flags|
- 	flags := { 
- 		'-Wl'
-            . '-z'
-            . 'now'
- 	   } asOrderedCollection .
- 	templates
- 		addLast:((CMakeSet new) 
- 			variable:'CMAKE_SHARED_LINKER_FLAGS' 
- 			quotedValue:'${CMAKE_SHARED_LINKER_FLAGS} ', (String streamContents: [:stream | flags asStringOn: stream delimiter: ' ' ])).
- 
- ."
- 	self subclassResponsibility.!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildAssert (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildAssert
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildAssertITimerHeartbeat (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildAssertITimerHeartbeat
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildDebug (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildDebug
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildDebugITimerHeartbeat (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildDebugITimerHeartbeat
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildITimerHeartbeat (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildITimerHeartbeat
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildMultiThreaded (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildMultiThreaded
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildMultiThreadedAssert (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildMultiThreadedAssert
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsBuildMultiThreadedDebug (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuildMultiThreadedDebug
- 	"convenience method for customizing CMAKE_SHARED_LINKER_FLAGS for different buildType "
- 	^self cmakeSharedLinkerFlagsBuild!

Item was removed:
- ----- Method: CPlatformConfigForSqueak>>cmakeSharedLinkerFlagsNoBuildType (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsNoBuildType
- 	"SHOULD NOT GET HERE"
- 	self shouldNotImplement.
- !

Item was changed:
  ----- Method: Linux64x86w32BitConfig>>customizeCMakeVMDisplayX11 (in category 'plugins') -----
  customizeCMakeVMDisplayX11
  	|module|
  	module := vmplugins detect: [:vmd | #CMakeVMDisplayX11 = ((vmd class name) asSymbol)] ifNone:[nil].  "error handling?"
  	module 
+ 		sources: #( '${targetPlatform}/vm-display-X11/sqUnixX11' '${targetPlatform}/vm-display-X11/sqUnixMozilla' );
- 		sources: #( '${targetPlatform}/vm-display-X11/sqUnixX11'	'${targetPlatform}/vm-display-X11/sqUnixMozilla' );
  		compilerdefinitions:(OrderedCollection with: '-fPIC' with: '-DPIC');
  		compilerflags: (self compilerFlags);
  		externallibraries: (self externalLibraries);
  		linkerflags: (self linkerFlags);
  		includedirectories:(OrderedCollection 
  										with:'${crossDir}/plugins/FilePlugin' 
  										with: '${targetPlatform}/plugins/B3DAcceleratorPlugin'  
   									     with: '${crossDir}/plugins/B3DAcceleratorPlugin').
  !

Item was changed:
  ----- Method: Linux64x86w32BitSqueakCogV3Config>>cmakeAddDefinitionsBuild (in category 'cmake buildType redirects') -----
  cmakeAddDefinitionsBuild
+ 	|c d  o|
- 	"from oscogvm/build.linux32x86/squeak.cog.v3/build/mvm"
  	(enabledebugmessages)
  		ifTrue:[	templates 
  		addLast:((CMakeMessage new) message: (self class name) , 'cmakeAddDefinitionsBuild')
  	] .
+ 	c := self compilerFlags asOrderedCollection.
+ 	d := self compilerDefinitions asOrderedCollection.
+ 	o:= OrderedCollection new.
+ 	o addAllLast: c; addAllLast: d.
  	templates
+ 		addLast:((CMakeAddDefinitions new) definitions: (self compilerDefinitions asOrderedCollection)). "see my self flag below"
- 		addLast:((CMakeAddDefinitions new) definitions: (self compilerDefinitions asOrderedCollection)).
  !

Item was changed:
  ----- Method: Linux64x86w32BitSqueakCogV3Config>>cmakeCFlagsBuild (in category 'cmake buildType redirects') -----
  cmakeCFlagsBuild
  	|cflags|
  	self flag:'tty'. "#build should have -O2"
  	cflags:= String streamContents: [:stream | (self compilerFlags) asStringOn: stream delimiter: ' ' ].
  	cflags:='"', cflags, '"'.
  	(enabledebugmessages)
  		ifTrue:[	templates 
  		addLast:((CMakeMessage new) message: (self class name) , 'cmakeCFlagsBuild')
  	] .
  	templates
- 		addLast:((CMakeSet new) variable:'CMAKE_CXX_FLAGS' value: '${CMAKE_CXX_FLAGS} ', cflags );
  		addLast:((CMakeSet new) variable:'CMAKE_C_FLAGS' value: '${CMAKE_C_FLAGS} ', cflags );
+ 		addLast:((CMakeSet new) variable:'CMAKE_C_FLAGS_RELEASE' value: '${CMAKE_CXX_FLAGS_RELEASE} ', cflags );
+ 		addLast:((CMakeSet new) variable:'CMAKE_C_FLAGS_DEBUG' value: '${CMAKE_CXX_FLAGS_DEBUG} ',cflags);		
+ 		addLast:((CMakeSet new) variable:'CMAKE_CXX_FLAGS' value: '${CMAKE_CXX_FLAGS} ', cflags );
  		addLast:((CMakeSet new) variable:'CMAKE_CXX_FLAGS_RELEASE' value: '${CMAKE_CXX_FLAGS_RELEASE} ', cflags );
  		addLast:((CMakeSet new) variable:'CMAKE_CXX_FLAGS_DEBUG' value: '${CMAKE_CXX_FLAGS_DEBUG} ', cflags ).
  
  	(enabledebugmessages)  "take a peek at em"
  		ifTrue:[	templates 
  		addLast:((CMakeMessage new) message: 'CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}');
  		addLast:((CMakeMessage new) message: 'CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}');
  		addLast:((CMakeMessage new) message: 'CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}');
  		addLast:((CMakeMessage new) message: 'CMAKE_C_FLAGS=${CMAKE_C_FLAGS}');
  		addLast:((CMakeMessage new) message: 'CMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}');
  		addLast:((CMakeMessage new) message: 'CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}')
  	] .
  
  
  !

Item was removed:
- ----- Method: Linux64x86w32BitSqueakCogV3Config>>cmakeSharedLinkerFlagsBuild (in category 'cmake buildType redirects') -----
- cmakeSharedLinkerFlagsBuild
- 
- 	(enabledebugmessages)
- 		ifTrue:[	templates 
- 		addLast:((CMakeMessage new) message: (self class name) , 'cmakeSharedLinkerFlagsBuild')
- 	] .
- 	templates
- 		addLast:((CMakeSet new) 
- 			variable:'CMAKE_SHARED_LINKER_FLAGS' 
- 			quotedValue:'${CMAKE_SHARED_LINKER_FLAGS} ', (String streamContents: [:stream | (self linkerFlags ) asStringOn: stream delimiter: ' ' ])).
- 
- 	(enabledebugmessages)
- 		ifTrue:[	templates 
- 			addLast:((CMakeMessage new) message: 'CMAKE_C_LINKER_PREFERENCE = ${CMAKE_C_LINKER_PREFERENCE}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_C_LINKER_PREFERENCE_PROPAGATES = ${CMAKE_C_LINKER_PREFERENCE_PROPAGATES}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_CXX_LINKER_PREFERENCE = ${CMAKE_CXX_LINKER_PREFERENCE}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES = ${CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_EXE_LINKER_FLAGS_DEBUG = ${CMAKE_EXE_LINKER_FLAGS_DEBUG}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_EXE_LINKER_FLAGS_RELEASE = ${CMAKE_EXE_LINKER_FLAGS_RELEASE}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_MODULE_LINKER_FLAGS = ${CMAKE_MODULE_LINKER_FLAGS}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_MODULE_LINKER_FLAGS_DEBUG = ${CMAKE_MODULE_LINKER_FLAGS_DEBUG}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_MODULE_LINKER_FLAGS_ RELEASE= ${CMAKE_MODULE_LINKER_FLAGS_RELEASE}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_SHARED_LINKER_FLAGS_DEBUG = ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_SHARED_LINKER_FLAGS_RELEASE = ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_STATIC_LINKER_FLAGS = ${CMAKE_STATIC_LINKER_FLAGS}');
- 			addLast:((CMakeMessage new) message: 'CMAKE_STATIC_LINKER_FLAGS_DEBUG= ${CMAKE_STATIC_LINKER_FLAGS_DEBUG}');
- 			addLast:((CMakeMessage new) message: ' CMAKE_STATIC_LINKER_FLAGS_RELEASE= ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}')		
- 
- 	] .
- !

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

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

Item was changed:
  ----- Method: Linux64x86w32BitSqueakCogV3Config>>externalLibraries (in category 'compiling') -----
  externalLibraries
  	^#(
+ 		     '-L/usr/lib'
+ 		     '-L/usr/lib/X11'
  			'uuid'  ""
  			 'ssl'  ""
  			 'crypto' ""
  			 'm'      	"C math library"
  			 'dl'      "dynamic linking library"
  			 'pthread' "POSIX threads library"
  			 'SM'   "session management library for X11"
  			 'ICE'   "ICE is the Inter Client Exchange protocol, part of X11"
  			 'GL'    "libGL implements the GLX interface as well as the main OpenGL API entrypoints"
  			 'X11'
  			 'nsl'    "network services library"
  		)
  				
  
  !

Item was changed:
  ----- Method: Linux64x86w32BitSqueakCogV3Config>>linkerFlags (in category 'compiling') -----
  linkerFlags
  	^#(	'-Wl'
              '-z'
              'now'
+ 	   ) 
- 	   )
  !

Item was changed:
  ----- Method: SqueakUnixConfig>>setGlobalOptionsAfterDetermineSystemBuild: (in category 'cmake buildType redirects') -----
  setGlobalOptionsAfterDetermineSystemBuild: aMaker
  	"	SystemNavigation default browseMethodsWhoseNamesContain: 'setGlobalOptionsAfterDetermineSystemBuild'"
  	(enabledebugmessages)
  		ifTrue:[	
  	templates 
  	addLast: ((CMakeMessage new) message: (self class name), '  setGlobalOptionsAfterDetermineSystemBuild: aMaker')
  	].
+ 	"templates addLast:((CMakeSet new) variable:'CMAKE_C_COMPILER' value: 'gcc')"
- 	templates addLast:((CMakeSet new) variable:'CMAKE_C_COMPILER' value: 'gcc')
  
  	!



More information about the Vm-dev mailing list