<!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&nbsp; <br>build.assert&nbsp; <br>build.assert.itimerheartbeat&nbsp; <br>build.debug&nbsp; <br>build.debug.itimerheartbeat&nbsp; <br>build.itimerheartbeat&nbsp; <br>build.multithreaded&nbsp; <br>build.multithreaded.assert&nbsp; <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CC="gcc -m32" \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXX="g++ -m32" \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS="$OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0" \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LIBS="-lpthread -luuid" \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CC="gcc -m32" \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; "set any CMake global options, before declaring a project in cmake file"<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; maker set: 'CMAKE_C_COMPILER' to: '/usr/bin/gcc'.<br>&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; ^ {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; '-O0'. <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; '--msse2'. <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; '-D_GNU_SOURCE'. <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; '-D_FILE_OFFSET_BITS=64'. <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; '-DCOGMTVM=0'.&nbsp; }<br></div></blockquote><b>Should I just throw the '-m32' in here?&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; &nbsp;^ '-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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; maker setTargetProperties: 'LINK_FLAGS "-m32"'.<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; maker puts: 'set_source_files_properties( ${srcVMDir}/cogit.c PROPERTIES <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; COMPILE_FLAGS "-O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer -mno-rtd -mno-accumulate-outgoing-args")'.<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; maker <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmd: 'set_source_files_properties'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; params: ' ${targetPlatform}/vm/sqUnixHeartbeat.c PROPERTIES <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; COMPILE_FLAGS "-O1 -fno-omit-frame-pointer -mno-rtd -mno-accumulate-outgoing-args"'.<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; maker addExternalLibraries: <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #(<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'm'&nbsp; "math lib"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'dl'&nbsp; "dynamic loader"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'pthread' "posix threads" <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ).<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir fullName.<br>&nbsp;&nbsp;&nbsp; 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&nbsp; '-m32' and if CMake doesn't handle it make sure putting it in compilerFlags is ok.<br>2. CFlags=compilerFlags<br>3. LIBS=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (I think this needs to be refactored with the method renamed in an override)<br>4. LDFlags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (I think we need a new method for these in CMakeVMGenerator&gt;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&gt;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>&nbsp;&nbsp;&nbsp; | intPlugins extPlugins |<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; output := String new writeStream.<br>&nbsp;&nbsp;&nbsp; config setGlobalOptions: self.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; self <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printHeader;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; project: config executableName.<br><br>&nbsp;&nbsp;&nbsp; config setGlobalOptionsAfterDetermineSystem: self.<br><br>&nbsp;&nbsp;&nbsp; config setupDirectories: self.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; self message: '${CMAKE_MODULE_PATH}'.<br>&nbsp;&nbsp;&nbsp; self set: 'CMAKE_CONFIGURATION_TYPES' to: 'Release'.<br><br>&nbsp;&nbsp;&nbsp; config preferredIncludes <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do: [ :each | self includeDirectories: each ].<br>&nbsp;&nbsp;&nbsp; self includeDirectories: self includeDirs.&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; config standardIncludes <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do: [:each | self includeDirectories: each ].<br><br>&nbsp;&nbsp;&nbsp; self addDefinitions: config compilerFlags.<br><br>&nbsp;&nbsp;&nbsp; config extraVMSettings: self.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; self puts: 'add_executable(' , config executableName, ' ', config executableType, ' ' , self sources , ')'.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; intPlugins := self generatePluginConfigs: config internalPlugins internal: true.<br>&nbsp;&nbsp;&nbsp; extPlugins := self generatePluginConfigs: config externalPlugins internal: false.<br><br>&nbsp;&nbsp;&nbsp; self processThirdpartyLibraries.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; self processPlugins:&nbsp; intPlugins, extPlugins.<br><br>&nbsp;&nbsp;&nbsp; config setExtraTargetProperties: self.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; self cmd: 'target_link_libraries'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; params: self moduleName , ' ${LINKLIBS}'.<br><br>&nbsp;&nbsp;&nbsp; config postBuildActions: self.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; self saveFile.<br>&nbsp;&nbsp;&nbsp; self generateBuildScript.</div></blockquote> <br><br><br><br><br><br><br></div></body></html>