Files
geant4/config/sys/WIN32-VC.gmk
T
2023-12-08 10:43:34 +01:00

143 lines
5.0 KiB
Plaintext

#
# ------ WIN32/VC ------ Visual Studio 2019 and higher
#
ifeq ($(G4SYSTEM),WIN32-VC)
CXX := CL
ifdef G4OPTIMISE
CXXFLAGS += -Ox -MD
else
ifdef G4DEBUG
CXXFLAGS += -Od -MDd -Zi -Fd$(G4LIBDIR)/lib$(name)
endif
endif
CXXFLAGS += -GR -EHsc -Zm200 -nologo -std:c++17
CXXFLAGS += -D_CONSOLE -D_WIN32 -DOS
CPPFLAGS += -DWIN32 -DXPNET -D_CRT_SECURE_NO_DEPRECATE -D_NO_CRT_STDIO_INLINE
LDFLAGS += -FORCE /NODEFAULTLIB:MSVCRT.dll /STACK:12582912
LOADLIBS += legacy_stdio_definitions.lib
SHEXT := dll
AR := LIB
ECHO := /usr/bin/echo -e
FIND := /usr/bin/find
SORT := /usr/bin/sort
GREP := /usr/bin/grep
SED := /usr/bin/sed
CAT := /usr/bin/cat
CUT := /usr/bin/cut
TOUCH := /usr/bin/touch
FC := g77
# FCLIBS := -lf2c
ifndef OGLFLAGS
OGLFLAGS :=
endif
ifndef OGLLIBS
OGLLIBS := opengl32.lib gdi32.lib user32.lib
endif
ifndef UI32LIBS
UI32LIBS := gdi32.lib user32.lib comctl32.lib
endif
ifndef QTHOME
QTHOME := /Qt
endif
ifndef QT_VERSION
QT_VERSION := 5
endif
ifndef QTFLAGS
QTFLAGS := -I$(QTHOME)/include
QTFLAGS += -I$(QTHOME)/include/QtCore
QTFLAGS += -I$(QTHOME)/include/QtGui
QTFLAGS += -I$(QTHOME)/include/QtWidgets
QTFLAGS += -I$(QTHOME)/include/QtOpenGL
ifeq ($(QT_VERSION),6)
QTFLAGS += -I $(QTHOME)/include/QtOpenGLWidgets
endif
endif
ifndef QTMOC
QTMOC := $(QTHOME)/bin/moc
endif
ifeq ($(QT_VERSION),5) # Qt5
ifndef QTLIBS
QTLIBS := $(LIB_PATH)$(QTHOME)/lib Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib
ifndef GLQTLIBS
GLQTLIBS := $(LIB_PATH)$(QTHOME)/lib Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5OpenGL.lib
endif
else # Qt6
ifndef QTLIBS
QTLIBS := $(LIB_PATH)$(QTHOME)/lib Qt6Core.lib Qt6Gui.lib Qt6Widgets.lib
ifndef GLQTLIBS
GLQTLIBS := $(LIB_PATH)$(QTHOME)/lib Qt6Core.lib Qt6Gui.lib Qt6Widgets.lib Qt6OpenGL.lib Qt6OpenGLWidgets.lib
endif
endif
#
# Building DLLs
# -------------
# The commands below allow to build DLLs from the archive libraries.
# From a libG4xxx.a, will extract the symbols with the genwindef tool,
# which will produce a G4xxx.def file.
# The G4xxx.def file will contain the list of symbols that are "exported"
# or made public for using the DLLs.
# The source genwindef.cc is in the geant4/config directory. The binary is
# built during the library installation process, and will be placed in
# $G4LIB/G4SYSTEM.
# If can also be built as follows :
# DOS> cl.exe /Fegenwindef.exe genwindef.cc
# Then, to use it :
# DOS> genwindef -o G4xxx.def -l G4xxx libG4xxx.a
# Libraries libG4xxx.lib can also be built with :
# DOS> lib /def:G4xxx.def /out:libG4xxx.lib
# It also produces a libG4xxx.exp used to build the DLL.
# The DLL can be built with :
# DOS> link /dll /out:G4xxx.dll libG4xxx.exp libG4xxx.a <dependencies>
# Note that a DLL must be fully linked. You should NOT have undefined
# symbols as output of the link command.
#
ifdef G4LIB_USE_CLHEP
GLOBLIBS += libG4clhep.lib
endif
ifdef G4LIB_USE_PTL
GLOBLIBS += libG4ptl.lib
endif
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`;\
cd $(G4TMP)/$(G4SYSTEM);\
$(ECHO) "Building $(name).def file ...";\
$(RM) $(name).def;\
$(G4LIB)/$(G4SYSTEM)/genwindef.exe -o $(name).def -l $(name) $(G4LIBDIR)/lib$(name).a;\
$(ECHO) "Building lib$(name).exp and lib$(name).lib file ...";\
$(RM) $(G4LIBDIR)/lib$(name).exp;\
$(RM) $(G4LIBDIR)/lib$(name).lib;\
lib.exe /nologo /machine:x64 /def:$(name).def \
/out:$(G4LIBDIR)/lib$(name).lib;\
$(RM) $(G4LIBDIR)/$(name).dll;\
$(ECHO) "Building $(name).dll file ...";\
link.exe /nologo /machine:x64 /dll /out:$(G4LIBDIR)/$(name).dll \
$(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
$(LIB_PATH)$(G4LIBDIR) $(GLOBLIBS) \
$(LIB_PATH)$(CLHEP_LIB_DIR) $(CLHEP_LIB) \
$(LIB_PATH)$(PTL_LIB_DIR) $(PTL_LIB) \
$(INTYLIBS) $(GDMLLIBS) $(ANALYSISLIBS) $(UI32LIBS) $(LOADLIBS)
endef
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`;\
cd $(G4TMP)/$(G4SYSTEM);\
$(ECHO) "Building $(name).def file ...";\
$(RM) $(name).def;\
$(G4LIB)/$(G4SYSTEM)/genwindef.exe -o $(name).def -l $(name) $(G4LIBDIR)/lib$(name).a;\
$(ECHO) "Building lib$(name).exp and lib$(name).lib ...";\
$(RM) $(G4LIBDIR)/lib$(name).exp;\
$(RM) $(G4LIBDIR)/lib$(name).lib;\
lib.exe /nologo /machine:x64 /def:$(name).def \
/out:$(G4LIBDIR)/lib$(name).lib;\
$(RM) $(G4LIBDIR)/$(name).dll;\
$(ECHO) "Building $(name).dll ...";\
link.exe /nologo /machine:x64 /dll /out:$(G4LIBDIR)/$(name).dll \
$(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
$(LIB_PATH)$(G4LIBDIR) $(GLOBLIBS) \
$(LIB_PATH)$(CLHEP_LIB_DIR) $(CLHEP_LIB) \
$(LIB_PATH)$(PTL_LIB_DIR) $(PTL_LIB) \
$(INTYLIBS) $(GDMLLIBS) $(ANALYSISLIBS) $(UI32LIBS) $(LOADLIBS)
endef
endif