• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15include (ExternalProject)
16
17set(re2_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/re2/install/include)
18set(re2_URL https://github.com/google/re2)
19set(re2_BUILD ${CMAKE_CURRENT_BINARY_DIR}/re2/src/re2)
20set(re2_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/re2/install)
21set(re2_TAG e7efc48)
22
23if(WIN32)
24  if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
25    set(re2_STATIC_LIBRARIES ${re2_BUILD}/$(Configuration)/re2.lib)
26  else()
27    set(re2_STATIC_LIBRARIES ${re2_BUILD}/re2.lib)
28  endif()
29else()
30  set(re2_STATIC_LIBRARIES ${re2_BUILD}/libre2.a)
31endif()
32
33set(re2_HEADERS
34    ${re2_INSTALL}/include/re2/re2.h
35)
36
37ExternalProject_Add(re2
38    PREFIX re2
39    GIT_REPOSITORY ${re2_URL}
40    GIT_TAG ${re2_TAG}
41    INSTALL_DIR ${re2_INSTALL}
42    BUILD_IN_SOURCE 1
43    BUILD_BYPRODUCTS ${re2_STATIC_LIBRARIES}
44    DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
45    CMAKE_CACHE_ARGS
46        -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
47        -DCMAKE_BUILD_TYPE:STRING=Release
48        -DCMAKE_INSTALL_PREFIX:STRING=${re2_INSTALL}
49        -DRE2_BUILD_TESTING:BOOL=OFF
50)
51