<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style='font-size:10pt;font-family:Verdana,Arial,Helvetica,sans-serif;'>Hi Igor (and all)<br><br>My goal is to develop a documented, boilerplate, easily duplicated, correct procedure for adding or modifying a CMakeVMaker(Squeak) configuration whenever Eliot adds or modifies a configuration in the GNU tree.<br><br>Using build.linux32x86/squeak.cog.v3/ as an example, I want to be able to examine the 'mvm' files in each build directory:<br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>build <br>build.assert <br>build.assert.itimerheartbeat <br>build.debug <br>build.debug.itimerheartbeat <br>build.itimerheartbeat <br>build.multithreaded <br>build.multithreaded.assert <br>build.multithreaded.debug<br></div></blockquote> And accurately translate that information into the appropriate CMakeVMaker(Squeak) Configuration class.<br><br>Using build.linux32x86/squeak.cog.v3/build/mvm as the example, we see that GNU system has this in their setup:<br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>test -f config.h || ../../../platforms/unix/config/configure --without-npsqueak \<br> CC="gcc -m32" \<br> CXX="g++ -m32" \<br> CFLAGS="$OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0" \<br> LIBS="-lpthread -luuid" \<br> LDFLAGS=-Wl,-z,now</div></blockquote> <br>The reason for this email is that I want to verify/clarify that my approach is correct and to share my concerns. <br><br>Please correct me or clarify as I go.<br><br> So line-by-line....<br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>test -f config.h || ../../../platforms/unix/config/configure --without-npsqueak \</div></blockquote><b> We are hard-coding this (for now) in configH method. </b><br><br>(Incidently, David. I looked at Ian's code briefly a couple of nights ago and he as a config.cmake step that is run. Much of Ian's code looks very similar to what is happening in VMakeCMake(Squeak). Once release 1 of this puppy is up, I will hopefully know enought<br>to integrate Ian's work)<br><br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><br> CC="gcc -m32" \<br> CXX="g++ -m32" \</div></blockquote> <br>I "think" these are handled in <br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><br>setGlobalOptions: maker<br><br> "set any CMake global options, before declaring a project in cmake file"<br> <br> maker set: 'CMAKE_C_COMPILER' to: '/usr/bin/gcc'.<br> maker set: 'CMAKE_CXX_COMPILER' to: '/usr/bin/g++'.</div></blockquote><b> But I am not sure where to pass in the '-m32' flag. </b>I will research this on Google, but if you know, it would be much appreciated.<br><br><br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div> CFLAGS="$OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0" \</div></blockquote> <br>I trust these are handled in CMakeVMaker(Squeak)<br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>compilerFlags<br> ^ {<br> '-O0'. <br> '--msse2'. <br> '-D_GNU_SOURCE'. <br> '-D_FILE_OFFSET_BITS=64'. <br> '-DCOGMTVM=0'. }<br></div></blockquote><b>Should I just throw the '-m32' in here? remember, my goal is to be boilerplate consistent going forward.<br><br></b><br><br>Now things get a bit confusing....<br><br>IN GNU we have<br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div> LIBS="-lpthread -luuid" \</div></blockquote> is represented by CMakeVMMaker(Squeak)<br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>linkFlags<br> ^ '-lSM -lICE -ldl -lGL -lpthread -lm -lnsl -lX11'<br></div></blockquote><br>From google,<code> "-L</code> is the path to the directories containing the libraries. A search path for libraries." and "<code>-l</code> is the name of the library you want to link to."<br><b>so the heuristics of the name is "libraries to link to" and not "linker flags".</b><br><br><br><br>Finally we have linker flags:<br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div> LDFLAGS=-Wl,-z,now</div></blockquote> <br><br>We don't have a method for this, except that setExtraTargetProperties seems to be a catch-all method....<br>Here are a couple examples at random:<br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>setExtraTargetProperties: maker<br><br> maker setTargetProperties: 'LINK_FLAGS "-m32"'.<br> <br> maker puts: 'set_source_files_properties( ${srcVMDir}/cogit.c PROPERTIES <br> COMPILE_FLAGS "-O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer -mno-rtd -mno-accumulate-outgoing-args")'.<br> <br> <br> maker <br> cmd: 'set_source_files_properties'<br> params: ' ${targetPlatform}/vm/sqUnixHeartbeat.c PROPERTIES <br> COMPILE_FLAGS "-O1 -fno-omit-frame-pointer -mno-rtd -mno-accumulate-outgoing-args"'.<br> <br> super setExtraTargetProperties: maker.</div></blockquote> <br><br>or in another class:<br><br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div> maker addExternalLibraries: <br> #(<br> 'm' "math lib"<br> 'dl' "dynamic loader"<br> 'pthread' "posix threads" <br> ).<br> <br> maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir fullName.<br> self addVMDrivers: maker.<br></div></blockquote> <br><br><br>In summary, here is what I am thinking.<br><br>I. research the CC and CXX '-m32' and if CMake doesn't handle it make sure putting it in compilerFlags is ok.<br>2. CFlags=compilerFlags<br>3. LIBS= (I think this needs to be refactored with the method renamed in an override)<br>4. LDFlags (I think we need a new method for these in CMakeVMGenerator>generate method)<br><br><br><br>Anyway, I wanted to get your input before proceeding. <br>To re-iterate. I am in "boilerplate" coding mode now where I want to take an existing GNU build and create a documented, boilerplate, consistent method of porting existing GNU builds.<br><br>Cheers.<br><br>tty<br><br><br>p.s. for ease of reference the CMakeVMGenrator>generate method is produced below:<br><br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><br>generate<br> | intPlugins extPlugins |<br> <br> output := String new writeStream.<br> config setGlobalOptions: self.<br> <br> self <br> printHeader;<br> project: config executableName.<br><br> config setGlobalOptionsAfterDetermineSystem: self.<br><br> config setupDirectories: self.<br> <br> self message: '${CMAKE_MODULE_PATH}'.<br> self set: 'CMAKE_CONFIGURATION_TYPES' to: 'Release'.<br><br> config preferredIncludes <br> do: [ :each | self includeDirectories: each ].<br> self includeDirectories: self includeDirs. <br> config standardIncludes <br> do: [:each | self includeDirectories: each ].<br><br> self addDefinitions: config compilerFlags.<br><br> config extraVMSettings: self.<br> <br> self puts: 'add_executable(' , config executableName, ' ', config executableType, ' ' , self sources , ')'.<br> <br> intPlugins := self generatePluginConfigs: config internalPlugins internal: true.<br> extPlugins := self generatePluginConfigs: config externalPlugins internal: false.<br><br> self processThirdpartyLibraries.<br> <br> self processPlugins: intPlugins, extPlugins.<br><br> config setExtraTargetProperties: self.<br> <br> self cmd: 'target_link_libraries'<br> params: self moduleName , ' ${LINKLIBS}'.<br><br> config postBuildActions: self.<br> <br> self saveFile.<br> self generateBuildScript.</div></blockquote> <br><br><br><br><br><br><br></div></body></html>