[Vm-dev] VM Maker: CMakeVMMaker-IgorStasenko.164.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jun 10 04:57:35 UTC 2012


Igor Stasenko uploaded a new version of CMakeVMMaker to project VM Maker:
http://source.squeak.org/VMMaker/CMakeVMMaker-IgorStasenko.164.mcz

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

Name: CMakeVMMaker-IgorStasenko.164
Author: IgorStasenko
Time: 10 June 2012, 6:57:22 am
UUID: 9684a447-fe31-4e4c-9bdc-56c63fd1308d
Ancestors: CMakeVMMaker-EstebanLorenzano.163

- added support for building & bundling VM with 3rd-party libraries (mainly to deal with Mac and windows platforms, since on linux users can easily install missing libs by own)
note, this may not work out of the box.. tested only on macs
so, more work may be needed


=============== Diff against CMakeVMMaker-EstebanLorenzano.163 ===============

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

Item was added:
+ CMThirdpartyLibrary subclass: #CMCairo
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMaker-Libs'!

Item was added:
+ ----- Method: CMCairo class>>canonicalName (in category 'as yet unclassified') -----
+ canonicalName
+ 	^ 'cairo'!

Item was added:
+ ----- Method: CMCairo>>archiveMD5Sum (in category 'package properties') -----
+ archiveMD5Sum
+ 
+ 	^ '87649eb75789739d517c743e94879e51'!

Item was added:
+ ----- Method: CMCairo>>build (in category 'generating actions') -----
+ build
+ 
+ 	gen 
+ 		puts:
+ '
+ add_custom_command(OUTPUT "${libcairoInstalled}"
+ 	COMMAND ./configure --prefix=''${installPrefix}'' PKG_CONFIG="${pkgconfigPath}"
+ 		PKG_CONFIG_PATH="${installPrefix}/lib/pkgconfig" CFLAGS=''-arch i386'' LDFLAGS=''-arch i386''
+ 		--disable-silent-rules --disable-xlib --disable-dependency-tracking
+ 	COMMAND make
+ 	COMMAND make install
+ 	WORKING_DIRECTORY "${libSourcesDir}"
+ 	DEPENDS "${unpackTarget}" pkg-config freetype2 libpng pixman
+ 	COMMENT "Building ${libName}"
+ )
+ '
+ !

Item was added:
+ ----- Method: CMCairo>>copyArtefacts (in category 'generating actions') -----
+ copyArtefacts
+ 
+ 	gen puts:
+ 'add_custom_command(
+ 	OUTPUT "${externalModulesDir}/${libraryFileName}"
+ 	COMMAND cp ${libcairoInstalled} ${externalModulesDir}/${libraryFileName}
+ 	DEPENDS "${libcairoInstalled}"
+ )'!

Item was added:
+ ----- Method: CMCairo>>defineAsTarget (in category 'generating actions') -----
+ defineAsTarget
+ 	
+ 	gen puts:
+ 	'add_custom_target(${libName}
+ 		DEPENDS "${externalModulesDir}/${libraryFileName}"
+ 	)'!

Item was added:
+ ----- Method: CMCairo>>defineGlobalTargets (in category 'generating actions') -----
+ defineGlobalTargets
+ 	| var |
+ 	var := self canonicalName , '_LIB'.
+ 	vmGen set: var toString: self targetForLinking.
+ "
+ define a library as imported one
+ and make it depend from it's build target
+ "
+ 	vmGen
+ 		puts: 
+ ('add_library("{1}" SHARED IMPORTED GLOBAL)
+ 	set_target_properties("{1}" PROPERTIES IMPORTED_LOCATION "{1}")
+ add_dependencies("{1}" "{2}")
+ ' format: { '${',var, '}' . self buildTarget }
+ ).
+ 
+ 	vmGen cmd: 'add_dependencies' params:
+ 		vmGen moduleName , ' ' , self buildTarget!

Item was added:
+ ----- Method: CMCairo>>dependencies (in category 'package properties') -----
+ dependencies
+ 	^ #( 'pkg-config' 'pixman' 'libpng' 'freetype2')!

Item was added:
+ ----- Method: CMCairo>>downloadURL (in category 'package properties') -----
+ downloadURL
+ 
+ 	^ 'http://www.cairographics.org/releases/cairo-1.12.2.tar.xz'!

Item was added:
+ ----- Method: CMCairo>>libraryFileName (in category 'package properties') -----
+ libraryFileName
+ 
+ 	^ 'libcairo.2.dylib'!

Item was added:
+ ----- Method: CMCairo>>setVariables (in category 'generating actions') -----
+ setVariables
+ 	super setVariables.
+ 	gen 
+ 		set: #libraryFileName to: self libraryFileName;
+ 		set: #libcairoInstalled toString: '${installPrefix}/lib/${libraryFileName}'.
+ 		!

Item was added:
+ ----- Method: CMCairo>>unpackedDirName (in category 'package properties') -----
+ unpackedDirName
+ 	^ 'cairo-1.12.2'!

Item was added:
+ CMThirdpartyLibrary subclass: #CMFreetype2
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMaker-Libs'!
+ 
+ !CMFreetype2 commentStamp: 'IgorStasenko 6/7/2012 02:50' prior: 0!
+ This is a configuration for building freetype2 library!

Item was added:
+ ----- Method: CMFreetype2 class>>canonicalName (in category 'as yet unclassified') -----
+ canonicalName
+ 	^ 'freetype2'!

Item was added:
+ ----- Method: CMFreetype2>>archiveMD5Sum (in category 'package properties') -----
+ archiveMD5Sum
+ 
+ 	^ 'c15f6dc8ed190d67b89ae09aaf7896b4'!

Item was added:
+ ----- Method: CMFreetype2>>build (in category 'generating actions') -----
+ build
+ 	gen 
+ 		puts:
+ '
+ add_custom_command(OUTPUT "${ft2config}"
+ 	COMMAND ./configure --prefix=''${installPrefix}'' CFLAGS=''-arch i386'' LDFLAGS=''-arch i386''
+ 	WORKING_DIRECTORY "${libSourcesDir}"
+ 	DEPENDS "${unpackTarget}"
+ )
+ add_custom_command(OUTPUT "${ft2libInstalled}"
+ 	COMMAND make
+ 	COMMAND make install
+ 	WORKING_DIRECTORY "${libSourcesDir}"
+ 	DEPENDS "${ft2config}"
+ 	COMMENT "Building ${libName}"
+ )
+ '
+ !

Item was added:
+ ----- Method: CMFreetype2>>copyArtefacts (in category 'generating actions') -----
+ copyArtefacts
+ 
+ 	gen puts:
+ 'add_custom_command(
+ 	OUTPUT "${externalModulesDir}/${libraryFileName}"
+ 	COMMAND cp ${installPrefix}/lib/${libraryFileName} ${externalModulesDir}/${libraryFileName}
+ 	DEPENDS "${ft2libInstalled}"
+ )'!

Item was added:
+ ----- Method: CMFreetype2>>defineAsTarget (in category 'generating actions') -----
+ defineAsTarget
+ 
+ 	gen puts:
+ 	
+ '
+ add_custom_target(${libName} 
+ 	DEPENDS ${externalModulesDir}/${libraryFileName}
+ 	)
+ '
+ 
+ !

Item was added:
+ ----- Method: CMFreetype2>>defineGlobalTargets (in category 'generating actions') -----
+ defineGlobalTargets
+ 	| var |
+ 	var := self canonicalName , '_LIB'.
+ 	vmGen set: var toString: self targetForLinking.
+ "
+ define a library as imported one
+ and make it depend from it's build target
+ "
+ 	vmGen
+ 		puts: 
+ ('add_library("{1}" SHARED IMPORTED GLOBAL)
+ 	set_target_properties("{1}" PROPERTIES IMPORTED_LOCATION "{1}")
+ add_dependencies("{1}" "{2}")
+ ' format: { '${',var, '}' . self buildTarget }
+ ).
+ 
+ 	vmGen cmd: 'add_dependencies' params:
+ 		vmGen moduleName , ' ' , self buildTarget!

Item was added:
+ ----- Method: CMFreetype2>>downloadURL (in category 'package properties') -----
+ downloadURL
+ 	^ 'http://ftp.igh.cnrs.fr/pub/nongnu/freetype/freetype-2.4.9.tar.gz'
+ !

Item was added:
+ ----- Method: CMFreetype2>>includeDir (in category 'as yet unclassified') -----
+ includeDir
+ 	"see setVariables"
+ 
+ " `<prefix>/include/freetype2' must be in your current inclusion path "
+ 
+ 
+ 	^ '"${thirdpartyDir}/out/include" "${thirdpartyDir}/out/include/freetype2"'!

Item was added:
+ ----- Method: CMFreetype2>>libraryFileName (in category 'package properties') -----
+ libraryFileName
+ 	^ 'libfreetype.6.dylib'!

Item was added:
+ ----- Method: CMFreetype2>>setVariables (in category 'generating actions') -----
+ setVariables
+ 	super setVariables.
+ 	
+ "add include path"
+ 	gen 
+ 		set: #freetype2_includeDir toString: '${installPrefix}/include';
+ 		set: #libraryFileName to: self libraryFileName;
+ 		set: #freetype2_location toString: '${externalModulesDir}/${libraryFileName}';
+ 		set: #ft2config toString: '${libSourcesDir}/builds/unix/config.status';
+ 	 	set: #ft2libInstalled toString: '${installPrefix}/lib/${libraryFileName}'!

Item was added:
+ ----- Method: CMFreetype2>>unpackedDirName (in category 'package properties') -----
+ unpackedDirName
+ 
+ 	^ 'freetype-2.4.9'!

Item was added:
+ CMThirdpartyLibrary subclass: #CMLibPng
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMaker-Libs'!

Item was added:
+ ----- Method: CMLibPng class>>canonicalName (in category 'as yet unclassified') -----
+ canonicalName
+ 	^ 'libpng'!

Item was added:
+ ----- Method: CMLibPng>>archiveMD5Sum (in category 'package properties') -----
+ archiveMD5Sum
+ 
+ 	^ '39a35257cd888d29f1d000c2ffcc79eb'!

Item was added:
+ ----- Method: CMLibPng>>build (in category 'generating actions') -----
+ build
+ 
+ 	gen 
+ 		puts:
+ '
+ add_custom_command(OUTPUT "${libpngInstalled}"
+ 	COMMAND ./configure --prefix=''${installPrefix}'' PKG_CONFIG="${pkgconfigPath}"
+ 		PKG_CONFIG_PATH="${installPrefix}/lib/pkgconfig" CFLAGS=''-arch i386'' LDFLAGS=''-arch i386''
+ 	COMMAND make
+ 	COMMAND make install
+ 	WORKING_DIRECTORY "${libSourcesDir}"
+ 	DEPENDS "${unpackTarget}" pkg-config
+ 	COMMENT "Building ${libName}"
+ )
+ '
+ !

Item was added:
+ ----- Method: CMLibPng>>copyArtefacts (in category 'generating actions') -----
+ copyArtefacts
+ 
+ 	gen puts:
+ 'add_custom_command(
+ 	OUTPUT "${externalModulesDir}/${libraryFileName}"
+ 	COMMAND cp ${libpngInstalled} ${externalModulesDir}/${libraryFileName}
+ 	DEPENDS "${libpngInstalled}"
+ )'!

Item was added:
+ ----- Method: CMLibPng>>defineAsTarget (in category 'generating actions') -----
+ defineAsTarget
+ 	
+ 	gen puts:
+ 	'add_custom_target(${libName}
+ 		DEPENDS "${externalModulesDir}/${libraryFileName}"
+ 	)'!

Item was added:
+ ----- Method: CMLibPng>>defineGlobalTargets (in category 'generating actions') -----
+ defineGlobalTargets
+ 	| var |
+ 	var := self canonicalName , '_LIB'.
+ 	vmGen set: var toString: self targetForLinking.
+ "
+ define a library as imported one
+ and make it depend from it's build target
+ "
+ 	vmGen
+ 		puts: 
+ ('add_library("{1}" SHARED IMPORTED GLOBAL)
+ 	set_target_properties("{1}" PROPERTIES IMPORTED_LOCATION "{1}")
+ add_dependencies("{1}" "{2}")
+ ' format: { '${',var, '}' . self buildTarget }
+ ).
+ 
+ 	vmGen cmd: 'add_dependencies' params:
+ 		vmGen moduleName , ' ' , self buildTarget!

Item was added:
+ ----- Method: CMLibPng>>dependencies (in category 'package properties') -----
+ dependencies
+ 	^ #( 'pkg-config' )!

Item was added:
+ ----- Method: CMLibPng>>downloadURL (in category 'package properties') -----
+ downloadURL
+ 
+ 	^ 'ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.49.tar.gz'!

Item was added:
+ ----- Method: CMLibPng>>libraryFileName (in category 'package properties') -----
+ libraryFileName
+ 
+ 	^ 'libpng12.0.dylib'!

Item was added:
+ ----- Method: CMLibPng>>setVariables (in category 'generating actions') -----
+ setVariables
+ 	super setVariables.
+ 	
+ "add include path"
+ 	gen 
+ 		set: #libraryFileName to: self libraryFileName;
+ 		set: #libpngInstalled toString: '${installPrefix}/lib/${libraryFileName}'.
+ 		!

Item was added:
+ ----- Method: CMLibPng>>unpackedDirName (in category 'package properties') -----
+ unpackedDirName
+ 	^ 'libpng-1.2.49'!

Item was added:
+ CMThirdpartyLibrary subclass: #CMPixman
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMaker-Libs'!

Item was added:
+ ----- Method: CMPixman class>>canonicalName (in category 'as yet unclassified') -----
+ canonicalName
+ 	^ 'pixman'!

Item was added:
+ ----- Method: CMPixman>>archiveMD5Sum (in category 'package properties') -----
+ archiveMD5Sum
+ 
+ 	^ '6563b6400b9fa23b47fd52105faf72b4'!

Item was added:
+ ----- Method: CMPixman>>build (in category 'generating actions') -----
+ build
+ 
+ 	gen 
+ 		puts:
+ '
+ add_custom_command(OUTPUT "${libpixmanInstalled}"
+ 	COMMAND ./configure --prefix=''${installPrefix}'' PKG_CONFIG="${pkgconfigPath}"
+ 		PKG_CONFIG_PATH="${installPrefix}/lib/pkgconfig" CFLAGS=''-arch i386'' LDFLAGS=''-arch i386''
+ 	COMMAND make
+ 	COMMAND make install
+ 	WORKING_DIRECTORY "${libSourcesDir}"
+ 	DEPENDS "${unpackTarget}" pkg-config
+ 	COMMENT "Building ${libName}"
+ )
+ '
+ !

Item was added:
+ ----- Method: CMPixman>>copyArtefacts (in category 'generating actions') -----
+ copyArtefacts
+ 
+ 	gen puts:
+ 'add_custom_command(
+ 	OUTPUT "${externalModulesDir}/${libraryFileName}"
+ 	COMMAND cp ${libpixmanInstalled} ${externalModulesDir}/${libraryFileName}
+ 	DEPENDS "${libpixmanInstalled}"
+ )'!

Item was added:
+ ----- Method: CMPixman>>defineAsTarget (in category 'generating actions') -----
+ defineAsTarget
+ 	
+ 	gen puts:
+ 	'add_custom_target(${libName}
+ 		DEPENDS "${externalModulesDir}/${libraryFileName}"
+ 	)'!

Item was added:
+ ----- Method: CMPixman>>defineGlobalTargets (in category 'generating actions') -----
+ defineGlobalTargets
+ 	| var |
+ 	var := self canonicalName , '_LIB'.
+ 	vmGen set: var toString: self targetForLinking.
+ "
+ define a library as imported one
+ and make it depend from it's build target
+ "
+ 	vmGen
+ 		puts: 
+ ('add_library("{1}" SHARED IMPORTED GLOBAL)
+ 	set_target_properties("{1}" PROPERTIES IMPORTED_LOCATION "{1}")
+ add_dependencies("{1}" "{2}")
+ ' format: { '${',var, '}' . self buildTarget }
+ ).
+ 
+ 	vmGen cmd: 'add_dependencies' params:
+ 		vmGen moduleName , ' ' , self buildTarget!

Item was added:
+ ----- Method: CMPixman>>dependencies (in category 'package properties') -----
+ dependencies
+ 	^ #( 'pkg-config' )!

Item was added:
+ ----- Method: CMPixman>>downloadURL (in category 'package properties') -----
+ downloadURL
+ 
+ 	^ 'http://www.cairographics.org/releases/pixman-0.26.0.tar.gz'!

Item was added:
+ ----- Method: CMPixman>>libraryFileName (in category 'package properties') -----
+ libraryFileName
+ 
+ 	^ 'libpixman-1.0.dylib'!

Item was added:
+ ----- Method: CMPixman>>setVariables (in category 'generating actions') -----
+ setVariables
+ 	super setVariables.
+ 	gen 
+ 		set: #libraryFileName to: self libraryFileName;
+ 		set: #libpixmanInstalled toString: '${installPrefix}/lib/${libraryFileName}'.
+ 		
+ 	!

Item was added:
+ ----- Method: CMPixman>>unpackedDirName (in category 'package properties') -----
+ unpackedDirName
+ 	^ 'pixman-0.26.0'!

Item was added:
+ CMThirdpartyLibrary subclass: #CMPkgConfig
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMaker-Libs'!
+ 
+ !CMPkgConfig commentStamp: 'IgorStasenko 6/9/2012 21:48' prior: 0!
+ this will build a pkg-config package, required to built cairo
+ !

Item was added:
+ ----- Method: CMPkgConfig class>>canonicalName (in category 'as yet unclassified') -----
+ canonicalName
+ 	^ 'pkg-config'!

Item was added:
+ ----- Method: CMPkgConfig>>archiveMD5Sum (in category 'package properties') -----
+ archiveMD5Sum
+ 
+ 	^ 'd922a88782b64441d06547632fd85744'!

Item was added:
+ ----- Method: CMPkgConfig>>build (in category 'generating actions') -----
+ build
+ 	gen 
+ 		puts: '
+ add_custom_command(OUTPUT "${pkgConfigBinary}"
+ 	COMMAND ./configure --prefix=''${installPrefix}'' CFLAGS=''-arch i386'' LDFLAGS=''-arch i386''
+ 	COMMAND make
+ 	COMMAND make install
+ 	WORKING_DIRECTORY "${libSourcesDir}"
+ 	DEPENDS "${unpackTarget}"
+ 	COMMENT "Building ${libName}"
+ )
+ '
+ !

Item was added:
+ ----- Method: CMPkgConfig>>copyArtefacts (in category 'generating actions') -----
+ copyArtefacts
+ 	"do nothing.. "!

Item was added:
+ ----- Method: CMPkgConfig>>defineAsTarget (in category 'generating actions') -----
+ defineAsTarget
+ 	
+ 	gen puts: '
+ add_custom_target(${libName} 
+ 	DEPENDS "${pkgConfigBinary}"
+ 	)
+ '
+ 
+ !

Item was added:
+ ----- Method: CMPkgConfig>>defineGlobalTargets (in category 'generating actions') -----
+ defineGlobalTargets
+ 
+ 	"none"
+ 	vmGen
+ 		set: #installPrefix toString: '${thirdpartyDir}/out';
+ 		set: #pkgconfigPath toString: '${installPrefix}/bin/pkg-config'
+ 		!

Item was added:
+ ----- Method: CMPkgConfig>>downloadURL (in category 'package properties') -----
+ downloadURL
+ 
+ 	^ 'http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz'!

Item was added:
+ ----- Method: CMPkgConfig>>setVariables (in category 'generating actions') -----
+ setVariables
+ 
+ 	super setVariables.
+ 	
+ 	gen set: #pkgConfigBinary toString: '${installPrefix}/bin/pkg-config'!

Item was added:
+ ----- Method: CMPkgConfig>>unpackedDirName (in category 'package properties') -----
+ unpackedDirName
+ 
+ 	^ 'pkg-config-0.23'!

Item was added:
+ Object subclass: #CMThirdpartyLibrary
+ 	instanceVariableNames: 'gen vmGen'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CMakeVMMaker-Libs'!
+ 
+ !CMThirdpartyLibrary commentStamp: 'IgorStasenko 6/7/2012 04:53' prior: 0!
+ My subclasses describing a configuration/settings necessary to build some third-party library used by VM
+ or by one of it's plugins.
+ 
+ We cannot use cmake configuration for those libraries, since most of them having own 
+ configuration/make scripts which build that library.
+ 
+ I serve as a convenience layer for building those libraries and connecting them with cmake configuration,
+ as well as provide necessary information, what output file(s) should be bundled with virtual machine.
+ !

Item was added:
+ ----- Method: CMThirdpartyLibrary class>>canonicalName (in category 'as yet unclassified') -----
+ canonicalName
+ 	"answer the library canonical name, like 
+ 		'freetype2'
+ 		or 'cairo' 
+ 		etc.
+ 		
+ 	Note , this method is used to find the corresponding library
+ 	from all subclasses of CMThirdpartyLibrary	
+ 	"
+ 	^ self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary class>>named: (in category 'as yet unclassified') -----
+ named: aName
+ 
+ 	^ (self allSubclasses detect: [:cls | cls canonicalName = aName])
+ 		new!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>archiveMD5Sum (in category 'package properties') -----
+ archiveMD5Sum
+ 	"answer the MD5 checksum (in string) for downloaded library archive 
+ 	(to check that downloaded file is not corrupt).
+ 	
+ 	You can take this sum by issuing:
+ 	  md5 filename
+ 	from command line
+ 	"
+ 	^ self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>build (in category 'generating actions') -----
+ build
+ 
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>buildTarget (in category 'package properties') -----
+ buildTarget
+ 	^ self canonicalName!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>canonicalName (in category 'package properties') -----
+ canonicalName
+ 	"answer the library canonical name, like 
+ 		'freetype2'
+ 		or 'cairo' 
+ 		etc"
+ 	^ self class canonicalName!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>copyArtefacts (in category 'generating actions') -----
+ copyArtefacts
+ 
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>defineAsTarget (in category 'generating actions') -----
+ defineAsTarget
+ 
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>defineGlobalTargets (in category 'generating actions') -----
+ defineGlobalTargets
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>dependencies (in category 'package properties') -----
+ dependencies
+ 	^ #()!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>download (in category 'generating actions') -----
+ download
+ 
+ 	"Produce output to download library archive.
+ 	By default, we use .tgz extension.. since it is most often used by OSS.
+ 	Note, that we check if file is already present, to not download it every time
+ 	we build"	
+ 	
+ 	gen puts:
+ 'if (NOT EXISTS "${workDir}/${libName}.tgz")
+ 	Message("Downloading ${url} ....")
+ 	Message("Into: ${workDir}/${libName}.tgz")
+ 	
+ 	FILE(DOWNLOAD
+ 		${url}
+ 	 	"${workDir}/${libName}.tgz"
+ 		SHOW_PROGRESS
+ 		EXPECTED_MD5 ${md5sum}
+ 	)
+ endif (NOT EXISTS "${workDir}/${libName}.tgz")
+ '!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>downloadURL (in category 'package properties') -----
+ downloadURL
+ 	"answer the url where given library can be downloaded from"
+ 	^ self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>generate (in category 'generating cmake file') -----
+ generate
+ 
+ 	gen message: 'Configuring thirdparty package: ', self canonicalName.
+ 	
+ 	self 
+ 		setVariables;
+ 		download;
+ 		unpack;
+ 		build;
+ 		copyArtefacts;
+ 		defineAsTarget.!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>generateFor: (in category 'generating cmake file') -----
+ generateFor: aVMGenerator
+ 
+ 	| libDir stream |
+ 	
+ 	vmGen := aVMGenerator.
+ 	
+ 	gen := CMakeGenerator new
+ 		output: (String new writeStream).
+ 	
+ 	libDir := (aVMGenerator thirdpartyDir / self canonicalName) assureExistence.
+ 
+ 	stream := libDir forceNewFileNamed: gen outputFileName.
+ 	stream ifNil: [ self error: 'Cannot write ',  gen outputFileName , 'to: ', libDir fullName ].
+ 
+ 	self generate.
+ 
+ 	stream nextPutAll: (vmGen config fixLineEndsOf: gen output contents); close.
+ 
+ 	vmGen addSubdirectory:  vmGen thirdpartyDirName , '/' , self canonicalName.
+ 	self defineGlobalTargets.
+ 	!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>libraryFileName (in category 'package properties') -----
+ libraryFileName
+ 	"answer the built library file name"
+ 
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>setVariables (in category 'generating actions') -----
+ setVariables
+ 
+ 	gen
+ 		set: #libName toString: self canonicalName;
+ 		set: #workDir toString: '${thirdpartyDir}/${libName}';
+ 		set: #unpackedDirName toString: self unpackedDirName;
+ 		set: #libSourcesDir toString: '${workDir}/${unpackedDirName}';
+ 		set: #url toString: self downloadURL;
+ 		set: #md5sum toString: self archiveMD5Sum;
+ 		set: #installPrefix toString: '${thirdpartyDir}/out'.!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>targetForLinking (in category 'exports') -----
+ targetForLinking
+ 	"Answer a target or path to library to link with, which can be used by 
+ 	external plugins or VM module"
+ 
+ 	^ '${externalModulesDir}/', self libraryFileName!

Item was added:
+ ----- Method: CMThirdpartyLibrary>>unpack (in category 'generating actions') -----
+ unpack
+ 	"produce commands for unpacking the library archive.
+ 	
+ 	the output of this command should use a directory
+ 	${workDir}/${libName}
+ 	where the unpacked library sources will be located.
+ 	
+ 	see #setVariables method for understanding what variables used here
+ 	"
+ 
+ 	gen set: #unpackTarget toString: '${libSourcesDir}/touch.cmake'.
+ 	
+ 	gen puts:
+ 'add_custom_command(OUTPUT "${unpackTarget}"
+ 		COMMAND tar -xzf "${libName}.tgz" 
+ 		COMMAND touch "${unpackTarget}"
+ 		COMMENT "Unpacking ${libName} ... "
+ 	)
+ '.
+ !

Item was added:
+ ----- Method: CMThirdpartyLibrary>>unpackedDirName (in category 'package properties') -----
+ unpackedDirName
+ 	"answer the directory name, which is created after unpacking
+ 	downloaded archive i.e.
+ 	
+ 	the archive downloaded from 
+ 	
+ 	http://ftp.igh.cnrs.fr/pub/nongnu/freetype/freetype-2.4.9.tar.gz
+ 	
+ 	if untarred, will create
+ 	freetype-2.4.9
+ 	subdirectory. But since there is no conventions, it could be anything,
+ 	so we should specify it here, so build system will know where to look for unpacked files"
+ 
+ 	^ self subclassResponsibility!

Item was added:
+ ----- Method: CMakeGenerator>>addDependency: (in category 'cmake commands') -----
+ addDependency: aName
+ 
+ 	self cmd: 'list'
+ 		params: 'APPEND ', self moduleName , '_dependencies ' , aName.
+ !

Item was added:
+ ----- Method: CMakeGenerator>>output (in category 'accessing') -----
+ output
+ 	^ output!

Item was added:
+ ----- Method: CMakeGenerator>>output: (in category 'accessing') -----
+ output: aStream
+ 
+ 	output := aStream!

Item was changed:
  ----- Method: CMakePluginGenerator>>generate (in category 'code generation') -----
  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.
+ 
+ 	"clear LINKLIBS variable"
+ 	self set: #LINKLIBS to: ''.		
- 		
  	
  	internal 
  		ifTrue: [ self puts: 'add_definitions(-DSQUEAK_BUILTIN_PLUGIN)'].
  	
  	self addSources: { name , '.c' } prefixed: '${pluginSrc}/'.
  
  	" default include directories for plugin "
  	self includeDirectories: '${pluginSrc} ${pluginCross} ${targetPlatform}/plugins/${pluginName}'.
  	
  	"Not needed because there are already there (inherited from main configuration)"
  	"self addDefinitions: vmGen config compilerFlags."
  
  	" 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}'.
  		
  	"	self cmd: 'set_property' params: 'TARGET ' , name , ' PROPERTY LINK_FLAGS -bundle'"
  	].
  
  	vmGen config extraPluginSettings: self.
  	
  	self isExternal ifTrue: [
  		self cmd: 'target_link_libraries'
  			params: self moduleName , ' ${LINKLIBS}'.
  		].
  	
  	" see senders of #linkFlags "
  	self 
  		cmd: 'set_property' 
  		params: 'TARGET ', name, ' PROPERTY LINK_FLAGS "${linkFlags}"'.
  	
+ 	"set dependencies"
+ 	self puts: 'IF (${',self moduleName , '_dependencies})'.
+ 	
+ 	self cmd: 'add_dependencies'
+ 		params: name , ' ${', self moduleName , '_dependencies}'.
+ 	
+ 	self puts: 'ENDIF (${',self moduleName , '_dependencies})'.
  	self saveFile.!

Item was added:
+ ----- Method: CMakePluginGenerator>>plugin (in category 'accessing') -----
+ plugin
+ 	^ plugin!

Item was changed:
  ----- Method: CMakeVMGenerator>>generate (in category 'code generation') -----
  generate
+ 	| intPlugins extPlugins |
+ 			
- 		
  	output := String new writeStream.
+ 	
+ 	config setGlobalOptions: self.
+ 	
- 		
  	self 
  		printHeader;
  		project: config executableName.
  
  	config setupDirectories: self.
- 	self include: 'directories.cmake'.
  		
  	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.
  
  	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 processInternalPlugins.	
  	config setExtraTargetProperties: self.
  	
  	self cmd: 'target_link_libraries'
  		params: self moduleName , ' ${LINKLIBS}'.
  		
+ 
+ 	self processPlugins:  intPlugins, extPlugins.
+ 
+ 	config postBuildActions: self.
- 	self processExternalPlugins.
  	
  	self saveFile.
  	!

Item was added:
+ ----- Method: CMakeVMGenerator>>generatePluginConfigs:internal: (in category 'processing plugins') -----
+ generatePluginConfigs: plugins internal: bool
+ 	"Answers a collection of CMakePluginGenerator instances"
+ 	
+ 	^ plugins collect: [:each | | plugin |
+ 		plugin := Smalltalk at: each.
+ 		plugin generateFor: self internal: bool.
+ 	].
+ 	
+ !

Item was added:
+ ----- Method: CMakeVMGenerator>>generatePluginsSource:internal: (in category 'processing plugins') -----
+ generatePluginsSource: plugins internal: bool
+ 
+ 	plugins do: [:each | | plugin gen |
+ 		plugin := Smalltalk at: each.
+ 		gen := plugin generateFor: self internal: bool.
+ 	].
+ 	
+ !

Item was changed:
+ ----- Method: CMakeVMGenerator>>processExternalPlugins (in category 'processing plugins') -----
- ----- Method: CMakeVMGenerator>>processExternalPlugins (in category 'as yet unclassified') -----
  processExternalPlugins
  
  	config externalPlugins do: [:each | | plugin gen |
  		plugin := Smalltalk at: each.
  		gen := plugin generateFor: self internal: false.
  		gen doNotGenerate ifFalse: [
  			self addSubdirectory: plugin moduleName.
  			]
  	].
  	
  !

Item was changed:
+ ----- Method: CMakeVMGenerator>>processInternalPlugins (in category 'processing plugins') -----
- ----- Method: CMakeVMGenerator>>processInternalPlugins (in category 'as yet unclassified') -----
  processInternalPlugins
  
  	| libs |
  	libs := OrderedCollection new.
  
  	config internalPlugins collect: [:each | | plugin gen |
  		plugin := Smalltalk at: each.
  		gen := plugin generateFor: self internal: true.
  		gen doNotGenerate ifFalse: [
  			libs add: plugin moduleName.
  			self addSubdirectory: plugin moduleName.
  			 ].
  		].
  	
  	self cmd: 'target_link_libraries' params:  config executableName , ' ' ,
  		(libs inject: '' into: [:res :ea | res, ' ' , ea ]) .
  
  	self generateExportsH: libs.
  !

Item was added:
+ ----- Method: CMakeVMGenerator>>processInternalPlugins: (in category 'processing plugins') -----
+ processInternalPlugins: pluginGenerators
+ 
+ 	| libs |
+ 	libs := OrderedCollection new.
+ 
+ 	pluginGenerators do: [:gen |
+ 		gen doNotGenerate ifFalse: [
+ 			libs add:  gen plugin moduleName.
+ 			self addSubdirectory:  gen plugin moduleName.
+ 			 ].
+ 		].
+ 
+ 	self cmd: 'target_link_libraries' params:  config executableName , ' ' ,
+ 		(libs inject: '' into: [:res :ea | res, ' ' , ea ]) .
+ 
+ 	self generateExportsH: libs.
+ !

Item was added:
+ ----- Method: CMakeVMGenerator>>processPlugins: (in category 'processing plugins') -----
+ processPlugins: pluginGenerators
+ 
+ 	| libs |
+ 	libs := OrderedCollection new.
+ 
+ 	pluginGenerators do: [:gen |
+ 		gen doNotGenerate ifFalse: [
+ 			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
+ 				].
+ 			self addSubdirectory:  gen plugin moduleName.
+ 			 ].
+ 		].
+ 
+ 	self cmd: 'target_link_libraries' params:  config executableName , ' ' ,
+ 		(libs inject: '' into: [:res :ea | res, ' ' , ea ]) .
+ 
+ 	self generateExportsH: libs.
+ !

Item was added:
+ ----- Method: CMakeVMGenerator>>processThirdpartyLibraries (in category 'as yet unclassified') -----
+ processThirdpartyLibraries
+ 
+ 	config thirdpartyLibs do: [:each |
+ 		each generateFor: self ]
+ 
+ !

Item was added:
+ ----- Method: CMakeVMGenerator>>thirdpartyDir (in category 'thirdparty libs') -----
+ thirdpartyDir
+ 	^ self buildDir / self thirdpartyDirName!

Item was added:
+ ----- Method: CMakeVMGenerator>>thirdpartyDirName (in category 'thirdparty libs') -----
+ thirdpartyDirName
+ 	^ 'thirdParty'!

Item was changed:
  Object subclass: #CPlatformConfig
+ 	instanceVariableNames: 'topDir buildDir srcDir platformsDir outputDir internalPlugins externalPlugins pluginsDir externalLibs thirdpartyLibs'
- 	instanceVariableNames: 'topDir buildDir srcDir platformsDir outputDir internalPlugins externalPlugins pluginsDir externalLibs'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'CMakeVMMaker'!
  
  !CPlatformConfig commentStamp: 'MarianoMartinezPeck 4/24/2011 15:29' prior: 0!
  Base class, defining some common properties and behavior for all kinds of VM build configurations. These classes are used to generate the VM sources and the CMMake files. 
  
  Notice that this configuration classes expect that you have download the "platofroms code" which is in Gitorious: https://gitorious.org/cogvm
  You can load it executing: git clone git://gitorious.org/cogvm/blessed.git
  
  Once that is done it should have created a directory /blessed. In order to get all the directories by default, place this image under /blessed/image 
  
  To generate a sources/build configuration use one of my subclasses with:
  <config> generate.   - to generate a build configuration
  <config> generateWithSources - to generate VMMaker sources and then build configuration.
  
  Once you do that, go to /blessed/build and execute:  cmake .    or cmake -G"MSYS Makefiles" if you are in Windows 
  
  Since some plugins require extra settings (like additional source files etc), there is two ways to add that:
  
  - add custom rules on plugin class side:
  
  PluginClass>>generateFor: aCMakeVMGenerator internal: aBoolean 
  
  	^ aCMakeVMGenerator 
  		generatePlugin: self 
  		internal: aBoolean
  		extraRules: [:maker |   ... your rules come here ... ]
  		
  - define rules by adding #configure<PluginClass>: method in config class (see my 'plugin extra rules' category)
  
  The last one is more compact and also avoids inter-package dependency, so you can load and use
  CMakeVMMaker even if some 3rd-party plugins are not loaded into image.
  
  
  Links of interest:
  
  Official Cog Website: http://www.mirandabanda.org/cog
  Official Cog Blog: http://www.mirandabanda.org/cogblog
  Cog issue tracker: http://code.google.com/p/cog
  Cog Wiki: http://code.google.com/p/cog/w/list
  Cog binaries: http://www.mirandabanda.org/files/Cog/VM
  Cog binaries in Pharo Hudson server: https://pharo-ic.lille.inria.fr/hudson/view/Cog
  Cog SVN branch: http://squeakvm.org/svn/squeak/branches/Cog
  VM mailing list: http://lists.squeakfoundation.org/mailman/listinfo/vm-dev
  VM-beginners mailing list: http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
  Guide step by step about how to build the Cog VM using CMakeVMMaker and Git: http://code.google.com/p/cog/wiki/Guide
  
  
  
  !

Item was added:
+ ----- Method: CPlatformConfig class>>browsePluginRules: (in category 'as yet unclassified') -----
+ browsePluginRules: aPlugin
+ 	
+ 	| nm |
+ 	(nm := aPlugin) isSymbol ifFalse: [
+ 		nm := aPlugin name.
+ 		].
+ 	
+ 	SystemNavigation default browseAllImplementorsOf: ('configure' , nm, ':' ) asSymbol
+ 	!

Item was added:
+ ----- Method: CPlatformConfig>>addThirdpartyLibrary: (in category 'thirdparty libs') -----
+ addThirdpartyLibrary: libName
+ 	| libs lib |
+ 	
+ 	libs := self thirdpartyLibs.
+ 	
+ 	lib :=  libs detect: [:each | each canonicalName = libName] ifNone: [ nil ].
+ 	
+ 	lib ifNil: [
+ 		lib := (CMThirdpartyLibrary named: libName).
+ 		"add dependencies first, so thirpartyLibs collection will be naturally dependency sorted"
+ 		lib dependencies do: [:dep | self addThirdpartyLibrary: dep ].
+ 		libs add: lib.
+ 		].
+ 	
+ 	^ lib!

Item was added:
+ ----- Method: CPlatformConfig>>postBuildActions: (in category 'utils') -----
+ postBuildActions: maker
+ 
+ 	" override to add custom rules after all targets is defined "!

Item was added:
+ ----- Method: CPlatformConfig>>setGlobalOptions: (in category 'utils') -----
+ setGlobalOptions: maker
+ 
+ 	"set any CMake global options, before declaring a project in cmake file"
+ 	!

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.
  	].
  
+ 	self write: dirsInclude toFile: 'directories.cmake'.
+ 	
+ 	gen include: 'directories.cmake'.
+ !
- 	self write: dirsInclude toFile: 'directories.cmake'!

Item was added:
+ ----- Method: CPlatformConfig>>thirdpartyLibs (in category 'thirdparty libs') -----
+ thirdpartyLibs
+ 	^ thirdpartyLibs ifNil: [ thirdpartyLibs := OrderedCollection new ].
+ !

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.
  		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.
  
  	(maker buildDir forceNewFileNamed: 'Info.plist') 
  		nextPutAll: plist; 
  		close.
  
  	maker 
  		addProperty: 'MACOSX_BUNDLE_INFO_PLIST' 
  		value: '${buildDir}/Info.plist'.  
  
  	(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_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.
  	maker set: 'RUNTIME_OUTPUT_DIRECTORY' toString: self outputDir.!

Item was added:
+ ----- Method: CogFamilyCocoaIOSConfig>>setGlobalOptions: (in category 'as yet unclassified') -----
+ setGlobalOptions: maker
+ 
+ 	"set any CMake global options, before declaring a project in cmake file"
+ 	
+ 	maker set: 'CMAKE_C_COMPILER' to: '/usr/bin/gcc-4.2'.
+ 	maker set: 'CMAKE_CXX_COMPILER' to: '/usr/bin/g++-4.2'.	
+ 	maker set: 'CMAKE_OSX_ARCHITECTURES' to: 'i386'.
+ 	maker set: 'CMAKE_OSX_SYSROOT' to: '/'.
+ 	
+ 	"maker set: 'CMAKE_OSX_SYSROOT' to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/'"!

Item was added:
+ ----- Method: InterpreterPlugin class>>browseSettings (in category '*CMakeVMMaker') -----
+ browseSettings
+ 
+ 	^ CPlatformConfig browsePluginRules: self!

Item was removed:
- ----- Method: InterpreterPlugin class>>supportedPlatforms: (in category '*CMakeVMMaker') -----
- supportedPlatforms: enum
- " use:
- 	^ enum unix
- or:
- 	^ enum unix, enum osX
- 	
- or 
- 
- 	^ enum unix i386, enum osX
- "
- 	^ enum all!

Item was changed:
  ----- Method: MacOSConfig>>configureFT2Plugin: (in category 'plugin extra rules') -----
  configureFT2Plugin: maker
  	"extra rules for Freetype plugin.
  	a custom rule to build freetype library"
+ 	| lib |
+ 	
+ 	maker isExternal ifFalse: [
+ 		self error: 'building internal FT2Plugin is not supported yet'  	
+ 	].
  
+ 	"add freetype library into loop"
+ 	lib := self addThirdpartyLibrary: 'freetype2'.
  
+ 	"link plugin with freetype lib"
+ 	maker addExternalLibrary: lib targetForLinking.
+ 	maker includeDirectories: lib includeDir.
- 	maker cmd: 'add_custom_command' params: 'OUTPUT "${buildDir}/FT2Plugin/libfreetype.a" 
- 		COMMAND "${topDir}/macbuild/FT2Plugin/makeFreetype.sh" "${buildDir}/FT2Plugin/libfreetype.a"
- 		COMMENT "Building freetype library"
- 	'.
- 
- 	maker addExternalLibrary: '${buildDir}/FT2Plugin/libfreetype.a'.
- 
- 	maker addSource: '${buildDir}/FT2Plugin/libfreetype.a'.
- 	
- 	
- 	"the freetype sources are located in {build}/FT2Plugin/freetype2/include "
- 	maker includeDirectories: '${buildDir}/FT2Plugin/freetype2/include'
  !

Item was changed:
  ----- Method: MacOSConfig>>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}'
- 			toString: ('${outputDir}/', self executableName, '.app/Contents/Resources')
  		].
  	^ super configurePlugin: aPlugin with: generator
  !

Item was added:
+ ----- Method: MacOSConfig>>externalModulesDir (in category 'accessing') -----
+ externalModulesDir
+ 	"answer the location in VM bundle, where plugins and rest of dynamic libs will be copied,
+ 	by default, it is Framerowks subdir. i.e: 
+ 	
+ 		Cog.app/Contents/Frameworks
+ 		
+ 	"
+ 	
+ 	^ '${outputDir}/', self executableName, '.app/Contents/Plugins'!

Item was added:
+ ----- Method: MacOSConfig>>fixLibsTemplate (in category 'utils') -----
+ fixLibsTemplate
+ 
+ ^
+ 'include(GetPrerequisites)
+ 
+ message("Fixing library references in: ${externalModulesDir}")
+ 
+ FILE(GLOB libs  "${externalModulesDir}/*.dylib")
+ 
+ set(all_imports "")
+ 
+ foreach(lib ${libs})
+ 	get_filename_component(libName "${lib}" NAME)
+ 	list(APPEND libNames "${libName}")
+ 	
+ 	set(prereq "")
+ 	get_prerequisites(${lib} prereq 1 0 "${bundlePath}" "")
+ 
+ 
+ 	list(APPEND all_imports ${prereq})
+ 
+ endforeach(lib)
+ 
+ list(REMOVE_DUPLICATES all_imports)
+ set(replacements "")
+ message ( "Found imports: ${all_imports} " )
+ 
+ foreach(import ${all_imports})
+ 	foreach(lib ${libNames})
+ 		set(match "^.*${lib}$")
+ 		if(import MATCHES ${match})
+ 			set(replacement "${pluginsRelPath}/${lib}")
+ 			message("Will replace: ${import} with: ${replacement}")
+ 			set(replacements ${replacements} "-change" "${import}" "${replacement}")
+ 		endif(import MATCHES ${match})
+ 	endforeach(lib)
+ endforeach(import)
+ 
+ foreach(lib ${libs})
+ 	get_filename_component(name ${lib} NAME)
+ 	set(fixedName "${pluginsRelPath}/${name}")
+ 	message("Fixing up: ${name}")
+ 
+  	execute_process(COMMAND install_name_tool -id "${fixedName}" "${lib}" )
+ 
+  	execute_process(COMMAND install_name_tool  ${replacements} ${lib} )
+ 
+ endforeach(lib)
+ '
+ 
+ !

Item was added:
+ ----- Method: MacOSConfig>>postBuildActions: (in category 'utils') -----
+ postBuildActions: gen
+ 
+ 	" override to add custom rules after all targets is defined "
+ 	
+ 	self write: self fixLibsTemplate toFile: 'fix_libs.cmake'.
+ 	
+ 	
+ 	gen
+ 		set: #bundlePath toString: '${outputDir}/', self executableName, '.app';
+ 		set: #pluginsRelPath toString: '@executable_path/../Plugins'.
+ 
+ 	gen
+ 		puts: '
+ 		INSTALL(CODE "
+ 			set(externalModulesDir \"${externalModulesDir}\")
+ 			set(bundlePath \"${bundlePath}\")
+ 			set(pluginsRelPath \"${pluginsRelPath}\")
+ 			
+ 			include(fix_libs.cmake)
+ 		")'
+ 			
+ "					FILE(GLOB_RECURSE bLibs /${externalModulesDir}/*.*)
+ "!

Item was added:
+ ----- Method: MacOSConfig>>setupDirectories: (in category 'source generation') -----
+ setupDirectories: gen
+ 
+ 	super setupDirectories: gen.
+ 	
+ 	gen set: #externalModulesDir toString: self externalModulesDir.
+ !

Item was changed:
  ----- Method: StackIPhoneConfig>>compilerFlagsDebug (in category 'settings') -----
  compilerFlagsDebug
  	^#('-g3' '-O0' '-DDEBUGVM=1')!

Item was changed:
  ----- Method: StackIPhoneConfig>>configureSocketPlugin: (in category 'plugin extra rules') -----
  configureSocketPlugin: maker
  	super configureSocketPlugin: maker.
  	maker includeDirectories: '${SDKROOT}/usr/include'.  "for tcp.h"!



More information about the Vm-dev mailing list