From fce7c5f8f04ac684b42aa5f7267f2e72756044f9 Mon Sep 17 00:00:00 2001 From: Colton Staiduhar <29374798+arizotaz@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:30:47 -0400 Subject: [PATCH] Linux Support --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++-- README.md | 14 ++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89ae074..a764e9b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") #set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Release>") # Declare Project where "GSM_TEMPLATE" is the project name -project(GSM_TEMPLATE LANGUAGES C CXX) +project(Assignment2 LANGUAGES C CXX) # Use FreeGlut on Macos (Requires X11 to be installed, but doesn't use it) option(USE_FREEGLUT "Use FreeGLUT on Mac (ignored on Windows)" ON) @@ -232,4 +232,32 @@ target_link_libraries("${CMAKE_PROJECT_NAME}" miniaudio ) -endif() \ No newline at end of file +elseif(UNIX AND NOT APPLE) + +target_sources("${CMAKE_PROJECT_NAME}" PRIVATE "${glad_SOURCE_DIR}/src/glad.c") +target_include_directories("${CMAKE_PROJECT_NAME}" PUBLIC "${glad_SOURCE_DIR}/include") + +# Add our include files +target_include_directories("${CMAKE_PROJECT_NAME}" PUBLIC +"${CMAKE_CURRENT_SOURCE_DIR}/include/" +"${freeglut_SOURCE_DIR}/include" +"${glad_SOURCE_DIR}/include" +) + +target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC use_freeglut=TRUE) + +target_link_libraries("${CMAKE_PROJECT_NAME}" + PRIVATE + OpenGL::GL + freeglut_static + "-framework Cocoa" + "-framework IOKit" + "-framework CoreVideo" + "-lpthread" + stb_image + miniaudio +) + +endif() + +message("Linux is not supported") diff --git a/README.md b/README.md index 467e9ad..24073b6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,21 @@ However, for this guide, install Visual Studio Code and [Brew](https://brew.sh). 6. Once CMake has finished configuring, press Shift+F5 (You may also need to press fn depending on how your mac is setup), and the application will run. +### For Linux (debian/ubuntu) +The following packages are needed in order for the included libraries to function +``` +build-essential +libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev +libx11-dev libxcursor-dev libxtst-dev libxft-dev libxmu-dev libxi-dev +``` + +Heres an easy one-line install script +``` +sudo apt install build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libx11-dev libxcursor-dev libxtst-dev libxft-dev libxmu-dev libxi-dev -y +``` + +After this point, follow the same instructions for MacOS, or use the CLI Interface Below