Skip to content

Commit

Permalink
Merge pull request #7 from ilya-lavrenov/compilation-fix
Browse files Browse the repository at this point in the history
Fixed compilation
  • Loading branch information
apaniukov authored Nov 20, 2023
2 parents cae3098 + fa822c2 commit 6ddb2a6
Showing 1 changed file with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ option(BUILD_FAST_TOKENIZERS OFF)
# to build only sentencepiece-static target
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL ON)

#
# Compile flags
#

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
set(cxx_flags "-Wno-undef")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4244: 'argument' : conversion from 'type1' to 'type2', possible loss of data
# C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data
set(cxx_flags "/wd4244 /wd4267")
endif()

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE_SUPPORTED)
if(SUGGEST_OVERRIDE_SUPPORTED)
set(cxx_flags "${cxx_flags} -Wno-suggest-override")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flags}")

#
# Dependencies
#
Expand Down Expand Up @@ -77,7 +97,7 @@ else()
FetchContent_Declare(
fast_tokenizer
URL https://bj.bcebos.com/paddlenlp/fast_tokenizer/fast_tokenizer-osx-x86_64-1.0.2.tgz
URL_HASH SHA256=5421e5fa5bab8690eaba9f74bbb055c855fb0be921492a47fb99a489fe1f6ef2
URL_HASH SHA256=4c8123ad941b3e4325ef72f328db545e34d5eec2de3e2545e1ab8ebeeb5146a9
)
elseif(APPLE AND AARCH64)
FetchContent_Declare(
Expand All @@ -99,26 +119,6 @@ else()
endif()
endif()

#
# Compile flags
#

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
set(cxx_flags "-Wno-undef")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4244: 'argument' : conversion from 'type1' to 'type2', possible loss of data
# C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data
set(cxx_flags "/wd4244 /wd4267")
endif()

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE_SUPPORTED)
if(SUGGEST_OVERRIDE_SUPPORTED)
set(cxx_flags "${cxx_flags} -Wno-suggest-override")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flags}")

#
# Target include dirs, link libraries and other properties
#
Expand Down

0 comments on commit 6ddb2a6

Please sign in to comment.