adaptation of autocmake for the static linking

This commit is contained in:
Miro ILIAS
2015-08-02 19:00:34 +02:00
parent 44832b57a7
commit 7150ae9793
9 changed files with 84 additions and 18 deletions

View File

@ -4,6 +4,9 @@ name: example
[cxx]
source: ../../../modules/cxx.cmake
[static]
source: ../../../modules/static_linking.cmake
[default_build_paths]
source: ../../../modules/default_build_paths.cmake

View File

@ -4,6 +4,9 @@ name: example
[fc]
source: ../../../modules/fc.cmake
[static]
source: ../../../modules/static_linking.cmake
[default_build_paths]
source: ../../../modules/default_build_paths.cmake

View File

@ -4,6 +4,9 @@ name: example
[fc]
source: ../../../modules/fc.cmake
[static]
source: ../../../modules/static_linking.cmake
[int64]
source: ../../../modules/int64.cmake

View File

@ -1,10 +1,15 @@
if(BLAS_FOUND)
if(CMAKE_Fortran_COMPILER_ID MATCHES PGI)
# we remove -rdynamic flag added by CMake
# PGI Fortran does not recognize this flag
SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES PGI)
# remove -rdynamic flag offensive for PGI Fortran
list(REMOVE_ITEM CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-rdynamic")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES Intel AND ENABLE_STATIC_LINKING)
# prevent "ifort: ... warning #10121: overriding '-static-intel' with
# '-i_dynamic'"
list(REMOVE_ITEM CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic")
endif()
if(BLAS_FOUND)
add_executable(example example.f90)
target_link_libraries(example ${MATH_LIBS})
else()

View File

@ -1,10 +1,14 @@
if(LAPACK_FOUND)
if(CMAKE_Fortran_COMPILER_ID MATCHES PGI)
# we remove -rdynamic flag added by CMake
# PGI Fortran does not recognize this flag
SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES PGI)
# remove -rdynamic flag offensive for PGI Fortran
list(REMOVE_ITEM CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-rdynamic")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES Intel AND ENABLE_STATIC_LINKING)
# prevent "ifort: ... warning #10121: overriding '-static-intel' with '-i_dynamic'"
list(REMOVE_ITEM CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic")
endif()
if(LAPACK_FOUND)
add_executable(example example.F90)
target_link_libraries(example ${MATH_LIBS})
else()

View File

@ -132,6 +132,10 @@ def test_extra_cmake_options():
def test_cxx():
configure_build_and_exe('cxx', 'python setup.py --cxx=g++')
def test_cxx_static():
configure_build_and_exe('cxx', 'python setup.py --cxx=g++ --static')
# ------------------------------------------------------------------------------
@ -165,6 +169,10 @@ def test_fc_omp():
os.environ['OMP_NUM_THREADS'] = '2'
configure_build_and_exe('fc_omp', 'python setup.py --omp --fc=gfortran')
def test_fc_static():
configure_build_and_exe('fc', 'python setup.py --fc=gfortran --static')
# ------------------------------------------------------------------------------
@ -172,9 +180,19 @@ def test_fc_omp():
def test_fc_blas():
configure_build_and_exe('fc_blas', 'python setup.py --fc=gfortran')
@no_windows
def test_fc_blas_static():
configure_build_and_exe('fc_blas', 'python setup.py --fc=gfortran --static')
# ------------------------------------------------------------------------------
@no_windows
def test_fc_lapack():
configure_build_and_exe('fc_lapack', 'python setup.py --fc=gfortran')
@no_windows
def test_fc_lapack_static():
configure_build_and_exe('fc_lapack', 'python setup.py --fc=gfortran --static --cmake-options="-DMATH_LIB_SEARCH_ORDER=ATLAS"')