Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: acc53bcaff
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 42 lines (32 sloc) 1.177 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/usr/bin/env python

from os import popen

srcdir = '.'
blddir = 'build'
VERSION = '0.0.1'

def set_options(opt):
  opt.tool_options('compiler_cxx')

def configure(conf):
  conf.check_tool('compiler_cxx')
  conf.check_tool('node_addon')
  
  sdl_config = conf.find_program('sdl-config', var='SDL_CONFIG', mandatory=True)
  sdl_libs = popen("%s --libs" % sdl_config).readline().strip()
  sdl_cflags = popen("%s --cflags" % sdl_config).readline().strip()

  sdl_addpaths = []
  sdl_addlibs = []
  for item in sdl_libs.split(' '):
    # -L items are lib paths, -l are additional libraries
    if item.find("-L") == 0:
      sdl_addpaths.append(item[2:])
    if item.find("-l") == 0:
      sdl_addlibs.append(item[2:])

  conf.env.append_value("LIBPATH_SDL", sdl_addpaths)
  conf.env.append_value("LIB_SDL", sdl_addlibs)
   
  conf.env.append_value("CPPFLAGS_SDL", sdl_cflags.split(' '))

def build(bld):
  obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
  obj.target = "node-sdl"
  obj.cxxflags = ["-pthread", "-Wall"]
  obj.linkflags = ["-lSDL_ttf", "-lSDL_image"]
  obj.includes = ["/usr/include/SDL"]
  obj.source = ["src/sdl.cc", "src/helpers.cc"]
  obj.uselib = "SDL"
Something went wrong with that request. Please try again.