Warning, /geant4/config/sys/Linux-clang.gmk is written in an unsupported language. File is not indexed.
0001 #
0002 # ------ GNU/LINUX ------ clang 9.0 and higher
0003 #
0004 # Original author: Gabriele Cosmo - CERN
0005 #
0006 ifeq ($(G4SYSTEM),Linux-clang)
0007 GCCBASE := $(shell which g++ | sed -e "s=/bin/g++==")
0008 CXX := clang++ --gcc-toolchain=$(GCCBASE)
0009 CXXFLAGS := -Wall -Wno-non-virtual-dtor -Wno-long-long
0010 CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual
0011 CXXFLAGS += -Wno-variadic-macros -Wshadow -pipe
0012 CXXFLAGS += -fno-trapping-math -ftree-vectorize -fno-math-errno
0013 CPPFLAGS += -std=c++17
0014 CXXFLAGS += -std=c++17
0015 G4USE_STD17 := 1
0016 ifdef G4MULTITHREADED
0017 CXXFLAGS += -ftls-model=initial-exec -pthread
0018 endif
0019 ifdef G4OPTIMISE
0020 CXXFLAGS += -O3
0021 FCFLAGS := -O3
0022 CCFLAGS := -O3
0023 else
0024 ifdef G4DEBUG
0025 CXXFLAGS += -g
0026 FCFLAGS := -g
0027 CCFLAGS := -g
0028 endif
0029 endif
0030 ifdef G4PROFILE
0031 CXXFLAGS += -pg
0032 FCFLAGS += -pg
0033 CCFLAGS += -pg
0034 endif
0035 ifdef G4OPTDEBUG
0036 CXXFLAGS += -O2 -g
0037 FCFLAGS += -O2 -g
0038 CCFLAGS += -O2 -g
0039 endif
0040 ifdef G4LIB_BUILD_SHARED
0041 CPPFLAGS += -fPIC
0042 CXXFLAGS += -fPIC
0043 FCFLAGS += -fPIC
0044 CCFLAGS += -fPIC
0045 endif
0046 G4RUNPATHOPTION := -Wl,-rpath,
0047 G4STATIC_MODE += -Wl,--whole-archive
0048 G4NOSTATIC_MODE += -Wl,--no-whole-archive
0049 CC := clang --gcc-toolchain=$(GCCBASE)
0050 FC := gfortran
0051 FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
0052 FCLIBS := -lg2c -lnsl
0053 ECHO := /bin/echo -e
0054 SHEXT := so
0055 ARCH := $(shell uname -m | cut -s -d "_" -f 2)
0056 LOADLIBS += -lm -lstdc++
0057 ifndef X11FLAGS
0058 X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
0059 endif
0060 ifndef X11LIBS
0061 X11LIBS := -L/usr/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lSM -lICE
0062 endif
0063 ifndef XMFLAGS
0064 XMFLAGS := -I/usr/include
0065 endif
0066 ifndef XMLIBS
0067 XMLIBS := -lXm -lXpm
0068 endif
0069 ifndef XAWFLAGS
0070 XAWFLAGS := -I/usr/include
0071 endif
0072 ifndef XAWLIBS
0073 XAWLIBS := -lXaw
0074 endif
0075 DLDLIBS := -ldl
0076 ifndef OGLHOME
0077 OGLHOME := /usr
0078 endif
0079 ifndef OGLFLAGS
0080 OGLFLAGS := -I$(OGLHOME)/include
0081 endif
0082 ifndef OGLLIBS
0083 OGLLIBS := -L$(OGLHOME)/lib$(ARCH) -lGL
0084 endif
0085
0086 # ---- QT Setup block -------------------------------------------------------
0087
0088 ifndef QTHOME
0089 QTHOME := /usr
0090 endif
0091 ifndef QTMOC
0092 QTMOC := $(QTHOME)/bin/moc
0093 endif
0094
0095 ifndef QT_VERSION
0096 QT_VERSION := 5
0097 endif
0098
0099 ifndef QTFLAGS
0100 QTFLAGS := -I $(QTHOME)/include -I$(QTHOME)/include/Qt
0101 QTFLAGS += -I $(QTHOME)/include/QtCore
0102 QTFLAGS += -I $(QTHOME)/include/QtGui
0103 QTFLAGS += -I $(QTHOME)/include/QtWidgets
0104 QTFLAGS += -I $(QTHOME)/include/QtOpenGL
0105 QTFLAGS += -I $(QTHOME)/include/Qt3DCore
0106 QTFLAGS += -I $(QTHOME)/include/Qt3DExtras
0107 QTFLAGS += -I $(QTHOME)/include/Qt3DRender
0108 ifeq ($(QT_VERSION),6)
0109 QTFLAGS += -I $(QTHOME)/include/QtOpenGLWidgets
0110 endif
0111 endif
0112 ifndef QTLIBPATH
0113 QTLIBPATH := $(QTHOME)/lib
0114 QT_SEARCH_LIB := $(shell ls $(QTLIBPATH)/qt$(QT_VERSION)/libq* 2>/dev/null | wc -l )
0115 ifneq ($(QT_SEARCH_LIB),0)
0116 QTLIBPATH := $(QTHOME)/lib/qt$(QT_VERSION)
0117 endif
0118 endif
0119 ifeq ($(QT_VERSION),5) # Qt5
0120 ifndef QTLIBS
0121 QTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets
0122 endif
0123 ifndef QT3DLIBS
0124 QT3DLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt53DCore -lQt53DExtras -lQt53DRender
0125 endif
0126 ifndef GLQTLIBS
0127 GLQTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5OpenGL
0128 endif
0129 else # Qt6
0130 ifndef QTLIBS
0131 QTLIBS := -L$(QTLIBPATH) -lQt6Core -lQt6Gui -lQt6Widgets
0132 endif
0133 ifndef QT3DLIBS
0134 QT3DLIBS := -L$(QTLIBPATH) -lQt6Core -lQt6Gui -lQt6Widgets -lQt63DCore -lQt63DExtras -lQt63DRender
0135 endif
0136 ifndef GLQTLIBS
0137 GLQTLIBS := -L$(QTLIBPATH) -lQt6Core -lQt6Gui -lQt6Widgets -lQt6OpenGL -lQt6OpenGLWidgets
0138 endif
0139 endif
0140
0141 #----------------------------------------------------------------------------
0142
0143 define build-granular-shared-lib
0144 @libdir=`(cd $(@D);/bin/pwd)`; \
0145 cd $(G4TMPDIR); \
0146 $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) *.o
0147 endef
0148 define build-global-shared-lib
0149 @libdir=`(cd $(@D);/bin/pwd)`; \
0150 cd $(G4TMP)/$(G4SYSTEM); \
0151 $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) \
0152 $(foreach dir,$(SUBLIBS),$(dir)/*.o);
0153 endef
0154
0155 endif