eigen.cmake 1.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

15
include(ExternalProject)
Q
qijun 已提交
16

17
# update eigen to the commit id f612df27 on 03/16/2021
18
set(EIGEN_PREFIX_DIR ${THIRD_PARTY_PATH}/eigen3)
19
set(EIGEN_SOURCE_DIR ${THIRD_PARTY_PATH}/eigen3/src/extern_eigen3)
Z
Zhang Ting 已提交
20
set(EIGEN_REPOSITORY https://gitlab.com/libeigen/eigen.git)
21
set(EIGEN_TAG        f612df273689a19d25b45ca4f8269463207c4fee)
Z
Zhang Ting 已提交
22

23 24
cache_third_party(extern_eigen3
    REPOSITORY    ${EIGEN_REPOSITORY}
25 26
    TAG           ${EIGEN_TAG}
    DIR           EIGEN_SOURCE_DIR)
27 28

if(WIN32)
29
    add_definitions(-DEIGEN_STRONG_INLINE=inline)
30
endif()
31 32 33 34

set(EIGEN_INCLUDE_DIR ${EIGEN_SOURCE_DIR})
INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIR})

35 36 37 38 39 40 41 42
ExternalProject_Add(
    extern_eigen3
    ${EXTERNAL_PROJECT_LOG_ARGS}
    ${SHALLOW_CLONE}
    "${EIGEN_DOWNLOAD_CMD}"
    PREFIX          ${EIGEN_PREFIX_DIR}
    SOURCE_DIR      ${EIGEN_SOURCE_DIR}
    UPDATE_COMMAND    ""
43
    PATCH_COMMAND     ""
44 45 46 47 48
    CONFIGURE_COMMAND ""
    BUILD_COMMAND     ""
    INSTALL_COMMAND   ""
    TEST_COMMAND      ""
)
Q
qijun 已提交
49

50
add_library(eigen3 INTERFACE)
L
liaogang 已提交
51

L
liaogang 已提交
52
add_dependencies(eigen3 extern_eigen3)
W
Wilber 已提交
53 54 55 56 57

# sw not support thread_local semantic
if(WITH_SW)
  add_definitions(-DEIGEN_AVOID_THREAD_LOCAL)
endif()