Changeset 20363

Show
Ignore:
Timestamp:
06/27/07 15:40:03 (1 year ago)
Author:
patrick
Message:

Merges from the trunk:

r20345: Change the preprocessor symbols that we use for identifying debug

and optimized builds. Instead of using _DEBUG and _OPT, we now look
for JUGGLER_DEBUG and JUGGLER_OPT or module-specific identifiers
such as GADGET_DEBUG and GADGET_OPT. Using _DEBUG was a bad idea
because it is used by Visual C++ to identify when the debug runtime
is to be linked. This caused us a lot of problems over the years.

On Windows, we now support three types of builds:

  1. Optimized and linked against the release runtime
  2. Debug-enabled and linked against the release runtime (the
    "_g" variant)
  3. Debug-enabled and linked against the debug runtime (the "_d"
    variant)

Automatic linking takes care of choosing the correct .lib file as
long as _DEBUG is not defined explicitly. Instead, it should only
be defined implicitly as a result of using /MDd when compiling.
User-level code on any platform should define JUGGLER_DEBUG or the
module-specific …_DEBUG symbol to indicate that debugging
capabilities are desired.

r20357: Using /DEBUG when linking causes problems with Visual C++ 7.1 and

automatic linking when the desired outcome is to link against the
"_g" DLL variant. For some reason, /DEBUG causes linking against
both the "_g" variant and the "_d" variant, and that makes
application execution go quite poorly. Visual C++ 8.0 does not
seem to exhibit this behavior, but I have changed those .vcproj
files, too.

This change includes incidental modifications made by Visual Studio
as a result of editing the linker settings in the project files.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/branches/2.2/build_windows.py

    r20331 r20363  
    10581058def installLibs(srcRoot, destdir, 
    10591059                buildPlatforms = ['Win32', 'x64'], 
    1060                 buildTypes = ['ReleaseDLL', 'DebugDLL', 'Release', 'Debug'], 
     1060                buildTypes = ['ReleaseDLL', 'DebugDLL', 'DebugRtDLL', 
     1061                              'Release', 'Debug'], 
    10611062                extensions = ['.dll', '.lib']): 
    10621063   for p in buildPlatforms: 
     
    13661367   printStatus("Installing Sonix plug-ins ...") 
    13671368 
    1368    destdir_dbg = os.path.join(prefix, 'lib', 'snx', 'plugins', 'dbg') 
    1369    destdir_opt = os.path.join(prefix, 'lib', 'snx', 'plugins', 'opt') 
     1369   destdir_dbg   = os.path.join(prefix, 'lib', 'snx', 'plugins', 'dbg') 
     1370   destdir_dbgrt = os.path.join(prefix, 'lib', 'snx', 'plugins', 'dbgrt') 
     1371   destdir_opt   = os.path.join(prefix, 'lib', 'snx', 'plugins', 'opt') 
    13701372 
    13711373   srcroot = os.path.join(buildDir, 'Sonix', 'OpenAL') 
    13721374   installLibs(srcroot, destdir_dbg, buildTypes = ['DebugDLL'], 
    13731375               extensions = ['.dll']) 
     1376   installLibs(srcroot, destdir_dbgrt, buildTypes = ['DebugRtDLL'], 
     1377               extensions = ['.dll']) 
    13741378   installLibs(srcroot, destdir_opt, buildTypes = ['ReleaseDLL'], 
    13751379               extensions = ['.dll']) 
     
    13771381   srcroot = os.path.join(buildDir, 'Sonix', 'Audiere') 
    13781382   installLibs(srcroot, destdir_dbg, buildTypes = ['DebugDLL'], 
     1383               extensions = ['.dll']) 
     1384   installLibs(srcroot, destdir_dbgrt, buildTypes = ['DebugRtDLL'], 
    13791385               extensions = ['.dll']) 
    13801386   installLibs(srcroot, destdir_opt, buildTypes = ['ReleaseDLL'], 
  • juggler/branches/2.2/modules/gadgeteer/Makefile.inc.in

    r20102 r20363  
    4343 
    4444# Extra compiler and linker options needed only by this file. 
    45 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    46 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     45DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     46OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4747 
    4848# ============================================================================= 
  • juggler/branches/2.2/modules/gadgeteer/drivers/Makefile.inc.in

    r20107 r20363  
    4242 
    4343# Extra compiler and linker options needed only by this file. 
    44 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    45 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     44DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     45OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4646 
    4747# ============================================================================= 
  • juggler/branches/2.2/modules/gadgeteer/drivers/gadget.driver.mk.in

    r19987 r20363  
    115115   DEBUG_APP=           TRUE 
    116116   OPTIM_APP=           FALSE 
    117    EXTRA_DEFS+=         -D_DEBUG 
     117   EXTRA_DEFS+=         -DJUGGLER_DEBUG 
    118118else 
    119119   BUILD_TYPE_EXT=       
    120120   DEBUG_APP=           FALSE 
    121121   OPTIM_APP=           TRUE 
    122    EXTRA_DEFS+=         -D_OPT -DNDEBUG 
     122   EXTRA_DEFS+=         -DJUGGLER_OPT -DNDEBUG 
    123123endif 
    124124 
  • juggler/branches/2.2/modules/gadgeteer/gadget/AutoLink.h

    r19729 r20363  
    3131#  include <gadget/gadgetParam.h> 
    3232 
    33 #  if defined(GADGET_DEBUG) && !defined(_USE_RELEASE_RUNTIME) 
    34 #     define GADGET_LIB_RT_OPT "_d" 
     33#  if defined(GADGET_DEBUG) 
     34#     if defined(_DEBUG) 
     35#        define GADGET_LIB_RT_OPT "_d" 
     36#     else 
     37#        define GADGET_LIB_RT_OPT "_g" 
     38#     endif 
    3539#  else 
    3640#     define GADGET_LIB_RT_OPT "" 
  • juggler/branches/2.2/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputWindowWin32.cpp

    r19729 r20363  
    283283   pWndClass->lpszClassName = ("Gadgeteer Event Window"); 
    284284 
    285 #ifdef _DEBUG 
    286 #  define LIBNAME "gadget_d.dll" 
     285#if defined(GADGET_DEBUG) 
     286#  if defined(_DEBUG) 
     287#     define LIBNAME "gadget_d.dll" 
     288#  else 
     289#     define LIBNAME "gadget_g.dll" 
     290#  endif 
    287291#else 
    288292#  define LIBNAME "gadget.dll" 
  • juggler/branches/2.2/modules/gadgeteer/gadget/gadgetConfig.h

    r19729 r20363  
    4848#undef PACKAGE_VERSION 
    4949 
    50 #ifdef _DEBUG 
     50/* 
     51 * If either JUGGLER_DEBUG or _DEBUG is defined, that implies the need for 
     52 * GADGET_DEBUG. 
     53 */ 
     54#if ! defined(GADGET_DEBUG) && (defined(JUGGLER_DEBUG) || defined(_DEBUG)) 
    5155#   define GADGET_DEBUG 
    52 #else 
     56/* If JUGGLER_OPT is defined, make sure that GADGET_OPT is also defined. */ 
     57#elif defined(JUGGLER_OPT) && ! defined(GADGET_OPT) 
    5358#   define GADGET_OPT 
    5459#endif 
  • juggler/branches/2.2/modules/gadgeteer/plugins/Makefile.inc.in

    r20107 r20363  
    4242 
    4343# Extra compiler and linker options needed only by this file. 
    44 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    45 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     44DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     45OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4646 
    4747# ============================================================================= 
  • juggler/branches/2.2/modules/gadgeteer/plugins/gadget.plugin.mk.in

    r19987 r20363  
    118118   DEBUG_APP=           TRUE 
    119119   OPTIM_APP=           FALSE 
    120    EXTRA_DEFS+=         -D_DEBUG 
     120   EXTRA_DEFS+=         -DJUGGLER_DEBUG 
    121121else 
    122122   BUILD_TYPE_EXT=       
    123123   DEBUG_APP=           FALSE 
    124124   OPTIM_APP=           TRUE 
    125    EXTRA_DEFS+=         -D_OPT -DNDEBUG 
     125   EXTRA_DEFS+=         -DJUGGLER_OPT -DNDEBUG 
    126126endif 
    127127 
  • juggler/branches/2.2/modules/gadgeteer/samples/tutorials/device.drivers/buttondevice.vcproj

    r19030 r20363  
    1313                <Configuration 
    1414                        Name="Debug|Win32" 
    15                         OutputDirectory="DebugDLL
    16                         IntermediateDirectory="DebugDLL
     15                        OutputDirectory="$(PlatformName)\$(ConfigurationName)
     16                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)
    1717                        ConfigurationType="2" 
    1818                        CharacterSet="2"> 
     
    2121                                Optimization="0" 
    2222                                AdditionalIncludeDirectories="&quot;$(VJ_BASE_DIR)\include&quot;;&quot;$(VJ_DEPS_DIR)\include&quot;" 
    23                                 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USRDLL;_GADGET_DRIVER_BUILD_" 
     23                                PreprocessorDefinitions="WIN32;JUGGLER_DEBUG;_CONSOLE;_USRDLL;_GADGET_DRIVER_BUILD_" 
     24                                MinimalRebuild="FALSE" 
     25                                RuntimeLibrary="2" 
     26                                BufferSecurityCheck="FALSE" 
     27                                RuntimeTypeInfo="TRUE" 
     28                                UsePrecompiledHeader="0" 
     29                                WarningLevel="3" 
     30                                Detect64BitPortabilityProblems="TRUE" 
     31                                DebugInformationFormat="1" 
     32                                DisableSpecificWarnings="4244;4251;4267;4275;4290;4312;4800"/> 
     33                        <Tool 
     34                                Name="VCCustomBuildTool"/> 
     35                        <Tool 
     36                                Name="VCLinkerTool" 
     37                                AdditionalDependencies="libnspr4.lib libplc4.lib ws2_32.lib $(NOINHERIT)" 
     38                                OutputFile="$(OutDir)/button_drv_g.dll" 
     39                                LinkIncremental="1" 
     40                                AdditionalLibraryDirectories="&quot;$(VJ_BASE_DIR)\lib&quot;;&quot;$(VJ_DEPS_DIR)\lib&quot;" 
     41                                GenerateDebugInformation="FALSE" 
     42                                ProgramDatabaseFile="$(OutDir)/button_drv_g.pdb" 
     43                                SubSystem="1" 
     44                                ImportLibrary="$(OutDir)/button_drv_g.lib" 
     45                                TargetMachine="1"/> 
     46                        <Tool 
     47                                Name="VCMIDLTool"/> 
     48                        <Tool 
     49                                Name="VCPostBuildEventTool"/> 
     50                        <Tool 
     51                                Name="VCPreBuildEventTool"/> 
     52                        <Tool 
     53                                Name="VCPreLinkEventTool"/> 
     54                        <Tool 
     55                                Name="VCResourceCompilerTool"/> 
     56                        <Tool 
     57                                Name="VCWebServiceProxyGeneratorTool"/> 
     58                        <Tool 
     59                                Name="VCWebDeploymentTool"/> 
     60                </Configuration> 
     61                <Configuration 
     62                        Name="DebugRt|Win32" 
     63                        OutputDirectory="$(PlatformName)\$(ConfigurationName)" 
     64                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 
     65                        ConfigurationType="2" 
     66                        CharacterSet="2"> 
     67                        <Tool 
     68                                Name="VCCLCompilerTool" 
     69                                Optimization="0" 
     70                                AdditionalIncludeDirectories="&quot;$(VJ_BASE_DIR)\include&quot;;&quot;$(VJ_DEPS_DIR)\include&quot;" 
     71                                PreprocessorDefinitions="WIN32;JUGGLER_DEBUG;_CONSOLE;_USRDLL;_GADGET_DRIVER_BUILD_" 
    2472                                MinimalRebuild="FALSE" 
    2573                                BasicRuntimeChecks="3" 
     
    62110                <Configuration 
    63111                        Name="Release|Win32" 
    64                         OutputDirectory="ReleaseDLL
    65                         IntermediateDirectory="ReleaseDLL
     112                        OutputDirectory="$(PlatformName)\$(ConfigurationName)
     113                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)
    66114                        ConfigurationType="2" 
    67115                        CharacterSet="2"> 
     
    72120                                OmitFramePointers="TRUE" 
    73121                                AdditionalIncludeDirectories="&quot;$(VJ_BASE_DIR)\include&quot;;&quot;$(VJ_DEPS_DIR)\include&quot;" 
    74                                 PreprocessorDefinitions="WIN32;_OPT;NDEBUG;_CONSOLE;_USRDLL;_GADGET_DRIVER_BUILD_" 
     122                                PreprocessorDefinitions="WIN32;JUGGLER_OPT;NDEBUG;_CONSOLE;_USRDLL;_GADGET_DRIVER_BUILD_" 
    75123                                StringPooling="TRUE" 
    76124                                MinimalRebuild="FALSE" 
  • juggler/branches/2.2/modules/jackal/Makefile.inc.in

    r20102 r20363  
    4343 
    4444# Extra compiler and linker options needed only by this file. 
    45 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    46 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     45DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     46OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4747 
    4848HAVE_TWEEK_CXX= @HAVE_TWEEK_CXX@ 
  • juggler/branches/2.2/modules/jackal/common/jccl/AutoLink.h

    r19729 r20363  
    3131#  include <jccl/jcclParam.h> 
    3232 
    33 #  if defined(JCCL_DEBUG) && !defined(_USE_RELEASE_RUNTIME) 
    34 #     define JCCL_LIB_RT_OPT "_d" 
     33#  if defined(JCCL_DEBUG) 
     34#     if defined(_DEBUG) 
     35#        define JCCL_LIB_RT_OPT "_d" 
     36#     else 
     37#        define JCCL_LIB_RT_OPT "_g" 
     38#     endif 
    3539#  else 
    3640#     define JCCL_LIB_RT_OPT "" 
  • juggler/branches/2.2/modules/jackal/common/jccl/jcclConfig.h

    r19729 r20363  
    4343#undef PACKAGE_TARNAME 
    4444#undef PACKAGE_VERSION 
    45 /** Debug settings */ 
    46 #ifdef _DEBUG  
    47 #  define JCCL_DEBUG  
    48 #else  
    49 #   define JCCL_OPT  
    50 #endif  
     45 
     46/* 
     47 * If either JUGGLER_DEBUG or _DEBUG is defined, that implies the need for 
     48 * JCCL_DEBUG. 
     49 */ 
     50#if ! defined(JCCL_DEBUG) && (defined(JUGGLER_DEBUG) || defined(_DEBUG)) 
     51#   define JCCL_DEBUG 
     52/* If JUGGLER_OPT is defined, make sure that JCCL_OPT is also defined. */ 
     53#elif defined(JUGGLER_OPT) && ! defined(JCCL_OPT) 
     54#   define JCCL_OPT 
     55#endif 
    5156 
    5257// Windows 
  • juggler/branches/2.2/modules/jackal/plugins/Makefile.inc.in

    r20107 r20363  
    4242 
    4343# Extra compiler and linker options needed only by this file. 
    44 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    45 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     44DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     45OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4646 
    4747HAVE_TWEEK_CXX= @HAVE_TWEEK_CXX@ 
  • juggler/branches/2.2/modules/jackal/test/TestSuite/Makefile.in

    r19729 r20363  
    5656topdir=         @topdir@ 
    5757 
    58 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    59 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     58DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     59OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    6060 
    6161LINK_FLAGS=     @APP_LINK_FLAGS@ $(EXTRA_LFLAGS) 
  • juggler/branches/2.2/modules/sonix/Makefile.inc.in

    r20102 r20363  
    4343 
    4444# Extra compiler and linker options needed only by this file. 
    45 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    46 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     45DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     46OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4747 
    4848# ============================================================================= 
  • juggler/branches/2.2/modules/sonix/plugins/Makefile.inc.in

    r20107 r20363  
    4242 
    4343# Extra compiler and linker options needed only by this file. 
    44 DBG_FLAGS=      -D_DEBUG @DBG_FLAGS@ 
    45 OPT_FLAGS=      -D_OPT -DNDEBUG @OPT_FLAGS@ 
     44DBG_FLAGS=      -DJUGGLER_DEBUG @DBG_FLAGS@ 
     45OPT_FLAGS=      -DJUGGLER_OPT -DNDEBUG @OPT_FLAGS@ 
    4646 
    4747# ============================================================================= 
  • juggler/branches/2.2/modules/sonix/snx/AutoLink.h

    r19729 r20363  
    4040#  include <snx/snxParam.h> 
    4141 
    42 #  if defined(SNX_DEBUG) && !defined(_USE_RELEASE_RUNTIME) 
    43 #     define SNX_LIB_RT_OPT "_d" 
     42#  if defined(SNX_DEBUG) 
     43#     if defined(_DEBUG) 
     44#        define SNX_LIB_RT_OPT "_d" 
     45#     else 
     46#        define SNX_LIB_RT_OPT "_g" 
     47#     endif 
    4448#  else 
    4549#     define SNX_LIB_RT_OPT "" 
  • juggler/branches/2.2/modules/sonix/snx/SoundFactory.cpp

    r19729 r20363  
    139139#endif 
    140140 
    141 #ifdef SNX_DEBUG 
     141#if defined(SNX_DEBUG) 
     142#if defined(_DEBUG) 
     143   std::string sonix_path(snx_base_dir + sonix_subdir + "dbgrt"); 
     144#else 
    142145   std::string sonix_path(snx_base_dir + sonix