Skip to content

Commit bd86907

Browse files
committed
Fix assortment of compilation issues and annoyances
1 parent 91568b0 commit bd86907

33 files changed

+286
-143
lines changed

dtool/src/dtoolbase/atomicAdjustWin32Impl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
#ifdef WIN32_VC
2222

2323
#include "numeric_types.h"
24-
#define WIN32_LEAN_AND_MEAN
24+
25+
#ifndef WIN32_LEAN_AND_MEAN
26+
#define WIN32_LEAN_AND_MEAN 1
27+
#endif
2528
#include <windows.h>
2629

2730
////////////////////////////////////////////////////////////////////

dtool/src/dtoolbase/dlmalloc.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,15 @@ void* dlvalloc(size_t);
148148
*/
149149
int dlmallopt(int, int);
150150

151+
#ifndef M_TRIM_THRESHOLD
151152
#define M_TRIM_THRESHOLD (-1)
153+
#endif
154+
#ifndef M_GRANULARITY
152155
#define M_GRANULARITY (-2)
156+
#endif
157+
#ifndef M_MMAP_THRESHOLD
153158
#define M_MMAP_THRESHOLD (-3)
154-
159+
#endif
155160

156161
/*
157162
malloc_footprint();

dtool/src/dtoolbase/dlmalloc_src.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ DEFAULT_MMAP_THRESHOLD default: 256K
462462
#endif /* _WIN32 */
463463
#endif /* WIN32 */
464464
#ifdef WIN32
465-
#define WIN32_LEAN_AND_MEAN
465+
#ifndef WIN32_LEAN_AND_MEAN
466+
#define WIN32_LEAN_AND_MEAN 1
467+
#endif
466468
#include <windows.h>
467469
#define HAVE_MMAP 1
468470
#define HAVE_MORECORE 0
@@ -597,9 +599,15 @@ DEFAULT_MMAP_THRESHOLD default: 256K
597599
malloc does support the following options.
598600
*/
599601

602+
#ifndef M_TRIM_THRESHOLD
600603
#define M_TRIM_THRESHOLD (-1)
604+
#endif
605+
#ifndef M_GRANULARITY
601606
#define M_GRANULARITY (-2)
607+
#endif
608+
#ifndef M_MMAP_THRESHOLD
602609
#define M_MMAP_THRESHOLD (-3)
610+
#endif
603611

604612
/* ------------------------ Mallinfo declarations ------------------------ */
605613

dtool/src/dtoolbase/memoryHook.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#ifdef WIN32
2020

2121
// Windows case.
22-
#define WIN32_LEAN_AND_MEAN
22+
#ifndef WIN32_LEAN_AND_MEAN
23+
#define WIN32_LEAN_AND_MEAN 1
24+
#endif
2325
#include <windows.h>
2426

2527
#else

dtool/src/dtoolbase/mutexWin32Impl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include "selectThreadImpl.h"
2020

2121
#ifdef WIN32_VC
22-
#define WIN32_LEAN_AND_MEAN
22+
#ifndef WIN32_LEAN_AND_MEAN
23+
#define WIN32_LEAN_AND_MEAN 1
24+
#endif
2325
#include <windows.h>
2426

2527
////////////////////////////////////////////////////////////////////

dtool/src/dtoolbase/ptmalloc2_smp_src.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,9 @@ int tsd_key_next;
482482
#elif defined(WIN32)
483483
/* Win32 emulation */
484484

485-
#define WIN32_LEAN_AND_MEAN
485+
#ifndef WIN32_LEAN_AND_MEAN
486+
#define WIN32_LEAN_AND_MEAN 1
487+
#endif
486488
#define _WIN32_WINNT 0x600
487489
#include <windows.h>
488490

dtool/src/dtoolutil/pandaFileStreamBuf.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#ifdef USE_PANDAFILESTREAM
2121

2222
#if defined(_WIN32)
23-
#define WIN32_LEAN_AND_MEAN
23+
#ifndef WIN32_LEAN_AND_MEAN
24+
#define WIN32_LEAN_AND_MEAN 1
25+
#endif
2426
#include <windows.h>
2527
#endif
2628

dtool/src/dtoolutil/pfstreamBuf.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
#endif
2929

3030
#ifdef WIN_PIPE_CALLS
31-
#define WIN32_LEAN_AND_MEAN
31+
#ifndef WIN32_LEAN_AND_MEAN
32+
#define WIN32_LEAN_AND_MEAN 1
33+
#endif
3234
#include <windows.h>
3335

3436
#else // WIN_PIPE_CALLS

makepanda/makepanda.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,10 @@ def CompileLink(dll, obj, opts):
15181518
else:
15191519
cmd = cxx + ' -shared'
15201520
if ("MODULE" not in opts): cmd += " -Wl,-soname=" + os.path.basename(dll)
1521+
if GetOrigExt(dll) == ".pyd" and not os.path.basename(dll).startswith('core'):
1522+
# Tell the other libraries where to find core.so.
1523+
# Not sure if this is the best way to do that, but it works.
1524+
cmd += " -Wl,-rpath '-Wl,$ORIGIN'"
15211525
cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
15221526

15231527
for x in obj:

panda/src/display/graphicsWindowProc.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
////////////////////////////////////////////////////////////////////
1414

15-
1615
#ifndef GRAPHICSWINDOWPROC_H
1716
#define GRAPHICSWINDOWPROC_H
1817

@@ -25,6 +24,8 @@
2524
#include <windows.h>
2625
#endif
2726

27+
class GraphicsWindow;
28+
2829
////////////////////////////////////////////////////////////////////
2930
// Class : GraphicsWindowProc
3031
// Description : Defines an interface for storing platform-specific
@@ -34,9 +35,10 @@ class GraphicsWindowProc{
3435
public:
3536
GraphicsWindowProc();
3637
#if defined(__WIN32__) || defined(_WIN32)
37-
virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
38+
virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd,
39+
UINT msg, WPARAM wparam, LPARAM lparam);
3840
#endif
3941
//purely virtual class
4042
};
4143

42-
#endif //GRAPHICSWINDOWPROC_H
44+
#endif // GRAPHICSWINDOWPROC_H

0 commit comments

Comments
 (0)