Reputation: 409
I am learning OpenGL and GLFW, and I decided to use premake5, because it seems easy to use and maintain. My project is located in a folder called LearningOpenGL. I am on MAC.
Project structure.
Application.cpp
#include <GLFW/glfw3.h>
#include <iostream>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
premake5.lua
workspace "LearningOpenGL"
configurations { "Debug", "Release" }
outputdir = "%{cfg.buildcfg}-%{cfg.system}"
project "LearningOpenGL"
kind "ConsoleApp"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
files {
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cc"
}
-- including GLFW headers
includedirs "%{prj.name}/vender/GLFW/include"
-- linking with GLFW
libdirs "LearningOpenGL/vender/GLFW/lib-macos"
links "libglfw3.a"
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
When I do
vender/bin/premake/premake5 gmake
Building configurations... Running action 'gmake'... Generated LearningOpenGL.make... Done (36ms).
and then
make
from Terminal it gives me this error which I cannot solve.
==== Building LearningOpenGL (debug) ==== Linking LearningOpenGL ld: library not found for -llibglfw3.a clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: * [bin/Debug-macosx/LearningOpenGL/LearningOpenGL] Error 1 make: * [LearningOpenGL] Error 2
Also, are there other easy to use project managers that I can use instead of premake?
Upvotes: 3
Views: 1114