eigen.cmake 1.7 KB
Newer Older
Q
qijun 已提交
1 2 3
INCLUDE(ExternalProject)

SET(EIGEN_SOURCE_DIR ${THIRD_PARTY_PATH}/eigen3)
S
sabreshao 已提交
4 5
SET(EIGEN_INCLUDE_DIR ${EIGEN_SOURCE_DIR}/src/extern_eigen3)
INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIR})
J
Jiabin Yang 已提交
6

7 8 9 10 11 12 13
if(WIN32)
    set(EIGEN_GIT_REPOSITORY https://github.com/wopeizl/eigen-git-mirror)
    set(EIGEN_GIT_TAG support_cuda9_win)
else()
    set(EIGEN_GIT_REPOSITORY https://github.com/eigenteam/eigen-git-mirror)
    set(EIGEN_GIT_TAG 917060c364181f33a735dc023818d5a54f60e54c)
endif()
14 15 16 17 18
if(WITH_AMD_GPU)
    ExternalProject_Add(
        extern_eigen3
        ${EXTERNAL_PROJECT_LOG_ARGS}
        GIT_REPOSITORY  "https://github.com/sabreshao/hipeigen.git"
S
sabreshao 已提交
19
        GIT_TAG         7cb2b6e5a4b4a1efe658abb215cd866c6fb2275e
20 21 22 23 24 25 26 27 28 29 30
        PREFIX          ${EIGEN_SOURCE_DIR}
        UPDATE_COMMAND  ""
        CONFIGURE_COMMAND ""
        BUILD_COMMAND     ""
        INSTALL_COMMAND   ""
        TEST_COMMAND      ""
    )
else()
    ExternalProject_Add(
        extern_eigen3
        ${EXTERNAL_PROJECT_LOG_ARGS}
31
        GIT_REPOSITORY  "${EIGEN_GIT_REPOSITORY}"
D
dzhwinter 已提交
32 33
        # eigen on cuda9.1 missing header of math_funtions.hpp
        # https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
34
        GIT_TAG         ${EIGEN_GIT_TAG}
35
        PREFIX          ${EIGEN_SOURCE_DIR}
D
dzhwinter 已提交
36
        DOWNLOAD_NAME   "eigen"
37 38 39 40 41 42 43
        UPDATE_COMMAND  ""
        CONFIGURE_COMMAND ""
        BUILD_COMMAND     ""
        INSTALL_COMMAND   ""
        TEST_COMMAND      ""
    )
endif()
Q
qijun 已提交
44

L
liaogang 已提交
45 46
if (${CMAKE_VERSION} VERSION_LESS "3.3.0")
    set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/eigen3_dummy.c)
47
    file(WRITE ${dummyfile} "const char *dummy_eigen3 = \"${dummyfile}\";")
L
liaogang 已提交
48 49 50 51
    add_library(eigen3 STATIC ${dummyfile})
else()
    add_library(eigen3 INTERFACE)
endif()
L
liaogang 已提交
52

L
liaogang 已提交
53
add_dependencies(eigen3 extern_eigen3)