]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Make it build on M1 Mac
authorslipher <slipher@protonmail.com>
Fri, 19 Aug 2022 06:23:38 +0000 (01:23 -0500)
committerslipher <slipher@protonmail.com>
Sat, 27 Aug 2022 13:27:41 +0000 (08:27 -0500)
The CMake changes are to work around the issue that the pkgconfig
module is populating the xxx_LIBRARIES variable with the library
name only (e.g. 'glib-2.0') rather than the full path, which the
linker is unable to find. I guess the correct way to do it is to
use the xxx_LDFLAGS variable from pkgconfig which should tell the
linker where to find the libraries, but it's kind of annoying
because we also have a non-pkgconfig route.

The xxx_LINK_LIBRARIES variable has the full library paths but
it is available only from CMake 3.12 so it can't be used
unconditionally.

README.md
cmake/FindGLIB.cmake
cmake/FindGTK2.cmake
cmake/FindGtkGLExt.cmake
cmake/FindMinizip.cmake
cmake/FindPango.cmake
libs/gtkutil/CMakeLists.txt
radiant/CMakeLists.txt

index 3b5fd112a7cf903925b9fcf3222f0eb61c27d4ba..3395423387885c24a3fc3d820a0fbc0112151d41 100644 (file)
--- a/README.md
+++ b/README.md
@@ -100,7 +100,7 @@ If you plan to build a bundle, you also need to install `patchelf`
 Note: some dependencies of gtk+ seems to only be pulled with gtk+3, gtkglext seems to require libffi.
 
 ```sh
-brew install cmake glib libffi gtk+ gtk+3 pkgconfig minizip webp coreutils gnu-sed wget sassc
+brew install cmake glib gobject-introspection libffi gtk+ gtk+3 gtk-doc pkgconfig minizip webp coreutils gnu-sed wget sassc
 brew link --force gettext
 ```
 
index cf12399e3f95c8d24043058a1bff32eb92e6e229..e1e09e35575e5f55920d5224320a4d2e68cb57c6 100644 (file)
@@ -9,6 +9,9 @@ if (PKG_CONFIG_FOUND)
         set(_pkgconfig_REQUIRED REQUIRED)
     endif ()
     pkg_check_modules(GLIB ${_pkgconfig_REQUIRED} glib-2.0)
+    if (GLIB_LINK_LIBRARIES)
+        set(GLIB_LIBRARIES ${GLIB_LINK_LIBRARIES}) # HACK
+    endif ()
 else ()
     find_path(GLIB_INCLUDE_DIRS glib.h)
     find_library(GLIB_LIBRARIES glib-2.0)
index ff205261d74b2301d43497622e9f9671f622f03c..6f21791d3eeaac20776b75ce8988880c2bf833af 100644 (file)
@@ -4,6 +4,9 @@ if (PKG_CONFIG_FOUND)
         set(_pkgconfig_REQUIRED REQUIRED)
     endif ()
     pkg_check_modules(GTK2 ${_pkgconfig_REQUIRED} gtk+-2.0)
+    if (GTK2_LINK_LIBRARIES)
+        set(GTK2_LIBRARIES ${GTK2_LINK_LIBRARIES}) # HACK
+    endif ()
 else ()
     find_path(GTK2_INCLUDE_DIRS gtk.h)
     # find_library(GTK2_LIBRARIES)
index fa8ddda9af38d324e0789a37bc6faf7d0c2c8441..7090890bdfaf54baa109ef9ace6163519c03d313 100644 (file)
@@ -11,6 +11,9 @@ if (PKG_CONFIG_FOUND)
     elseif (WIN32)
         pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-win32-1.0)
     endif ()
+    if (GtkGLExt_LINK_LIBRARIES)
+        set(GtkGLExt_LIBRARIES ${GtkGLExt_LINK_LIBRARIES}) # HACK
+    endif ()
 else ()
     find_path(GtkGLExt_INCLUDE_DIRS gtkglwidget.h)
     # find_library(GtkGLExt_LIBRARIES)
index 0de098f438fb258aba1d66bf397cb802e660db09..8aeea29614c10c4dfadcc90e98ca7de9c186a67f 100644 (file)
@@ -4,6 +4,9 @@ if (PKG_CONFIG_FOUND)
         set(_pkgconfig_REQUIRED REQUIRED)
     endif ()
     pkg_check_modules(Minizip ${_pkgconfig_REQUIRED} minizip)
+    if (Minizip_LINK_LIBRARIES)
+        set(Minizip_LIBRARIES ${Minizip_LINK_LIBRARIES}) # HACK
+    endif ()
 else ()
     find_path(Minizip_INCLUDE_DIRS unzip.h)
     # find_library(Minizip_LIBRARIES)
index 67359ef05887d013654475160f4425f373541c42..aaf64a16c707162dc97f4ae4caf90f107ec8191a 100644 (file)
@@ -5,6 +5,12 @@ if (PKG_CONFIG_FOUND)
     endif ()
     pkg_search_module(Pango ${_pkgconfig_REQUIRED} pango pangocairo)
     pkg_search_module(PangoFT2 ${_pkgconfig_REQUIRED} pangoft2)
+    if (Pango_LINK_LIBRARIES)
+        set(Pango_LIBRARIES ${Pango_LINK_LIBRARIES}) # HACK
+    endif()
+    if (PangoFT2_LINK_LIBRARIES)
+        set(PangoFT2_LIBRARIES ${PangoFT2_LINK_LIBRARIES}) # HACK
+    endif()
 else ()
     # find_path(Pango_INCLUDE_DIRS)
     # find_library(Pango_LIBRARIES)
index 80eca88c62457f699f813b1d7cce4f00b93a0366..1d6df92b721ba88411df3b0e9549298e07fa7353 100644 (file)
@@ -27,6 +27,7 @@ add_library(gtkutil STATIC
 target_include_directories(gtkutil PRIVATE uilib)
 target_link_libraries(gtkutil PRIVATE uilib)
 
+find_package(GTK${GTK_TARGET} REQUIRED)
 target_include_directories(gtkutil PRIVATE ${GTK${GTK_TARGET}_INCLUDE_DIRS})
 target_link_libraries(gtkutil PRIVATE ${GTK${GTK_TARGET}_LIBRARIES})
 
index f93b00cf1329a8662fb132c1cd897372a38808a9..bbf72ed4a9276f87b6ed3ed3dbdcecc6445d91b6 100644 (file)
@@ -1,6 +1,7 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
 
 find_package(OpenGL REQUIRED)
+find_package(GTK${GTK_TARGET} REQUIRED)
 
 string(SUBSTRING ${CMAKE_SHARED_MODULE_SUFFIX} 1 -1 _clibext)
 add_definitions(-DCMAKE_SHARED_MODULE_SUFFIX="${_clibext}")