feat: compile on linux
This commit is contained in:
parent
4c94e0f047
commit
4cbe93321d
|
@ -10,7 +10,11 @@ if(WIN32)
|
|||
|
||||
# OpenGL
|
||||
find_package(OpenGL REQUIRED)
|
||||
elseif(UNIX OR APPLE)
|
||||
elseif(UNIX)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(GLFW REQUIRED glfw3)
|
||||
find_package(OpenGL REQUIRED)
|
||||
elseif(APPLE)
|
||||
message(FATAL_ERROR "Linux and macOS platforms are not supported yet.")
|
||||
endif()
|
||||
|
||||
|
@ -19,4 +23,8 @@ add_executable(${PROJECT_NAME} hello.cpp)
|
|||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} glfw3)
|
||||
target_link_libraries(${PROJECT_NAME} OpenGL::GL)
|
||||
elseif(UNIX)
|
||||
include_directories(${GLFW_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} ${GLFW_LIBRARIES})
|
||||
target_link_libraries(${PROJECT_NAME} OpenGL::GL)
|
||||
endif()
|
24
hello.cpp
24
hello.cpp
|
@ -1,5 +1,11 @@
|
|||
// To compile on Windows
|
||||
|
||||
// Install GLFW 3.3.8
|
||||
// https://www.glfw.org/download.html
|
||||
// On Windows:
|
||||
// extract the downloaded .zip file to "C:/libs"; this is currently expected
|
||||
// by our CMakeLists.txt.
|
||||
|
||||
// Install CMake
|
||||
// https://cmake.org/download
|
||||
// Add to PATH for all users
|
||||
|
@ -11,17 +17,21 @@
|
|||
// The last step compiles the executable - this can also be done from Visual
|
||||
// Studio
|
||||
|
||||
// Install GLFW 3.3.8
|
||||
// https://www.glfw.org/download.html
|
||||
// On Windows:
|
||||
// extract the downloaded .zip file to "C:/libs"; this is currently expected
|
||||
// by our CMakeLists.txt.
|
||||
|
||||
// To run in VS
|
||||
// Set startup project in Solution Explorer
|
||||
// Press F5 to run
|
||||
//
|
||||
// To compile on Arch Linux
|
||||
//
|
||||
// Install dependencies
|
||||
// sudo pacman -S glfw mesa
|
||||
//
|
||||
// Build
|
||||
// cmake ..
|
||||
// cmake --build .
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <gl/GL.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue