bkaradzic / GENie

GENie - Project generator tool
Other
888 stars 168 forks source link

Problems with gmake #402

Open JulioRM97 opened 5 years ago

JulioRM97 commented 5 years ago

I have being working with genie for long, but only with xcode and visual, few days ago I decide to use gmake to create all the examples without having to open the code editor but all the time are appearing link errors. If someone could help me, I will grateful.

This is the lua script:

solution "Phantom"

language "C++" startproject "Phantom" --targetdir "build"

newoption { trigger = "gfxapi", value = "API", description = "Choose a particular 3D API for rendering", allowed = { { "opengl" , "OpenGL" }, { "directx", "Direct3D (Windows only)"}, { "vulkan" , "Vulkan" } } }

newoption { trigger = "pfv", value = "#", description = "Choose a particular platform version", }

-- windowstargetplatformversion = string.gsub(os.getenv("WindowsSDKVersion") or "8.1", "\", "") if _OPTIONS['pfv'] then windowstargetplatformversion(_OPTIONS['pfv']) end

configurations { "Debug", "Release", }

platforms { "x32", "x64", }

--Aqui todos los includes
includedirs 

{ "external/glfw/include", "external/glm/", "external/VulkanSDK/1.1.97.0/Include" }

flags { "Cpp17" }

if _OPTIONS['gfxapi'] == "vulkan" then

links
{
  "vulkan-1"
}

configuration {"x32", "Release"}
  defines
  {

  }

configuration {"x32", "Debug"}  
  libdirs
  {
    "external/VulkanSDK/1.1.97.0/Lib32"
  }

configuration {"x64", "Debug"}
  defines
  {

  }

  libdirs
  {
    "external/VulkanSDK/1.1.97.0/Lib"
  }

configuration {"x64", "Release"} 
  defines
  {

  }

end

configuration {"x32", "Release"} targetdir "build/x32/Release" debugdir "build/x32/Release" objdir "$(SolutionDir)/build/obj"

configuration {"x32", "Debug"} targetdir "build/x32/Debug" debugdir "build/x32/Debug" objdir "$(SolutionDir)/build/obj"

configuration "x32" defines { "_GLFW_WIN32" }

configuration "x64"

configuration "Debug" flags { "Symbols" }

defines { "_DEBUG" }

configuration "Release" defines { "NDEBUG" }

flags { "OptimizeSize" }

--PROJECTS project "Phantom" kind "StaticLib"

includedirs { "Phantom/include" }

files { "Phantom/src/.*", "Phantom/include/*.", "Phantom/assets/.*", ".sh", ".lua", ".txt", ".md", "**.bat" }

links { "GLFW32", "GLM", }

location (_ACTION .. "/Phantom")

project "GLFW32" kind "StaticLib"

includedirs { "external/glfw/win32_platform.h", "external/glfw/win32_joystick.h", "external/glfw/wgl_context.h", "external/glfw/egl_context.h", "external/glfw/osmesa_context.h", "external/glfw/src/internal.h", "external/glfw/src/mappings.h", "external/glfw/src/glfw_config.h", "external/glfw/include" }

files { "external/glfw/src/context.c", "external/glfw/src/init.c", "external/glfw/src/input.c", "external/glfw/src/monitor.c", "external/glfw/src/vulkan.c", "external/glfw/src/window.c", "external/glfw/src/win32_platform.h", "external/glfw/src/win32_joystick.h", "external/glfw/src/wgl_context.h", "external/glfw/src/egl_context.h", "external/glfw/src/osmesa_context.h", "external/glfw/src/win32_init.c", "external/glfw/src/win32_joystick.c", "external/glfw/src/win32_monitor.c", "external/glfw/src/win32_time.c", "external/glfw/src/win32_thread.c", "external/glfw/src/win32_window.c", "external/glfw/src/wgl_context.c", "external/glfw/src/egl_context.c", "external/glfw/src/osmesa_context.c" }

location (_ACTION .. "/GLFW")

project "GLM" kind "StaticLib"

includedirs { "external/glm/glm" }

files { "external/glm/glm/*." }

location (_ACTION .. "/glm")

project "Simple Window" kind "ConsoleApp"

files { "Phantom/examples/window/*." }

links { "GLFW32", "GLM", }

location (_ACTION .. "/window")

project "Hello triangle" kind "ConsoleApp"

includedirs { "Phantom/examples/hello_triangle" } files { "Phantom/examples/hello_triangle/*." }

links { "GLFW32", "GLM", "vulkan-1", }

location (_ACTION .. "/hello_triangle")

PabloPicose commented 5 years ago

It is important to take a care with the link order, MSBuild (VS) and XCode compilers dont take into account this, but gnu comiplers.... Take a look here: GNU link order There is a Premake error treating this (genie is from premake): Premake: gmake link order