<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>you cannot unilaterally do this. </div><div>I hate autoconf too, 
but in VM list we have a general agreement on how to manage the VM build
 process, and unless you manage to convince the rest of people working 
there (and specially Eliot, who works there more than the rest), you 
have literally zero chance this will be adopted (and then, your work 
will be a general lose of time…). </div><div>In any case, you have my vote :)</div></blockquote><div>This was something that I did for quickly testing and trying to remove the windowing code. I also did this, because the building system is not working all of the time in my linux machine. The scripts for loading the VMMaker image are most of the time not working at all in Linux. I got frustrated by not being able on keep working on Lowcode for supporting the 64 bits version, because of these problems.<br><br></div><div>Anyway, I do not care if this part gets integrated or not, as long as I can keep working on my stuff, and I don't have a bunch of manully written scripts in build.*/* . As long as there is a single script that can be configured for each target or flavour of the VM I am okay with it.<br><br></div><div>Now I will document these scripts:<br><br></div><div>For setting the flavour of the VM, there are the following options<br>- SPUR_OBJECT_MODEL (On by default)<br>- SISTA_OPTIMIZER (Off by default)<br>- PHARO_BRANDING (On by default)<br>- COG_JIT(On by default. If off, it will build a stack interpreter only VM)<br><br></div><div>There are platform specific check for choosing whether to build a 64 bits VM or not. When building in a x86_64 systems, there is the BUILD_I386_VERSION option (Off by default) which will set the appropiate flags for building a 32 bits VM in a 64 bits system (-m32)<br><br></div><div>These options are used for making a string with the vm sources direction(src ,stacksrc, spursrc, etc) and for selecting the sources of the vm. In this experimental branch I am moving some of the sources at platform/<platform_name/vm into the minheadless/source, for including the barest minimum code for compiling the VM. By the end of this, I should probably move back the platform specific sources into their original locations.<br><br></div><div>The plugins to build with the VM are defined in Plugins.cmake (<a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/Plugins.cmake">https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/Plugins.cmake</a>)<br><br></div><div>Most of the time, adding a plugin is just a matter calling a macro:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-pl-c"># Basic internal plugins</span>
      
      
        <table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC74" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(FilePlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC75" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(LargeIntegers INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC76" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(LocalePlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC77" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(MiscPrimitivePlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC78" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(SecurityPlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC79" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(SocketPlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC80" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
<br></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC81" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(B2DPlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC82" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(BitBltPlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC83" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
<br></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC84" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(FloatArrayPlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC85" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(FloatMathPlugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC86" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">add_vm_plugin_auto(Matrix2x3Plugin INTERNAL)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC87" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
<br></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC88" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># Basic external plugins</span></td>
      </tr>
      <tr>
        </tr></tbody></table>add_vm_plugin_auto(SurfacePlugin EXTERNAL)<br></blockquote><div> </div>For more selective plugins, such as the SqueakFFIPrims plugin there is the add_vm_plugin_sources macro:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

      
      
        add_vm_plugin_sources(SqueakFFIPrims EXTERNAL <span class="gmail-pl-smi">${SqueakFFIPrims_Sources}</span>)</blockquote><div><br></div><div>Later I will add another macro for linking a library with a plugin, which will perform the correct action depending whether the Plugin is internal or external. The macros for building a plugin add an option for specifying whether to build or not a plugin (e.g: BUILD_PLUGIN_FilePlugin, BUILD_PLUGIN_FT2Plugin).<br><br></div><div>For building the a default VM using cmake, the only commands are required in the top level source directory:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>mkdir build_dir<br></div><div>cd build_dir<br></div><div>cmake ..<br></div><div>make<br></div></blockquote><div><br></div><div>For choosing interactively which options to enable or not, it is possible to use cmake-gui instead of cmake in the above sequence of commands. The built VM will be placed at build_dir/dist<br><br></div><div>Currently, I am not using the cmake configure capabilties for generating config.h and generating the HAVE_*_H defines. Later I will implement this, but taking special care in supporting the cross compilation scenario, where it is not possible to execute compiled program for probing the system for things such as sizeof(void*).<br></div><div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Could you explain more what traditional display backend means? Because I am probably out of domain but want to know more.  <br></div></blockquote><div>If the SUPPORT_TRADITIONAL_DISPLAY cmake option is enabled, and cmake finds SDL2 (it will look for the SDL2 libraries using the names SDL2-2.0 SDL2), then a non-headless VM will be built using sqPlatformSpecific-SDL2Window.c ( <a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqPlatformSpecific-SDL2Window.c">https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqPlatformSpecific-SDL2Window.c</a> ) instead of sqPlatformSpecific-NullWindow.c ( <a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqPlatformSpecific-NullWindow.c">https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqPlatformSpecific-NullWindow.c</a> ).<br><br></div><div>This non-headless VM using SDL2 instead of the platform specific API, which should help in avoiding conflicts between the OSWindow event loop and the VM event loop. This works with a normal Pharo 6 image.<br><br></div><div>This SDL2 based backend creates a window for the VM, only when asked by the image and process events sent to the VM window in the traditional way of translating the events into squeak events; placing the translated event in a queue, and then signaling a semaphore. SDL2 events that are not related to the VM window are placed untranslated in a separate queue, and there are used signal a separate semaphore for allowing OSWindow to process the event. I have already implemented the required primitives and updated OSWindow for using them, when they exist. I still have to update the OSWindow configuration. This approach allows preventing conflicts between the events for the VM window and OSWindow.<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Ronie, do you already have code to restore windows after image save? Any issue opened? <br></blockquote><div>Not yet for the extra morphic Worlds.<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How much VM size it reduced?</blockquote><div>I have not checked yet, but this is about reducing some complexity.<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>How dare you ?<br><br></div><div>Yesterday 03:00 am I finally 
managed to make my shared memory bridge between Pharo and C++ to work 
also on Windows after a ton of debugging and here comes you telling me 
that all my effort was for nothing. It now works and is tested on MacOS 
10.12 , Ubuntu 15.04 and Windows 10 (all of them 64 bit).  <br><br></div></blockquote><div>That is not worthless at all. That is still an excellent mechanism for fast IPC.<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Have you got no mercy ?</blockquote><div>No :) . Ask Thibault about the OpenGL bindings for the UFFI. That time I was cleaning OSWindow dependencies.<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Suffice to say I am super interested in both Non GUI Pharo because I
 use Unreal Game Engine and embedding Pharo because I use Unreal Game 
Engine. <br><br></div><div>Embedding Pharo is a must have for me because
 my shared memory solution would not be acceptable by Apple on iOS since
 it forbids an app from running two executable at the same time which is
 basic requirement for shared memory. Stupid Apple :/ . Android seems to
 be fine with this. <br><br></div><div>For now my game will target only 
PC where my shared memory solution works fine but sooner or later I will
 have to port to iOS and Android. <br></div><div><br></div>If there is anything I can do to help you out, dont hesitate to ask. I am going to give your build a try now :).   <br></blockquote><div>It is still needed to define a proper interface for embedding the VM. This interface should be a single .h file, with the highest level of abstraction possible. There are some other issues such as potential name clashes, and the fact that the VM symbols are public by default. At the bare minimum, it has to provide functions for initializing the VM, passing command line arguments, loading an image, running the image, and shutting down.<br><br></div><div>So far I managed to reduce main source code a lot in sqMain.c (<a href="https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqMain.c">https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqMain.c</a> ) . I am probably moving most of that into a separate source code file that will be always linked with VM core library, and keeping the source file with main function only couple of lines long (Init vm, load image, interpret and shutdown )<br><br></div><div>BTW, now I am working for a chilean video game company using Unreal. I do not like Unreal because it takes a very long time to compile, even with a 44 cores machine (88 threads) that we have in the company for rendering and compiling. I am wondering how that integration is going to end.<br><br></div><div>The embedding interface is not in my priority list. My priority is getting OSWindow working well in Windows (required by the Bloc and Roassal people). My second priority is getting Lowcode working on Linux, Mac and Windows in both, 32-bits and 64 bits mode.<br></div><div><br></div><div>Best regards,<br></div><div>Ronie<br></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-24 5:59 GMT-03:00 Denis Kudriashov <span dir="ltr"><<a href="mailto:dionisiydk@gmail.com" target="_blank">dionisiydk@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><div class="gmail_extra">Hi</div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-24 8:12 GMT+01:00 Ronie Salgado <span dir="ltr"><<a href="mailto:roniesalg@gmail.com" target="_blank">roniesalg@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><div><div><div><div><div>Hello,<br><br></div>I am working on removing most of windowing code from the VM, and in trying to unify the platform specific code of the VM. In the MinimalistHeadless branch of <a href="https://github.com/ronsaldo/opensmalltalk-vm" target="_blank">https://github.com/ronsaldo/op<wbr>ensmalltalk-vm</a> I made the following changes:<br></div></div></div></div></div></div></div></blockquote><div><br></div><div>This is super cool. With Pavel we just tried open oswindow based world from headless image and it work almost perfect. No problems with keyboard and scrolling anymore. And it already provides very good approach for deploying desktop app.   </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><div><div><div><div><br></div>- Unified standard CMake building scripts for Unixes. I hate autoconf. I want to use them in Windows too.<br></div>- Refactoring the Unix entry points. I am trying to remove a lot of code for simplfying stuff.<br></div>- Null window driver for true headless.<br></div>- Optional SDL2 based traditional display backend for compatibility reasons, and because the extra Morphic worlds using OSWindow are a bit unstable.<br></div></div></div></blockquote><div><br></div><div>Could you explain more what traditional display backend means? Because I am probably out of domain but want to know more.  </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div></div><br></div>So far I managed to run a standard Pharo 6 image using this custom VM in Linux. Windows and Mac are coming next. Hopefully this is going to fix the problems with duplicated events when using OSWindow in Windows.<br><br>I am also planning on making a standard interface for embedding the VM in an application, at least as a static library. With this new building system, this seems to be easy to do.<br><br></div><div>BTW. When I tried the minimalistic Pharo image, in a completely headless VM, I got the following error:<br><br>[ "Ugh .... now this is a biggie - a system that does not support<br>        any of the display depths at all."<br>Smalltalk<br>    logError:<br>        'Fatal error: This system has no support for any display depth at all.'<br>    inContext: thisContext.<br>Smalltalk quitPrimitive    "There is no way to continue from here" ] in DisplayScreen>>findAnyDisplayD<wbr>epth<br>DisplayScreen>>findAnyDisplayD<wbr>epthIfNone:<br>DisplayScreen>>findAnyDisplayD<wbr>epth<br>DisplayScreen>>setExtent:depth<wbr>:<br>DisplayScreen class>>startUp<br><br></div><div>As a workaround, I am doing the following for ioHasDisplayDepth with the null driver:<br><br>sqInt ioHasDisplayDepth(sqInt depth)<br>{<br>    return true;<br>}<br></div></blockquote><div><br></div><div>I guess it is temp solution? Because no DisplayScreen should exist in headless mode.</div></div><br></div></div>
<br></blockquote></div><br></div></div>