From 601b6b86781912ac761d4d25d1a3499b93b7e690 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 22 Dec 2016 21:29:11 +0100 Subject: [PATCH] Tweaks for building with static thirdparty libs on Linux Sneak in a function used by makewheel --- makepanda/makepanda.py | 14 +++++++++++--- makepanda/makepandacore.py | 12 ++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 040fb03e2b..cb175542f2 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -561,6 +561,10 @@ if (COMPILER == "MSVC"): LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum)) #LibName(pkg, 'ddraw.lib') LibName(pkg, 'dxguid.lib') + + if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"): + IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2") + IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include") LibName("WINSOCK", "wsock32.lib") LibName("WINSOCK2", "wsock32.lib") @@ -766,9 +770,13 @@ if (COMPILER=="GCC"): SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h") SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config") - if GetTarget() == "darwin" and not PkgSkip("FFMPEG"): - LibName("FFMPEG", "-Wl,-read_only_relocs,suppress") - LibName("FFMPEG", "-framework VideoDecodeAcceleration") + if not PkgSkip("FFMPEG"): + if GetTarget() == "darwin": + LibName("FFMPEG", "-Wl,-read_only_relocs,suppress") + LibName("FFMPEG", "-framework VideoDecodeAcceleration") + elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"): + # Needed when linking ffmpeg statically on Linux. + LibName("FFMPEG", "-Wl,-Bsymbolic") cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV") if cv_lib == "opencv_core": diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 1b011188ff..fea93fd434 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1491,6 +1491,11 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, if os.path.isdir(os.path.join(pkg_dir, "include")): IncDirectory(target_pkg, os.path.join(pkg_dir, "include")) + # Handle cases like freetype2 where the include dir is a subdir under "include" + for i in incs: + if os.path.isdir(os.path.join(pkg_dir, "include", i)): + IncDirectory(target_pkg, os.path.join(pkg_dir, "include", i)) + if os.path.isdir(os.path.join(pkg_dir, "lib")): LibDirectory(target_pkg, os.path.join(pkg_dir, "lib")) @@ -2749,6 +2754,13 @@ def GetOrigExt(x): def SetOrigExt(x, v): ORIG_EXT[x] = v +def GetExtensionSuffix(): + target = GetTarget() + if target == 'windows': + return '.pyd' + else: + return '.so' + def CalcLocation(fn, ipath): if (fn.count("/")): return fn dllext = ""