Global.gmsvc.pp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //
  2. // Global.gmsvc.pp
  3. //
  4. // This file is read in before any of the individual Sources.pp files
  5. // are read. It defines a few global variables to assist
  6. // Template.gmsvc.pp.
  7. //
  8. #if $[< $[PPREMAKE_VERSION],0.58]
  9. #error You need at least ppremake version 0.58 to use BUILD_TYPE gmsvc.
  10. #endif
  11. #defun get_metalibs target,complete_libs
  12. // In Windows, we need to know the complete set of metalibs that
  13. // encapsulates each of the libraries we'd be linking with normally.
  14. // In the case where a particular library is not part of a metalib,
  15. // we include the library itself.
  16. #define actual_libs
  17. #foreach lib $[complete_libs]
  18. // Only consider libraries that we're actually building.
  19. #if $[all_libs $[and $[build_directory],$[build_target]],$[lib]]
  20. #define modmeta $[module $[TARGET],$[lib]]
  21. #if $[ne $[modmeta],]
  22. #if $[ne $[modmeta],$[target]] // We don't link with ourselves.
  23. #set actual_libs $[actual_libs] $[modmeta]
  24. #endif
  25. #else
  26. #set actual_libs $[actual_libs] $[lib]
  27. #endif
  28. #endif
  29. #end lib
  30. #set actual_libs $[unique $[actual_libs]] $[patsubst %:m,%,$[filter %:m,$[OTHER_LIBS]]]
  31. $[actual_libs]
  32. #end get_metalibs
  33. #defun decygwin frompat,topat,path
  34. #foreach file $[path]
  35. #if $[isfullpath $[file]]
  36. $[patsubstw $[frompat],$[topat],$[cygpath_w $[file]]]
  37. #else
  38. $[patsubstw $[frompat],$[topat],$[osfilename $[file]]]
  39. #endif
  40. #end file
  41. #end decygwin
  42. #define install_lib_dir $[install_lib_dir]
  43. #define install_bin_dir $[install_bin_dir]
  44. #define install_headers_dir $[install_headers_dir]
  45. #define install_data_dir $[install_data_dir]
  46. #define install_igatedb_dir $[install_igatedb_dir]
  47. #define install_config_dir $[install_config_dir]
  48. #define install_parser_inc_dir $[install_parser_inc_dir]
  49. // Define this if we want to make .sbr files.
  50. #if $[USE_BROWSEINFO]
  51. #defer BROWSEINFO_FLAG /Fr"$[osfilename $[target:%.obj=%.sbr]]"
  52. #else
  53. #define BROWSEINFO_FLAG
  54. #endif
  55. #define CFLAGS_SHARED
  56. // Define LINK_ALL_STATIC to generate static libs instead of DLL's.
  57. #if $[ne $[LINK_ALL_STATIC],]
  58. #define dlink_all_static LINK_ALL_STATIC
  59. #define build_dlls
  60. #define build_libs yes
  61. #define dlllib lib
  62. #else
  63. #define dlink_all_static
  64. #define build_dlls yes
  65. #define build_libs
  66. #define dlllib dll
  67. #endif
  68. #include $[THISDIRPREFIX]compilerSettings.pp
  69. #define WARNING_LEVEL_FLAG /W3
  70. #if $[or $[ne $[DO_PSTATS],],$[<= $[OPTIMIZE],3]]
  71. // this should probably only be defined for panda-specific dirs
  72. #define EXTRA_CDEFS $[EXTRA_CDEFS] DO_PSTATS
  73. #endif
  74. #if $[TEST_INLINING]
  75. // /W4 will make MSVC spit out if it inlined a fn or not, but also cause a lot of other spam warnings
  76. #define WARNING_LEVEL_FLAG /W4
  77. #define EXTRA_CDEFS $[EXTRA_CDEFS] FORCE_INLINING
  78. #elif $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  79. #define EXTRA_CDEFS $[EXTRA_CDEFS] FORCE_INLINING
  80. #endif
  81. #defer CDEFINES_OPT1 _DEBUG $[dlink_all_static] $[EXTRA_CDEFS]
  82. #defer CDEFINES_OPT2 _DEBUG $[dlink_all_static] $[EXTRA_CDEFS]
  83. #defer CDEFINES_OPT3 $[dlink_all_static] $[EXTRA_CDEFS]
  84. #defer CDEFINES_OPT4 NDEBUG $[dlink_all_static] $[EXTRA_CDEFS]
  85. // /GZ disables OPT flags, so OPT1 only
  86. #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[OPT1FLAGS] $[DEBUGFLAGS]
  87. #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPTFLAGS]
  88. #defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS]
  89. #defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS]
  90. #if $[ENABLE_PROFILING]
  91. // note according to docs, this should force /PDB:none /DEBUGTYPE:cv, so no pdb file is generated for debug?? (doesnt seem to be true)
  92. #define PROFILE_FLAG /PROFILE
  93. #else
  94. #define PROFILE_FLAG
  95. #endif
  96. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  97. #defer LDFLAGS_OPT1 /debug /incremental:no /NODEFAULTLIB:MSVCRT.LIB /WARN:3 $[PROFILE_FLAG]
  98. #defer LDFLAGS_OPT2 /debug /incremental:no /NODEFAULTLIB:MSVCRT.LIB /WARN:3 $[PROFILE_FLAG]
  99. #defer LDFLAGS_OPT3 /fixed:no /incremental:no /NODEFAULTLIB:MSVCRTD.LIB /WARN:3 $[PROFILE_FLAG] /OPT:REF
  100. #defer LDFLAGS_OPT4 /fixed:no /incremental:no /NODEFAULTLIB:MSVCRTD.LIB /WARN:3 $[PROFILE_FLAG] /OPT:REF
  101. // $[build_pdbs] will be nonempty (true) if we should expect to
  102. // generate a .pdb file when we build a DLL or EXE.
  103. #if $[and $[eq $[USE_COMPILER], MSVC],$[<= $[OPTIMIZE],2]]
  104. #define build_pdbs yes
  105. #else
  106. #define build_pdbs
  107. #endif
  108. // $[dllext] will be "_d" for debug builds, and empty for non-debug
  109. // builds. This is the extra bit of stuff we tack on to the end of a
  110. // dll name. We name the debug dll's file_d.dll, partly to be
  111. // consistent with Python's convention, and partly for our own benefit
  112. // to differentiate debug-built from non-debug-built dll's (since the
  113. // distinction is so important in Windows).
  114. #define dllext $[if $[<= $[OPTIMIZE],2],_d]
  115. #defer interrogate_ipath $[decygwin %,-I"%",$[target_ipath]]
  116. #defer interrogate_spath $[decygwin %,-S"%",$[install_parser_inc_dir]]
  117. #defer extra_cflags /EHsc /Zm250 /DWIN32_VC /DWIN32 $[WARNING_LEVEL_FLAG] $[END_CFLAGS]
  118. #defer COMPILE_C $[COMPILER] /nologo /c /Fo"$[osfilename $[target]]" $[decygwin %,/I"%",$[EXTRA_INCPATH] $[ipath]] $[flags] $[extra_cflags] $[source]
  119. #defer COMPILE_C++ $[COMPILE_C]
  120. #defer STATIC_LIB_C $[LIBBER] /nologo $[sources] /OUT:"$[osfilename $[target]]"
  121. #defer STATIC_LIB_C++ $[STATIC_LIB_C]
  122. //#defer ver_resource $[directory]\ver.res
  123. //#defer SHARED_LIB_C link /nologo /dll /VERBOSE:LIB $[LDFLAGS_OPT$[OPTIMIZE]] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]]
  124. #defer SHARED_LIB_C $[LINKER] /nologo /dll $[LDFLAGS_OPT$[OPTIMIZE]] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]]
  125. #defer SHARED_LIB_C++ $[SHARED_LIB_C]
  126. #defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
  127. #defer LINK_BIN_C++ $[LINK_BIN_C]
  128. #if $[ne $[LINK_ALL_STATIC],]
  129. #defer SHARED_LIB_C $[STATIC_LIB_C]
  130. #defer SHARED_LIB_C++ $[STATIC_LIB_C++]
  131. #defer ODIR_SHARED $[ODIR_STATIC]
  132. #endif