Merge pull request #1538 from zh794390558/cmake
[speechx] libsndfile , openfst, openblas cmakepull/1540/head
commit
1a1ba2b459
@ -1 +1 @@
|
|||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
@ -0,0 +1,27 @@
|
|||||||
|
include(FetchContent)
|
||||||
|
set(Boost_DEBUG ON)
|
||||||
|
|
||||||
|
set(Boost_PREFIX_DIR ${fc_patch}/boost)
|
||||||
|
set(Boost_SOURCE_DIR ${fc_patch}/boost-src)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
Boost
|
||||||
|
URL https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz
|
||||||
|
URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
|
||||||
|
PREFIX ${Boost_PREFIX_DIR}
|
||||||
|
SOURCE_DIR ${Boost_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
execute_process(COMMAND bootstrap.sh WORKING_DIRECTORY ${Boost_SOURCE_DIR})
|
||||||
|
execute_process(COMMAND b2 WORKING_DIRECTORY ${Boost_SOURCE_DIR})
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(Boost)
|
||||||
|
|
||||||
|
message(STATUS "boost src dir: ${Boost_SOURCE_DIR}")
|
||||||
|
message(STATUS "boost inc dir: ${Boost_INCLUDE_DIR}")
|
||||||
|
message(STATUS "boost bin dir: ${Boost_BINARY_DIR}")
|
||||||
|
|
||||||
|
set(BOOST_ROOT ${Boost_SOURCE_DIR})
|
||||||
|
message(STATUS "boost root dir: ${BOOST_ROOT}")
|
||||||
|
|
||||||
|
include_directories(${Boost_SOURCE_DIR})
|
@ -1,10 +1,8 @@
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
glog
|
glog
|
||||||
URL https://github.com/google/glog/archive/v0.4.0.zip
|
URL https://github.com/google/glog/archive/v0.4.0.zip
|
||||||
URL_HASH SHA256=9e1b54eb2782f53cd8af107ecf08d2ab64b8d0dc2b7f5594472f3bd63ca85cdc
|
URL_HASH SHA256=9e1b54eb2782f53cd8af107ecf08d2ab64b8d0dc2b7f5594472f3bd63ca85cdc
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(glog)
|
FetchContent_MakeAvailable(glog)
|
||||||
|
|
||||||
include_directories(${glog_BINARY_DIR} ${glog_SOURCE_DIR}/src)
|
include_directories(${glog_BINARY_DIR} ${glog_SOURCE_DIR}/src)
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
kenlm
|
kenlm
|
||||||
GIT_REPOSITORY "https://github.com/kpu/kenlm.git"
|
GIT_REPOSITORY "https://github.com/kpu/kenlm.git"
|
||||||
GIT_TAG "df2d717e95183f79a90b2fa6e4307083a351ca6a"
|
GIT_TAG "df2d717e95183f79a90b2fa6e4307083a351ca6a"
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/kpu/kenlm/blob/master/cmake/modules/FindEigen3.cmake
|
# https://github.com/kpu/kenlm/blob/master/cmake/modules/FindEigen3.cmake
|
||||||
set(EIGEN3_INCLUDE_DIR ${Eigen3_SOURCE_DIR})
|
set(EIGEN3_INCLUDE_DIR ${Eigen3_SOURCE_DIR})
|
||||||
|
|
||||||
FetchContent_MakeAvailable(kenlm)
|
FetchContent_MakeAvailable(kenlm)
|
||||||
|
|
||||||
include_directories(${kenlm_SOURCE_DIR})
|
include_directories(${kenlm_SOURCE_DIR})
|
@ -0,0 +1,35 @@
|
|||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
set(OpenBLAS_SOURCE_DIR ${fc_patch}/OpenBLAS-src)
|
||||||
|
set(OpenBLAS_PREFIX ${fc_patch}/OpenBLAS-prefix)
|
||||||
|
|
||||||
|
# ######################################################################################################################
|
||||||
|
# OPENBLAS https://github.com/lattice/quda/blob/develop/CMakeLists.txt#L575
|
||||||
|
# ######################################################################################################################
|
||||||
|
enable_language(Fortran)
|
||||||
|
#TODO: switch to CPM
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
ExternalProject_Add(
|
||||||
|
OPENBLAS
|
||||||
|
GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git
|
||||||
|
GIT_TAG v0.3.10
|
||||||
|
GIT_SHALLOW YES
|
||||||
|
PREFIX ${OpenBLAS_PREFIX}
|
||||||
|
SOURCE_DIR ${OpenBLAS_SOURCE_DIR}
|
||||||
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
|
CMAKE_GENERATOR "Unix Makefiles")
|
||||||
|
# https://cmake.org/cmake/help/latest/module/ExternalProject.html?highlight=externalproject_get_property#external-project-definition
|
||||||
|
ExternalProject_Get_Property(OPENBLAS INSTALL_DIR)
|
||||||
|
set(OpenBLAS_INSTALL_PREFIX ${INSTALL_DIR})
|
||||||
|
add_library(openblas STATIC IMPORTED)
|
||||||
|
add_dependencies(openblas OPENBLAS)
|
||||||
|
set_target_properties(openblas PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES Fortran)
|
||||||
|
# ${CMAKE_INSTALL_LIBDIR} lib
|
||||||
|
set_target_properties(openblas PROPERTIES IMPORTED_LOCATION ${OpenBLAS_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libopenblas.a)
|
||||||
|
|
||||||
|
|
||||||
|
# https://cmake.org/cmake/help/latest/command/install.html?highlight=cmake_install_libdir#installing-targets
|
||||||
|
# ${CMAKE_INSTALL_LIBDIR} lib
|
||||||
|
# ${CMAKE_INSTALL_INCLUDEDIR} include
|
||||||
|
link_directories(${OpenBLAS_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||||
|
include_directories(${OpenBLAS_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
|
@ -0,0 +1,19 @@
|
|||||||
|
include(FetchContent)
|
||||||
|
set(openfst_SOURCE_DIR ${fc_patch}/openfst-src)
|
||||||
|
set(openfst_BINARY_DIR ${fc_patch}/openfst-build)
|
||||||
|
|
||||||
|
ExternalProject_Add(openfst
|
||||||
|
URL https://github.com/mjansche/openfst/archive/refs/tags/1.7.2.zip
|
||||||
|
URL_HASH SHA256=ffc56931025579a8af3515741c0f3b0fc3a854c023421472c07ca0c6389c75e6
|
||||||
|
# #PREFIX ${openfst_PREFIX_DIR}
|
||||||
|
# SOURCE_DIR ${openfst_SOURCE_DIR}
|
||||||
|
# BINARY_DIR ${openfst_BINARY_DIR}
|
||||||
|
CONFIGURE_COMMAND ${openfst_SOURCE_DIR}/configure --prefix=${openfst_PREFIX_DIR}
|
||||||
|
"CPPFLAGS=-I${gflags_BINARY_DIR}/include -I${glog_SOURCE_DIR}/src -I${glog_BINARY_DIR}"
|
||||||
|
"LDFLAGS=-L${gflags_BINARY_DIR} -L${glog_BINARY_DIR}"
|
||||||
|
"LIBS=-lgflags_nothreads -lglog -lpthread"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/patch/openfst ${openfst_SOURCE_DIR}
|
||||||
|
BUILD_COMMAND make -j 4
|
||||||
|
)
|
||||||
|
link_directories(${openfst_PREFIX_DIR}/lib)
|
||||||
|
include_directories(${openfst_PREFIX_DIR}/include)
|
Loading…
Reference in new issue