diff options
Diffstat (limited to 'lapack/CMakeLists.txt')
-rw-r--r-- | lapack/CMakeLists.txt | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/lapack/CMakeLists.txt b/lapack/CMakeLists.txt index 9883d4c72..e48497fda 100644 --- a/lapack/CMakeLists.txt +++ b/lapack/CMakeLists.txt @@ -1,15 +1,13 @@ project(EigenLapack CXX) -include("../cmake/language_support.cmake") - -workaround_9220(Fortran EIGEN_Fortran_COMPILER_WORKS) - -if(EIGEN_Fortran_COMPILER_WORKS) - enable_language(Fortran OPTIONAL) - if(NOT CMAKE_Fortran_COMPILER) - set(EIGEN_Fortran_COMPILER_WORKS OFF) - endif() +include(CheckLanguage) +check_language(Fortran) +if(CMAKE_Fortran_COMPILER) + enable_language(Fortran) + set(EIGEN_Fortran_COMPILER_WORKS ON) +else() + set(EIGEN_Fortran_COMPILER_WORKS OFF) endif() add_custom_target(lapack) @@ -35,7 +33,7 @@ set(EigenLapack_SRCS ${EigenLapack_SRCS} second_NONE.f dsecnd_NONE.f ) -option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enbale the Lapack unit tests") +option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enable the Lapack unit tests") if(EIGEN_ENABLE_LAPACK_TESTS) @@ -49,7 +47,7 @@ if(EIGEN_ENABLE_LAPACK_TESTS) INACTIVITY_TIMEOUT 15 TIMEOUT 240 STATUS download_status - EXPECTED_MD5 5758ce55afcf79da98de8b9de1615ad5 + EXPECTED_MD5 ab5742640617e3221a873aba44bbdc93 SHOW_PROGRESS) message(STATUS ${download_status}) @@ -59,7 +57,7 @@ if(EIGEN_ENABLE_LAPACK_TESTS) message(STATUS "Setup lapack reference and lapack unit tests") execute_process(COMMAND tar xzf "lapack_addons_3.4.1.tgz" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) else() - message(STATUS "Download of lapack_addons_3.4.1.tgz failed, LAPACK unit tests wont be enabled") + message(STATUS "Download of lapack_addons_3.4.1.tgz failed, LAPACK unit tests won't be enabled") set(EIGEN_ENABLE_LAPACK_TESTS false) endif() @@ -74,7 +72,7 @@ if(EIGEN_ENABLE_LAPACK_TESTS) sgetrf.f dgetrf.f cgetrf.f zgetrf.f sgetrs.f dgetrs.f cgetrs.f zgetrs.f) - FILE(GLOB ReferenceLapack_SRCS0 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "reference/*.f") + file(GLOB ReferenceLapack_SRCS0 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "reference/*.f") foreach(filename1 IN LISTS ReferenceLapack_SRCS0) string(REPLACE "reference/" "" filename ${filename1}) list(FIND EigenLapack_SRCS ${filename} id1) @@ -86,29 +84,33 @@ if(EIGEN_ENABLE_LAPACK_TESTS) endif() -endif(EIGEN_ENABLE_LAPACK_TESTS) +endif() -endif(EIGEN_Fortran_COMPILER_WORKS) +endif() -add_library(eigen_lapack_static ${EigenLapack_SRCS} ${ReferenceLapack_SRCS}) -add_library(eigen_lapack SHARED ${EigenLapack_SRCS}) +set(EIGEN_LAPACK_TARGETS "") -target_link_libraries(eigen_lapack eigen_blas) +add_library(eigen_lapack_static ${EigenLapack_SRCS} ${ReferenceLapack_SRCS}) +list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack_static) -if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) - target_link_libraries(eigen_lapack_static ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) - target_link_libraries(eigen_lapack ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) +if (EIGEN_BUILD_SHARED_LIBS) + add_library(eigen_lapack SHARED ${EigenLapack_SRCS}) + list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack) + target_link_libraries(eigen_lapack eigen_blas) endif() -add_dependencies(lapack eigen_lapack eigen_lapack_static) +foreach(target IN LISTS EIGEN_LAPACK_TARGETS) + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + endif() + add_dependencies(lapack ${target}) + install(TARGETS ${target} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +endforeach() -install(TARGETS eigen_lapack eigen_lapack_static - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - - get_filename_component(eigen_full_path_to_testing_lapack "./testing/" ABSOLUTE) if(EXISTS ${eigen_full_path_to_testing_lapack}) @@ -133,24 +135,25 @@ if(EXISTS ${eigen_full_path_to_testing_lapack}) string(REGEX REPLACE "(.*)/STACK:(.*) (.*)" "\\1/STACK:900000000000000000 \\3" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") endif() + file(MAKE_DIRECTORY "${LAPACK_BINARY_DIR}/TESTING") add_subdirectory(testing/MATGEN) add_subdirectory(testing/LIN) add_subdirectory(testing/EIG) macro(add_lapack_test output input target) set(TEST_INPUT "${LAPACK_SOURCE_DIR}/testing/${input}") - set(TEST_OUTPUT "${LAPACK_BINARY_DIR}/testing/${output}") - get_target_property(TEST_LOC ${target} LOCATION) + set(TEST_OUTPUT "${LAPACK_BINARY_DIR}/TESTING/${output}") string(REPLACE "." "_" input_name ${input}) set(testName "${target}_${input_name}") if(EXISTS "${TEST_INPUT}") - add_test(LAPACK-${testName} "${CMAKE_COMMAND}" - -DTEST=${TEST_LOC} + add_test(NAME LAPACK-${testName} + COMMAND "${CMAKE_COMMAND}" + -DTEST=$<TARGET_FILE:${target}> -DINPUT=${TEST_INPUT} -DOUTPUT=${TEST_OUTPUT} -DINTDIR=${CMAKE_CFG_INTDIR} -P "${LAPACK_SOURCE_DIR}/testing/runtest.cmake") endif() - endmacro(add_lapack_test) + endmacro() if (BUILD_SINGLE) add_lapack_test(stest.out stest.in xlintsts) |