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.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 #
  2 # ------ macOS ------
  3 #                                 macOS, Apple clang-12 and higher
  4 #
  5 # Original author: Gabriele Cosmo - CERN
  6 #
  7 ifeq ($(G4SYSTEM),Darwin-clang)
  8   CXX       := clang++
  9   CXXFLAGS  := -Wall -Wno-non-virtual-dtor -Wno-long-long
 10   CXXFLAGS  += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual
 11   CXXFLAGS  += -Wno-variadic-macros -Wshadow -pipe
 12   CXXFLAGS  += -fno-trapping-math -ftree-vectorize -fno-math-errno
 13   CPPFLAGS  += -DGL_SILENCE_DEPRECATION
 14   CPPFLAGS  += -std=c++17
 15   CXXFLAGS  += -std=c++17
 16   G4USE_STD17 := 1
 17   ifdef G4MULTITHREADED
 18     CXXFLAGS += -ftls-model=initial-exec -pthread
 19   endif
 20   ifdef G4OPTIMISE
 21     CXXFLAGS  += -O3
 22     FCFLAGS   := -O3
 23     CCFLAGS   := -O3
 24   else
 25     ifdef G4DEBUG
 26       CXXFLAGS  += -g
 27       FCFLAGS   := -g
 28       CCFLAGS   := -g
 29     endif
 30   endif
 31   ifdef G4PROFILE
 32     CXXFLAGS  += -pg
 33     FCFLAGS   += -pg
 34     CCFLAGS   += -pg
 35   endif
 36   ifdef G4OPTDEBUG
 37     CXXFLAGS  += -O2 -g
 38     FCFLAGS   += -O2 -g
 39     CCFLAGS   += -O2 -g
 40   endif
 41   G4RUNPATHOPTION := -Wl,-rpath, 
 42 #  G4STATIC_MODE += -Wl,-force_load
 43   FC := gfortran
 44   FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
 45   LDFLAGS += -bind_at_load
 46   FCLIBS := -lg2c -lnsl
 47   SHEXT   := dylib
 48   LOADLIBS += -lm
 49   ifndef X11FLAGS
 50     X11FLAGS  := -I/usr/X11/include
 51   endif
 52   ifndef X11LIBS
 53     X11LIBS   := -L/usr/X11/lib  -lXmu -lXt -lXext -lX11 -lSM -lICE
 54   endif
 55   ifndef XMFLAGS
 56     XMFLAGS   := -I/usr/local/include
 57 #   XMFLAGS   := -I/usr/X11/include          ##### some installations.
 58   endif
 59   ifndef XMLIBS
 60     XMLIBS    := -L/usr/local/lib -lXm -lXpm
 61 #   XMLIBS    := -L/usr/X11/lib -lXm -lXpm   ##### some installations.
 62   endif
 63   ifndef XAWFLAGS
 64     XAWFLAGS   := -I/usr/local/include
 65 #   XAWFLAGS   := -I/usr/X11/include         ##### some installations.
 66   endif
 67   ifndef XAWLIBS
 68     XAWLIBS    := -lXaw
 69   endif
 70   DLDLIBS   := -ldl
 71   ifndef OGLHOME
 72     OGLHOME  := /usr/X11
 73   endif
 74   ifndef OGLFLAGS
 75     OGLFLAGS  := -I$(OGLHOME)/include 
 76   endif
 77   ifndef OGLLIBS
 78     OGLPATH  := $(shell test -f /Library/Frameworks/OpenGL.framework/OpenGL && echo "/Library/Frameworks/OpenGL.framework")
 79     ifneq ($(OGLPATH),/Library/Frameworks/OpenGL.framework)
 80       OGLPATH  := $(shell test -f /System/Library/Frameworks/OpenGL.framework/OpenGL && echo "/System/Library/Frameworks/OpenGL.framework")
 81     endif
 82     ifneq ($(OGLPATH),)
 83       OGLLIBS := -F$(OGLPATH)/.. -framework OpenGL -framework AGL 
 84     else
 85       OGLLIBS := -L$(OGLHOME)/lib -lGL
 86     endif
 87   endif
 88 
 89 # ---- Qt Setup block -------------------------------------------------------
 90 
 91   ifndef QTHOME
 92     QTHOME := /Library/Frameworks
 93   endif
 94   ifndef QT_VERSION
 95     QT_VERSION := 5
 96   endif
 97   ifeq ($(QTHOME),/Library/Frameworks)
 98     ifndef QTMOC
 99       QTMOC      := /usr/bin/moc
100     endif
101     ifndef QTFLAGS
102       QTFLAGS   := -I $(QTHOME)/QtCore.framework/Headers
103       QTFLAGS   += -I $(QTHOME)/QtGui.framework/Headers
104       QTFLAGS   += -I $(QTHOME)/QtWidgets.framework/Headers
105       QTFLAGS   += -I $(QTHOME)/QtOpenGL.framework/Headers
106       QTFLAGS   += -I $(QTHOME)/Qt3DCore.framework/Headers
107       QTFLAGS   += -I $(QTHOME)/Qt3DExtras.framework/Headers
108       QTFLAGS   += -I $(QTHOME)/Qt3DRender.framework/Headers
109       ifeq ($(QT_VERSION),6)
110         QTFLAGS   += -I $(QTHOME)/QtOpenGLWidgets.framework/Headers
111       endif
112       QTFLAGS   += -I $(QTHOME)/include/Qt -I$(QTHOME)/include
113     endif
114     ifndef QTLIBPATH
115       QTLPATH  := $(QTHOME)
116     endif
117     QTLIBPATH  := -F$(QTLPATH)
118     QT_AS_FRAMEWORK := $(shell test -d $(QTLPATH)/QtCore.framework && echo yes)
119     ifndef QTLIBS
120       ifdef QT_AS_FRAMEWORK
121         QTLIBS    := $(QTLIBPATH) -framework QtCore -framework QtGui
122       else
123         QTLIBS    := -L$(QTLPATH) -lQtCore -lQtGui
124       endif   
125     endif
126     ifndef QT3DLIBS
127       ifdef QT_AS_FRAMEWORK
128         QT3DLIBS  := $(QTLIBPATH) -framework QtCore -framework QtGui
129         QT3DLIBS  += -framework QtWidgets -framework Qt3DCore -framework Qt3DExtras -framework Qt3DRender
130       else
131         QT3DLIBS  := -L$(QTLPATH) -lQtCore -lQtGui
132         QT3DLIBS  += -lQtWidgets -lQt3DCore -lQt3DExtras -lQt3DRender
133       endif   
134     endif
135     ifndef GLQTLIBS  
136       ifdef QT_AS_FRAMEWORK
137         GLQTLIBS  := $(QTLIBPATH) -framework QtCore -framework QtGui -framework QtOpenGL
138         ifeq ($(QT_VERSION),6)
139           GLQTLIBS += -framework QtOpenGLWidgets
140         endif
141       else
142         GLQTLIBS  := -L$(QTLPATH) -lQtCore -lQtGui -lQtOpenGL
143         ifeq ($(QT_VERSION),6)
144           GLQTLIBS += -lQtOpenGLWidgets
145         endif
146       endif   
147     endif
148   else
149     ifndef QTMOC
150       QTMOC      := $(QTHOME)/bin/moc
151     endif
152     QTLPATH  := $(QTHOME)/lib
153     ifndef QTFLAGS
154       QTFLAGS   := -I $(QTLPATH)/QtCore.framework/Headers 
155       QTFLAGS   += -I $(QTLPATH)/QtGui.framework/Headers 
156       QTFLAGS   += -I $(QTLPATH)/QtWidgets.framework/Headers
157       QTFLAGS   += -I $(QTLPATH)/QtOpenGL.framework/Headers
158       QTFLAGS   += -I $(QTLPATH)/Qt3DCore.framework/Headers
159       QTFLAGS   += -I $(QTLPATH)/Qt3DExtras.framework/Headers
160       QTFLAGS   += -I $(QTLPATH)/Qt3DRender.framework/Headers
161       QTFLAGS   += -I $(QTHOME)/include/Qt -I$(QTHOME)/include
162       ifeq ($(QT_VERSION),6)
163         QTFLAGS   += -I $(QTHOME)/QtOpenGLWidgets.framework/Headers
164       endif
165     endif
166     ifndef QTLIBS
167        QTLIBS    := -F$(QTLPATH) -framework QtCore -framework QtGui
168        QTLIBS    += -framework QtWidgets
169     endif   
170     ifndef QT3DLIBS
171        QT3DLIBS    := -F$(QTLPATH) -framework QtCore -framework QtGui
172        QT3DLIBS    += -framework QtWidgets
173        QT3DLIBS    += -framework Qt3DCore -framework Qt3DExtras -framework Qt3DRender
174     endif   
175     ifndef GLQTLIBS  
176       GLQTLIBS    := -F$(QTLPATH) -framework QtCore -framework QtGui
177       GLQTLIBS    += -framework QtWidgets
178       GLQTLIBS    += -framework QtOpenGL
179       ifeq ($(QT_VERSION),6)
180         GLQTLIBS  += -framework QtOpenGLWidgets
181       endif
182     endif   
183   endif
184 
185 #------ Wt Setup block ------------------------------------------------------
186 
187   ifndef WTHOME
188     WTHOME := /usr
189   endif
190   WTFLAGS := -I$(WTHOME)/include/boost -I$(WTHOME)/include -DQT_NO_KEYWORDS 
191   WTLIBS  := -L$(WTHOME)/lib -lwt -lwtext -lwthttp  -lboost_signals  -L/usr/lib -lz -lssl -lcrypto
192 
193 #----------------------------------------------------------------------------
194 
195   define build-granular-shared-lib
196     @libdir=`(cd $(@D);/bin/pwd)`; \
197      cd $(G4TMPDIR); \
198      $(CXX) -Wl,-w -dynamiclib -single_module -undefined dynamic_lookup \
199          -o $$libdir/$(@F) $(INTYLIBS) *.o
200   endef
201   define build-global-shared-lib
202     @libdir=`(cd $(@D);/bin/pwd)`; \
203      cd $(G4TMP)/$(G4SYSTEM); \
204      $(CXX) -Wl,-w -dynamiclib -single_module -undefined dynamic_lookup \
205          -o $$libdir/$(@F) $(INTYLIBS) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
206   endef
207 
208 endif