fix: use macOS Frameworks

We want solvespace to dynamically link with only one OpenGL library at a
time, in particular the one that ships with MacOS. For this we use macOS
frameworks, and pass the appropriate flag to the linker.

We should not use default cmake logic for finding openGL, since it seems
to find the wrong version of libGL, that may have been installed by some
other package at some point.
pull/1456/head
Dhruv Gramopadhye 2024-04-04 00:42:09 -07:00
parent 94618d4ce1
commit 9124a4e1de
1 changed files with 2 additions and 1 deletions

View File

@ -309,7 +309,8 @@ if(ENABLE_GUI)
"${CMAKE_SOURCE_DIR}/extlib/si/siapp.lib") "${CMAKE_SOURCE_DIR}/extlib/si/siapp.lib")
endif() endif()
elseif(APPLE) elseif(APPLE)
find_package(OpenGL REQUIRED) set(CMAKE_C_FLAGS "-framework OpenGL ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-framework OpenGL ${CMAKE_CXX_FLAGS}")
find_library(APPKIT_LIBRARY AppKit REQUIRED) find_library(APPKIT_LIBRARY AppKit REQUIRED)
elseif(EMSCRIPTEN) elseif(EMSCRIPTEN)
# Everything is built in # Everything is built in