From 7f7f85794dbd94398ebdeace92187d0db881ee6a Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Oct 2015 21:09:35 +0200 Subject: [PATCH] Fix various compilation and linker issues across several platforms --- direct/src/dcparser/dcPython.h | 4 +++- makepanda/makepanda.py | 2 ++ panda/src/pgraph/renderState.cxx | 8 ++++---- panda/src/pgraph/transformState.cxx | 6 +++--- panda/src/putil/bitArray.cxx | 4 ++-- panda/src/putil/paramValue.h | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/direct/src/dcparser/dcPython.h b/direct/src/dcparser/dcPython.h index d5a50baa2f..f04aa11e6b 100644 --- a/direct/src/dcparser/dcPython.h +++ b/direct/src/dcparser/dcPython.h @@ -20,8 +20,10 @@ #ifdef HAVE_PYTHON -#undef HAVE_LONG_LONG // NSPR and Python both define this. +#define PY_SSIZE_T_CLEAN 1 + #undef _POSIX_C_SOURCE +#undef _XOPEN_SOURCE #include // Python 2.5 adds Py_ssize_t; earlier versions don't have it. diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ad9f40792c..07bdd7e538 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1653,6 +1653,8 @@ def CompileLink(dll, obj, opts): else: cmd += " -pthread" + cmd += " -Wl,-allow-multiple-definition" + if LDFLAGS != "": cmd += " " + LDFLAGS diff --git a/panda/src/pgraph/renderState.cxx b/panda/src/pgraph/renderState.cxx index a3f4c6c9a7..fd385668df 100644 --- a/panda/src/pgraph/renderState.cxx +++ b/panda/src/pgraph/renderState.cxx @@ -985,7 +985,7 @@ clear_cache() { RenderState *state = (RenderState *)(*ti).p(); int i; - int cache_size = state->_composition_cache.get_size(); + int cache_size = (int)state->_composition_cache.get_size(); for (i = 0; i < cache_size; ++i) { if (state->_composition_cache.has_element(i)) { const RenderState *result = state->_composition_cache.get_data(i)._result; @@ -995,10 +995,10 @@ clear_cache() { } } } - _cache_stats.add_total_size(-state->_composition_cache.get_num_entries()); + _cache_stats.add_total_size(-(int)state->_composition_cache.get_num_entries()); state->_composition_cache.clear(); - cache_size = state->_invert_composition_cache.get_size(); + cache_size = (int)state->_invert_composition_cache.get_size(); for (i = 0; i < cache_size; ++i) { if (state->_invert_composition_cache.has_element(i)) { const RenderState *result = state->_invert_composition_cache.get_data(i)._result; @@ -1008,7 +1008,7 @@ clear_cache() { } } } - _cache_stats.add_total_size(-state->_invert_composition_cache.get_num_entries()); + _cache_stats.add_total_size(-(int)state->_invert_composition_cache.get_num_entries()); state->_invert_composition_cache.clear(); } diff --git a/panda/src/pgraph/transformState.cxx b/panda/src/pgraph/transformState.cxx index bffa840479..7daf7c0a40 100644 --- a/panda/src/pgraph/transformState.cxx +++ b/panda/src/pgraph/transformState.cxx @@ -1174,7 +1174,7 @@ clear_cache() { TransformState *state = (TransformState *)(*ti).p(); int i; - int cache_size = state->_composition_cache.get_size(); + int cache_size = (int)state->_composition_cache.get_size(); for (i = 0; i < cache_size; ++i) { if (state->_composition_cache.has_element(i)) { const TransformState *result = state->_composition_cache.get_data(i)._result; @@ -1184,7 +1184,7 @@ clear_cache() { } } } - _cache_stats.add_total_size(-state->_composition_cache.get_num_entries()); + _cache_stats.add_total_size(-(int)state->_composition_cache.get_num_entries()); state->_composition_cache.clear(); cache_size = state->_invert_composition_cache.get_size(); @@ -1197,7 +1197,7 @@ clear_cache() { } } } - _cache_stats.add_total_size(-state->_invert_composition_cache.get_num_entries()); + _cache_stats.add_total_size(-(int)state->_invert_composition_cache.get_num_entries()); state->_invert_composition_cache.clear(); } diff --git a/panda/src/putil/bitArray.cxx b/panda/src/putil/bitArray.cxx index d7a5aace02..99e7d7d653 100644 --- a/panda/src/putil/bitArray.cxx +++ b/panda/src/putil/bitArray.cxx @@ -575,8 +575,8 @@ output_binary(ostream &out, int spaces_every) const { if (_highest_bits) { out << "...1 "; } - size_t num_bits = max(get_num_bits(), (size_t)spaces_every); - for (size_t i = num_bits - 1; i >= 0; i--) { + int num_bits = max((int)get_num_bits(), spaces_every); + for (int i = num_bits - 1; i >= 0; i--) { if (spaces_every != 0 && ((i % spaces_every) == spaces_every - 1)) { out << ' '; } diff --git a/panda/src/putil/paramValue.h b/panda/src/putil/paramValue.h index 694c34529d..e1a4ca9cf0 100644 --- a/panda/src/putil/paramValue.h +++ b/panda/src/putil/paramValue.h @@ -153,6 +153,8 @@ private: static TypeHandle _type_handle; }; +#include "paramValue.I" + EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, ParamValue); EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, ParamValue); @@ -211,8 +213,6 @@ typedef ParamMatrix3f ParamMatrix3; typedef ParamMatrix4f ParamMatrix4; #endif -#include "paramValue.I" - // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ #pragma interface