-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (36 loc) · 1.67 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.15)
project("translatador")
option(USE_WHATLANG "Compile with language detection support via whatlang-rs" ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Make sure that we have pulled submodules (https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html)
find_package(Git QUIET)
if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
if (GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if (NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif ()
endif ()
endif ()
# WASM-compatible Bergamot allows us to ship a library without dependency on MKL/CUDA
set(USE_WASM_COMPATIBLE_SOURCE ON)
# Ensure that the project can be embedded in a shared library (e.g. for bindings)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(extern)
set_target_properties(bergamot-translator PROPERTIES GIT_SUBMODULE OFF)
if (USE_WHATLANG)
add_definitions(-DUSE_WHATLANG=1)
endif ()
add_library(translatador STATIC "src/translatador.cpp")
target_include_directories(translatador PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_link_libraries(translatador PRIVATE bergamot-translator)
if (USE_WHATLANG)
target_link_libraries(translatador PRIVATE whatlang)
endif ()
add_subdirectory(bindings)
add_subdirectory(examples)