Skip to content

Commit

Permalink
Merge pull request #25 from mryzhov/fetch_content
Browse files Browse the repository at this point in the history
Ported master commits
  • Loading branch information
apaniukov authored Feb 16, 2024
2 parents a4d6bc5 + e47227b commit e1214e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
BUILD_DIR: ${{ github.workspace }}\\openvino\\build

steps:
- name: git configuration
run: git config --system core.longpaths true

- name: Clone OpenVINO
uses: actions/checkout@v4
with:
Expand Down
1 change: 1 addition & 0 deletions python/openvino_tokenizers/tokenizer_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations
import logging
import weakref
from dataclasses import dataclass, field
Expand Down
45 changes: 26 additions & 19 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ add_library(${TARGET_NAME} SHARED ${SRC})
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_OPENVINO_EXTENSION_API)
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime)

if(rpaths)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}")
endif()

# Installing the extension module to the root of the package
install(TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

# cpack configuration
set(CPACK_PACKAGE_NAME ${TARGET_NAME})
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}")
set(CPACK_SOURCE_GENERATOR "") # not used

if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
Expand Down Expand Up @@ -74,7 +60,12 @@ FetchContent_Declare(
URL https://github.com/google/sentencepiece/archive/refs/tags/v0.1.99.tar.gz
URL_HASH SHA256=63617eaf56c7a3857597dcd8780461f57dd21381b56a27716ef7d7e02e14ced4
)
FetchContent_MakeAvailable(sentencepiece)
FetchContent_GetProperties(sentencepiece)
if(NOT sentencepiece_POPULATED)
FetchContent_Populate(sentencepiece)
add_subdirectory(${sentencepiece_SOURCE_DIR} ${sentencepiece_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()


if(BUILD_FAST_TOKENIZERS)
FetchContent_Declare(
Expand Down Expand Up @@ -115,8 +106,11 @@ else()
URL https://github.com/google/re2/archive/refs/tags/2022-04-01.tar.gz
URL_HASH SHA256=1ae8ccfdb1066a731bba6ee0881baad5efd2cd661acd9569b689f2586e1a50e9
)
FetchContent_MakeAvailable(re2)
set_property(DIRECTORY ${re2_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL ON)
FetchContent_GetProperties(re2)
if(NOT re2_POPULATED)
FetchContent_Populate(re2)
add_subdirectory(${re2_SOURCE_DIR} ${re2_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
elseif(LINUX AND X86_64)
FetchContent_Declare(
fast_tokenizer
Expand Down Expand Up @@ -148,6 +142,7 @@ else()
endif()

FetchContent_MakeAvailable(fast_tokenizer)

# to allow find_library to work with conda-forge env
set(_old_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY})
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
Expand Down Expand Up @@ -192,8 +187,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_OPTIONS "${extra_flags}"
# Post build steps to copy core_tokenizers dependencies
#

set_property(DIRECTORY ${sentencepiece_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL ON)

if(BUILD_FAST_TOKENIZERS)
install(TARGETS core_tokenizers
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down Expand Up @@ -224,4 +217,18 @@ if(extra_libs)
install(FILES ${extra_libs} DESTINATION ${extra_libs_location})
endif()

if(rpaths)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}")
endif()

# Installing the extension module to the root of the package
install(TARGETS ${TARGET_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

# cpack configuration
set(CPACK_PACKAGE_NAME ${TARGET_NAME})
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}")
set(CPACK_SOURCE_GENERATOR "") # not used

include (CPack)

0 comments on commit e1214e6

Please sign in to comment.