MediaWiki:Blockipsuccesssub

From askoh.net wiki

Jump to: navigation, search

Documentation of Visual Studio build of SqueakVM 3.10. If you want to play with it immediately, get it here. Otherwise, follow instruction below to build a VS SqueakVM 3.10. Note: in case rebuild cause any error, follow step 1 of subtitle: Squeak, include directories

We will build 3.10 version of SqueakVM. We will need to download platform specific files from Squeak source release. Next, we will generate independent files (plugins and interpreter) from VMMaker.


Contents

Tools

  • Download SqueakVM Win32-3.10.7 source. Extract it, then copy only directory named platforms into root directory, eg. "C:\Smalltalk\Squeak\3.10\demo\VS2008" in my case. This will be root directory for source code, VS projects and also the solution file. You will get "MyRoot\platforms", in my case "C:\Smalltalk\Squeak\3.10\demo\VS2008\platforms".
  • Delete winbuild, we are going to generate our own version of winbuild from VMMaker.
  • Download Squeak 3.10 & image. Setup the image with VMMaker package. Follow VMMaker page to learn more about VMMaker.
  • In VMMaker UI, select the following as internal plugin. I'm not sure which are the "must-have" plugins. So, I will just follow the previous configuration since they work.
  1. BallonEnginePlugin(B2DPlugin)
  2. BitBltSimulation(BitBltPlugin)
  3. BMPReadWriterPlugin
  4. FilePlugin
  5. DropPlugin
  6. HostWindowPlugin
  7. SecurityPlugin
  8. SocketPlugin
  9. JoystickTabletPlugin
  • Use VMMaker to generate source into "C:\Smalltalk\Squeak\3.10\demo\VS2008\platforms\win32\build\src".
  • At this point, all files are ready to be use in VM building.


Building

  • Open-up Visual Studio (VC 2008 Express), choose Empty Project, create new project named Squeak. Set location to "MyRoot\Projects", in my case "C:\Smalltalk\Squeak\3.10\demo\VS2008\Projects". Uncheck Create directory for solution.
  • Close the solution. Cut Squeak.sln and Squeak.ncb from "MyRoot\Projects\Squeak", and paste it at "MyRoot".
  • Open up Squeak.sln, ignore pop-up warnings. Right-click on Squeak(unavailable), remove it. At File -> Add -> Existing Projects..., go into "MyRoot\Projects\Squeak" and add Squeak.vcproj.
  • Steps above needed to achieve directory-tree of desire.


Squeak

  • Under Tools -> Options -> Projects and Solutions -> VC++ Directories, make sure to select Include files at Show directories for:, then add in the following:
    • $(SolutionDir)\winbuild\src\vm
    • $(SolutionDir)\platforms\win32\build\vm
    • $(SolutionDir)\platforms\win32\vm
    • $(SolutionDir)\platforms\Cross\vm
    • $(SolutionDir)\platforms\win32\build\src\vm
  • Right-click on Squeak, choose Add -> Existing Item.... Repeat this step, add these files to the project.
    • "MyRoot\platforms\win32\build\src\vm" :
      • interp.h
      • sqNamedPrims.h
      • interp.c
    • "MyRoot\platforms\Cross\vm" :
      • sq.h
      • sqNamedPrims.c
      • sqVirtualMachine.c
    • "MyRoot\platforms\win32\vm" :
      • sqConfig.h
      • sqWin32.h
      • sqWin32Prefs.h
      • version.h
      • sqWin32Alloc.c
      • sqWin32Args.c
      • sqWin32Directory.c
      • sqWin32Exports.c
      • sqWin32ExternalPrims.c
      • sqWin32Intel.c
      • sqWin32PluginSupport.c
      • sqWin32Prefs.c
      • sqWin32Service.c
      • sqWin32Stubs.c
      • sqWin32Utils.c
      • sqWin32Window.c
      • version.c
    • "MyRoot\platforms\win32\misc" : (Add to Resource File)
      • Squeak.rc
      • resource.h
  • Under Configuration Properties -> General, set Character Set to Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_WINDOWS;__i386__;_CRT_SECURE_NO_DEPRECATE;VM_NAME=\"Squeak\";_USE_32BIT_TIME_T.
  • Under C/C++ -> Code Generation -> Basic Runtime Checks, choose Default.
  • Under C/C++ -> Code Generation -> Runtime Library, choose Multi-threaded Debug (/MTd).
  • Under C/C++ -> Browse Information -> Enable Browse Information, choose Include All Browse Information (/FR).
  • Under C/C++ -> Advanced -> Show Includes, choose Yes (/showIncludes).
  • Under C/C++ -> Advanced -> Undefine Preprocessor Definitions, fill in UNICODE.
  • Under Linker -> General -> Enable Incremental Linking, choose Yes (/INCREMENTAL).
  • Under Linker -> Input -> Additional Dependencies, fill in winmm.lib msvcrtd.lib Version.lib.
  • Under Linker -> Input -> Ignore All Default Libraries, choose Yes (/NODEFAULTLIB).
  • Under Linker -> System -> SubSystem, choose Windows (/SUBSYSTEM:WINDOWS).
  • Under Linker -> Advanced-> Randomized Base Address, choose Disable Image Randomization (/DYNAMICBASE:NO).
  • Under Linker -> Advanced-> Data Execution Prevention (DEP), choose Default.
  • Click on Apply, then OK.
  • Some adjustment to the coding.
    • Open version.h, change content to #define VM_BUILD_STRING "Win32 built on " __DATE__ " "__TIME__ " Compiler: Visual Studio 2008"
  • sqMemoryAccess.h line 166, delete
static void inline flag(char *ignored)
{
  (void)ignored;
}

replace it with #define flag() ;

  • sqWin32Window.c line 38, add the line void HideSplashScreen(void);
  • sqWin32Window.c line 519, comment out the entire line. //__asm__ __volatile__ ("rdtsc" : "=A" (value));.
  • sqWin32Window.c line 528, change void SetDefaultPrinter() to void SetDefaultPrinterSqueak().
  • sqWin32Window.c line 2777, replaceofn.lpstrTitle = L""VM_NAME": Please select an image file..."; with ofn.lpstrTitle = TEXT(VM_NAME": Please select an image file...");.
  • sqWin32Prefs.c line 368, change SetDefaultPrinter(); to SetDefaultPrinterSqueak();.
  • sqWin32Intel.c line 317-338, comment out these lines.
  • sqWin32Intel.c line 176, change printf to _printf. We'll ignore it.
  • sq.h line 420, add these lines. #define strdup _strdup, #define strnicmp _strnicmp and #define warnPrintf printf

B2DPlugin

  • Create a new empty project named B2DPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked B2DPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\B2DPlugin" : B2DPlugin.c
  • Open B2DPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check B2DPlugin.


BitBltPlugin

  • Create a new empty project named BitBltPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked BitBltPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\BitBltPlugin" : BitBltPlugin.c
  • Open BitBltPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check BitBltPlugin.



BMPReadWriterPlugin

  • Create a new empty project named BMPReadWriterPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked BMPReadWriterPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\BMPReadWriterPlugin" : BMPReadWriterPlugin.c
  • Open BMPReadWriterPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check BMPReadWriterPlugin.



FilePlugin

  • Create a new empty project named FilePlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked FilePlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\FilePlugin" : FilePlugin.c
  • "MyRoot\platforms\Cross\plugins\FilePlugin" : FilePlugin.h sqFilePluginBasicPrims.c
  • "MyRoot\platforms\win32\plugins\FilePlugin" : sqWin32FilePrims.c
  • Open FilePlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\FilePlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check FilePlugin.


DropPlugin

  • Create a new empty project named DropPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked DropPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\DropPlugin" : DropPlugin.c
  • "MyRoot\platforms\Cross\plugins\DropPlugin" : DropPlugin.h
  • "MyRoot\platforms\win32\plugins\DropPlugin" : sqWin32Drop.c
  • Open DropPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\DropPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check DropPlugin.


HostWindowPlugin

  • Create a new empty project named HostWindowPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked HostWindowPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\HostWindowPlugin" : HostWindowPlugin.c
  • "MyRoot\platforms\Cross\plugins\HostWindowPlugin" : HostWindowPlugin.h
  • "MyRoot\platforms\win32\plugins\HostWindowPlugin" : sqWin32HostWindowPlugin.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\HostWindowPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check HostWindowPlugin.


SecurityPlugin

  • Create a new empty project named SecurityPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked SecurityPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\SecurityPlugin" : SecurityPlugin.c
  • "MyRoot\platforms\Cross\plugins\SecurityPlugin" : SecurityPlugin.h
  • "MyRoot\platforms\win32\plugins\SecurityPlugin" : sqWin32Security.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\SecurityPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check SecurityPlugin.


SocketPlugin

  • Create a new empty project named SocketPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked SocketPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\SocketPlugin" : SocketPlugin.c
  • "MyRoot\platforms\Cross\plugins\SocketPlugin" : SocketPlugin.h
  • "MyRoot\platforms\win32\plugins\SocketPlugin" : sqWin32NewNet.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\SocketPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Under Librarian -> General -> Additional Dependencies, choose Ws2_32.lib.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check SocketPlugin.


JoystickTabletPlugin

  • Create a new empty project named JoystickTabletPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked JoystickTabletPlugin, choose Add -> Existing Item....
  • "MyRoot\platforms\win32\build\src\JoystickTabletPlugin" : JoystickTabletPlugin.c
  • "MyRoot\platforms\Cross\plugins\JoystickTabletPlugin" : JoystickTabletPlugin.h
  • "MyRoot\platforms\win32\plugins\JoystickTabletPlugin" : sqWin32Joystick.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\JoystickTabletPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check JoystickTabletPlugin.

Directory Tree

Note

  1. Make sure to copy splash.bmp into "MyRoot\Projects\Squeak", so that during debug, Squeak can find it, and open-up Squeak window. Without it, Squeak window wouldn't show up. splash.bmp can be found in Squeak package, along side with image and Squeak executable.
  2. Copy an image to the same directory, so that you wouldn't need to manually choose an image every time running(debugging) Squeak in VS.
Personal tools
Navigation