Commit 9d158648 authored by Roscoe A. Bartlett's avatar Roscoe A. Bartlett
Browse files

Add support for 'fpic' build name keyword (ATDV-151)

The current SPARC CUDA shared builds actually are hard-coded to link against
static libs for Trilinos.  For that, you nee to add -fPIC to the Trilinos
static build.

The default is not to use -fPIC obviously.
parent ec7ddad2
......@@ -53,6 +53,7 @@ ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(USE_OPENMP OFF)
ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(USE_PTHREADS OFF)
ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(USE_CUDA OFF)
ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(CUDA_RDC OFF)
ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(FPIC OFF)
ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(COMPLEX OFF)
SET(ATDM_INST_SERIAL OFF)
......@@ -176,8 +177,16 @@ ATDM_SET_CACHE(BUILD_SHARED_LIBS "${ATDM_SHARED_LIBS}" CACHE BOOL)
ATDM_SET_CACHE(CMAKE_BUILD_TYPE "${ATDM_CMAKE_BUILD_TYPE}" CACHE STRING)
SET(EXTRA_EXTRA_CXX_FLAGS)
# RDC
IF (ATDM_USE_CUDA AND ATDM_CUDA_RDC)
SET(EXTRA_EXTRA_CXX_FLAGS " --remove-duplicate-link-files")
SET(EXTRA_EXTRA_CXX_FLAGS "${EXTRA_EXTRA_CXX_FLAGS} --remove-duplicate-link-files")
# To get around defect in TriBITS where it will add duplicate libs if a
# downstream package add dependencies on both a subpackage and its parent
# package.
ENDIF()
# FPIC
IF (ATDM_FPIC)
SET(EXTRA_EXTRA_CXX_FLAGS "${EXTRA_EXTRA_CXX_FLAGS} -fPIC")
# To get around defect in TriBITS where it will add duplicate libs if a
# downstream package add dependencies on both a subpackage and its parent
# package.
......
......@@ -86,9 +86,9 @@ build name strings [below](#build-name-examples).
Each of these keywords [`<system_name>`](#system_name),
[`<kokkos_arch>`](#kokkos_arch), [`<compiler>`](#compiler),
[`<kokkos_thread>`](#kokkos_thread), [`<rdc>`](#rdc), [`<complex>`](#complex),
[`<shared_static>`](#shared_static), [`<release_debug>`](#release_debug), and
[`<pt>`](#pt), are described below.
[`<kokkos_thread>`](#kokkos_thread), [`<rdc>`](#rdc), [`<fpic>`](#fpic),
[`<complex>`](#complex), [`<shared_static>`](#shared_static),
[`<release_debug>`](#release_debug), and [`<pt>`](#pt), are described below.
<a name="system_name"/>
......@@ -184,6 +184,13 @@ builds (does nothing in non-CUDA builds):
NOTE: Setting `rdc` also currently adds the `nvcc_wrapper` option
`--remove-duplicate-link-files` as well.
<a name="fpic"/>
**`<fpic>`:** The following `<build-name>` keyword will result in `-fPIC`
being added to `CMAKE_CXX_FLAGS`:
* `fpic`: Add `-fPIC` to `CMAKE_CXX_FLAGS`
<a name="complex"/>
**`<complex>`:** The following `<build-name>` keywords determine if support
......
......@@ -18,6 +18,7 @@
# ATDM_CONFIG_USE_CUDA
# ATDM_CONFIG_USE_PTHREADS
# ATDM_CONFIG_CUDA_RDC
# ATDM_CONFIG_FPIC
# ATDM_CONFIG_COMPLEX
# ATDM_CONFIG_SHARED_LIBS
# ATDM_CONFIG_PT_PACKAGES
......@@ -53,7 +54,7 @@ fi
ATDM_UTILS_SCRIPT_DIR=`echo $BASH_SOURCE | sed "s/\(.*\)\/.*\.sh/\1/g"`
export ATDM_CONFIG_SCRIPT_DIR=`readlink -f ${ATDM_UTILS_SCRIPT_DIR}/..`
echo "Setting compiler and build options for buld name '${ATDM_CONFIG_BUILD_NAME}'"
echo "Setting compiler and build options for build-name '${ATDM_CONFIG_BUILD_NAME}'"
# Set the defaults
export ATDM_CONFIG_COMPILER=DEFAULT
......@@ -249,6 +250,13 @@ elif [[ $ATDM_CONFIG_BUILD_NAME == *"-rdc"* ]] \
export ATDM_CONFIG_CUDA_RDC=ON
fi
# Use -fPIC or not
export ATDM_CONFIG_FPIC=OFF
if [[ $ATDM_CONFIG_BUILD_NAME == *"-fpic"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"_fpic"* ]]; then
export ATDM_CONFIG_FPIC=ON
fi
# Enable complex (double) data-types or not
export ATDM_CONFIG_COMPLEX=OFF
if [[ $ATDM_CONFIG_BUILD_NAME == *"no-complex"* ]]; then
......
......@@ -11,6 +11,7 @@ unset ATDM_CONFIG_USE_OPENMP
unset ATDM_CONFIG_USE_CUDA
unset ATDM_CONFIG_USE_PTHREADS
unset ATDM_CONFIG_CUDA_RDC
unset ATDM_CONFIG_FPIC
unset ATDM_CONFIG_COMPLEX
unset ATDM_CONFIG_SHARED_LIBS
unset ATDM_CONFIG_PT_PACKAGES
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment