Linux Support

This commit is contained in:
Colton Staiduhar
2026-03-25 16:30:47 -04:00
parent a584d4a258
commit fce7c5f8f0
2 changed files with 44 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
#set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>: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
)
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")

View File

@@ -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