Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to specified external library version #7

Open
leedors527 opened this issue Aug 22, 2024 · 0 comments
Open

Link to specified external library version #7

leedors527 opened this issue Aug 22, 2024 · 0 comments

Comments

@leedors527
Copy link

cmake_minimum_required(VERSION 3.10)

project(MetalTranslate)

include(ExternalProject)

set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)

# CTranslate2 External Project
ExternalProject_Add(CTranslate2
    GIT_REPOSITORY https://github.com/OpenNMT/CTranslate2
    GIT_TAG 4908b9d
    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DWITH_MKL=OFF -DWITH_DNNL=ON
)

# Tokenizer External Project
ExternalProject_Add(Tokenizer
    GIT_REPOSITORY https://github.com/OpenNMT/Tokenizer
	GIT_TAG 559b8e7
    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
)

# Include directories for CTranslate2 and Tokenizer
include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)

# Ensure CTranslate2 and Tokenizer are built before metaltranslate
add_executable(metaltranslate src/main.cpp)

# Add the MetalTranslate sources
set(TARGET_H
    src/MetalTranslate.h
    src/MetalTranslateConfig.h)

target_sources(metaltranslate PRIVATE src/MetalTranslate.cpp)

# Link the external libraries
add_dependencies(metaltranslate CTranslate2 Tokenizer)
target_link_libraries(metaltranslate ${EXTERNAL_INSTALL_LOCATION}/lib/libctranslate2.so)
target_link_libraries(metaltranslate ${EXTERNAL_INSTALL_LOCATION}/lib/libOpenNMTTokenizer.so)


Please revise CMakelists.txt like this.
It was not works previous version on my machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant