premake5.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. workspace "gameplay"
  2. local project_action = "UNDEFINED"
  3. if _ACTION ~= nill then project_action = _ACTION end
  4. local platform = "%{cfg.system}-%{cfg.platform}"
  5. local target_dir = path.join(os.getcwd(), "_build/"..platform.."/%{cfg.buildcfg}")
  6. local workspace_dir = path.join(os.getcwd(), "_compiler/"..project_action)
  7. local deps_dir = path.join(os.getcwd(), "_deps")
  8. local vulkan_sdk_dir = os.getenv("VULKAN_SDK")
  9. configurations { "debug", "release" }
  10. startproject "gameplay.editor"
  11. location (workspace_dir)
  12. targetdir (target_dir)
  13. objdir("_build/tmp/%{cfg.system}/%{prj.name}")
  14. symbols "On"
  15. exceptionhandling "On"
  16. rtti "On"
  17. staticruntime "On"
  18. flags { "FatalCompileWarnings", "MultiProcessorCompile", "NoPCH", "UndefinedIdentifiers", "NoIncrementalLink" }
  19. cppdialect "C++17"
  20. systemversion "latest"
  21. filter { "system:windows" }
  22. platforms { "x86_64" }
  23. files { ".editorconfig" }
  24. editandcontinue "Off"
  25. symbols "Full"
  26. buildoptions { "/utf-8", "/bigobj" }
  27. buildoptions { "/permissive-" }
  28. buildoptions { "/WX" }
  29. warnings "Extra"
  30. disablewarnings { "4100", "4127", "4189", "4201", "4251", "4530", "4456", "4458", "26812" }
  31. filter { "system:linux" }
  32. platforms { "x86_64" }
  33. defaultplatform "x86_64"
  34. buildoptions { "-fvisibility=hidden -D_FILE_OFFSET_BITS=64 -fPIC" }
  35. enablewarnings { "all", "vla" }
  36. disablewarnings { "error=unused-variable" }
  37. filter { "system:linux", "configurations:debug" }
  38. buildoptions { "-fstack-protector-strong" }
  39. filter { "platforms:x86_64" }
  40. architecture "x86_64"
  41. filter { "configurations:debug", "system:windows" }
  42. optimize "Off"
  43. filter { "configurations:debug", "system:linux" }
  44. optimize "Off"
  45. filter { "configurations:release" }
  46. defines { "NDEBUG" }
  47. filter { "configurations:release", "system:windows" }
  48. optimize "Speed"
  49. filter { "configurations:release", "system:linux" }
  50. optimize "On"
  51. filter {}
  52. project "gameplay"
  53. kind "SharedLib"
  54. location (workspace_dir.."/%{prj.name}")
  55. defines { "GP_EXPORT" }
  56. includedirs {
  57. "include/gameplay",
  58. "source/gameplay",
  59. vulkan_sdk_dir.."/include",
  60. deps_dir.."/imgui",
  61. deps_dir.."/imgui/backends",
  62. deps_dir.."/freetype/include",
  63. deps_dir.."/spdlog/include",
  64. deps_dir.."/cpptoml/include",
  65. deps_dir.."/stb/include",
  66. deps_dir.."/glfw/include",
  67. deps_dir.."/glm/include",
  68. }
  69. libdirs {
  70. vulkan_sdk_dir.."/lib",
  71. }
  72. links { "freetype", "glfw3" }
  73. filter { "system:windows" }
  74. libdirs {
  75. deps_dir.."/freetype/bin/"..platform.."/%{cfg.buildcfg}",
  76. deps_dir.."/glfw/bin/"..platform.."/%{cfg.buildcfg}",
  77. }
  78. links { "vulkan-1", "opengl32", "user32", "gdi32", "shell32", "kernel32", "pathcch" }
  79. filter { "system:linux" }
  80. libdirs {
  81. deps_dir.."/freetype/bin/"..platform,
  82. deps_dir.."/glfw/bin/"..platform,
  83. }
  84. links { "vulkan", "dl", "pthread", "X11", "z"}
  85. linkoptions { "-export-dynamic" }
  86. buildoptions { "-pthread" }
  87. disablewarnings { "undef", "unused-function", "unused-value", "unused-but-set-variable" }
  88. filter {}
  89. files {
  90. "include/gameplay/*.*",
  91. "source/gameplay/*.*",
  92. deps_dir.."/imgui/*.h",
  93. deps_dir.."/imgui/*.cpp",
  94. deps_dir.."/imgui/backends/imgui_impl_glfw.*",
  95. deps_dir.."/imgui/backends/imgui_impl_vulkan.*",
  96. deps_dir.."/imgui/misc/freetype/imgui_freetype.*",
  97. }
  98. vpaths
  99. {
  100. ["imgui"] = deps_dir.."/imgui/**.*",
  101. ["include"] = "include/gameplay/*.*",
  102. ["source"] = "source/gameplay/*.*",
  103. }
  104. project "gameplay.editor"
  105. dependson( "gameplay" )
  106. kind "ConsoleApp"
  107. location (workspace_dir.."/%{prj.name}")
  108. includedirs("include")
  109. libdirs { target_dir }
  110. links { "gameplay" }
  111. filter { "system:linux" }
  112. links { "dl", "pthread" }
  113. buildoptions { "-pthread" }
  114. filter {}
  115. files { "source/gameplay.editor/*.cpp" }