Skip to content

Commit

Permalink
Fix windows compilation: math and timezone (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
ftessier authored Aug 3, 2023
2 parents a40598c + 2d1a449 commit afee58e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions HEN_HOUSE/gui/egs_configure/egs_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ EGS_DSO::EGS_DSO(const QString &cpp_name){
#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
fpic = is_x86_64() ? "-fPIC" : QString();
#endif
flibs = cpp_name.contains("g++") ? "-lgfortran" : QString();
flibs = cpp_name.contains("g++") ? "-lgfortran -lquadmath" : QString();
}

// Initialize default GCC compiler as gfortran
Expand Down Expand Up @@ -1007,7 +1007,7 @@ QString MCompiler::getFlibs2LinkCPP( const QString &f_name, const QString &a_pat
if ( f_name.contains("g77") && name().contains("g++"))
flibs= QString("-lg2c");
else if ( f_name.contains("gfortran") && name().contains("g++"))
flibs= QString("-lgfortran");
flibs= QString("-lgfortran -lquadmath");
else if ( f_name.contains("ifort") && name().contains("icpc"))
flibs= QString("-lifport -lifcore");
else{// using any other C++/Fortran compiler combination
Expand All @@ -1020,7 +1020,7 @@ QString MCompiler::getFlibs2LinkCPP( const QString &f_name, const QString &a_pat
#else
// Setting an initial guess
if ( f_name.contains("gfortran") && name().contains("g++") )
flibs="-lgfortran";
flibs="-lgfortran -lquadmath";
else if ( f_name.contains("g77") )
flibs="-lg2c";
else if ( f_name.contains("ifort") && name().contains("icpc"))
Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/scripts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ if test x$F77 = xg77 || test x$F77 = xgfortran; then
if test x$F77 = xg77; then
SHLIB_LIBS="-lg2c"
else
SHLIB_LIBS="-lgfortran"
SHLIB_LIBS="-lgfortran -lquadmath"
fi
printf $format "An OS X system with $F77 and $CC ... " >&2
echo "using $SHLIB_FLAGS and $SHLIB_LIBS to build shared libraries" >&2
Expand Down
6 changes: 4 additions & 2 deletions HEN_HOUSE/specs/all_common.spec
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,19 @@ FEXT = f
# The git hash and branch
GIT_HASH =
ifeq ($(OS),Windows_NT)
USING_GIT = $(shell cmd /C git rev-parse --is-inside-work-tree)
USING_GIT = $(shell cmd /C @ECHO OFF & git rev-parse --is-inside-work-tree 2>NUL)
ifeq ($(USING_GIT),true)
GIT_HASH = -DGIT_HASH="\"$(shell cmd /C git rev-parse --short=7 HEAD)\""
else
GIT_HASH = -DGIT_HASH="\"unknown\""
endif
else
GIT_HASH = -DGIT_HASH="\"$(shell if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then git rev-parse --short=7 HEAD; fi)\""
endif
COMPILE_TIME =
ifeq ($(OS),Windows_NT)
COMPILE_TIME = -DCOMPILE_TIME="\"$(shell cmd /C date /T)$(shell cmd /C time /T) $(shell cmd /C tzutil /g)\""
COMPILE_TIME = -DCOMPILE_TIME="\"$(shell cmd /C date /T) $(shell cmd /C time /T)\""
else
COMPILE_TIME = -DCOMPILE_TIME="\"$(shell date -u +'%Y-%m-%d %H:%M:%S UTC')\""
endif
Expand Down
6 changes: 4 additions & 2 deletions HEN_HOUSE/specs/beamnrc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,19 @@ LIB_SOURCES = $(BEAM_HOME)beam_lib.macros \
# The git hash and branch
GIT_HASH =
ifeq ($(OS),Windows_NT)
USING_GIT = $(shell cmd /C git rev-parse --is-inside-work-tree)
USING_GIT = $(shell cmd /C @ECHO OFF & git rev-parse --is-inside-work-tree 2>NUL)
ifeq ($(USING_GIT),true)
GIT_HASH = -DGIT_HASH="\"$(shell cmd /C git rev-parse --short=7 HEAD)\""
else
GIT_HASH = -DGIT_HASH="\"unknown\""
endif
else
GIT_HASH = -DGIT_HASH="\"$(shell if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then git rev-parse --short=7 HEAD; fi)\""
endif
COMPILE_TIME =
ifeq ($(OS),Windows_NT)
COMPILE_TIME = -DCOMPILE_TIME="\"$(shell cmd /C date /T)$(shell cmd /C time /T) $(shell cmd /C tzutil /g)\""
COMPILE_TIME = -DCOMPILE_TIME="\"$(shell cmd /C date /T)$(shell cmd /C time /T)\""
else
COMPILE_TIME = -DCOMPILE_TIME="\"$(shell date -u +'%Y-%m-%d %H:%M:%S UTC')\""
endif

0 comments on commit afee58e

Please sign in to comment.