Friday, January 24, 2014

Using Cygwin and the MinGW Cross Compiler with SDL2

MinGW is currently the most popular way to use GCC on Windows. I recently found that there is a way of using MinGW from within Cygwin as a cross-compiler. I've recently been doing some OpenGL programming across both Linux and Windows, and using Cygwin has allowed me to keep my build system largely the same.
  1. I installed the following Cygwin 64 packages (I'm not sure if they are all necessary)
    1. mingw64-x86_64-binutils
    2. mingw64-x86_64-gcc
    3. mingw64-x86_64-gcc-core
    4. mingw64-x86_64-gcc-g++
    5. mingw64-x86_64-winpthreads
  2. Download the MinGW SDL2 development files.
  3. Extract the SDL2 development files.
  4. Copy source to dest (using SDL2-2.0.1 as the example)
    1. SDL2-2.0.1\x86_64-w64-mingw32\include\SDL2
      C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\include
    2. SDL2-2.0.1\x86_64-w64-mingw32\lib\libSDL2.a
      C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\libSDL2.a
    3. SDL2-2.0.1\x86_64-w64-mingw32\lib\libSDL2main.a
      C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\libSDL2main.a
    4. SDL2-2.0.1\x86_64-w64-mingw32\bin\sdl2-config
      C:\cygwin64\bin\sdl2-config
  5. Edit C:\cygwin64\bin\sdl2-config
    1.  Change the "prefix" variable to /usr/x86_64-w64-mingw32/sys-root/mingw
    2. Remove "-XCClinker" from the linker line.
  6. Compile and link (statically)
    1.   x86_64-w64-mingw32-gcc.exe opengltest.c -o gltest.exe $(sdl2-config --cflags --static-libs) -lopengl32

Vim Indentation Based on File/Folder Name/Regex

I've been working between a couple of projects that have wildly different coding standards. Vim has a flexible way to change settings based on a file path regular expression. Here is an example line where I set my indentation to 3 if the file path matches the given regexes (forgive the sprawl across two visual lines):


autocmd BufNewFile,BufRead */projectfolder/*.cpp,*/projectfolder/*.h setlocal expandtab tabstop=3 shiftwidth=3

Wednesday, January 22, 2014

vegan edamame potato salad

I found this recipe on the back of some Bird's Eye shelled edamame a number of years ago. I can't find it anywhere online, so I thought I'd post it myself.

Preparation Time:  15 minutes
Cooking Time:  10 minutes
Total Time:  25 minutes
Serves:  6-8

Ingredients:


  • 2 lbs small red skinned potatoes (quartered)
  • 1 package (16 oz) of Birds Eye Shelled Soybeans
  • 3 Tbsp olive oil
  • 2 Tbsp apple cider vinegar
  • 1 Tbsp Dijon mustard
  • 1 Tbsp brown sugar
  • 1 tsp salt
  • 1/2 tsp black pepper
  • 1 clove garlic, chopped (optional)
  • 1/2 red onion, thinly sliced.

Cook potatoes in large pot of salted water for 6-7 minutes or until
tender. Drain and allow to cool. Prepare soybeans per the packaged
directions. Set aside and keep chilled until needed. Mix the next 7
ingredients and whisk to blend. Combine the potatoes, edamame, and
onion with dressing. Mix well. Season with additional salt and pepper
to taste. Chill until ready to use.

Sunday, January 5, 2014

Clozure Common Lisp (CCL) on Raspberry Pi



This is a distillation of a few documents for my own use, including http://lispm.dyndns.org/ccl

This is how I was able to get Clozure Common Lisp (revision 15996) running on Raspbian (Wheezy version 2013-12-20 downloaded from http://www.raspberrypi.org/downloads).
  1. sudo aptitude install build-essential m4 subversion
  2. svn co http://svn.clozure.com/publicsvn/openmcl/release/1.9/linuxarm/ccl
  3. cd ccl/lisp-kernel/linuxarm
  4. make clean
  5. make