eigen.cmake 2.1 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})
6 7 8 9 10 11 12 13
if(NOT WITH_FAST_MATH)
  # EIGEN_FAST_MATH: https://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html
  # enables some optimizations which might affect the accuracy of the result. 
  # This currently enables the SSE vectorization of sin() and cos(), 
  # and speedups sqrt() for single precision.
  # Defined to 1 by default. Define it to 0 to disable.
  add_definitions(-DEIGEN_FAST_MATH=0)
endif()
14 15 16 17 18

if(WITH_AMD_GPU)
    ExternalProject_Add(
        extern_eigen3
        ${EXTERNAL_PROJECT_LOG_ARGS}
P
peizhilin 已提交
19 20 21
#        GIT_REPOSITORY  "https://github.com/sabreshao/hipeigen.git"
#        GIT_TAG         0cba03ff9f8f9f70bbd92ac5857b031aa8fed6f9
            GIT_REPOSITORY  "http://admin@172.20.90.14:8080/r/eigen3.git"
22 23 24 25 26 27 28 29 30 31 32
        PREFIX          ${EIGEN_SOURCE_DIR}
        UPDATE_COMMAND  ""
        CONFIGURE_COMMAND ""
        BUILD_COMMAND     ""
        INSTALL_COMMAND   ""
        TEST_COMMAND      ""
    )
else()
    ExternalProject_Add(
        extern_eigen3
        ${EXTERNAL_PROJECT_LOG_ARGS}
P
peizhilin 已提交
33 34
#            GIT_REPOSITORY  "https://github.com/eigenteam/eigen-git-mirror"
            GIT_REPOSITORY  "http://admin@172.20.90.14:8080/r/eigen3.git"
D
dzhwinter 已提交
35 36
        # 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
P
peizhilin 已提交
37
#        GIT_TAG         917060c364181f33a735dc023818d5a54f60e54c
38
        PREFIX          ${EIGEN_SOURCE_DIR}
D
dzhwinter 已提交
39
        DOWNLOAD_NAME   "eigen"
40 41 42 43 44 45 46
        UPDATE_COMMAND  ""
        CONFIGURE_COMMAND ""
        BUILD_COMMAND     ""
        INSTALL_COMMAND   ""
        TEST_COMMAND      ""
    )
endif()
Q
qijun 已提交
47

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

L
liaogang 已提交
56 57 58
add_dependencies(eigen3 extern_eigen3)

LIST(APPEND external_project_dependencies eigen3)