|
| 1 | +# Copyright (c) 2018 PaddlePaddle 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 | +# |
| 15 | + |
| 16 | +IF(MOBILE_INFERENCE) |
| 17 | + return() |
| 18 | +ENDIF() |
| 19 | + |
| 20 | +include (ExternalProject) |
| 21 | + |
| 22 | +# NOTE: gzstream is needed when linking with ctr reader. |
| 23 | + |
| 24 | +SET(GZSTREAM_SOURCES_DIR ${THIRD_PARTY_PATH}/gzstream) |
| 25 | +SET(GZSTREAM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gzstream) |
| 26 | +SET(GZSTREAM_INCLUDE_DIR "${GZSTREAM_INSTALL_DIR}/include/" CACHE PATH "gzstream include directory." FORCE) |
| 27 | + |
| 28 | +ExternalProject_Add( |
| 29 | + extern_gzstream |
| 30 | + GIT_REPOSITORY "https://github.com/kanedo/gzstream.git" |
| 31 | + GIT_TAG "" |
| 32 | + PREFIX ${GZSTREAM_SOURCES_DIR} |
| 33 | + UPDATE_COMMAND "" |
| 34 | + CONFIGURE_COMMAND "" |
| 35 | + BUILD_IN_SOURCE 1 |
| 36 | + BUILD_COMMAND make -j8 |
| 37 | + INSTALL_COMMAND mkdir -p ${GZSTREAM_INSTALL_DIR}/lib/ && mkdir -p ${GZSTREAM_INSTALL_DIR}/include/ |
| 38 | + && cp ${GZSTREAM_SOURCES_DIR}/src/extern_gzstream/libgzstream.a ${GZSTREAM_INSTALL_DIR}/lib |
| 39 | + && cp -r ${GZSTREAM_SOURCES_DIR}/src/extern_gzstream/gzstream.h ${GZSTREAM_INSTALL_DIR}/include |
| 40 | +) |
| 41 | + |
| 42 | +ADD_LIBRARY(gzstream STATIC IMPORTED GLOBAL) |
| 43 | +SET_PROPERTY(TARGET gzstream PROPERTY IMPORTED_LOCATION |
| 44 | + "${GZSTREAM_INSTALL_DIR}/lib/libgzstream.a") |
| 45 | + |
| 46 | +include_directories(${GZSTREAM_INCLUDE_DIR}) |
| 47 | +ADD_DEPENDENCIES(gzstream extern_gzstream) |
0 commit comments