premake4.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. function setTargetObjDir(outDir)
  2. for _, cfg in ipairs(configurations()) do
  3. for _, plat in ipairs(platforms()) do
  4. local action = _ACTION or ""
  5. local prj = project()
  6. --"_debug_win32_vs2008"
  7. local suffix = "_" .. cfg .. "_" .. plat .. "_" .. action
  8. targetPath = outDir
  9. suffix = string.lower(suffix)
  10. local obj_path = "../intermediate/" .. cfg .. "/" .. action .. "/" .. prj.name
  11. obj_path = string.lower(obj_path)
  12. configuration {cfg, plat}
  13. targetdir(targetPath)
  14. objdir(obj_path)
  15. targetsuffix(suffix)
  16. end
  17. end
  18. end
  19. function linkLib(libBaseName)
  20. for _, cfg in ipairs(configurations()) do
  21. for _, plat in ipairs(platforms()) do
  22. local action = _ACTION or ""
  23. local prj = project()
  24. local cfgName = cfg
  25. --"_debug_win32_vs2008"
  26. local suffix = "_" .. cfgName .. "_" .. plat .. "_" .. action
  27. libFullName = libBaseName .. string.lower(suffix)
  28. configuration {cfg, plat}
  29. links(libFullName)
  30. end
  31. end
  32. end
  33. solution "test"
  34. configurations { "debug", "release" }
  35. platforms { "x32", "x64" }
  36. location ("./" .. (_ACTION or ""))
  37. language "C++"
  38. flags { "ExtraWarnings" }
  39. configuration "debug"
  40. defines { "DEBUG" }
  41. flags { "Symbols" }
  42. configuration "release"
  43. defines { "NDEBUG" }
  44. flags { "Optimize" }
  45. configuration "vs*"
  46. defines { "_CRT_SECURE_NO_WARNINGS" }
  47. configuration "gmake"
  48. buildoptions "-msse4.2 -Werror=cast-qual"
  49. project "gtest"
  50. kind "StaticLib"
  51. defines { "GTEST_HAS_PTHREAD=0" }
  52. files {
  53. "../thirdparty/gtest/src/gtest-all.cc",
  54. "../thirdparty/gtest/src/**.h",
  55. }
  56. includedirs {
  57. "../thirdparty/gtest/",
  58. "../thirdparty/gtest/include",
  59. }
  60. setTargetObjDir("../thirdparty/lib")
  61. project "unittest"
  62. kind "ConsoleApp"
  63. files {
  64. "../include/**.h",
  65. "../test/unittest/**.cpp",
  66. "../test/unittest/**.h",
  67. }
  68. includedirs {
  69. "../include/",
  70. "../thirdparty/gtest/include/",
  71. }
  72. libdirs "../thirdparty/lib"
  73. setTargetObjDir("../bin")
  74. linkLib "gtest"
  75. links "gtest"
  76. project "perftest"
  77. kind "ConsoleApp"
  78. files {
  79. "../include/**.h",
  80. "../test/perftest/**.cpp",
  81. "../test/perftest/**.c",
  82. "../test/perftest/**.h",
  83. }
  84. includedirs {
  85. "../include/",
  86. "../thirdparty/gtest/include/",
  87. "../thirdparty/",
  88. "../thirdparty/jsoncpp/include/",
  89. "../thirdparty/libjson/",
  90. "../thirdparty/yajl/include/",
  91. }
  92. libdirs "../thirdparty/lib"
  93. setTargetObjDir("../bin")
  94. linkLib "gtest"
  95. links "gtest"
  96. solution "example"
  97. configurations { "debug", "release" }
  98. platforms { "x32", "x64" }
  99. location ("./" .. (_ACTION or ""))
  100. language "C++"
  101. flags { "ExtraWarnings" }
  102. includedirs "../include/"
  103. configuration "debug"
  104. defines { "DEBUG" }
  105. flags { "Symbols" }
  106. configuration "release"
  107. defines { "NDEBUG" }
  108. flags { "Optimize", "EnableSSE2" }
  109. configuration "vs*"
  110. defines { "_CRT_SECURE_NO_WARNINGS" }
  111. project "condense"
  112. kind "ConsoleApp"
  113. files "../example/condense/*"
  114. setTargetObjDir("../bin")
  115. project "pretty"
  116. kind "ConsoleApp"
  117. files "../example/pretty/*"
  118. setTargetObjDir("../bin")
  119. project "prettyauto"
  120. kind "ConsoleApp"
  121. files "../example/prettyauto/*"
  122. setTargetObjDir("../bin")
  123. project "tutorial"
  124. kind "ConsoleApp"
  125. files "../example/tutorial/*"
  126. setTargetObjDir("../bin")
  127. project "serialize"
  128. kind "ConsoleApp"
  129. files "../example/serialize/*"
  130. setTargetObjDir("../bin")