Просмотр исходного кода

SCons: Allow unbundling libwebsockets and miniupnpc

Rémi Verschelde 7 лет назад
Родитель
Сommit
7d392cd6f4
3 измененных файлов с 36 добавлено и 17 удалено
  1. 3 2
      SConstruct
  2. 15 3
      platform/server/detect.py
  3. 18 12
      platform/x11/detect.py

+ 3 - 2
SConstruct

@@ -171,11 +171,11 @@ opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during comp
 opts.Add(BoolVariable('progress', "Show a progress indicator during build", True))
 opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
 opts.Add(EnumVariable('macports_clang', "Build using clang from MacPorts", 'no', ('no', '5.0', 'devel')))
+opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
 
 # Thirdparty libraries
 opts.Add(BoolVariable('builtin_bullet', "Use the builtin bullet library", True))
 opts.Add(BoolVariable('builtin_enet', "Use the builtin enet library", True))
-opts.Add(BoolVariable('builtin_miniupnpc', "Use the builtin miniupnpc library", True))
 opts.Add(BoolVariable('builtin_freetype', "Use the builtin freetype library", True))
 opts.Add(BoolVariable('builtin_libogg', "Use the builtin libogg library", True))
 opts.Add(BoolVariable('builtin_libpng', "Use the builtin libpng library", True))
@@ -183,7 +183,9 @@ opts.Add(BoolVariable('builtin_libtheora', "Use the builtin libtheora library",
 opts.Add(BoolVariable('builtin_libvorbis', "Use the builtin libvorbis library", True))
 opts.Add(BoolVariable('builtin_libvpx', "Use the builtin libvpx library", True))
 opts.Add(BoolVariable('builtin_libwebp', "Use the builtin libwebp library", True))
+opts.Add(BoolVariable('builtin_libwebsockets', "Use the builtin libwebsockets library", True))
 opts.Add(BoolVariable('builtin_mbedtls', "Use the builtin mbedTLS library", True))
+opts.Add(BoolVariable('builtin_miniupnpc', "Use the builtin miniupnpc library", True))
 opts.Add(BoolVariable('builtin_opus', "Use the builtin opus library", True))
 opts.Add(BoolVariable('builtin_pcre2', "Use the builtin pcre2 library)", True))
 opts.Add(BoolVariable('builtin_recast', "Use the builtin recast library", True))
@@ -191,7 +193,6 @@ opts.Add(BoolVariable('builtin_squish', "Use the builtin squish library", True))
 opts.Add(BoolVariable('builtin_thekla_atlas', "Use the builtin thekla_altas library", True))
 opts.Add(BoolVariable('builtin_zlib', "Use the builtin zlib library", True))
 opts.Add(BoolVariable('builtin_zstd', "Use the builtin zstd library", True))
-opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
 
 # Compilation environment setup
 opts.Add("CXX", "C++ compiler")

+ 15 - 3
platform/server/detect.py

@@ -67,9 +67,6 @@ def configure(env):
 
     # FIXME: Check for existence of the libs before parsing their flags with pkg-config
 
-    if not env['builtin_libwebp']:
-        env.ParseConfig('pkg-config libwebp --cflags --libs')
-
     # freetype depends on libpng and zlib, so bundling one of them while keeping others
     # as shared libraries leads to weird issues
     if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
@@ -124,6 +121,21 @@ def configure(env):
     if not env['builtin_libogg']:
         env.ParseConfig('pkg-config ogg --cflags --libs')
 
+    if not env['builtin_libwebp']:
+        env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+    if not env['builtin_mbedtls']:
+        # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
+        env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
+
+    if not env['builtin_libwebsockets']:
+        env.ParseConfig('pkg-config libwebsockets --cflags --libs')
+
+    if not env['builtin_miniupnpc']:
+        # No pkgconfig file so far, hardcode default paths.
+        env.Append(CPPPATH=["/usr/include/miniupnpc"])
+        env.Append(LIBS=["miniupnpc"])
+
     # On Linux wchar_t should be 32-bits
     # 16-bit library shouldn't be required due to compiler optimisations
     if not env['builtin_pcre2']:

+ 18 - 12
platform/x11/detect.py

@@ -158,14 +158,6 @@ def configure(env):
 
     # FIXME: Check for existence of the libs before parsing their flags with pkg-config
 
-    if not env['builtin_mbedtls']:
-        # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
-        env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
-
-    if not env['builtin_libwebp']:
-        env.ParseConfig('pkg-config libwebp --cflags --libs')
-
-
     # freetype depends on libpng and zlib, so bundling one of them while keeping others
     # as shared libraries leads to weird issues
     if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
@@ -205,6 +197,10 @@ def configure(env):
         env['builtin_libogg'] = False  # Needed to link against system libtheora
         env['builtin_libvorbis'] = False  # Needed to link against system libtheora
         env.ParseConfig('pkg-config theora theoradec --cflags --libs')
+    else:
+        list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
+        if any(platform.machine() in s for s in list_of_x86):
+            env["x86_libtheora_opt_gcc"] = True
 
     if not env['builtin_libvpx']:
         env.ParseConfig('pkg-config vpx --cflags --libs')
@@ -220,10 +216,20 @@ def configure(env):
     if not env['builtin_libogg']:
         env.ParseConfig('pkg-config ogg --cflags --libs')
 
-    if env['builtin_libtheora']:
-        list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
-        if any(platform.machine() in s for s in list_of_x86):
-            env["x86_libtheora_opt_gcc"] = True
+    if not env['builtin_libwebp']:
+        env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+    if not env['builtin_mbedtls']:
+        # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
+        env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
+
+    if not env['builtin_libwebsockets']:
+        env.ParseConfig('pkg-config libwebsockets --cflags --libs')
+
+    if not env['builtin_miniupnpc']:
+        # No pkgconfig file so far, hardcode default paths.
+        env.Append(CPPPATH=["/usr/include/miniupnpc"])
+        env.Append(LIBS=["miniupnpc"])
 
     # On Linux wchar_t should be 32-bits
     # 16-bit library shouldn't be required due to compiler optimisations