]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge branch 'macos' into 'master'
authorThomas Debesse <gitlab@illwieckz.net>
Sat, 1 Jun 2019 16:18:07 +0000 (16:18 +0000)
committerThomas Debesse <gitlab@illwieckz.net>
Sat, 1 Jun 2019 16:18:07 +0000 (16:18 +0000)
fix linking on macOS and tell people how to build

See merge request xonotic/netradiant!125

CMakeLists.txt
README.md
cmake/FindGtkGLExt.cmake

index 7498450870d5e6e314ed3c3da71f4c1f54cce71a..ad592edfadc8e76234bb2cf2591962e5d0230aac 100644 (file)
@@ -172,12 +172,16 @@ endif ()
 if (BUILD_BINARIES)
     if (APPLE)
         if (BUILD_RADIANT)
-        option(XWINDOWS "Build against X11" ON)
-        endif()
+            option(XWINDOWS "Build against X11" ON)
+        endif ()
 
         add_definitions(
                 -DPOSIX=1
         )
+
+        link_directories(
+                /usr/local/lib
+        )
     elseif (WIN32)
         add_definitions(
                 -DWIN32=1
@@ -325,7 +329,7 @@ if (DOWNLOAD_GAMEPACKS)
        set(GAME_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
     endif ()
     install(CODE
-           "execute_process(COMMAND \"${PROJECT_SOURCE_DIR}/gamepack-manager\" --license ${GAMEPACKS_LICENSE_LIST} --name ${GAMEPACKS_NAME_LIST} --download-dir \"${PROJECT_BINARY_DIR}/download\" --install-dir \"${GAME_INSTALL_PREFIX}\" --install)"
+        "execute_process(COMMAND \"${PROJECT_SOURCE_DIR}/gamepack-manager\" --license ${GAMEPACKS_LICENSE_LIST} --name ${GAMEPACKS_NAME_LIST} --download-dir \"${PROJECT_BINARY_DIR}/download\" --install-dir \"${GAME_INSTALL_PREFIX}\" --install)"
         )
 endif()
 
index e38b9185de1fa352fa6ed802abcb18e3f2b7e1ff..6270506950b4f123153f45e6ea08ed6ae40fa9c4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -50,12 +50,10 @@ pacman -S --needed base-devel mingw-w64-i686-{toolchain,cmake,make,gtk2,gtkglext
 pacman -S --needed base-devel mingw-w64-x86_64-{toolchain,cmake,make,gtk2,gtkglext,libwebp}
 ```
 
-## OS X:
+## macOS:
 
 ```
-brew install gtkglext
-brew install webp
-brew install Caskroom/cask/xquartz
+brew install gcc cmake Caskroom/cask/xquartz gtkglext pkgconfig minizip webp coreutils gnu-sed
 brew link --force gettext
 ```
 
@@ -86,6 +84,12 @@ cmake -G "Unix Makefiles" -H. -Bbuild && cmake --build build -- -j$(nproc)
 cmake -G "Unix Makefiles" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build -- -j$(nproc)
 ```
 
+On Mac you have to add this to the first cmake call:
+
+```
+-DCMAKE_C_COMPILER=/usr/local/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9 -DOPENGL_INCLUDE_DIR=/opt/X11/include -DOPENGL_gl_LIBRARY=/opt/X11/lib/libGL.dylib
+```
+
 ## Build and installation details
 
 ### Compilation details
index b30a1e1185fe57a11b891f277bccba0df94f0bfb..40a0c858b19a334dad7e68eae0251bfb053de7fd 100644 (file)
@@ -3,12 +3,15 @@ if (PKG_CONFIG_FOUND)
     if (GtkGLExt_FIND_REQUIRED)
         set(_pkgconfig_REQUIRED REQUIRED)
     endif ()
-    if (XWINDOWS)
+    if (APPLE)
+        # libffi is provided by base system so brew does not take the risk to override it
+        # hence then need for an explicit look-up
+        set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig")
+        pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-1.0 gtkglext-quartz-1.0)
+    elseif (XWINDOWS)
         pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-x11-1.0)
     elseif (WIN32)
         pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-win32-1.0)
-    else ()
-        pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-quartz-1.0)
     endif ()
 else ()
     find_path(GtkGLExt_INCLUDE_DIRS gtkglwidget.h)