Skip to content

Commit

Permalink
Merge pull request #818 from pbdot/sokol-mac-build
Browse files Browse the repository at this point in the history
Add Sokol GL3.3 render setup for Mac
  • Loading branch information
pbdot authored Jan 10, 2025
2 parents 72b00b5 + 65ddedb commit a0939df
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ endif()

if (EDGE_SOKOL)
add_definitions(-DEDGE_SOKOL)
if (EDGE_SOKOL_GL)
find_package(OpenGL REQUIRED)
endif()
else()
find_package(OpenGL REQUIRED)
endif()
Expand Down
8 changes: 5 additions & 3 deletions libraries/sokol/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

add_library(sokol sokol.cc)

target_link_libraries(sokol imgui)
set (SOKOL_LINK_LIBRARIES imgui)

if (CMAKE_HOST_UNIX)
target_link_libraries(sokol GL)
if (EDGE_SOKOL_GL)
set (SOKOL_LINK_LIBRARIES ${SOKOL_LINK_LIBRARIES} ${OPENGL_LIBRARIES})
endif()

target_link_libraries(sokol PUBLIC ${SOKOL_LINK_LIBRARIES})

target_include_directories(sokol PUBLIC ./)
target_compile_definitions(sokol PUBLIC SOKOL_NO_DEPRECATED SOKOL_TRACE_HOOKS SOKOL_IMGUI_NO_SOKOL_APP)

Expand Down
2 changes: 1 addition & 1 deletion source_files/edge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ else()
endif()

if (EDGE_SOKOL)
set(EDGE_LINK_LIBRARIES ${EDGE_LINK_LIBRARIES} sokol imgui)
set(EDGE_LINK_LIBRARIES ${EDGE_LINK_LIBRARIES} sokol)
else ()
target_include_directories(edge-classic PRIVATE ${EDGE_LIBRARY_DIR}/glad/include/glad)
set(EDGE_LINK_LIBRARIES ${EDGE_LINK_LIBRARIES} glad ${OPENGL_LIBRARIES})
Expand Down
12 changes: 7 additions & 5 deletions source_files/edge/i_video.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,18 @@ void StartupGraphics(void)
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
#endif

#ifdef SOKOL_GLES3
#ifdef SOKOL_GLCORE
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#elif SOKOL_GLES3
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif


#endif

// -DS- 2005/06/27 Detect SDL Resolutions
Expand Down

0 comments on commit a0939df

Please sign in to comment.