From 959f1a0f92f09c08de88626e9958ab1cca37e02e Mon Sep 17 00:00:00 2001
From: Maxime Curioni <maxime.curioni@gmail.com>
Date: Tue, 6 May 2008 17:23:27 +0000
Subject: [PATCH] soc-2008-mxcurioni: swig compiles as independent library

---
 SConstruct                          |  5 ++++-
 config/darwin-config.py             |  1 +
 config/linux2-config.py             | 10 ++++++++++
 config/linuxcross-config.py         | 12 ++++++++++++
 config/openbsd3-config.py           | 10 ++++++++++
 config/sunos5-config.py             | 10 ++++++++++
 config/win32-mingw-config.py        | 10 ++++++++++
 config/win32-vc-config.py           | 10 ++++++++++
 extern/SConscript                   |  1 +
 source/blender/freestyle/SConscript | 24 +++++++++++++++---------
 tools/btools.py                     |  5 +++--
 11 files changed, 86 insertions(+), 12 deletions(-)

diff --git a/SConstruct b/SConstruct
index 90092c51573..341638c0e0c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -269,7 +269,7 @@ if not quickie and do_clean:
                 print "clean dir %s"%(B.root_build_dir+dir)
                 shutil.rmtree(B.root_build_dir+dir)
         for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
-                'extern/xvidcore/build/generic/platform.inc','extern/freestyle/lib3ds/Makefile']:
+                'extern/xvidcore/build/generic/platform.inc','extern/freestyle/lib3ds/Makefile','extern/freestyle/swig/Makefile']:
             if os.path.exists(confile):
                 print "clean file %s"%confile
                 os.remove(confile)
@@ -340,12 +340,15 @@ if env['WITH_BF_PLAYER']:
     playerlist = B.create_blender_liblist(env, 'player')
     env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
 
+
+
 ##### Now define some targets
 
 
 #------------ INSTALL
 
 #-- binaries
+
 blenderinstall = []
 if  env['OURPLATFORM']=='darwin':
     for prg in B.program_list:
diff --git a/config/darwin-config.py b/config/darwin-config.py
index 856317cd627..9ceb1d1644b 100644
--- a/config/darwin-config.py
+++ b/config/darwin-config.py
@@ -164,6 +164,7 @@ WITH_BF_FREESTYLE = 'true'
 BF_FREESTYLE = '#extern/freestyle'
 BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
 BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
diff --git a/config/linux2-config.py b/config/linux2-config.py
index 4d8b5c97512..3c8a48d12bc 100644
--- a/config/linux2-config.py
+++ b/config/linux2-config.py
@@ -86,6 +86,16 @@ BF_SOLID_LIB = 'extern_solid'
 
 WITH_BF_YAFRAY = 'true'
 
+WITH_BF_FREESTYLE = 'true'
+BF_FREESTYLE = '#extern/freestyle'
+BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
+BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
+BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
+BF_LIB3DS_LIB = 'extern_lib3ds'
+BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
+BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
diff --git a/config/linuxcross-config.py b/config/linuxcross-config.py
index e6c4e8769b4..886b9f93f3f 100644
--- a/config/linuxcross-config.py
+++ b/config/linuxcross-config.py
@@ -6,6 +6,18 @@ BF_VERSE_INCLUDE = "#extern/verse/dist"
 
 WITH_BF_YAFRAY = 'true'
 
+WITH_BF_FREESTYLE = 'true'
+BF_FREESTYLE = '#extern/freestyle'
+BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
+BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
+BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
+BF_LIB3DS_LIB = 'extern_lib3ds'
+BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
+BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+
+###########################
+
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '2.5'
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
diff --git a/config/openbsd3-config.py b/config/openbsd3-config.py
index f7f254973af..ad4891a0098 100644
--- a/config/openbsd3-config.py
+++ b/config/openbsd3-config.py
@@ -80,6 +80,16 @@ BF_SOLID_LIB = 'extern_solid'
 
 WITH_BF_YAFRAY = 'true'
 
+WITH_BF_FREESTYLE = 'true'
+BF_FREESTYLE = '#extern/freestyle'
+BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
+BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
+BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
+BF_LIB3DS_LIB = 'extern_lib3ds'
+BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
+BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
diff --git a/config/sunos5-config.py b/config/sunos5-config.py
index b3ca0e267ff..6581ad2b692 100644
--- a/config/sunos5-config.py
+++ b/config/sunos5-config.py
@@ -82,6 +82,16 @@ BF_SOLID_LIB = 'extern_solid'
 
 WITH_BF_YAFRAY = 'true'
 
+WITH_BF_FREESTYLE = 'true'
+BF_FREESTYLE = '#extern/freestyle'
+BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
+BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
+BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
+BF_LIB3DS_LIB = 'extern_lib3ds'
+BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
+BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
diff --git a/config/win32-mingw-config.py b/config/win32-mingw-config.py
index d9fd6ce8d4f..b0a3c3ae18d 100644
--- a/config/win32-mingw-config.py
+++ b/config/win32-mingw-config.py
@@ -97,6 +97,16 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
 WITH_BF_YAFRAY = 'true'
 
+WITH_BF_FREESTYLE = 'true'
+BF_FREESTYLE = '#extern/freestyle'
+BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
+BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
+BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
+BF_LIB3DS_LIB = 'extern_lib3ds'
+BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
+BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
diff --git a/config/win32-vc-config.py b/config/win32-vc-config.py
index 32b6597b5d5..849b153378f 100644
--- a/config/win32-vc-config.py
+++ b/config/win32-vc-config.py
@@ -108,6 +108,16 @@ WITH_BF_YAFRAY = 'true'
 
 WITH_BF_BINRELOC = 'false'
 
+WITH_BF_FREESTYLE = 'true'
+BF_FREESTYLE = '#extern/freestyle'
+BF_FREESTYLE_SRC = '#source/blender/freestyle/src'
+BF_SWIG = '${BF_FREESTYLE}/swig'
+BF_SWIG_LIB = 'extern_swig'
+BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
+BF_LIB3DS_LIB = 'extern_lib3ds'
+BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
+BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
diff --git a/extern/SConscript b/extern/SConscript
index 8ab451a8024..7997981b7f2 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -11,6 +11,7 @@ if env['WITH_BF_BULLET']:
 
 if env['WITH_BF_FREESTYLE']:
     SConscript(['freestyle/lib3ds/SConscript'])
+    SConscript(['freestyle/swig/SConscript'])
 
 if env['WITH_BF_INTERNATIONAL']:
     SConscript(['bFTGL/SConscript'])
diff --git a/source/blender/freestyle/SConscript b/source/blender/freestyle/SConscript
index ce8b9d0f224..7e859e58c58 100644
--- a/source/blender/freestyle/SConscript
+++ b/source/blender/freestyle/SConscript
@@ -1,10 +1,16 @@
 #!/usr/bin/python
-# import sys
-# Import ('env')
-# 
-# sources = ['']
-# 
-# incs = ' '
-# incs += ' ' + env['BF_LIB3DS_INC']
-# 
-# env.BlenderLib ( 'bf_freestyle', sources, Split(incs), Split(defs), libtype=['international','player'], priority=[0, 205] )
+import sys
+Import ('env')
+
+sources = []
+defs = []
+
+incs = '#/extern/freestyle/lib3ds #/extern/freestyle/swig'
+incs += ' ' + env['BF_LIB3DS_INC']
+
+# env.BlenderLib (libname="bf_freestyle",
+# 				sources=sources,
+#                 includes=Split(incs),
+#                 defines=defs,
+#                 libtype=['blender'],
+#                 priority = [15] )
\ No newline at end of file
diff --git a/tools/btools.py b/tools/btools.py
index 8158bf6cfcc..deab2e687b6 100755
--- a/tools/btools.py
+++ b/tools/btools.py
@@ -66,7 +66,7 @@ def validate_arguments(args, bc):
             'BF_FANCY', 'BF_QUIET',
             'BF_X264_CONFIG',
             'BF_XVIDCORE_CONFIG',
-			'BF_WITH_BF_FREESTYLE', 'BF_FREESTYLE', 'BF_FREESTYLE_SRC', 'BF_SWIG', 'BF_LIB3DS', 'BF_LIB3DS_LIB', 'BF_LIB3DS_LIBPATH', 'BF_LIB3DS_INC'
+			'BF_WITH_BF_FREESTYLE', 'BF_FREESTYLE', 'BF_FREESTYLE_SRC', 'BF_SWIG', 'BF_SWIG_LIB', 'BF_LIB3DS', 'BF_LIB3DS_LIB', 'BF_LIB3DS_LIBPATH', 'BF_LIB3DS_INC'
             ]
 
     arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
@@ -242,7 +242,8 @@ def read_opts(cfg, args):
         ('BF_FREESTYLE', 'Freestyle base path', ''),
         ('BF_FREESTYLE_SRC', 'Freestyle source path', ''),
         ('BF_SWIG', 'SWIG base path', ''),
-        ('BF_LIB3DS', 'SWIG base path', ''),
+        ('BF_SWIG_LIB', 'SWIG library', ''),
+        ('BF_LIB3DS', 'lib3ds base path', ''),
         ('BF_LIB3DS_LIB', 'lib3ds library', ''),
         ('BF_LIB3DS_LIBPATH', 'lib3ds library path', ''),
 		('BF_LIB3DS_INC', 'lib3ds include path', ''),
-- 
GitLab