From e10c8b7b69697d2aa01fe9e30ef6fd8002eb12ef Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 5 Jan 2016 02:17:08 -0800 Subject: [PATCH] Define DEBUG and MOO_DEBUG (but not _DEBUG) in debug windows builds. --- CMakeLists.txt | 5 ++++- moo/moo-config.h | 10 ++++++---- moo/moo-pch.h | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e13eba4a..0d8a5239 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,8 +161,11 @@ else() set(${var}_RELEASE "${${var}_RELEASE} /Zi") string(REPLACE "/Ob1" "/Ob2" ${var}_RELWITHDEBINFO "${${var}_RELWITHDEBINFO}") + + # /MDd means link with the debug crt library, which we don't want; and /D_DEBUG forces + # that as well because of some includes; turn them off. string(REPLACE "/MDd" "/MD" ${var}_DEBUG "${${var}_DEBUG}") - string(REPLACE "/D_DEBUG" "" ${var}_DEBUG "${${var}_DEBUG}") + string(REPLACE "/D_DEBUG" "/DENABLE_DEBUG=1 /DDEBUG=1 /DMOO_DEBUG=1" ${var}_DEBUG "${${var}_DEBUG}") endforeach() set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /INCREMENTAL") diff --git a/moo/moo-config.h b/moo/moo-config.h index e5148c80..3c39ea9b 100644 --- a/moo/moo-config.h +++ b/moo/moo-config.h @@ -1,5 +1,9 @@ -#ifndef MOO_CONFIG_H -#define MOO_CONFIG_H +#pragma once + +#if (defined(DEBUG) && ((!DEBUG) || !(MOO_DEBUG) || !(ENABLE_DEBUG))) || \ + (!defined(DEBUG) && (defined(MOO_DEBUG) || defined(ENABLE_DEBUG))) +# error "DEBUG, MOO_DEBUG, and ENABLE_DEBUG must either be all defined to non-zero or all undefined" +#endif #undef MOO_CL_GCC #undef MOO_CL_MINGW @@ -59,5 +63,3 @@ # define MOO_CDECL __cdecl # define MOO_STDCALL __stdcall #endif - -#endif /* MOO_CONFIG_H */ diff --git a/moo/moo-pch.h b/moo/moo-pch.h index 378d8462..3a668e3b 100644 --- a/moo/moo-pch.h +++ b/moo/moo-pch.h @@ -15,3 +15,7 @@ #include #endif // __WIN32__ + +#ifdef MOO_ENABLE_PYTHON +#include +#endif