premake5.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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" }
  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.."/freetype/include",
  62. deps_dir.."/spdlog/include",
  63. deps_dir.."/cpptoml/include",
  64. deps_dir.."/stb/include",
  65. deps_dir.."/glfw/include",
  66. deps_dir.."/glm/include",
  67. }
  68. libdirs {
  69. vulkan_sdk_dir.."/lib",
  70. }
  71. links { "freetype", "glfw3" }
  72. filter { "system:windows" }
  73. libdirs {
  74. deps_dir.."/freetype/bin/"..platform.."/%{cfg.buildcfg}",
  75. deps_dir.."/glfw/bin/"..platform.."/%{cfg.buildcfg}",
  76. }
  77. links { "vulkan-1", "opengl32", "user32", "gdi32", "shell32", "kernel32", "pathcch" }
  78. filter { "system:linux" }
  79. libdirs {
  80. deps_dir.."/freetype/bin/"..platform,
  81. deps_dir.."/glfw/bin/"..platform,
  82. }
  83. links { "vulkan", "dl", "pthread", "X11", "z"}
  84. linkoptions { "-export-dynamic" }
  85. buildoptions { "-pthread" }
  86. disablewarnings { "unused-function", "unused-value", "unused-but-set-variable" }
  87. filter {}
  88. files {
  89. "include/gameplay/*.*",
  90. "source/gameplay/*.*",
  91. deps_dir.."/imgui/*.h",
  92. deps_dir.."/imgui/imgui.cpp",
  93. deps_dir.."/imgui/imgui_demo.cpp",
  94. deps_dir.."/imgui/imgui_draw.cpp",
  95. deps_dir.."/imgui/imgui_tables.cpp",
  96. deps_dir.."/imgui/imgui_widgets.cpp",
  97. deps_dir.."/imgui/imgui_widgets.cpp",
  98. deps_dir.."/imgui/misc/freetype/imgui_freetype.*",
  99. }
  100. vpaths
  101. {
  102. ["imgui"] = deps_dir.."/imgui/**.*",
  103. ["include"] = "include/gameplay/*.*",
  104. ["source"] = "source/gameplay/*.*",
  105. }
  106. project "gameplay.editor"
  107. dependson( "gameplay" )
  108. kind "ConsoleApp"
  109. location (workspace_dir.."/%{prj.name}")
  110. includedirs("include")
  111. libdirs { target_dir }
  112. links { "gameplay" }
  113. filter { "system:linux" }
  114. links { "dl", "pthread" }
  115. buildoptions { "-pthread" }
  116. filter {}
  117. files { "source/gameplay.editor/*.cpp" }