SConscript 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ## -*- mode: python -*-
  2. ## $Id$
  3. ##
  4. ## Flexlay - A Generic 2D Game Editor
  5. ## Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
  6. ##
  7. ## This program is free software; you can redistribute it and/or
  8. ## modify it under the terms of the GNU General Public License
  9. ## as published by the Free Software Foundation; either version 2
  10. ## of the License, or (at your option) any later version.
  11. ##
  12. ## This program is distributed in the hope that it will be useful,
  13. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ## GNU General Public License for more details.
  16. ##
  17. ## You should have received a copy of the GNU General Public License
  18. ## along with this program; if not, write to the Free Software
  19. ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. import os
  21. import re
  22. import glob
  23. Import('clanLib_env')
  24. opts = Variables('custom.py')
  25. opts.Add('CXX', 'The C++ compiler.', 'g++')
  26. opts.Add('CXXFLAGS', 'The C++ compiler flags.', ["-g", "-O2", "-Wall", "-fPIC"])
  27. opts.Add('CPPPATH', 'additional header path', '')
  28. opts.Add('LIBPATH', 'additional library path', '')
  29. opts.Add('DESTDIR', 'destination directory which gets appended to PREFIX', '')
  30. opts.Add('PREFIX', 'PREFIX, ie. /usr/local', '/usr/local')
  31. env = Environment(SHLIBPREFIX='',
  32. ENV = os.environ,
  33. options=opts)
  34. Help(opts.GenerateHelpText(env))
  35. def gen_i_depends(path, filename):
  36. print(os.getcwd())
  37. lst = []
  38. regex = re.compile("^%include +\"(.*)\".*")
  39. f = file(filename)
  40. for i in f.readlines():
  41. i = i[:-1]
  42. if regex.match(i):
  43. lst.append(path + "/" + regex.sub("\\1", i))
  44. f.close()
  45. return lst
  46. #Depends('../lib/flexlay_wrap.i', gen_i_depends(Dir("../lib").abspath, File("../lib/flexlay_wrap.i").abspath))
  47. #env.Command('flexlay_ruby_wrap.cpp', '../lib/flexlay_wrap.i',
  48. # "swig -c++ -ruby -o $TARGET $SOURCE")
  49. env.ParseConfig("pkg-config --cflags --libs ruby-2.7")
  50. libflexlay_ruby_env = env.Clone()
  51. libflexlay_ruby_env.Append(CXXFLAGS=["-std=c++11", "-Wno-uninitialized", "-Wno-unused-variable", "-Wno-unused-but-set-variable"])
  52. flexlay_ruby_lib = libflexlay_ruby_env.SharedLibrary(
  53. target = "flexlay_wrap.so",
  54. source = [
  55. "../lib/flexlay_wrap.i",
  56. "ruby_functor.cpp",
  57. "ruby_meta_data.cpp",
  58. "ruby_sexpr_parser.cpp",
  59. "ruby_object.cpp",
  60. "ruby_converter.cpp"
  61. ],
  62. CPPPATH=[".",'$USER_CPPPATH', '../lib/'] + clanLib_env['CPPPATH'] + env['CPPPATH'],
  63. LINKFLAGS = clanLib_env['LINKFLAGS'],
  64. LIBPATH=['../lib', '.'] + clanLib_env['LIBPATH'],
  65. LIBS=['flexlay'] + clanLib_env['LIBS'],
  66. SWIGFLAGS="-ruby -c++")
  67. # install_ruby = env.Alias('install_headers', Install(env['DESTDIR'] + env['PREFIX'] + '/include/flexlay', flexlay_headers))
  68. # env.Alias('install', [install_ruby])
  69. # EOF #