Skip to content

Commit

Permalink
[Make] Updates to use C++11
Browse files Browse the repository at this point in the history
  • Loading branch information
dmed256 committed Nov 30, 2019
1 parent 1e2f496 commit de598e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ compiler: gcc
env:
global:
- LD_LIBRARY_PATH="${TRAVIS_BUILD_DIR}/lib:${LD_LIBRARY_PATH}"
- CXXFLAGS="-g -O0 -fno-inline"
- DEBUG=1

before_install:
- |
Expand Down
38 changes: 26 additions & 12 deletions include/occa/scripts/shellTools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -361,27 +361,41 @@ function compilerVendor {
esac
}

function compilerCpp11Flags {
case "$vendor" in
GCC|LLVM|INTEL|PGI)
echo "-std=c++11";;
CRAY) echo "-hstd=c++11" ;;
IBM) echo "-qlanglvl=extended0x" ;;
# Unknown
PATHSCALE) echo "-std=c++11" ;;
# Unknown
HP) echo "-std=c++11" ;;
*) ;;
esac
}

function compilerReleaseFlags {
local vendor=$(compilerVendor "$1")

case "$vendor" in
GCC|LLVM) echo "-O3 -D __extern_always_inline=inline" ;;
INTEL) echo "-O3 -xHost" ;;
CRAY) echo "-O3 -h intrinsics -fast" ;;
IBM) echo "-O3 -qhot=simd" ;;
PGI) echo "-O3 -fast -Mipa=fast,inline -Msmartalloc" ;;
PATHSCALE) echo "-O3 -march=auto" ;;
HP) echo "+O3" ;;
*) echo "" ;;
GCC|LLVM) echo " -O3 -D __extern_always_inline=inline" ;;
INTEL) echo " -O3 -xHost" ;;
CRAY) echo " -O3 -h intrinsics -fast" ;;
IBM) echo " -O3 -qhot=simd" ;;
PGI) echo " -O3 -fast -Mipa=fast,inline -Msmartalloc" ;;
PATHSCALE) echo " -O3 -march=auto" ;;
HP) echo " +O3" ;;
*) ;;
esac
}

function compilerDebugFlags {
local vendor=$(compilerVendor "$1")

case "$vendor" in
N/A) ;;
*) echo "-g" ;;
N/A) ;;
*) echo " -g";;
esac
}

Expand All @@ -404,8 +418,8 @@ function compilerSharedFlag {
GCC|LLVM|INTEL|PATHSCALE|CRAY|PGI)
echo "-shared";;
IBM) echo "-qmkshrobj";;
HP) echo "-b" ;;
*) echo "" ;;
HP) echo "-b";;
*) echo "";;
esac
}

Expand Down
5 changes: 3 additions & 2 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ includeFlagsFor = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; head

compilerReleaseFlags = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; compilerReleaseFlags "$(compiler)")
compilerDebugFlags = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; compilerDebugFlags "$(compiler)")
compilerCpp11Flags = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; compilerCpp11Flags "$(compiler)")
compilerPicFlag = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; compilerPicFlag "$(compiler)")
compilerSharedFlag = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; compilerSharedFlag "$(compiler)")
compilerPthreadFlag = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.sh; compilerPthreadFlag "$(compiler)")
Expand All @@ -162,6 +163,7 @@ compilerOpenMPFlag = $(shell . $(OCCA_DIR)/include/occa/scripts/shellTools.s
#---[ Compiler Info ]-----------------------------
debugFlags = $(call compilerDebugFlags)
releaseFlags = $(call compilerReleaseFlags)
cpp11Flags = $(call compilerCpp11Flags)
picFlag = $(call compilerPicFlag)
sharedFlag = $(call compilerSharedFlag)
pthreadFlag = $(call compilerPthreadFlag)
Expand Down Expand Up @@ -271,7 +273,6 @@ ifdef OCCA_HIP_ENABLED
ifeq ($(usingLinux),1)
linkerFlags += -lhip_hcc
endif
compilerFlags += -std=c++11
endif
else
hipIncFlags = $(call includeFlagsFor,hip/hip_runtime_api.h)
Expand All @@ -292,7 +293,6 @@ else
paths += $(hipconfig)
paths += $(hipIncFlags)
linkerFlags += $(hipLibFlags)
compilerFlags += -std=c++11
endif
endif
endif
Expand Down Expand Up @@ -355,6 +355,7 @@ endif
ifeq ($(cudaEnabled),1)
compilerFlags += -Wno-c++11-long-long
endif
compilerFlags += $(cpp11Flags)

ifeq ($(checkEnabled),1)
OCCA_CHECK_ENABLED := 1
Expand Down

0 comments on commit de598e6

Please sign in to comment.