Skip to content

Commit

Permalink
[legacy] geant4: Support brewed GL libs on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisklein committed Feb 8, 2021
1 parent 0a99a74 commit 13c85f3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/legacy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,14 @@ if(PACKAGE_SET STREQUAL full)
set(mt
"-DGEANT4_BUILD_MULTITHREADED=OFF")
endif()
if(APPLE)
set(patch_support_brewed_gl_macos
PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant4/support_brewed_gl.patch")
endif()
ExternalProject_Add(geant4
URL https://gitlab.cern.ch/geant4/geant4/-/archive/v${geant4_version}/geant4-v${geant4_version}.tar.gz
URL_HASH SHA256=e381e04c02aeade1ed8cdd9fdbe7dcf5d6f0f9b3837a417976b839318a005dbd
${patch_support_brewed_gl_macos}
${CMAKE_DEFAULT_ARGS} CMAKE_ARGS
"-DGEANT4_BUILD_CXXSTD=c++${CMAKE_CXX_STANDARD}"
${mt}
Expand Down
39 changes: 39 additions & 0 deletions legacy/geant4/support_brewed_gl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
commit c4caa66623c7d81d493521d4941498535dc40cd0
Author: Florian Uhlig <f.uhlig@gsi.de>
Date: Fri Jan 15 11:27:17 2021 +0100

Fix installation error with brew GL package

The brew package manager for macosx supports meanwhile the installation of
x11 and GL and is not longer bound to the usage of the unsupported XQuartz
package. Using the brew packages libx11 and mesa-glu the necessary include
and library files are ínstalled in /usr/local. Unfortunately this directory
is not in the search path such that the configuration of Geant4 fails.
The fix add the the missing search path such that GL installation is found
and the configuration succeeds.

diff --git a/cmake/Modules/FindXQuartzGL.cmake b/cmake/Modules/FindXQuartzGL.cmake
index c26754a611..335dc88dc2 100644
--- a/cmake/Modules/FindXQuartzGL.cmake
+++ b/cmake/Modules/FindXQuartzGL.cmake
@@ -49,17 +49,17 @@ set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)

find_path(XQuartzGL_INCLUDE_DIR GL/gl.h
- PATHS /usr/X11R6/include /opt/X11/include
+ PATHS /usr/X11R6/include /opt/X11/include /usr/local/include
NO_DEFAULT_PATH
)

find_library(XQuartzGL_gl_LIBRARY GL
- PATHS /usr/X11R6/lib /opt/X11/lib
+ PATHS /usr/X11R6/lib /opt/X11/lib /usr/local/lib
NO_DEFAULT_PATH
)

find_library(XQuartzGL_glu_LIBRARY GLU
- PATHS /usr/X11R6/lib /opt/X11/lib
+ PATHS /usr/X11R6/lib /opt/X11/lib /usr/local/lib
NO_DEFAULT_PATH
)

0 comments on commit 13c85f3

Please sign in to comment.