From ea2305de701fe89082bcd26de6b29d3077dc7a8b Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 26 Dec 2016 17:37:02 -0700 Subject: [PATCH 01/18] general: Fix missing includes. --- panda/src/gobj/shaderBuffer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/panda/src/gobj/shaderBuffer.h b/panda/src/gobj/shaderBuffer.h index 5faa4322ac..549ebdc536 100644 --- a/panda/src/gobj/shaderBuffer.h +++ b/panda/src/gobj/shaderBuffer.h @@ -15,8 +15,11 @@ #define SHADERBUFFER_H #include "pandabase.h" +#include "typedWritableReferenceCount.h" #include "namable.h" #include "geomEnums.h" +#include "graphicsStateGuardianBase.h" +#include "factoryParams.h" class BufferContext; class PreparedGraphicsObjects; From cf105f276c55b7a02b87c527bc01f56ef3df306b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 28 Dec 2016 20:23:27 +0100 Subject: [PATCH 02/18] More alignment fixes for 32-byte AVX --- dtool/src/dtoolbase/deletedBufferChain.cxx | 4 ++-- dtool/src/dtoolbase/dtoolbase.h | 5 +++++ panda/src/linmath/lsimpleMatrix.h | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dtool/src/dtoolbase/deletedBufferChain.cxx b/dtool/src/dtoolbase/deletedBufferChain.cxx index 122edf8837..557b6ce9d8 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.cxx +++ b/dtool/src/dtoolbase/deletedBufferChain.cxx @@ -71,7 +71,7 @@ allocate(size_t size, TypeHandle type_handle) { // Allocate memory, and make sure the object starts at the proper alignment. void *mem = NeverFreeMemory::alloc(alloc_size); - intptr_t pad = ((intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment(); + intptr_t pad = (-(intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment(); obj = (ObjectNode *)((uintptr_t)mem + pad); #ifdef USE_DELETEDCHAINFLAG @@ -80,7 +80,7 @@ allocate(size_t size, TypeHandle type_handle) { void *ptr = node_to_buffer(obj); -#ifdef _DEBUG +#ifndef NDEBUG assert(((uintptr_t)ptr % MemoryHook::get_memory_alignment()) == 0); #endif diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index b192f24055..c6cbbd7f46 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -339,21 +339,26 @@ typedef struct _object PyObject; #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE +#define ALIGN_32BYTE #define ALIGN_64BYTE #elif defined(_MSC_VER) #define ALIGN_4BYTE __declspec(align(4)) #define ALIGN_8BYTE __declspec(align(8)) #define ALIGN_16BYTE __declspec(align(16)) +#define ALIGN_32BYTE __declspec(align(32)) #define ALIGN_64BYTE __declspec(align(64)) #elif defined(__GNUC__) #define ALIGN_4BYTE __attribute__ ((aligned (4))) #define ALIGN_8BYTE __attribute__ ((aligned (8))) #define ALIGN_16BYTE __attribute__ ((aligned (16))) +#define ALIGN_32BYTE __attribute__ ((aligned (32))) #define ALIGN_64BYTE __attribute__ ((aligned (64))) #else #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE +#define ALIGN_32BYTE +#define ALIGN_64BYTE #endif // Do we need to implement memory-alignment enforcement within the MemoryHook diff --git a/panda/src/linmath/lsimpleMatrix.h b/panda/src/linmath/lsimpleMatrix.h index 0ba2dc1196..5669e18be3 100644 --- a/panda/src/linmath/lsimpleMatrix.h +++ b/panda/src/linmath/lsimpleMatrix.h @@ -58,7 +58,9 @@ private: #endif // HAVE_EIGEN // This is as good a place as any to define this alignment macro. -#ifdef LINMATH_ALIGN +#if defined(LINMATH_ALIGN) && defined(HAVE_EIGEN) && defined(__AVX__) +#define ALIGN_LINMATH ALIGN_32BYTE +#elif defined(LINMATH_ALIGN) #define ALIGN_LINMATH ALIGN_16BYTE #else #define ALIGN_LINMATH From fa851ae5acb2b0ce06a2ae425f896ce7acb983c4 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 22:42:05 +0100 Subject: [PATCH 03/18] Allow custom version to be passed on to makewheel when building with --wheel --- makepanda/makepanda.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 95dc6d791b..c96d188bcb 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -52,6 +52,7 @@ RUNTIME=0 DISTRIBUTOR="" VERSION=None DEBVERSION=None +WHLVERSION=None RPMRELEASE="1" GIT_COMMIT=None P3DSUFFIX=None @@ -163,7 +164,7 @@ def usage(problem): def parseopts(args): global INSTALLER,WHEEL,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL - global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION + global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER longopts = [ "help","distributor=","verbose","runtime","osxtarget=", @@ -206,8 +207,11 @@ def parseopts(args): elif (option=="--arch"): target_arch = value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): - VERSION=value - if (len(VERSION.split(".")) != 3): raise Exception + match = re.match(r'^\d+\.\d+\.\d+', value) + if not match: + usage("version requires three digits") + WHLVERSION = value + VERSION = match.group() elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) elif (option=="--static"): SetLinkAllStatic(True) @@ -7257,7 +7261,7 @@ try: if WHEEL: ProgressOutput(100.0, "Building wheel") from makewheel import makewheel - makewheel(VERSION, GetOutputDir()) + makewheel(WHLVERSION, GetOutputDir()) finally: SaveDependencyCache() From 40ea0ab7869a77093d4d60fe31f01fcf58d60089 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 22:46:57 +0100 Subject: [PATCH 04/18] cppparser: support directives __LINE__, __FILE__, __has_include --- dtool/src/cppparser/cppPreprocessor.cxx | 247 +++++++++++++++++------- dtool/src/cppparser/cppPreprocessor.h | 3 + 2 files changed, 177 insertions(+), 73 deletions(-) diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 83050d3c41..feda153530 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -809,6 +809,8 @@ expand_manifests(const string &input_expr, bool expand_undefined, // Here's an identifier. Is it "defined"? if (ident == "defined") { expand_defined_function(expr, q, p); + } else if (expand_undefined && ident == "__has_include") { + expand_has_include_function(expr, q, p, loc); } else { // Is it a manifest? Manifests::const_iterator mi = _manifests.find(ident); @@ -817,6 +819,20 @@ expand_manifests(const string &input_expr, bool expand_undefined, expand_manifest_inline(expr, q, p, manifest); manifest_found = true; + } else if (ident == "__FILE__") { + // Special case: this is a dynamic definition. + string file = string("\"") + loc.file._filename_as_referenced.get_fullpath() + "\""; + expr = expr.substr(0, q) + file + expr.substr(p); + p = q + file.size(); + manifest_found = true; + + } else if (ident == "__LINE__") { + // So is this. + string line = format_string(loc.first_line); + expr = expr.substr(0, q) + line + expr.substr(p); + p = q + line.size(); + manifest_found = true; + } else if (expand_undefined && ident != "true" && ident != "false") { // It is not found. Expand it to 0, but only if we are currently // parsing an #if expression. @@ -1486,14 +1502,10 @@ handle_undef_directive(const string &args, const YYLTYPE &loc) { */ void CPPPreprocessor:: handle_ifdef_directive(const string &args, const YYLTYPE &loc) { - Manifests::const_iterator mi = _manifests.find(args); - if (mi != _manifests.end()) { - // The macro is defined. We continue. - return; + if (!is_manifest_defined(args)) { + // The macro is undefined. Skip stuff. + skip_false_if_block(true); } - - // The macro is undefined. Skip stuff. - skip_false_if_block(true); } /** @@ -1501,17 +1513,12 @@ handle_ifdef_directive(const string &args, const YYLTYPE &loc) { */ void CPPPreprocessor:: handle_ifndef_directive(const string &args, const YYLTYPE &loc) { - Manifests::const_iterator mi = _manifests.find(args); - if (mi == _manifests.end()) { - // The macro is undefined. We continue. - return; + if (is_manifest_defined(args)) { + // The macro is defined. Skip stuff. + skip_false_if_block(true); } - - // The macro is defined. Skip stuff. - skip_false_if_block(true); } - /** * */ @@ -1593,6 +1600,8 @@ handle_include_directive(const string &args, const YYLTYPE &loc) { _angle_includes.insert(filename); } } + } else { + warning("Ignoring invalid #include directive", loc); } filename.set_text(); @@ -1600,71 +1609,30 @@ handle_include_directive(const string &args, const YYLTYPE &loc) { // Now look for the filename. If we didn't use angle quotes, look first in // the current directory. - bool found_file = false; CPPFile::Source source = CPPFile::S_none; - if (okflag) { - found_file = false; + if (find_include(filename, angle_quotes, source)) { + _last_c = '\0'; - // Search the current directory. - if (!angle_quotes && !found_file && filename.exists()) { - found_file = true; + // If it was explicitly named on the command-line, mark it S_local. + filename.make_canonical(); + if (_explicit_files.count(filename)) { source = CPPFile::S_local; } - // Search the same directory as the includer. - if (!angle_quotes && !found_file) { - Filename match(get_file()._filename.get_dirname(), filename); - if (match.exists()) { - filename = match; - found_file = true; - source = CPPFile::S_alternate; - } + CPPFile file(filename, filename_as_referenced, source); + + // Don't include it if we included it before and it had #pragma once. + ParsedFiles::const_iterator it = _parsed_files.find(file); + if (it != _parsed_files.end() && it->_pragma_once) { + return; } - // Now search the angle-include-path - if (angle_quotes && !found_file && filename.resolve_filename(_angle_include_path)) { - found_file = true; - source = CPPFile::S_system; - } - - // Now search the quote-include-path - if (!angle_quotes && !found_file) { - for (size_t dir=0; dir<_quote_include_path.get_num_directories(); dir++) { - Filename match(_quote_include_path.get_directory(dir), filename); - if (match.exists()) { - filename = match; - found_file = true; - source = _quote_include_kind[dir]; - } - } - } - - if (!found_file) { - warning("Cannot find " + filename.get_fullpath(), loc); - } else { - _last_c = '\0'; - - // If it was explicitly named on the command-line, mark it S_local. - filename.make_canonical(); - if (_explicit_files.count(filename)) { - source = CPPFile::S_local; - } - - CPPFile file(filename, filename_as_referenced, source); - - // Don't include it if we included it before and it had #pragma once. - ParsedFiles::const_iterator it = _parsed_files.find(file); - if (it != _parsed_files.end() && it->_pragma_once) { - return; - } - - if (!push_file(file)) { - warning("Unable to read " + filename.get_fullpath(), loc); - } + if (!push_file(file)) { + warning("Unable to read " + filename.get_fullpath(), loc); } } else { - warning("Ignoring invalid #include directive", loc); + warning("Cannot find " + filename.get_fullpath(), loc); } } @@ -1779,6 +1747,69 @@ skip_false_if_block(bool consider_elifs) { _save_comments = true; } +/** + * Returns true if the given manifest is defined. + */ +bool CPPPreprocessor:: +is_manifest_defined(const string &manifest_name) { + Manifests::const_iterator mi = _manifests.find(manifest_name); + if (mi != _manifests.end()) { + return true; + } + + if (manifest_name == "__has_include" || + manifest_name == "__FILE__" || + manifest_name == "__LINE__") { + // Special built-in directives that are considered "defined". + return true; + } + + return false; +} + +/** + * Locates the given filename. Changes the first argument to the full path. + */ +bool CPPPreprocessor:: +find_include(Filename &filename, bool angle_quotes, CPPFile::Source &source) { + // Now look for the filename. If we didn't use angle quotes, look first in + // the current directory. + if (!angle_quotes && filename.exists()) { + source = CPPFile::S_local; + return true; + } + + // Search the same directory as the includer. + if (!angle_quotes) { + Filename match(get_file()._filename.get_dirname(), filename); + if (match.exists()) { + filename = match; + source = CPPFile::S_alternate; + return true; + } + } + + // Now search the angle-include-path + if (angle_quotes && filename.resolve_filename(_angle_include_path)) { + source = CPPFile::S_system; + return true; + } + + // Now search the quote-include-path + if (!angle_quotes) { + for (size_t dir = 0; dir < _quote_include_path.get_num_directories(); ++dir) { + Filename match(_quote_include_path.get_directory(dir), filename); + if (match.exists()) { + filename = match; + source = _quote_include_kind[dir]; + return true; + } + } + } + + return false; +} + /** * */ @@ -1885,6 +1916,14 @@ get_identifier(int c) { if (mi != _manifests.end() && !should_ignore_manifest((*mi).second)) { return expand_manifest((*mi).second); } + if (name == "__FILE__") { + return get_literal(SIMPLE_STRING, loc, loc.file._filename_as_referenced); + } + if (name == "__LINE__") { + YYSTYPE result; + result.u.integer = loc.first_line; + return CPPToken(INTEGER, loc, "", result); + } // Check for keywords. int kw = check_keyword(name); @@ -2227,9 +2266,7 @@ expand_defined_function(string &expr, size_t q, size_t &p) { vector_string args; extract_manifest_args_inline("defined", 1, -1, args, expr, p); if (args.size() >= 1) { - const string &manifest_name = args[0]; - Manifests::const_iterator mi = _manifests.find(manifest_name); - if (mi != _manifests.end()) { + if (is_manifest_defined(args[0])) { // The macro is defined; the result is "1". result = "1"; } else { @@ -2242,6 +2279,70 @@ expand_defined_function(string &expr, size_t q, size_t &p) { p = q + result.size(); } +/** + * Expands the __has_include(manifest) function to either 1 or 0, depending on + * whether the include file exists. + */ +void CPPPreprocessor:: +expand_has_include_function(string &expr, size_t q, size_t &p, YYLTYPE loc) { + bool found_file = false; + + // Skip whitespace till paren. + while (p < expr.size() && isspace(expr[p])) { + p++; + } + size_t args_begin = p + 1; + + vector_string args; + extract_manifest_args_inline("__has_include", 1, -1, args, expr, p); + + if (!args.empty() && args[0].size() >= 2) { + Filename filename; + bool angle_quotes = false; + + string inc = args[0]; + + // Just to play things safe, since our manifest-expansion logic might not + // filter out quotes and angle brackets properly, we'll only expand + // manifests if we don't begin with a quote or bracket. + if (!inc.empty() && (inc[0] != '"' && inc[0] != '<')) { + inc = expand_manifests(inc, false, loc); + } + + if (inc[0] == '"' && inc[inc.size() - 1] == '"') { + filename = inc.substr(1, inc.size() - 2); + } else if (inc[0] == '<' && inc[inc.size() - 1] == '>') { + filename = inc.substr(1, inc.size() - 2); + if (!_noangles) { + // If _noangles is true, we don't make a distinction between angle + // brackets and quote marks--all #inc statements are treated the + // same, as if they used quote marks. + angle_quotes = true; + } + } else { + loc.last_column += loc.first_column + p - 2; + loc.first_column += args_begin; + warning("invalid argument for __has_include() directive", loc); + expr = expr.substr(0, q) + "0" + expr.substr(p); + p = q + 1; + return; + } + + filename.set_text(); + + CPPFile::Source source = CPPFile::S_none; + found_file = find_include(filename, angle_quotes, source); + } else { + loc.last_column += loc.first_column + p - 2; + loc.first_column += args_begin; + warning("invalid argument for __has_include() directive", loc); + } + + string result = found_file ? "1" : "0"; + expr = expr.substr(0, q) + result + expr.substr(p); + p = q + result.size(); +} + /** * */ diff --git a/dtool/src/cppparser/cppPreprocessor.h b/dtool/src/cppparser/cppPreprocessor.h index e375b259dd..e119211596 100644 --- a/dtool/src/cppparser/cppPreprocessor.h +++ b/dtool/src/cppparser/cppPreprocessor.h @@ -143,6 +143,8 @@ private: void handle_error_directive(const string &args, const YYLTYPE &loc); void skip_false_if_block(bool consider_elifs); + bool is_manifest_defined(const string &manifest_name); + bool find_include(Filename &filename, bool angle_quotes, CPPFile::Source &source); CPPToken get_quoted_char(int c); CPPToken get_quoted_string(int c); @@ -153,6 +155,7 @@ private: void extract_manifest_args(const string &name, int num_args, int va_arg, vector_string &args); void expand_defined_function(string &expr, size_t q, size_t &p); + void expand_has_include_function(string &expr, size_t q, size_t &p, YYLTYPE loc); void expand_manifest_inline(string &expr, size_t q, size_t &p, const CPPManifest *manifest); void extract_manifest_args_inline(const string &name, int num_args, From 40e981e485c383367d5f2a9bacf2b906ea90df2d Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 22:47:58 +0100 Subject: [PATCH 05/18] makepanda: enable C++11 support by default --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index c96d188bcb..92f7edb5f7 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1194,7 +1194,7 @@ def CompileCxx(obj,src,opts): if (COMPILER=="GCC"): if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj - else: cmd = GetCXX()+' -ftemplate-depth-70 -fPIC -c -o ' + obj + else: cmd = GetCXX()+' -std=gnu++0x -ftemplate-depth-70 -fPIC -c -o ' + obj for (opt, dir) in INCDIRECTORIES: if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir) for (opt, dir) in FRAMEWORKDIRECTORIES: From 9facf874aba9b2b051b8cd1f0e62bb8baf68cda3 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 23:53:24 +0100 Subject: [PATCH 06/18] Let compiler synthesize QuadDef move assignment operator This hopefully fixes a compile issue with older clang versions. --- panda/src/text/textAssembler.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/panda/src/text/textAssembler.h b/panda/src/text/textAssembler.h index 1215765bf5..64b4c7ef03 100644 --- a/panda/src/text/textAssembler.h +++ b/panda/src/text/textAssembler.h @@ -212,21 +212,6 @@ private: typedef pmap GeomCollectorMap; struct QuadDef { - // Copying this class is a performance hotspot, hence we define the move - // constructor. - ALWAYS_INLINE QuadDef() {} - ALWAYS_INLINE QuadDef(const QuadDef ©) : - _dimensions(copy._dimensions), _uvs(copy._uvs), - _slantl(copy._slantl), _slanth(copy._slanth), - _glyph(copy._glyph) {} - -#ifdef USE_MOVE_SEMANTICS - ALWAYS_INLINE QuadDef(QuadDef &&from) NOEXCEPT : - _dimensions(from._dimensions), _uvs(from._uvs), - _slantl(from._slantl), _slanth(from._slanth), - _glyph(move(from._glyph)) {} -#endif - LVecBase4 _dimensions; LVecBase4 _uvs; PN_stdfloat _slantl, _slanth; From 603f0eb3b18b72b8fe85b6710c8c63fbb80330c8 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 4 Jan 2017 16:28:38 -0800 Subject: [PATCH 07/18] fix occasional crash in PNMImage::quick_filter_from() --- panda/src/pnmimage/pnm-image-filter.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/pnmimage/pnm-image-filter.cxx b/panda/src/pnmimage/pnm-image-filter.cxx index ac57b20b23..63398ad3c1 100644 --- a/panda/src/pnmimage/pnm-image-filter.cxx +++ b/panda/src/pnmimage/pnm-image-filter.cxx @@ -696,7 +696,7 @@ box_filter_line(const PNMImage &image, // Get the final (partial) xel float x_contrib = x1 - (float)x_last; - if (x_contrib > 0.0001f) { + if (x_contrib > 0.0001f && x < image.get_x_size()) { box_filter_xel(image, x, y, x_contrib, y_contrib, color, pixel_count); } @@ -728,7 +728,7 @@ box_filter_region(const PNMImage &image, // Get the final (partial) row float y_contrib = y1 - (float)y_last; - if (y_contrib > 0.0001f) { + if (y_contrib > 0.0001f && y < image.get_y_size()) { box_filter_line(image, x0, y, x1, y_contrib, color, pixel_count); } From c4d232b0be9de4e64fd067d8deb3ebe7953b0da5 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 4 Jan 2017 16:56:09 -0800 Subject: [PATCH 08/18] publish PfmVizzer destructor to fix leak --- panda/src/grutil/pfmVizzer.I | 4 ++++ panda/src/grutil/pfmVizzer.h | 1 + 2 files changed, 5 insertions(+) diff --git a/panda/src/grutil/pfmVizzer.I b/panda/src/grutil/pfmVizzer.I index 6a0a5a23bc..2185248829 100644 --- a/panda/src/grutil/pfmVizzer.I +++ b/panda/src/grutil/pfmVizzer.I @@ -19,6 +19,10 @@ get_pfm() { return _pfm; } +INLINE PfmVizzer:: +~PfmVizzer() { +} + /** * Returns the reference to the PfmFile manipulated by this PfmVizzer. */ diff --git a/panda/src/grutil/pfmVizzer.h b/panda/src/grutil/pfmVizzer.h index 7b466f0ee3..e8423f8dd1 100644 --- a/panda/src/grutil/pfmVizzer.h +++ b/panda/src/grutil/pfmVizzer.h @@ -30,6 +30,7 @@ class GeomVertexWriter; class EXPCL_PANDA_GRUTIL PfmVizzer { PUBLISHED: PfmVizzer(PfmFile &pfm); + INLINE ~PfmVizzer(); INLINE PfmFile &get_pfm(); INLINE const PfmFile &get_pfm() const; From 127cbc3b3840dace259d092353a3251aa8942693 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 Jan 2017 17:15:42 +0100 Subject: [PATCH 09/18] Windows installer improvements and fixes: - copy .ico file - write installer log to install.log - restore python DLL to bin directory --- makepanda/installer.nsi | 70 +++++++++++++++++++++++++++++++++++------ makepanda/makepanda.py | 17 +++++----- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index d934cc4ee0..d004d15006 100755 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -141,8 +141,9 @@ SectionGroup "Panda3D Libraries" SetDetailsPrint listonly SetOutPath "$INSTDIR" - File "${BUILT}\LICENSE" - File /r /x CVS "${BUILT}\ReleaseNotes" + File /nonfatal "${BUILT}\LICENSE" + File /nonfatal "${BUILT}\ReleaseNotes" + File /nonfatal "${BUILT}\pandaIcon.ico" SetOutPath $INSTDIR\etc File /r "${BUILT}\etc\*" @@ -532,15 +533,17 @@ Section "Sample programs" SecSamples WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "https://www.panda3d.org/manual/index.php" WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "https://www.panda3d.org/manual/index.php/Sample_Programs_in_the_Distribution" SetOutPath $INSTDIR - CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda3D Manual" - CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda3D Website" - CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Sample Program Manual" + CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Manual" + CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Website" + CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Sample Program Manual" FindFirst $0 $1 $INSTDIR\samples\* loop: StrCmp $1 "" done StrCmp $1 "." next StrCmp $1 ".." next + FindFirst $2 $3 $INSTDIR\samples\$1\*.py + StrCmp $3 "" next Push $1 Push "-" Push " " @@ -557,14 +560,13 @@ Section "Sample programs" SecSamples DetailPrint "Creating shortcuts for sample program $READABLE" CreateDirectory "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE" SetOutPath $INSTDIR\samples\$1 - WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE" - CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Manual Entry on this Sample Program" + WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "https://www.panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE" + CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Manual Entry on this Sample Program" CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1" - FindFirst $2 $3 $INSTDIR\samples\$1\*.py iloop: StrCmp $3 "" idone - CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $3" - CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $3" + CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3" + CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3" FindNext $2 $3 goto iloop idone: @@ -684,6 +686,10 @@ Section -post DetailPrint "Broadcasting WM_WININICHANGE message..." SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500 + # Now dump the log to disk. + StrCpy $0 "$INSTDIR\install.log" + Push $0 + Call DumpLog SectionEnd Section Uninstall @@ -1235,3 +1241,47 @@ done: Exch $R3 FunctionEnd + +!define LVM_GETITEMCOUNT 0x1004 +!define LVM_GETITEMTEXT 0x102D + +Function DumpLog + Exch $5 + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $6 + + FindWindow $0 "#32770" "" $HWNDPARENT + GetDlgItem $0 $0 1016 + StrCmp $0 0 exit + FileOpen $5 $5 "w" + StrCmp $5 "" exit + SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6 + System::Alloc ${NSIS_MAX_STRLEN} + Pop $3 + StrCpy $2 0 + System::Call "*(i, i, i, i, i, i, i, i, i) i \ + (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1" + loop: StrCmp $2 $6 done + System::Call "User32::SendMessageA(i, i, i, i) i \ + ($0, ${LVM_GETITEMTEXT}, $2, r1)" + System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)" + FileWrite $5 "$4$\r$\n" + IntOp $2 $2 + 1 + Goto loop + done: + FileClose $5 + System::Free $1 + System::Free $3 + exit: + Pop $6 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + Exch $5 +FunctionEnd diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 92f7edb5f7..2e54cc2058 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2871,11 +2871,13 @@ if tp_dir is not None: CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/") if not PkgSkip("PYTHON") and not RTDIST: - #XXX rdb I don't think we need to copy over the Python DLL, do we? - #pydll = "/" + SDK["PYTHONVERSION"].replace(".", "") - #if (GetOptimize() <= 2): pydll += "_d.dll" - #else: pydll += ".dll" - #CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll) + # We need to copy the Python DLL to the bin directory for now. + pydll = "/" + SDK["PYTHONVERSION"].replace(".", "") + if GetOptimize() <= 2: + pydll += "_d.dll" + else: + pydll += ".dll" + CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll) #for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): # CopyFile(GetOutputDir() + "/bin/", fn) @@ -2949,6 +2951,7 @@ if GetTarget() == 'windows': # Convert to Windows newlines so they can be opened by notepad. WriteFile(GetOutputDir() + "/LICENSE", ReadFile("doc/LICENSE"), newline='\r\n') WriteFile(GetOutputDir() + "/ReleaseNotes", ReadFile("doc/ReleaseNotes"), newline='\r\n') + CopyFile(GetOutputDir() + "/pandaIcon.ico", "panda/src/configfiles/pandaIcon.ico") else: CopyFile(GetOutputDir()+"/", "doc/LICENSE") CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes") @@ -6596,7 +6599,7 @@ def MakeInstallerNSIS(file, title, installdir): AddToPathEnv("PATH", GetOutputDir() + "\\bin") AddToPathEnv("PATH", GetOutputDir() + "\\plugins") - cmd = sys.executable + " -B -u direct\\src\\plugin_installer\\make_installer.py" + cmd = sys.executable + " -B -u " + os.path.join("direct", "src", "plugin_installer", "make_installer.py") cmd += " --version %s --regview %s" % (VERSION, regview) if GetTargetArch() == 'x64': @@ -6605,7 +6608,7 @@ def MakeInstallerNSIS(file, title, installdir): cmd += " --install \"$PROGRAMFILES32\\Panda3D\" " oscmd(cmd) - shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file) + shutil.move(os.path.join("direct", "src", "plugin_installer", "p3d-setup.exe"), file) return print("Building "+title+" installer at %s" % (file)) From 53752bd3762cd9dbe9d7ba38c14594ff058367b2 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 Jan 2017 17:22:11 +0100 Subject: [PATCH 10/18] Remove packpanda and eggcacher, don't require libpython on Linux --- direct/src/directbase/ppython.cxx | 106 ---- direct/src/directscripts/eggcacher.py | 11 +- direct/src/directscripts/packpanda.nsi | 831 ------------------------- direct/src/directscripts/packpanda.py | 424 ------------- makepanda/installer.nsi | 9 +- makepanda/makepanda.py | 22 +- makepanda/makepandacore.py | 2 +- makepanda/makewheel.py | 1 - 8 files changed, 20 insertions(+), 1386 deletions(-) delete mode 100644 direct/src/directbase/ppython.cxx delete mode 100755 direct/src/directscripts/packpanda.nsi delete mode 100755 direct/src/directscripts/packpanda.py diff --git a/direct/src/directbase/ppython.cxx b/direct/src/directbase/ppython.cxx deleted file mode 100644 index e460de766c..0000000000 --- a/direct/src/directbase/ppython.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// This is a little wrapper to make it easy to run a python program from the -// command line. Basically, it just interfaces to the Python API and imports -// the module that was specified by the IMPORT_MODULE preprocessor definition -// when it was compiled. - -#include "dtoolbase.h" - -#undef _POSIX_C_SOURCE -#undef _XOPEN_SOURCE -#include -#if PY_MAJOR_VERSION >= 3 -#include -#endif - -#ifndef IMPORT_MODULE -#error IMPORT_MODULE must be defined when compiling ppython.cxx ! -#endif - -#define _STRINGIFY(s) #s -#define STRINGIFY(s) _STRINGIFY(s) -#define IMPORT_MODULE_STR STRINGIFY(IMPORT_MODULE) - -#if defined(_WIN32) && PY_MAJOR_VERSION >= 3 -// As Py_SetProgramName expects a wchar_t*, it's easiest to just use the wmain -// entry point. -int wmain(int argc, wchar_t *argv[]) { - Py_SetProgramName(argv[0]); - -#elif PY_MAJOR_VERSION >= 3 -// Convert from UTF-8 to wchar_t*. -int main(int argc, char *mb_argv[]) { - wchar_t **argv = new wchar_t*[argc + 1]; - for (int i = 0; i < argc; ++i) { - size_t len = mbstowcs(NULL, mb_argv[i], 0); - argv[i] = new wchar_t[len + 1]; - mbstowcs(argv[i], mb_argv[i], len); - argv[i][len] = 0; - } - // Just for good measure - argv[argc] = NULL; - - Py_SetProgramName(argv[0]); - -#else -// Python 2. -int main(int argc, char *argv[]) { - Py_SetProgramName(argv[0]); -#endif - - // On Windows, we need to set pythonhome correctly. We'll try to find - // ppython.exe on the path and set pythonhome to its location. -#ifdef _WIN32 -#if PY_MAJOR_VERSION >= 3 - // Py_SetPythonHome expects a wchar_t in Python 3. - wchar_t *path = _wgetenv(L"PATH"); - wchar_t *result = wcstok(path, L";"); - while (result != NULL) { - struct _stat st; - wchar_t *ppython = (wchar_t*) malloc(wcslen(result) * 2 + 26); - wcscpy(ppython, result); - wcscat(ppython, L"\\python.exe"); - if (_wstat(ppython, &st) == 0) { - Py_SetPythonHome(result); - free(ppython); - break; - } - result = wcstok(NULL, L";"); - free(ppython); - } -#else - char *path = getenv("PATH"); - char *result = strtok(path, ";"); - while (result != NULL) { - struct stat st; - char *ppython = (char*) malloc(strlen(result) + 13); - strcpy(ppython, result); - strcat(ppython, "\\ppython.exe"); - if (stat(ppython, &st) == 0) { - Py_SetPythonHome(result); - free(ppython); - break; - } - result = strtok(NULL, ";"); - free(ppython); - } -#endif -#endif - - Py_Initialize(); - - if (Py_VerboseFlag) { - fprintf(stderr, "Python %s\\n%s\\n", Py_GetVersion(), Py_GetCopyright()); - } - - PySys_SetArgv(argc, argv); - - int sts = 0; - PyObject* m = PyImport_ImportModule(IMPORT_MODULE_STR); - if (m <= 0) { - PyErr_Print(); - sts = 1; - } - - Py_Finalize(); - return sts; -} diff --git a/direct/src/directscripts/eggcacher.py b/direct/src/directscripts/eggcacher.py index ad11303fe0..6dcee8e2d3 100644 --- a/direct/src/directscripts/eggcacher.py +++ b/direct/src/directscripts/eggcacher.py @@ -87,8 +87,13 @@ class EggCacher: TexturePool.releaseAllTextures() progress += size -cacher = EggCacher(sys.argv[1:]) -# Dummy main function so this can be added to console_scripts. -def main(): +def main(args=None): + if args is None: + args = sys.argv[1:] + + cacher = EggCacher(args) return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/direct/src/directscripts/packpanda.nsi b/direct/src/directscripts/packpanda.nsi deleted file mode 100755 index 73c9011d9a..0000000000 --- a/direct/src/directscripts/packpanda.nsi +++ /dev/null @@ -1,831 +0,0 @@ -; Panda3D installation script for the Nullsoft Installation System (NSIS). -; Jon Parise -; with Ben Johnson -; with Jason Pratt -; mangled by Josh Yelon - -; Caller needs to define these variables: -; -; COMPRESSOR - either zlib or lzma -; NAME - name of what we're building (ie, "Panda3D" or "Airblade") -; SMDIRECTORY - where to put this in the start menu (ie, "Panda3D 1.1.0" or "Airblade 1.1.0") -; INSTALLDIR - where to install the program (ie, "C:\Program Files\Panda3D-1.1.0") -; OUTFILE - where to put the output file (ie, "..\nsis-output.exe") -; LICENSE - location of the license file (ie, "C:\Airblade\LICENSE.TXT") -; LANGUAGE - name of the Language file to use (ie, "English" or "Panda3DEnglish") -; RUNTEXT - text for run-box at end of installation (ie, "Run the Panda Greeting Card") -; IBITMAP - name of installer bitmap (ie, "C:\Airblade\Airblade.bmp") -; UBITMAP - name of uninstaller bitmap (ie, "C:\Airblade\Airblade.bmp") -; -; PANDA - location of panda install tree. -; PYVER - version of Python that Panda was built with (ie, "2.7") -; PANDACONF - name of panda config directory - usually $PANDA\etc -; PSOURCE - location of the panda source-tree if available, OR location of panda install tree. -; PYEXTRAS - directory containing python extras, if any. -; REGVIEW - either 32 or 64, depending on the build architecture. -; -; PPGAME - directory containing prepagaged game, if any (ie, "C:\My Games\Airblade") -; PPMAIN - python program containing prepackaged game, if any (ie, "Airblade.py") -; PPICON - file containing icon of prepackaged game. -; - -!include "MUI.nsh" -!include "WinMessages.nsh" -Name "${NAME}" -InstallDir "${INSTALLDIR}" -OutFile "${OUTFILE}" - -SetCompress auto -SetCompressor ${COMPRESSOR} - -!define MUI_WELCOMEFINISHPAGE_BITMAP "${IBITMAP}" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${UBITMAP}" - -!define MUI_ABORTWARNING -!define MUI_FINISHPAGE_NOREBOOTSUPPORT -!define MUI_FINISHPAGE_RUN -!define MUI_FINISHPAGE_RUN_FUNCTION runFunction -!define MUI_FINISHPAGE_RUN_TEXT "${RUNTEXT}" - -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "${LICENSE}" -!insertmacro MUI_PAGE_DIRECTORY -!insertmacro MUI_PAGE_INSTFILES -!insertmacro MUI_PAGE_FINISH - -!insertmacro MUI_UNPAGE_WELCOME -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH - -!insertmacro MUI_LANGUAGE "${LANGUAGE}" - -ShowInstDetails nevershow -ShowUninstDetails nevershow - -LicenseData "${LICENSE}" - -InstType "Typical" - -!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - -var READABLE -var MANPAGE -var TUTNAME - -Function runFunction - !ifdef PPGAME - ExecShell "open" "$SMPROGRAMS\${SMDIRECTORY}\Play ${NAME}.lnk" - !else - ExecShell "open" "$SMPROGRAMS\${SMDIRECTORY}\Panda Manual.lnk" - !endif -FunctionEnd - -Section "${SMDIRECTORY}" SecCore - SectionIn 1 2 3 RO - - SetDetailsPrint none - SetOutPath $INSTDIR - SetOverwrite try - - SetOutPath $INSTDIR - File "${PANDA}\LICENSE" - SetOutPath $INSTDIR\bin - File /r "${PANDA}\bin\*.dll" - File /nonfatal /r "${PANDA}\bin\*.pyd" - File /nonfatal /r "${PANDA}\bin\Microsoft.*.manifest" - SetOutPath $INSTDIR\etc - File /r "${PANDACONF}\*" - SetOutPath $INSTDIR\direct\directscripts - File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\directscripts\*" - SetOutPath $INSTDIR\direct\filter - File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\filter\*.sha" - SetOutPath $INSTDIR\direct - File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\*.py" - Delete "$INSTDIR\panda3d.py" - Delete "$INSTDIR\panda3d.pyc" - Delete "$INSTDIR\panda3d.pyo" - SetOutPath $INSTDIR\pandac - File /r "${PANDA}\pandac\*.py" - SetOutPath $INSTDIR\panda3d - File /r "${PANDA}\panda3d\*.py" - File /r "${PANDA}\panda3d\*.pyd" - SetOutPath $INSTDIR\python - File /r "${PANDA}\python\*" - RMDir /r "$SMPROGRAMS\${SMDIRECTORY}" - CreateDirectory "$SMPROGRAMS\${SMDIRECTORY}" - - !ifdef PPGAME - - SetOutPath $INSTDIR\models - File /r /x CVS "${PANDA}\models\*" - SetOutPath $INSTDIR\bin - File /r "${PANDA}\bin\eggcacher.exe" - SetOutpath $INSTDIR\game - File /r "${PPGAME}\*" - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Play ${NAME}.lnk" "$INSTDIR\python\ppython.exe" "-E ${PPMAIN}" "$INSTDIR\${PPICON}" 0 SW_SHOWMINIMIZED "" "Play ${NAME}" - # Preload all EGG files into the model-cache - SetOutPath $INSTDIR - SetDetailsPrint textonly - SetDetailsView show - nsExec::ExecToLog '"$INSTDIR\bin\eggcacher.exe" --concise game' - SetDetailsPrint none - SetDetailsView hide - - !else - - SetOutPath $INSTDIR\plugins - File /nonfatal /r "${PANDA}\plugins\*.dle" - File /nonfatal /r "${PANDA}\plugins\*.dlo" - File /nonfatal /r "${PANDA}\plugins\*.mll" - File /nonfatal /r "${PANDA}\plugins\*.mel" - File /nonfatal /r "${PANDA}\plugins\*.ms" - File "${PSOURCE}\doc\INSTALLING-PLUGINS.TXT" - SetOutPath $INSTDIR\pandac\input - File /r "${PANDA}\pandac\input\*" - SetOutPath $INSTDIR\bin - File /r "${PANDA}\bin\*.exe" - File /nonfatal /r "${PANDA}\bin\*.p3d" - SetOutPath $INSTDIR\lib - File /r /x *.exp "${PANDA}\lib\*" - SetOutPath $INSTDIR\include - File /r /x *.exp "${PANDA}\include\*" - SetOutPath $INSTDIR\Pmw - File /r /x CVS "${PANDA}\Pmw\*" - SetOutPath $INSTDIR\NSIS - File /r /x CVS "${NSISDIR}\*" - SetOutPath $INSTDIR - File /r /x CVS "${PANDA}\ReleaseNotes" - !ifdef PYEXTRAS - SetOutPath $INSTDIR\python\lib - File /nonfatal /r "${PYEXTRAS}\*" - !endif - SetOutPath $INSTDIR\models - File /r /x CVS "${PANDA}\models\*" - SetOutPath $INSTDIR\samples - File /nonfatal /r /x CVS "${PSOURCE}\samples\*" - MessageBox MB_YESNO|MB_ICONQUESTION \ - "EGG caching is about to begin.$\nThis process may take a couple minute and approximately 270 MB of RAM.$\nWARNING : It might stuck if your computer resources are low.$\n$\nDo you really want to do this optional step ?" \ - IDNO SkipCaching - # Preload all EGG files into the model-cache - SetOutPath $INSTDIR - SetDetailsPrint both - SetDetailsView show - nsExec::ExecToLog '"$INSTDIR\bin\eggcacher.exe" --concise models samples' - SetDetailsPrint none - SetDetailsView hide - SkipCaching: - - SetOutPath $INSTDIR - WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "http://panda3d.org/" - WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php" - WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php/Sample_Programs_in_the_Distribution" - SetOutPath $INSTDIR - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda Manual" - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda Website" - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Sample Program Manual" - - FindFirst $0 $1 $INSTDIR\samples\* - loop: - StrCmp $1 "" done - StrCmp $1 "." next - StrCmp $1 ".." next - Push $1 - Push "-" - Push " " - Call StrRep - Pop $R0 - StrCpy $READABLE $R0 - Push $1 - Push "-" - Push "_" - Call StrRep - Pop $R0 - StrCpy $MANPAGE $R0 - CreateDirectory "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE" - SetOutPath $INSTDIR\samples\$1 - WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE" - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Manual Entry on this Sample Program" - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1" - FindFirst $2 $3 $INSTDIR\samples\$1\Tut-*.py - iloop: - StrCmp $3 "" idone - StrCpy $TUTNAME $3 -3 4 - Push $TUTNAME - Push "-" - Push " " - Call StrRep - Pop $R0 - StrCpy $TUTNAME $R0 - CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE\Run $TUTNAME.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME" - CreateShortCut "$INSTDIR\samples\$1\Run $TUTNAME.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME" - FindNext $2 $3 - goto iloop - idone: - next: - FindNext $0 $1 - Goto loop - done: - - !endif - -SectionEnd - - -Section -post - - !ifdef REGVIEW - SetRegView ${REGVIEW} - !endif - - !ifndef PPGAME - - # Add the "bin" directory to the PATH. - Push "$INSTDIR\python" - Call RemoveFromPath - Push "$INSTDIR\python\Scripts" - Call RemoveFromPath - Push "$INSTDIR\bin" - Call RemoveFromPath - Push "$INSTDIR\python" - Call AddToPath - Push "$INSTDIR\python\Scripts" - Call AddToPath - Push "$INSTDIR\bin" - Call AddToPath - - ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" "" - StrCmp $0 "$INSTDIR\python" RegPath 0 - StrCmp $0 "" RegPath 0 - - MessageBox MB_YESNO|MB_ICONQUESTION \ - "Your system already has a copy of Python installed. Panda3D installs its own copy of Python ${PYVER}, which will install alongside your existing copy. Would you like to make Panda's copy the default Python? If you choose 'No', you will have to configure your existing copy of Python to use the Panda3D libraries, keeping in mind that this version of Panda3D can only run with Python ${PYVER}." \ - IDNO SkipRegPath - - RegPath: - DetailPrint "Adding registry keys for python..." - WriteRegStr HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" "" "$INSTDIR\python" - SkipRegPath: - !endif - - DetailPrint "Adding the uninstaller ..." - Delete "$INSTDIR\uninst.exe" - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SMDIRECTORY}" "DisplayName" "${SMDIRECTORY}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SMDIRECTORY}" "UninstallString" '"$INSTDIR\uninst.exe"' - SetOutPath $INSTDIR - CreateShortcut "$SMPROGRAMS\${SMDIRECTORY}\Uninstall ${NAME}.lnk" "$INSTDIR\uninst.exe" "" - -SectionEnd - -Section Uninstall - - !ifdef REGVIEW - SetRegView ${REGVIEW} - !endif - - !ifndef PPGAME - Push "$INSTDIR\python" - Call un.RemoveFromPath - Push "$INSTDIR\python\Scripts" - Call un.RemoveFromPath - Push "$INSTDIR\bin" - Call un.RemoveFromPath - - ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" "" - StrCmp $0 "$INSTDIR\python" 0 SkipUnReg - DeleteRegKey HKLM "Software\Python\PythonCore\${PYVER}" - SkipUnReg: - !endif - - Delete "$INSTDIR\uninst.exe" - RMDir /r "$SMPROGRAMS\${SMDIRECTORY}" - RMDir /r "$INSTDIR" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SMDIRECTORY}" - -SectionEnd - -# --[ Utility Functions ]------------------------------------------------------ - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -Function IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -Function un.IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 unIsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - unIsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -Function StrStr - Push $0 - Exch - Pop $0 ; $0 now have the string to find - Push $1 - Exch 2 - Pop $1 ; $1 now have the string to find in - Exch - Push $2 - Push $3 - Push $4 - Push $5 - StrCpy $2 -1 - StrLen $3 $0 - StrLen $4 $1 - IntOp $4 $4 - $3 - unStrStr_loop: - IntOp $2 $2 + 1 - IntCmp $2 $4 0 0 unStrStrReturn_notFound - StrCpy $5 $1 $3 $2 - StrCmp $5 $0 unStrStr_done unStrStr_loop - unStrStrReturn_notFound: - StrCpy $2 -1 - unStrStr_done: - Pop $5 - Pop $4 - Pop $3 - Exch $2 - Exch 2 - Pop $0 - Pop $1 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -Function un.StrStr - Push $0 - Exch - Pop $0 ; $0 now have the string to find - Push $1 - Exch 2 - Pop $1 ; $1 now have the string to find in - Exch - Push $2 - Push $3 - Push $4 - Push $5 - StrCpy $2 -1 - StrLen $3 $0 - StrLen $4 $1 - IntOp $4 $4 - $3 - unStrStr_loop: - IntOp $2 $2 + 1 - IntCmp $2 $4 0 0 unStrStrReturn_notFound - StrCpy $5 $1 $3 $2 - StrCmp $5 $0 unStrStr_done unStrStr_loop - unStrStrReturn_notFound: - StrCpy $2 -1 - unStrStr_done: - Pop $5 - Pop $4 - Pop $3 - Exch $2 - Exch 2 - Pop $0 - Pop $1 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -; Commentary and smarter ';' checking by Jon Parise -Function AddToPath - Exch $0 - Push $1 - Push $2 - Push $3 - Call IsNT - Pop $1 - - StrCmp $1 1 AddToPath_NT - ; We're not on NT, so modify the AUTOEXEC.BAT file. - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 0 END - GetFullPathName /SHORT $0 $0 - FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n" - FileClose $1 - Goto AddToPath_done - - AddToPath_NT: - ReadRegStr $1 HKCU "Environment" "PATH" - Call IsUserAdmin - Pop $3 - ; If this is an Admin user, use the System env. variable instead of the user's env. variable - StrCmp $3 1 0 +2 - ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" - - ; If the PATH string is empty, jump over the mangling routines. - StrCmp $1 "" AddToPath_NTdoIt - - ; Pull off the last character of the PATH string. If it's a semicolon, - ; we don't need to add another one, so jump to the section where we - ; append the new PATH component(s). - StrCpy $2 $1 1 -1 - StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi - - AddToPath_NTAddSemi: - StrCpy $1 "$1;" - Goto AddToPath_NTAddPath - AddToPath_NTAddPath: - StrCpy $0 "$1$0" - Goto AddToPath_NTdoIt - AddToPath_NTdoIt: - Call IsUserAdmin - Pop $3 - StrCmp $3 1 0 NotAdmin - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0 - Goto AddToPath_done - - NotAdmin: - WriteRegExpandStr HKCU "Environment" "PATH" $0 - AddToPath_done: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -Function RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Call IsNT - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop - StrCmp $3 "$0" unRemoveFromPath_dosLoop - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - StrLen $2 $0 - Call IsUserAdmin - Pop $5 - StrCmp $5 1 0 NotAdmin - ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" - Push $1 - Push $0 - Call StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - Goto unRemoveFromPath_done - - - NotAdmin: - ReadRegStr $1 HKCU "Environment" "PATH" - Push $1 - Push $0 - Call StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKCU "Environment" "PATH" $3 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91 -Function un.RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Call un.IsNT - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop - StrCmp $3 "$0" unRemoveFromPath_dosLoop - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - StrLen $2 $0 - Call un.IsUserAdmin - Pop $5 - StrCmp $5 1 0 NotAdmin - ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" - Push $1 - Push $0 - Call un.StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - Goto unRemoveFromPath_done - - - NotAdmin: - ReadRegStr $1 HKCU "Environment" "PATH" - Push $1 - Push $0 - Call un.StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKCU "Environment" "PATH" $3 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -; From: http://nsis.sourceforge.net/archive/nsisweb.php?page=329&instances=0,11 -; Localized by Ben Johnson (bkj@andrew.cmu.edu) -Function IsUserAdmin - Push $0 - Push $1 - Push $2 - Push $3 - Call IsNT - Pop $1 - - ClearErrors - UserInfo::GetName - ;IfErrors Win9x - Pop $2 - UserInfo::GetAccountType - Pop $3 - - ; Compare results of IsNT with "1" - StrCmp $1 1 0 NotNT - ;This is NT - - - StrCmp $3 "Admin" 0 NotAdmin - ; Observation: I get here when running Win98SE. (Lilla) - ; The functions UserInfo.dll looks for are there on Win98 too, - ; but just don't work. So UserInfo.dll, knowing that admin isn't required - ; on Win98, returns admin anyway. (per kichik) - ; MessageBox MB_OK 'User "$R1" is in the Administrators group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - Return - - NotAdmin: - ; You should still check for an empty string because the functions - ; UserInfo.dll looks for may not be present on Windows 95. (per kichik) - - #StrCmp $2 "" Win9x - #StrCpy $0 0 - ;MessageBox MB_OK 'User "$2" is in the "$3" group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 0 - Return - - ;Because we use IsNT, this is redundant. - #Win9x: - # ; comment/message below is by UserInfo.nsi author: - # ; This one means you don't need to care about admin or - # ; not admin because Windows 9x doesn't either - # ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" - # StrCpy $0 0 - - NotNT: - ;We are not NT - ;Win9x doesn't have "admin" users. - ;Let the user do whatever. - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - -FunctionEnd - -Function un.IsUserAdmin - Push $0 - Push $1 - Push $2 - Push $3 - Call un.IsNT - Pop $1 - - ClearErrors - UserInfo::GetName - ;IfErrors Win9x - Pop $2 - UserInfo::GetAccountType - Pop $3 - - ; Compare results of IsNT with "1" - StrCmp $1 1 0 NotNT - ;This is NT - - - StrCmp $3 "Admin" 0 NotAdmin - ; Observation: I get here when running Win98SE. (Lilla) - ; The functions UserInfo.dll looks for are there on Win98 too, - ; but just don't work. So UserInfo.dll, knowing that admin isn't required - ; on Win98, returns admin anyway. (per kichik) - ; MessageBox MB_OK 'User "$R1" is in the Administrators group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - Return - - NotAdmin: - ; You should still check for an empty string because the functions - ; UserInfo.dll looks for may not be present on Windows 95. (per kichik) - - #StrCmp $2 "" Win9x - #StrCpy $0 0 - ;MessageBox MB_OK 'User "$2" is in the "$3" group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 0 - Return - - ;Because we use IsNT, this is redundant. - #Win9x: - # ; comment/message below is by UserInfo.nsi author: - # ; This one means you don't need to care about admin or - # ; not admin because Windows 9x doesn't either - # ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" - # StrCpy $0 0 - - NotNT: - ;We are not NT - ;Win9x doesn't have "admin" users. - ;Let the user do whatever. - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - -FunctionEnd - -Function StrRep - - ;Written by dirtydingus 2003-02-20 04:30:09 - ; USAGE - ;Push String to do replacement in (haystack) - ;Push String to replace (needle) - ;Push Replacement - ;Call StrRep - ;Pop $R0 result - ;StrCpy $Result STR $R0 - - Exch $R4 ; $R4 = Replacement String - Exch - Exch $R3 ; $R3 = String to replace (needle) - Exch 2 - Exch $R1 ; $R1 = String to do replacement in (haystack) - Push $R2 ; Replaced haystack - Push $R5 ; Len (needle) - Push $R6 ; len (haystack) - Push $R7 ; Scratch reg - StrCpy $R2 "" - StrLen $R5 $R3 - StrLen $R6 $R1 -loop: - StrCpy $R7 $R1 $R5 - StrCmp $R7 $R3 found - StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1 - StrCpy $R2 "$R2$R7" - StrCpy $R1 $R1 $R6 1 - StrCmp $R1 "" done loop -found: - StrCpy $R2 "$R2$R4" - StrCpy $R1 $R1 $R6 $R5 - StrCmp $R1 "" done loop -done: - StrCpy $R3 $R2 - Pop $R7 - Pop $R6 - Pop $R5 - Pop $R2 - Pop $R1 - Pop $R4 - Exch $R3 - -FunctionEnd - diff --git a/direct/src/directscripts/packpanda.py b/direct/src/directscripts/packpanda.py deleted file mode 100755 index c195017f04..0000000000 --- a/direct/src/directscripts/packpanda.py +++ /dev/null @@ -1,424 +0,0 @@ -############################################################################# -# -# packpanda - this is a tool that packages up a panda game into a -# convenient, easily-downloaded windows executable. Packpanda runs on linux -# and windows - on linux, it builds .debs and .rpms, on windows it relies on -# NSIS, the nullsoft scriptable install system, to do the hard work. -# -# This is intentionally a very simplistic game-packer with very -# limited options. The goal is simplicity, not feature richness. -# There are dozens of complex, powerful packaging tools already out -# there. This one is for people who just want to do it quick and -# easy. -# -############################################################################## - -import sys, os, getopt, shutil, py_compile, subprocess - -OPTIONLIST = [ -("dir", 1, "Name of directory containing game"), -("name", 1, "Human-readable name of the game"), -("version", 1, "Version number to add to game name"), -("rmdir", 2, "Delete all directories with given name"), -("rmext", 2, "Delete all files with given extension"), -("fast", 0, "Use fast compression instead of good compression"), -("bam", 0, "Generate BAM files, change default-model-extension to BAM"), -("pyc", 0, "Generate PYC files"), -] - -def ParseFailure(): - print("") - print("packpanda usage:") - print("") - for (opt, hasval, explanation) in OPTIONLIST: - if (hasval): - print(" --%-10s %s"%(opt+" x", explanation)) - else: - print(" --%-10s %s"%(opt+" ", explanation)) - sys.exit(1) - -def ParseOptions(args): - try: - options = {} - longopts = [] - for (opt, hasval, explanation) in OPTIONLIST: - if (hasval==2): - longopts.append(opt+"=") - options[opt] = [] - elif (hasval==1): - longopts.append(opt+"=") - options[opt] = "" - else: - longopts.append(opt) - options[opt] = 0 - opts, extras = getopt.getopt(args, "", longopts) - for option, value in opts: - for (opt, hasval, explanation) in OPTIONLIST: - if (option == "--"+opt): - if (hasval==2): options[opt].append(value) - elif (hasval==1): options[opt] = value - else: options[opt] = 1 - return options - except: ParseFailure(); - -OPTIONS = ParseOptions(sys.argv[1:]) - -############################################################################## -# -# Locate the relevant trees. -# -############################################################################## - -PANDA=None -for dir in sys.path: - if (dir != "") and os.path.exists(os.path.join(dir,"direct")) and os.path.exists(os.path.join(dir,"pandac")): - PANDA=os.path.abspath(dir) -if (PANDA is None): - sys.exit("Cannot locate the panda root directory in the python path (cannot locate directory containing direct and pandac).") -print("PANDA located at "+PANDA) - -if (os.path.exists(os.path.join(PANDA,"..","makepanda","makepanda.py"))) and (sys.platform != "win32" or os.path.exists(os.path.join(PANDA,"..","thirdparty","win-nsis","makensis.exe"))): - PSOURCE=os.path.abspath(os.path.join(PANDA,"..")) - if (sys.platform == "win32"): - NSIS=os.path.abspath(os.path.join(PANDA,"..","thirdparty","win-nsis")) -else: - PSOURCE=PANDA - if (sys.platform == "win32"): - NSIS=os.path.join(PANDA,"nsis") - -############################################################################## -# -# Identify the main parts of the game: DIR, NAME, MAIN, ICON, BITMAP, etc -# -############################################################################## - -VER=OPTIONS["version"] -DIR=OPTIONS["dir"] -if (DIR==""): - print("You must specify the --dir option.") - ParseFailure() -DIR=os.path.abspath(DIR) -MYDIR=os.path.abspath(os.getcwd()) -BASENAME=os.path.basename(DIR) -if (OPTIONS["name"] != ""): - NAME=OPTIONS["name"] -else: - NAME=BASENAME -SMDIRECTORY=NAME -if (VER!=""): SMDIRECTORY=SMDIRECTORY+" "+VER -PYTHONV="python"+sys.version[:3] -LICENSE=os.path.join(DIR, "license.txt") -OUTFILE=os.path.basename(DIR) -if (VER!=""): OUTFILE=OUTFILE+"-"+VER -if (sys.platform == "win32"): - ICON=os.path.join(DIR, "icon.ico") - BITMAP=os.path.join(DIR, "installer.bmp") - OUTFILE=os.path.abspath(OUTFILE+".exe") - INSTALLDIR='C:\\'+os.path.basename(DIR) - if (VER!=""): INSTALLDIR=INSTALLDIR+"-"+VER - COMPRESS="lzma" - if (OPTIONS["fast"]): COMPRESS="zlib" -if (OPTIONS["pyc"]): MAIN="main.pyc" -else: MAIN="main.py" - -def PrintFileStatus(label, file): - if (os.path.exists(file)): - print("%-15s: %s"%(label, file)) - else: - print("%-15s: %s (MISSING)"%(label, file)) - -PrintFileStatus("Dir", DIR) -print("%-15s: %s"%("Name", NAME)) -print("%-15s: %s"%("Start Menu", SMDIRECTORY)) -PrintFileStatus("Main", os.path.join(DIR, MAIN)) -if (sys.platform == "win32"): - PrintFileStatus("Icon", ICON) - PrintFileStatus("Bitmap", BITMAP) -PrintFileStatus("License", LICENSE) -print("%-15s: %s"%("Output", OUTFILE)) -if (sys.platform == "win32"): - print("%-15s: %s"%("Install Dir", INSTALLDIR)) - -if (os.path.isdir(DIR)==0): - sys.exit("Difficulty reading "+DIR+". Cannot continue.") - -if (os.path.isfile(os.path.join(DIR, "main.py"))==0): - sys.exit("Difficulty reading main.py. Cannot continue.") - -if (os.path.isfile(LICENSE)==0): - LICENSE=os.path.join(PANDA,"LICENSE") - -if (sys.platform == "win32") and (os.path.isfile(BITMAP)==0): - BITMAP=os.path.join(NSIS,"Contrib","Graphics","Wizard","nsis.bmp") - -if (sys.platform == "win32"): - if (os.path.isfile(ICON)==0): - PPICON="bin\\ppython.exe" - else: - PPICON="game\\icon.ico" - -############################################################################## -# -# Copy the game to a temporary directory, so we can modify it safely. -# -############################################################################## - -def limitedCopyTree(src, dst, rmdir): - if (os.path.isdir(src)): - if (os.path.basename(src) in rmdir): - return - if (not os.path.isdir(dst)): os.mkdir(dst) - for x in os.listdir(src): - limitedCopyTree(os.path.join(src,x), os.path.join(dst,x), rmdir) - else: - shutil.copyfile(src, dst) - - -TMPDIR=os.path.abspath("packpanda-TMP") -if (sys.platform == "win32"): - TMPGAME=os.path.join(TMPDIR,"game") - TMPETC=os.path.join(TMPDIR,"etc") -else: - TMPGAME=os.path.join(TMPDIR,"usr","share","games",BASENAME,"game") - TMPETC=os.path.join(TMPDIR,"usr","share","games",BASENAME,"etc") -print("") -print("Copying the game to "+TMPDIR+"...") -if (os.path.exists(TMPDIR)): - try: shutil.rmtree(TMPDIR) - except: sys.exit("Cannot delete "+TMPDIR) -try: - os.mkdir(TMPDIR) - rmdir = {} - for x in OPTIONS["rmdir"]: - rmdir[x] = 1 - if not os.path.isdir( TMPGAME ): - os.makedirs(TMPGAME) - limitedCopyTree(DIR, TMPGAME, rmdir) - if not os.path.isdir( TMPETC ): - os.makedirs(TMPETC) - if sys.platform == "win32": - limitedCopyTree(os.path.join(PANDA, "etc"), TMPETC, {}) - else: - shutil.copyfile("/etc/Config.prc", os.path.join(TMPETC, "Config.prc")) - shutil.copyfile("/etc/Confauto.prc", os.path.join(TMPETC, "Confauto.prc")) -except: sys.exit("Cannot copy game to "+TMPDIR) - -############################################################################## -# -# If --bam requested, change default-model-extension .egg to bam. -# -############################################################################## - -def ReadFile(wfile): - try: - srchandle = open(wfile, "rb") - data = srchandle.read() - srchandle.close() - return data - except: exit("Cannot read "+wfile) - -def WriteFile(wfile,data): - try: - dsthandle = open(wfile, "wb") - dsthandle.write(data) - dsthandle.close() - except: exit("Cannot write "+wfile) - -if OPTIONS["bam"]: - CONF=ReadFile(os.path.join(TMPETC,"Confauto.prc")) - CONF=CONF.replace("default-model-extension .egg","default-model-extension .bam") - WriteFile(os.path.join(TMPETC,"Confauto.prc"), CONF) - -############################################################################## -# -# Compile all py files, convert all egg files. -# -# We do this as a sanity check, even if the user -# hasn't requested that his files be compiled. -# -############################################################################## - -if (sys.platform == "win32"): - EGG2BAM=os.path.join(PANDA,"bin","egg2bam.exe") -else: - EGG2BAM=os.path.join(PANDA,"bin","egg2bam") - -def egg2bam(file,bam): - present = os.path.exists(bam) - if (present): bam = "packpanda-TMP.bam"; - cmd = 'egg2bam -noabs -ps rel -pd . "'+file+'" -o "'+bam+'"' - print("Executing: "+cmd) - if (sys.platform == "win32"): - res = os.spawnl(os.P_WAIT, EGG2BAM, cmd) - else: - res = os.system(cmd) - if (res != 0): sys.exit("Problem in egg file: "+file) - if (present) or (OPTIONS["bam"]==0): - os.unlink(bam) - -def py2pyc(file): - print("Compiling python "+file) - pyc = file[:-3]+'.pyc' - pyo = file[:-3]+'.pyo' - if (os.path.exists(pyc)): os.unlink(pyc) - if (os.path.exists(pyo)): os.unlink(pyo) - try: py_compile.compile(file) - except: sys.exit("Cannot compile "+file) - if (OPTIONS["pyc"]==0): - if (os.path.exists(pyc)): - os.unlink(pyc) - if (os.path.exists(pyo)): - os.unlink(pyo) - -def CompileFiles(file): - if (os.path.isfile(file)): - if (file.endswith(".egg")): - egg2bam(file, file[:-4]+'.bam') - elif (file.endswith(".egg.pz") or file.endswith(".egg.gz")): - egg2bam(file, file[:-7]+'.bam') - elif (file.endswith(".py")): - py2pyc(file) - else: pass - elif (os.path.isdir(file)): - for x in os.listdir(file): - CompileFiles(os.path.join(file, x)) - -def DeleteFiles(file): - base = os.path.basename(file).lower() - if (os.path.isdir(file)): - for pattern in OPTIONS["rmdir"]: - if pattern.lower() == base: - print("Deleting "+file) - shutil.rmtree(file) - return - for x in os.listdir(file): - DeleteFiles(os.path.join(file, x)) - else: - for ext in OPTIONS["rmext"]: - if base[-(len(ext) + 1):] == ("." + ext).lower(): - print("Deleting "+file) - os.unlink(file) - return - -print("") -print("Compiling BAM and PYC files...") -os.chdir(TMPGAME) -CompileFiles(".") -DeleteFiles(".") - -############################################################################## -# -# Now make the installer. Yay! -# -############################################################################## - -INSTALLER_DEB_FILE=""" -Package: BASENAME -Version: VERSION -Section: games -Priority: optional -Architecture: ARCH -Essential: no -Depends: PYTHONV -Provides: BASENAME -Description: NAME -Maintainer: Unknown -""" - -INSTALLER_SPEC_FILE=""" -Summary: NAME -Name: BASENAME -Version: VERSION -Release: 1 -Group: Amusement/Games -License: See license file -BuildRoot: TMPDIR -BuildRequires: PYTHONV -%description -NAME -%files -%defattr(-,root,root) -/usr/bin/BASENAME -/usr/lib/games/BASENAME -/usr/share/games/BASENAME -""" - -RUN_SCRIPT=""" -#!/bin/sh -cd /usr/share/games/BASENAME/game -PYTHONPATH=/usr/lib/games/BASENAME:/usr/share/games/BASENAME -LD_LIBRARY_PATH=/usr/lib/games/BASENAME -PYTHONV MAIN -""" - -if (sys.platform == "win32"): - CMD="\""+NSIS+"\\makensis.exe\" /V2 " - CMD=CMD+'/DCOMPRESSOR="'+COMPRESS+'" ' - CMD=CMD+'/DNAME="'+NAME+'" ' - CMD=CMD+'/DSMDIRECTORY="'+SMDIRECTORY+'" ' - CMD=CMD+'/DINSTALLDIR="'+INSTALLDIR+'" ' - CMD=CMD+'/DOUTFILE="'+OUTFILE+'" ' - CMD=CMD+'/DLICENSE="'+LICENSE+'" ' - CMD=CMD+'/DLANGUAGE="English" ' - CMD=CMD+'/DRUNTEXT="Play '+NAME+'" ' - CMD=CMD+'/DIBITMAP="'+BITMAP+'" ' - CMD=CMD+'/DUBITMAP="'+BITMAP+'" ' - CMD=CMD+'/DPANDA="'+PANDA+'" ' - CMD=CMD+'/DPANDACONF="'+TMPETC+'" ' - CMD=CMD+'/DPSOURCE="'+PSOURCE+'" ' - CMD=CMD+'/DPPGAME="'+TMPGAME+'" ' - CMD=CMD+'/DPPMAIN="'+MAIN+'" ' - CMD=CMD+'/DPPICON="'+PPICON+'" ' - CMD=CMD+'"'+PSOURCE+'\\direct\\directscripts\\packpanda.nsi"' - - print("") - print(CMD) - print("packing...") - subprocess.call(CMD) -else: - os.chdir(MYDIR) - os.system("mkdir -p %s/usr/bin" % TMPDIR) - os.system("mkdir -p %s/usr/share/games/%s" % (TMPDIR, BASENAME)) - os.system("mkdir -p %s/usr/lib/games/%s" % (TMPDIR, BASENAME)) - os.system("cp --recursive %s/direct %s/usr/share/games/%s/direct" % (PANDA, TMPDIR, BASENAME)) - os.system("cp --recursive %s/pandac %s/usr/share/games/%s/pandac" % (PANDA, TMPDIR, BASENAME)) - os.system("cp --recursive %s/models %s/usr/share/games/%s/models" % (PANDA, TMPDIR, BASENAME)) - os.system("cp --recursive %s/Pmw %s/usr/share/games/%s/Pmw" % (PANDA, TMPDIR, BASENAME)) - os.system("cp %s %s/usr/share/games/%s/LICENSE" % (LICENSE, TMPDIR, BASENAME)) - os.system("cp --recursive /usr/lib/panda3d/* %s/usr/lib/games/%s/" % (TMPDIR, BASENAME)) - - # Make the script to run the game - txt = RUN_SCRIPT[1:].replace("BASENAME",BASENAME).replace("PYTHONV",PYTHONV).replace("MAIN",MAIN) - WriteFile(TMPDIR+"/usr/bin/"+BASENAME, txt) - os.system("chmod +x "+TMPDIR+"/usr/bin/"+BASENAME) - - if (os.path.exists("/usr/bin/rpmbuild")): - os.system("rm -rf %s/DEBIAN" % TMPDIR) - os.system("rpm -E '%_target_cpu' > packpanda-TMP.txt") - ARCH=ReadFile("packpanda-TMP.txt").strip() - os.remove("packpanda-TMP.txt") - txt = INSTALLER_SPEC_FILE[1:].replace("VERSION",VER).replace("TMPDIR",TMPDIR) - txt = txt.replace("BASENAME",BASENAME).replace("NAME",NAME).replace("PYTHONV",PYTHONV) - WriteFile("packpanda-TMP.spec", txt) - os.system("rpmbuild --define '_rpmdir "+TMPDIR+"' -bb packpanda-TMP.spec") - os.system("mv "+ARCH+"/"+BASENAME+"-"+VER+"-1."+ARCH+".rpm .") - os.rmdir(ARCH) - os.remove("packpanda-TMP.spec") - - if (os.path.exists("/usr/bin/dpkg-deb")): - os.system("dpkg --print-architecture > packpanda-TMP.txt") - ARCH=ReadFile("packpanda-TMP.txt").strip() - os.remove("packpanda-TMP.txt") - txt = INSTALLER_DEB_FILE[1:].replace("VERSION",str(VER)).replace("PYTHONV",PYTHONV) - txt = txt.replace("BASENAME",BASENAME).replace("NAME",NAME).replace("ARCH",ARCH) - os.system("mkdir -p %s/DEBIAN" % TMPDIR) - os.system("cd %s ; (find usr -type f -exec md5sum {} \;) > DEBIAN/md5sums" % TMPDIR) - WriteFile(TMPDIR+"/DEBIAN/control",txt) - os.system("dpkg-deb -b "+TMPDIR+" "+BASENAME+"_"+VER+"_"+ARCH+".deb") - - if not(os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")): - exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!") - -# Dummy main function so this can be added to console_scripts. -def main(): - return 0 diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index d004d15006..c5e76fc766 100755 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -619,13 +619,10 @@ Section -post DetailPrint "Preloading .egg files into the model cache..." SetDetailsPrint listonly - ; We need to set the $PATH for eggcacher. SetOutPath $INSTDIR - ReadEnvStr $R0 "PATH" - StrCpy $R0 "$INSTDIR\python;$INSTDIR\bin;$R0" - System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2' - - nsExec::ExecToLog '"$INSTDIR\bin\eggcacher.exe" --concise models samples' + nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m direct.directscripts.eggcacher --concise models samples' + Pop $0 + DetailPrint "Command returned exit status $0" SetDetailsPrint both DetailPrint "Writing the uninstaller ..." diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 2e54cc2058..4faa683f87 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -90,7 +90,7 @@ PkgListSet(["PYTHON", "DIRECT", # Python support "ROCKET", "AWESOMIUM", # GUI libraries "CARBON", "COCOA", # Mac OS X toolkits "X11", # Unix platform support - "PANDATOOL", "PVIEW", "DEPLOYTOOLS", "DIRECTSCRIPTS",# Toolchain + "PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain "SKEL", # Example SKEL project "PANDAFX", # Some distortion special lenses "PANDAPARTICLESYSTEM", # Built in particle system @@ -172,7 +172,7 @@ def parseopts(args): "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=", "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl", - "universal", "target=", "arch=", "git-commit=", + "universal", "target=", "arch=", "git-commit=", "no-directscripts", "use-touchinput", "no-touchinput"] anything = 0 optimize = "" @@ -224,6 +224,7 @@ def parseopts(args): # Backward compatibility, OPENGL was renamed to GL elif (option=="--use-opengl"): PkgEnable("GL") elif (option=="--no-opengl"): PkgDisable("GL") + elif (option=="--no-directscripts"): pass elif (option=="--directx-sdk"): STRDXSDKVERSION = value.strip().lower() if STRDXSDKVERSION == '': @@ -832,7 +833,11 @@ if (COMPILER=="GCC"): SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h") if not PkgSkip("PYTHON"): - SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config") + python_lib = SDK["PYTHONVERSION"] + if not RTDIST: + # We don't link anything in the SDK with libpython. + python_lib = "" + SmartPkgEnable("PYTHON", "", python_lib, (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config") SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h")) SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h") @@ -4996,17 +5001,6 @@ if (PkgSkip("DIRECT")==0): OPTS=['DIR:direct/src/directbase', 'PYTHON'] TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx') - if not PkgSkip("PYTHON") and not RTDIST and not RUNTIME and not PkgSkip("DIRECTSCRIPTS"): - DefSymbol("BUILDING:PACKPANDA", "IMPORT_MODULE", "direct.directscripts.packpanda") - TargetAdd('packpanda.obj', opts=OPTS+['BUILDING:PACKPANDA'], input='ppython.cxx') - TargetAdd('packpanda.exe', input='packpanda.obj') - TargetAdd('packpanda.exe', opts=['PYTHON']) - - DefSymbol("BUILDING:EGGCACHER", "IMPORT_MODULE", "direct.directscripts.eggcacher") - TargetAdd('eggcacher.obj', opts=OPTS+['BUILDING:EGGCACHER'], input='ppython.cxx') - TargetAdd('eggcacher.exe', input='eggcacher.obj') - TargetAdd('eggcacher.exe', opts=['PYTHON']) - # # DIRECTORY: direct/src/dcparser/ # diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 2eb4342b06..ee903a3940 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1574,7 +1574,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, location = os.path.join(GetOutputDir(), "lib", os.path.basename(location)) LibName(target_pkg, location) else: - print(GetColor("cyan") + "Couldn't find library lib" + libname + " in thirdparty directory " + pkg.lower() + GetColor()) + print(GetColor("cyan") + "Couldn't find library lib" + libname + " in thirdparty directory " + thirdparty_dir + GetColor()) for d, v in defs.values(): DefSymbol(target_pkg, d, v) diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index 6d3b6fdf72..56fb43133e 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -551,7 +551,6 @@ def makewheel(version, output_dir, platform=default_platform): # Add a panda3d-tools directory containing the executables. entry_points = '[console_scripts]\n' entry_points += 'eggcacher = direct.directscripts.eggcacher:main\n' - entry_points += 'packpanda = direct.directscripts.packpanda:main\n' tools_init = '' for file in os.listdir(bin_dir): basename = os.path.splitext(file)[0] From 816b2ac3ba3f35b209dfde8afe6eee40cba358b7 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 Jan 2017 23:24:52 +0100 Subject: [PATCH 11/18] C++11 polyfills. This should fix Snow Leopard build. --- dtool/src/dtoolbase/dtoolbase_cc.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index eb99381c01..eb7afc9048 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -75,6 +75,7 @@ typedef int ios_seekdir; #endif #include +#include #ifdef HAVE_NAMESPACE using namespace std; @@ -114,6 +115,18 @@ typedef ios::iostate ios_iostate; typedef ios::seekdir ios_seekdir; #endif +// Apple has an outdated libstdc++. Not all is lost, though, as we can fill +// in some important missing functions. +#if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719 +template struct remove_reference {typedef T type;}; +template struct remove_reference {typedef T type;}; +template struct remove_reference{typedef T type;}; + +template typename remove_reference::type &&move(T &&t) { + return static_cast::type&&>(t); +} +#endif + #ifdef _MSC_VER #define ALWAYS_INLINE __forceinline #elif defined(__GNUC__) @@ -153,7 +166,7 @@ typedef ios::seekdir ios_seekdir; #elif defined(__GNUC__) && (__cplusplus >= 201103L) // GCC // GCC defines several macros which we can query. List of all supported -// builtin macros: https:gcc.gnu.orgprojectscxx0x.html +// builtin macros: https://gcc.gnu.org/projects/cxx-status.html # if __cpp_constexpr >= 200704 # define CONSTEXPR constexpr # endif From 41d26284d75e47749c4488a948e038aea06c16e6 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 13:40:09 -0500 Subject: [PATCH 12/18] Fix various compilation issues on Mac. Work around bugs in Apple Clang that ships with XCode 4 with C++11 by disabling constexpr Use move() instead of std::move() It also looks like we'll have to continue using pystub for tools that use libp3interrogatedb for now. --- dtool/src/dtoolbase/dtoolbase_cc.h | 6 +++- dtool/src/interrogate/interrogate.cxx | 3 ++ dtool/src/interrogate/interrogate_module.cxx | 3 ++ dtool/src/interrogate/parse_file.cxx | 3 ++ .../src/test_interrogate/test_interrogate.cxx | 3 ++ panda/src/display/displayRegion.I | 4 +-- panda/src/linmath/lvecBase2_src.I | 16 ---------- panda/src/linmath/lvecBase2_src.h | 4 +-- panda/src/linmath/lvecBase3_src.I | 16 ---------- panda/src/linmath/lvecBase3_src.h | 4 +-- panda/src/linmath/lvecBase4_src.I | 32 ------------------- panda/src/linmath/lvecBase4_src.h | 8 ++--- panda/src/putil/weakKeyHashMap.I | 2 +- 13 files changed, 28 insertions(+), 76 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index eb7afc9048..486eaa00ba 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -118,6 +118,8 @@ typedef ios::seekdir ios_seekdir; // Apple has an outdated libstdc++. Not all is lost, though, as we can fill // in some important missing functions. #if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719 +typedef decltype(nullptr) nullptr_t; + template struct remove_reference {typedef T type;}; template struct remove_reference {typedef T type;}; template struct remove_reference{typedef T type;}; @@ -147,7 +149,9 @@ template typename remove_reference::type &&move(T &&t) { // Determine the availability of C++11 features. #if defined(__has_extension) // Clang magic. # if __has_extension(cxx_constexpr) -# define CONSTEXPR constexpr +# if !defined(__apple_build_version__) || __apple_build_version__ >= 5000000 +# define CONSTEXPR constexpr +# endif # endif # if __has_extension(cxx_noexcept) # define NOEXCEPT noexcept diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index 206132bb31..94175b9d2b 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -19,6 +19,7 @@ #include "pnotify.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" +#include "pystub.h" #include CPPParser parser; @@ -305,6 +306,8 @@ predefine_macro(CPPParser& parser, const string& inoption) { int main(int argc, char **argv) { + pystub(); + preprocess_argv(argc, argv); string command_line; int i; diff --git a/dtool/src/interrogate/interrogate_module.cxx b/dtool/src/interrogate/interrogate_module.cxx index 8e397d8b9e..5feae341b7 100644 --- a/dtool/src/interrogate/interrogate_module.cxx +++ b/dtool/src/interrogate/interrogate_module.cxx @@ -19,6 +19,7 @@ #include "interrogate_interface.h" #include "interrogate_request.h" #include "load_dso.h" +#include "pystub.h" #include "pnotify.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" @@ -379,6 +380,8 @@ int main(int argc, char *argv[]) { extern int optind; int flag; + pystub(); + preprocess_argv(argc, argv); flag = getopt_long_only(argc, argv, short_options, long_options, NULL); while (flag != EOF) { diff --git a/dtool/src/interrogate/parse_file.cxx b/dtool/src/interrogate/parse_file.cxx index 2b32f39561..6670bcbe44 100644 --- a/dtool/src/interrogate/parse_file.cxx +++ b/dtool/src/interrogate/parse_file.cxx @@ -22,6 +22,7 @@ #include "cppGlobals.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" +#include "pystub.h" #include CPPParser parser; @@ -193,6 +194,8 @@ show_nested_types(const string &str) { int main(int argc, char **argv) { + pystub(); + extern char *optarg; extern int optind; const char *optstr = "I:S:D:o:l:vp"; diff --git a/dtool/src/test_interrogate/test_interrogate.cxx b/dtool/src/test_interrogate/test_interrogate.cxx index f9aa7c1ab4..6c2b961ff3 100644 --- a/dtool/src/test_interrogate/test_interrogate.cxx +++ b/dtool/src/test_interrogate/test_interrogate.cxx @@ -17,6 +17,7 @@ #include "interrogate_request.h" #include "load_dso.h" #include "filename.h" +#include "pystub.h" #include "panda_getopt.h" #include "preprocess_argv.h" @@ -520,6 +521,8 @@ main(int argc, char **argv) { extern int optind; const char *optstr = "p:ftqh"; + pystub(); + bool all_functions = false; bool all_types = false; bool quick_load = false; diff --git a/panda/src/display/displayRegion.I b/panda/src/display/displayRegion.I index 11492a3a5e..6004791d31 100644 --- a/panda/src/display/displayRegion.I +++ b/panda/src/display/displayRegion.I @@ -480,8 +480,8 @@ set_cull_result(PT(CullResult) cull_result, PT(SceneSetup) scene_setup, Thread *current_thread) { CDCullWriter cdata(_cycler_cull, true, current_thread); #ifdef USE_MOVE_SEMANTICS - cdata->_cull_result = std::move(cull_result); - cdata->_scene_setup = std::move(scene_setup); + cdata->_cull_result = move(cull_result); + cdata->_scene_setup = move(scene_setup); #else swap(cdata->_cull_result, cull_result); swap(cdata->_scene_setup, scene_setup); diff --git a/panda/src/linmath/lvecBase2_src.I b/panda/src/linmath/lvecBase2_src.I index 9ddce8966c..401e2e346a 100644 --- a/panda/src/linmath/lvecBase2_src.I +++ b/panda/src/linmath/lvecBase2_src.I @@ -72,14 +72,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 2: the number of components of a LVecBase2. - */ -CONSTEXPR int FLOATNAME(LVecBase2):: -size() { - return 2; -} - /** * Returns true if any component of the vector is not-a-number, false * otherwise. @@ -178,14 +170,6 @@ get_data() const { return &_v(0); } -/** - * Returns the number of elements in the vector, two. - */ -CONSTEXPR int FLOATNAME(LVecBase2):: -get_num_components() { - return 2; -} - /** * Returns an iterator that may be used to traverse the elements of the * matrix, STL-style. diff --git a/panda/src/linmath/lvecBase2_src.h b/panda/src/linmath/lvecBase2_src.h index 0167855c65..d0c0693f55 100644 --- a/panda/src/linmath/lvecBase2_src.h +++ b/panda/src/linmath/lvecBase2_src.h @@ -50,7 +50,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 2; } INLINE_LINMATH bool is_nan() const; @@ -74,7 +74,7 @@ PUBLISHED: INLINE_LINMATH void add_y(FLOATTYPE value); INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 2; } public: INLINE_LINMATH iterator begin(); diff --git a/panda/src/linmath/lvecBase3_src.I b/panda/src/linmath/lvecBase3_src.I index b7011da0ca..eeaea584d5 100644 --- a/panda/src/linmath/lvecBase3_src.I +++ b/panda/src/linmath/lvecBase3_src.I @@ -89,14 +89,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 3: the number of components of a LVecBase3. - */ -CONSTEXPR int FLOATNAME(LVecBase3):: -size() { - return 3; -} - /** * Returns true if any component of the vector is not-a-number, false * otherwise. @@ -246,14 +238,6 @@ get_data() const { return &_v(0); } -/** - * Returns the number of elements in the vector, three. - */ -CONSTEXPR int FLOATNAME(LVecBase3):: -get_num_components() { - return 3; -} - /** * Returns an iterator that may be used to traverse the elements of the * matrix, STL-style. diff --git a/panda/src/linmath/lvecBase3_src.h b/panda/src/linmath/lvecBase3_src.h index fdc39c7819..fb9b67ca27 100644 --- a/panda/src/linmath/lvecBase3_src.h +++ b/panda/src/linmath/lvecBase3_src.h @@ -52,7 +52,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 3; } INLINE_LINMATH bool is_nan() const; @@ -87,7 +87,7 @@ PUBLISHED: INLINE_LINMATH void add_z(FLOATTYPE value); INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 3; } public: INLINE_LINMATH iterator begin(); diff --git a/panda/src/linmath/lvecBase4_src.I b/panda/src/linmath/lvecBase4_src.I index 7890a6f8f0..70a376a3bf 100644 --- a/panda/src/linmath/lvecBase4_src.I +++ b/panda/src/linmath/lvecBase4_src.I @@ -118,14 +118,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 4: the number of components of a LVecBase4. - */ -CONSTEXPR int FLOATNAME(LVecBase4):: -size() { - return 4; -} - /** * Returns true if any component of the vector is not-a-number, false * otherwise. @@ -288,14 +280,6 @@ get_data() const { return &_v(0); } -/** - * Returns the number of elements in the vector, four. - */ -CONSTEXPR int FLOATNAME(LVecBase4):: -get_num_components() { - return 4; -} - /** * Returns an iterator that may be used to traverse the elements of the * matrix, STL-style. @@ -958,14 +942,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 4: the number of components of a LVecBase4. - */ -CONSTEXPR int FLOATNAME(UnalignedLVecBase4):: -size() { - return 4; -} - /** * Returns the address of the first of the three data elements in the vector. * The remaining elements occupy the next positions consecutively in memory. @@ -974,11 +950,3 @@ INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLVecBase4):: get_data() const { return &_v(0); } - -/** - * Returns the number of elements in the vector, 4. - */ -CONSTEXPR int FLOATNAME(UnalignedLVecBase4):: -get_num_components() { - return 4; -} diff --git a/panda/src/linmath/lvecBase4_src.h b/panda/src/linmath/lvecBase4_src.h index 1d4a16e961..b6e1a4df35 100644 --- a/panda/src/linmath/lvecBase4_src.h +++ b/panda/src/linmath/lvecBase4_src.h @@ -62,7 +62,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 4; } INLINE_LINMATH bool is_nan() const; @@ -100,7 +100,7 @@ PUBLISHED: INLINE_LINMATH void add_w(FLOATTYPE value); INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 4; } INLINE_LINMATH void extract_data(float*){}; public: @@ -236,10 +236,10 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 4; } INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 4; } public: typedef FLOATTYPE numeric_type; diff --git a/panda/src/putil/weakKeyHashMap.I b/panda/src/putil/weakKeyHashMap.I index c80e47723d..b4b007f998 100644 --- a/panda/src/putil/weakKeyHashMap.I +++ b/panda/src/putil/weakKeyHashMap.I @@ -307,7 +307,7 @@ template INLINE void WeakKeyHashMap:: set_data(int n, Value &&data) { nassertv(has_element(n)); - _table[n]._data = std::move(data); + _table[n]._data = move(data); } #endif // USE_MOVE_SEMANTICS From 58c1581c0c7520311f72ba07e908f56e99efdf33 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:20:17 -0500 Subject: [PATCH 13/18] Fix .whl version when no explicit --version is specified --- makepanda/makepanda.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 4faa683f87..ac528371c7 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -368,6 +368,9 @@ if VERSION is None: else: VERSION = ParsePandaVersion("dtool/PandaVersion.pp") +if WHLVERSION is None: + WHLVERSION = VERSION + print("Version: %s" % VERSION) if RUNTIME or RTDIST: print("Core API Version: %s" % COREAPI_VERSION) From 72a1a9820baf640fc9d06d6fd73f7f4785d4ce07 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:50:48 -0500 Subject: [PATCH 14/18] Fix issues in ancient ffmpeg versions (Eg. Ubuntu Precise) --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 8e2d0b0e47..c9cee499cd 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -40,6 +40,10 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO #endif +#if LIBAVCODEC_VERSION_MAJOR < 54 +#define AV_CODEC_ID_VP8 CODEC_ID_VP8 +#endif + #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) #define AV_PIX_FMT_NONE PIX_FMT_NONE #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 @@ -116,6 +120,7 @@ init_from(FfmpegVideo *source) { _eof_known = false; _eof_frame = 0; +#if LIBAVUTIL_VERSION_MAJOR >= 52 // Check if we got an alpha format. Please note that some video codecs // (eg. libvpx) change the pix_fmt after decoding the first frame, which is // why we didn't do this earlier. @@ -123,7 +128,9 @@ init_from(FfmpegVideo *source) { if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) { _num_components = 4; _pixel_format = (int)AV_PIX_FMT_BGRA; - } else { + } else +#endif + { _num_components = 3; _pixel_format = (int)AV_PIX_FMT_BGR24; } From ba5bba42b019fdf35e34577ac839bc7a16cefa66 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:51:09 -0500 Subject: [PATCH 15/18] Fix interrogate warnings, flesh out iterator header --- dtool/src/parser-inc/iterator | 72 ++++++++++++++++++++++++++++++++++- dtool/src/parser-inc/memory | 2 +- 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/dtool/src/parser-inc/iterator b/dtool/src/parser-inc/iterator index 40b8e2f479..c6cdf654fa 100644 --- a/dtool/src/parser-inc/iterator +++ b/dtool/src/parser-inc/iterator @@ -1,6 +1,74 @@ #pragma once +#include +#include + namespace std { - template class iterator; - template class reverse_iterator; + // Iterator tags + struct input_iterator_tag {}; + struct output_iterator_tag {}; + struct forward_iterator_tag : public input_iterator_tag {}; + struct bidirectional_iterator_tag : public forward_iterator_tag {}; + struct random_access_iterator_tag : public bidirectional_iterator_tag {}; + + // Iterator traits + template struct iterator_traits { + typedef typename Iterator::difference_type difference_type; + typedef typename Iterator::value_type value_type; + typedef typename Iterator::pointer pointer; + typedef typename Iterator::reference reference; + typedef typename Iterator::iterator_category iterator_category; + }; + + template struct iterator_traits { + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + typedef random_access_iterator_tag iterator_category; + }; + + template struct iterator_traits { + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + typedef random_access_iterator_tag iterator_category; + }; + + // Iterators + template struct iterator { + typedef T value_type; + typedef Distance difference_type; + typedef Pointer pointer; + typedef Reference reference; + typedef Category iterator_category; + }; + + template + class reverse_iterator : public + iterator::iterator_category, + typename iterator_traits::value_type, + typename iterator_traits::difference_type, + typename iterator_traits::pointer, + typename iterator_traits::reference> { + public: + typedef Iterator iterator_type; + typedef typename iterator_traits::difference_type difference_type; + typedef typename iterator_traits::reference reference; + typedef typename iterator_traits::pointer pointer; + }; + + template, + class Distance = ptrdiff_t> + class istream_iterator; + + template> + class ostream_iterator; + + template> + class istreambuf_iterator; + template > + class ostreambuf_iterator; }; diff --git a/dtool/src/parser-inc/memory b/dtool/src/parser-inc/memory index 30a54d006a..8c3a7b1b1d 100644 --- a/dtool/src/parser-inc/memory +++ b/dtool/src/parser-inc/memory @@ -122,7 +122,7 @@ namespace std { struct is_always_equal; template using rebind_alloc = size_t; - template using rebind_traits = allocator_traits >; + //template using rebind_traits = allocator_traits >; }; template class allocator; From 4ed199cece1843453cce95205ed1f9e3affa47e6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 18:45:23 +0100 Subject: [PATCH 16/18] Fix various compile warnings and a few code consistency issues --- direct/src/plugin/p3dInstance.cxx | 8 ++++---- direct/src/plugin/p3dOsxSplashWindow.cxx | 16 ++++++++-------- dtool/src/dtoolbase/dlmalloc_src.cxx | 9 +++++++-- .../interrogate/interfaceMakerPythonNative.cxx | 2 +- dtool/src/parser-inc/arpa/inet.h | 4 ++++ dtool/src/parser-inc/netdb.h | 9 +++++++++ panda/src/audiotraits/fmodAudioManager.cxx | 4 ++-- panda/src/audiotraits/openalAudioManager.cxx | 1 - panda/src/collide/collisionBox.cxx | 8 ++++---- panda/src/collide/collisionFloorMesh.cxx | 4 ++-- .../src/collide/collisionHandlerFluidPusher.cxx | 2 +- panda/src/collide/collisionInvSphere.cxx | 8 ++++---- panda/src/collide/collisionPlane.cxx | 14 +++++++------- panda/src/collide/collisionPolygon.cxx | 12 ++++++------ panda/src/collide/collisionSphere.cxx | 14 +++++++------- panda/src/collide/collisionTube.cxx | 10 +++++----- panda/src/downloader/httpClient.cxx | 2 +- panda/src/gobj/texture_ext.cxx | 4 ++-- panda/src/ode/odeTriMeshData.cxx | 2 +- panda/src/ode/odeTriMeshGeom.I | 2 +- panda/src/pgraph/clipPlaneAttrib.cxx | 4 ++-- panda/src/pgraph/portalClipper.cxx | 2 +- panda/src/physx/physxControllerDesc.h | 3 ++- pandatool/src/xfile/xParser.cxx.prebuilt | 2 +- pandatool/src/xfile/xParser.yxx | 2 +- 25 files changed, 83 insertions(+), 65 deletions(-) create mode 100644 dtool/src/parser-inc/arpa/inet.h create mode 100644 dtool/src/parser-inc/netdb.h diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index b3f96b3f9c..0eabdaafd5 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -3450,8 +3450,8 @@ paint_window_osx_port() { int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size()); size_t rowsize = _swbuffer->get_row_size(); - Rect src_rect = {0, 0, y_size, x_size}; - Rect ddrc_rect = {0, 0, y_size, x_size}; + Rect src_rect = {0, 0, (short)y_size, (short)x_size}; + Rect ddrc_rect = {0, 0, (short)y_size, (short)x_size}; QDErr err; @@ -3502,7 +3502,7 @@ paint_window_osx_cgcontext(CGContextRef context) { int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size()); if (_buffer_image != NULL) { - CGRect region = { { 0, 0 }, { x_size, y_size } }; + CGRect region = { { 0, 0 }, { (CGFloat)x_size, (CGFloat)y_size } }; CGContextDrawImage(context, region, _buffer_image); } } @@ -3538,7 +3538,7 @@ handle_event_osx_event_record(const P3D_event_data &event) { // First, convert the coordinates from screen coordinates to browser // window coordinates. WindowRef window = handle._handle._osx_cgcontext._window; - CGPoint cgpt = { pt.h, pt.v }; + CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v }; HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL, kHICoordSpaceWindow, window); diff --git a/direct/src/plugin/p3dOsxSplashWindow.cxx b/direct/src/plugin/p3dOsxSplashWindow.cxx index 2014251149..c8fc969679 100644 --- a/direct/src/plugin/p3dOsxSplashWindow.cxx +++ b/direct/src/plugin/p3dOsxSplashWindow.cxx @@ -267,7 +267,7 @@ refresh() { return; } if (_toplevel_window != NULL) { - Rect r = { 0, 0, _win_height, _win_width }; + Rect r = { 0, 0, (short)_win_height, (short)_win_width }; InvalWindowRect(_toplevel_window, &r); } else { @@ -345,7 +345,7 @@ paint_window_osx_cgcontext(CGContextRef context) { CGColorSpaceRef rgb_space = CGColorSpaceCreateDeviceRGB(); CGColorRef bg = CGColorCreate(rgb_space, bg_components); - CGRect region = { { 0, 0 }, { _win_width, _win_height } }; + CGRect region = { { 0, 0 }, { (CGFloat)_win_width, (CGFloat)_win_height } }; CGContextSetFillColorWithColor(context, bg); CGContextFillRect(context, region); @@ -407,7 +407,7 @@ handle_event_osx_event_record(const P3D_event_data &event) { // First, convert the coordinates from screen coordinates to browser // window coordinates. WindowRef window = handle._handle._osx_cgcontext._window; - CGPoint cgpt = { pt.h, pt.v }; + CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v }; HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL, kHICoordSpaceWindow, window); @@ -617,7 +617,7 @@ paint_progress_bar(CGContextRef context) { int bar_x, bar_y, bar_width, bar_height; get_bar_placement(bar_x, bar_y, bar_width, bar_height); - CGRect bar_rect = { { bar_x, bar_y }, { bar_width, bar_height } }; + CGRect bar_rect = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)bar_width, (CGFloat)bar_height } }; // Clear the entire progress bar to white (or the background color). CGContextSetFillColorWithColor(context, bar_bg); @@ -627,7 +627,7 @@ paint_progress_bar(CGContextRef context) { if (_progress_known) { int progress_width = (int)(bar_width * _install_progress + 0.5); if (progress_width != 0) { - CGRect prog = { { bar_x, bar_y }, { progress_width, bar_height } }; + CGRect prog = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)progress_width, (CGFloat)bar_height } }; CGContextSetFillColorWithColor(context, bar); CGContextFillRect(context, prog); } @@ -642,7 +642,7 @@ paint_progress_bar(CGContextRef context) { progress = block_travel * 2 - progress; } - CGRect prog = { { bar_x + progress, bar_y }, { block_width, bar_height } }; + CGRect prog = { { (CGFloat)(bar_x + progress), (CGFloat)bar_y }, { (CGFloat)block_width, (CGFloat)bar_height } }; CGContextSetFillColorWithColor(context, bar); CGContextFillRect(context, prog); } @@ -652,8 +652,8 @@ paint_progress_bar(CGContextRef context) { // We offset the border by half a pixel, so we'll be drawing the one-pixel // line through the middle of a pixel, and it won't try to antialias // itself into a half-black two-pixel line. - CGRect border_rect = { { bar_x - 0.5, bar_y - 0.5 }, - { bar_width + 1, bar_height + 1 } }; + CGRect border_rect = { { (CGFloat)(bar_x - 0.5), (CGFloat)(bar_y - 0.5) }, + { (CGFloat)(bar_width + 1), (CGFloat)(bar_height + 1) } }; CGContextBeginPath(context); CGContextSetLineWidth(context, 1); diff --git a/dtool/src/dtoolbase/dlmalloc_src.cxx b/dtool/src/dtoolbase/dlmalloc_src.cxx index 008350de73..a26fcd28cd 100644 --- a/dtool/src/dtoolbase/dlmalloc_src.cxx +++ b/dtool/src/dtoolbase/dlmalloc_src.cxx @@ -587,8 +587,11 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP #define MAX_SIZE_T (~(size_t)0) #ifndef USE_LOCKS /* ensure true if spin or recursive locks set */ -#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \ - (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)) +#if (defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) +#define USE_LOCKS 1 +#else +#define USE_LOCKS 0 +#endif #endif /* USE_LOCKS */ #if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */ @@ -647,7 +650,9 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP #ifndef HAVE_MREMAP #ifdef linux #define HAVE_MREMAP 1 +#ifndef _GNU_SOURCE #define _GNU_SOURCE /* Turns on mremap() definition */ +#endif #else /* linux */ #define HAVE_MREMAP 0 #endif /* linux */ diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index a844771fa6..f24839d331 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -6198,7 +6198,7 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName, // the assumption that the called method doesn't do anything with this // tuple other than unpack it (which is a fairly safe assumption to make). out << " PyTupleObject args;\n"; - out << " PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n"; + out << " (void)PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n"; } out << diff --git a/dtool/src/parser-inc/arpa/inet.h b/dtool/src/parser-inc/arpa/inet.h new file mode 100644 index 0000000000..a3ed68c461 --- /dev/null +++ b/dtool/src/parser-inc/arpa/inet.h @@ -0,0 +1,4 @@ +#pragma once + +#include +#include diff --git a/dtool/src/parser-inc/netdb.h b/dtool/src/parser-inc/netdb.h new file mode 100644 index 0000000000..367025cd3a --- /dev/null +++ b/dtool/src/parser-inc/netdb.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +struct hostent; +struct netent; +struct protoent; +struct servent; diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 7d7ae246e3..dc98e76287 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -424,8 +424,8 @@ get_sound(const string &file_name, bool positional, int) { vfs->resolve_filename(path, get_model_path()); // Build a new AudioSound from the audio data. - PT(AudioSound) audioSound = 0; - PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional ); + PT(AudioSound) audioSound; + PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional); _all_sounds.insert(fmodAudioSound); diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index ba1b4684a3..b6d68a0ec0 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -1022,7 +1022,6 @@ cleanup() { OpenALAudioManager::SoundData:: SoundData() : _manager(0), - _movie(0), _sample(0), _stream(NULL), _length(0.0), diff --git a/panda/src/collide/collisionBox.cxx b/panda/src/collide/collisionBox.cxx index b358d8b359..b55988c352 100644 --- a/panda/src/collide/collisionBox.cxx +++ b/panda/src/collide/collisionBox.cxx @@ -199,7 +199,7 @@ PT(CollisionEntry) CollisionBox:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space(); @@ -402,7 +402,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionBox:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); LPoint3 from_origin = ray->get_origin() * wrt_mat; @@ -483,7 +483,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionBox:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *seg; - DCAST_INTO_R(seg, entry.get_from(), 0); + DCAST_INTO_R(seg, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); LPoint3 from_origin = seg->get_point_a() * wrt_mat; @@ -564,7 +564,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionBox:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionFloorMesh.cxx b/panda/src/collide/collisionFloorMesh.cxx index fcec727778..d523875727 100644 --- a/panda/src/collide/collisionFloorMesh.cxx +++ b/panda/src/collide/collisionFloorMesh.cxx @@ -125,7 +125,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionFloorMesh:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); LPoint3 from_origin = ray->get_origin() * entry.get_wrt_mat(); double fx = from_origin[0]; @@ -190,7 +190,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionFloorMesh:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); LPoint3 from_origin = sphere->get_center() * entry.get_wrt_mat(); double fx = from_origin[0]; diff --git a/panda/src/collide/collisionHandlerFluidPusher.cxx b/panda/src/collide/collisionHandlerFluidPusher.cxx index eea0cc1f22..0a48381d01 100644 --- a/panda/src/collide/collisionHandlerFluidPusher.cxx +++ b/panda/src/collide/collisionHandlerFluidPusher.cxx @@ -136,7 +136,7 @@ handle_entries() { // currently we only support spheres as the collider const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entries.front()->get_from(), 0); + DCAST_INTO_R(sphere, entries.front()->get_from(), false); from_node_path.set_pos(wrt_node, 0,0,0); LPoint3 sphere_offset = (sphere->get_center() * diff --git a/panda/src/collide/collisionInvSphere.cxx b/panda/src/collide/collisionInvSphere.cxx index 913ef32589..35a73225dd 100644 --- a/panda/src/collide/collisionInvSphere.cxx +++ b/panda/src/collide/collisionInvSphere.cxx @@ -92,7 +92,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -144,7 +144,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -185,7 +185,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -228,7 +228,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionPlane.cxx b/panda/src/collide/collisionPlane.cxx index c551464960..d722adde7b 100644 --- a/panda/src/collide/collisionPlane.cxx +++ b/panda/src/collide/collisionPlane.cxx @@ -107,7 +107,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -146,7 +146,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -191,7 +191,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -243,7 +243,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -300,7 +300,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_tube(const CollisionEntry &entry) const { const CollisionTube *tube; - DCAST_INTO_R(tube, entry.get_from(), 0); + DCAST_INTO_R(tube, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -371,7 +371,7 @@ test_intersection_from_tube(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_parabola(const CollisionEntry &entry) const { const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -437,7 +437,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index ff64dcc298..646a7b9439 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -364,7 +364,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { } const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space(); @@ -545,7 +545,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { } const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -613,7 +613,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { } const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -686,7 +686,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { } const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -761,7 +761,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { } const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -846,7 +846,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPolygon:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); // To make things easier, transform the box into the coordinate space of the // plane. diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 2e0802b350..139a39a4b1 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -120,7 +120,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); @@ -231,7 +231,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -271,7 +271,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); // Instead of transforming the box into the sphere's coordinate space, we do // it the other way around. It's easier that way. @@ -347,7 +347,7 @@ test_intersection_from_box(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -394,7 +394,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -443,7 +443,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_tube(const CollisionEntry &entry) const { const CollisionTube *tube; - DCAST_INTO_R(tube, entry.get_from(), 0); + DCAST_INTO_R(tube, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -499,7 +499,7 @@ test_intersection_from_tube(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_parabola(const CollisionEntry &entry) const { const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionTube.cxx b/panda/src/collide/collisionTube.cxx index cb3f24f737..8e3b188aab 100644 --- a/panda/src/collide/collisionTube.cxx +++ b/panda/src/collide/collisionTube.cxx @@ -146,7 +146,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionTube:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space(); @@ -224,7 +224,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -272,7 +272,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -333,7 +333,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -397,7 +397,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_parabola(const CollisionEntry &entry) const { const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index 63ba1c6258..129d5fb6be 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -807,7 +807,7 @@ load_client_certificate() { // Rewind the "file" to the beginning in order to read the public key // (which might appear first in the file). - BIO_reset(mbio); + (void)BIO_reset(mbio); ERR_clear_error(); _client_certificate_pub = diff --git a/panda/src/gobj/texture_ext.cxx b/panda/src/gobj/texture_ext.cxx index 1e661e960a..507fa41fc4 100644 --- a/panda/src/gobj/texture_ext.cxx +++ b/panda/src/gobj/texture_ext.cxx @@ -66,7 +66,7 @@ set_ram_image(PyObject *image, Texture::CompressionMode compression, if (view.len % component_width != 0) { PyErr_Format(PyExc_ValueError, - "byte buffer is not a multiple of %zu bytes", + "byte buffer is not a multiple of %d bytes", component_width); return; } @@ -131,7 +131,7 @@ set_ram_image_as(PyObject *image, const string &provided_format) { if (view.len % component_width != 0) { PyErr_Format(PyExc_ValueError, - "byte buffer is not a multiple of %zu bytes", + "byte buffer is not a multiple of %d bytes", component_width); return; } diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx index afae75b753..5f02cefa56 100644 --- a/panda/src/ode/odeTriMeshData.cxx +++ b/panda/src/ode/odeTriMeshData.cxx @@ -29,7 +29,7 @@ get_data(dGeomID id) { if (iter != data_map.end()) { return iter->second; } - return 0; + return NULL; } void OdeTriMeshData:: diff --git a/panda/src/ode/odeTriMeshGeom.I b/panda/src/ode/odeTriMeshGeom.I index 8bfd233bbf..b0a2e6177c 100644 --- a/panda/src/ode/odeTriMeshGeom.I +++ b/panda/src/ode/odeTriMeshGeom.I @@ -34,7 +34,7 @@ set_tri_mesh_data(OdeTriMeshData &data) { INLINE PT(OdeTriMeshData) OdeTriMeshGeom:: get_tri_mesh_data() const { - nassertr(_id != 0 ,0); + nassertr(_id != 0, NULL); return OdeTriMeshData::get_data(_id); } diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index e62a3d6e24..c95f9437c4 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -487,7 +487,7 @@ filter_to_max(int max_clip_planes) const { CPT(RenderAttrib) ClipPlaneAttrib:: compose_off(const RenderAttrib *other) const { const ClipPlaneAttrib *ta; - DCAST_INTO_R(ta, other, 0); + DCAST_INTO_R(ta, other, NULL); if (_off_all_planes || (!ta->_off_all_planes && ta->_off_planes.empty())) { // If we turn off all planes, or the other turns none off, the result is @@ -701,7 +701,7 @@ get_hash_impl() const { CPT(RenderAttrib) ClipPlaneAttrib:: compose_impl(const RenderAttrib *other) const { const ClipPlaneAttrib *ta; - DCAST_INTO_R(ta, other, 0); + DCAST_INTO_R(ta, other, NULL); if (ta->_off_all_planes) { // If the other type turns off all planes, it doesn't matter what we are. diff --git a/panda/src/pgraph/portalClipper.cxx b/panda/src/pgraph/portalClipper.cxx index 7b9e55556b..f6d45aab8f 100644 --- a/panda/src/pgraph/portalClipper.cxx +++ b/panda/src/pgraph/portalClipper.cxx @@ -39,7 +39,7 @@ PortalClipper:: PortalClipper(GeometricBoundingVolume *frustum, SceneSetup *scene_setup): _reduced_viewport_min(-1,-1), _reduced_viewport_max(1,1), -_clip_state(0) +_clip_state(NULL) { _previous = new GeomNode("my_frustum"); diff --git a/panda/src/physx/physxControllerDesc.h b/panda/src/physx/physxControllerDesc.h index 7919b60118..4624938ffd 100644 --- a/panda/src/physx/physxControllerDesc.h +++ b/panda/src/physx/physxControllerDesc.h @@ -23,8 +23,9 @@ * Descriptor class for a character controller. */ class EXPCL_PANDAPHYSX PhysxControllerDesc { - PUBLISHED: + virtual ~PhysxControllerDesc() {}; + virtual void set_to_default() = 0; virtual bool is_valid() const = 0; diff --git a/pandatool/src/xfile/xParser.cxx.prebuilt b/pandatool/src/xfile/xParser.cxx.prebuilt index 606ead1db3..42c65a72a6 100644 --- a/pandatool/src/xfile/xParser.cxx.prebuilt +++ b/pandatool/src/xfile/xParser.cxx.prebuilt @@ -98,7 +98,7 @@ static XFile *x_file = (XFile *)NULL; static XFileNode *current_node = (XFileNode *)NULL; -static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL; +static PT(XFileDataDef) current_data_def; //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. diff --git a/pandatool/src/xfile/xParser.yxx b/pandatool/src/xfile/xParser.yxx index 4aa8ffd3b3..a98f39d177 100644 --- a/pandatool/src/xfile/xParser.yxx +++ b/pandatool/src/xfile/xParser.yxx @@ -32,7 +32,7 @@ static XFile *x_file = (XFile *)NULL; static XFileNode *current_node = (XFileNode *)NULL; -static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL; +static PT(XFileDataDef) current_data_def; //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. From 43a5f2a9f20118db9fcbeec14467c97a711d37b6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 20:38:33 +0100 Subject: [PATCH 17/18] Fixes for Python 3.5: - Disable conversion to Windows newlines, which is causing double Windows newlines for Config.prc - We need to copy vcruntime140.dll to the bin directory for Python 3.5+ build using MSVC 2010 to work --- makepanda/makepanda.py | 6 +++--- makepanda/makepandacore.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ac528371c7..6a7d8ce521 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2887,8 +2887,8 @@ if tp_dir is not None: pydll += ".dll" CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll) - #for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): - # CopyFile(GetOutputDir() + "/bin/", fn) + for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): + CopyFile(GetOutputDir() + "/bin/", fn) # Copy the whole Python directory. CopyTree(GetOutputDir() + "/python", SDK["PYTHON"]) @@ -2907,7 +2907,7 @@ if tp_dir is not None: else: idents = () - for ident in tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity'): + for ident in idents: sxs_name = '_'.join([ ident.get('processorArchitecture'), ident.get('name').lower(), diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index ee903a3940..24f3614337 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -980,7 +980,10 @@ def WriteFile(wfile, data, newline=None): data = data.replace('\n', newline) try: - dsthandle = open(wfile, "w") + if sys.version_info >= (3, 0): + dsthandle = open(wfile, "w", newline='') + else: + dsthandle = open(wfile, "w") dsthandle.write(data) dsthandle.close() except: From 749e09d49ecc31a5235a4af46849626b483f5936 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 23:10:51 +0100 Subject: [PATCH 18/18] ffmpeg: don't hide last frame of video This is not quite a complete fix, since the last frame of the video won't be shown long enough for it to matter when looping the video. A more complete fix may be needed later. --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index c9cee499cd..8a23853811 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -327,13 +327,13 @@ set_time(double timestamp, int loop_count) { if (_eof_known) { if (loop_count == 0) { - frame = frame % _eof_frame; + frame = frame % (_eof_frame + 1); } else { - int last_frame = _eof_frame * loop_count; + int last_frame = (_eof_frame + 1) * loop_count; if (frame < last_frame) { - frame = frame % _eof_frame; + frame = frame % (_eof_frame + 1); } else { - frame = _eof_frame - 1; + frame = _eof_frame; } } }