Browse Source

#第一次提交

master
Administrator 1 year ago
parent
commit
a9b114cefe
4 changed files with 31 additions and 12 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +11
    -2
      cmake-local/gflags.cmake
  3. +7
    -1
      cmake-local/glog.cmake
  4. +12
    -8
      cmake-local/openfst.cmake

+ 1
- 1
CMakeLists.txt

@ -38,5 +38,5 @@ endif()
if(OPENFST) if(OPENFST)
include(openfst) include(openfst)
add_executable(fst_main "fst.cc") add_executable(fst_main "fst.cc")
target_link_libraries(fst_main ${third_party_libraries} dl)
target_link_libraries(fst_main PRIVATE ${third_party_libraries})
endif() endif()

+ 11
- 2
cmake-local/gflags.cmake

@ -1,3 +1,12 @@
find_package(gflags REQUIRED)
#FetchContent_Declare(gflags
# SOURCE_DIR ${LIB_BASE_DIR}/gflags-src)
#FetchContent_MakeAvailable(gflags)
#
#include_directories(${gflags_BINARY_DIR}/include)
list(APPEND third_party_libraries gflags)
set(GFLAGS_ROOT_DIR ${LIB_BASE_DIR}/gflags-src)
find_package(gflags REQUIRED CONFIG HINTS ${GFLAGS_ROOT_DIR})
set(GFLAGS_INCLUDE_DIR ${LIB_BASE_DIR}/gflags-build/include)
list(APPEND third_party_libraries gflags)

+ 7
- 1
cmake-local/glog.cmake

@ -1,2 +1,8 @@
find_package(glog REQUIRED)
#find_package(glog REQUIRED)
#list(APPEND third_party_libraries glog::glog)
set(GLOG_ROOT_DIR ${LIB_BASE_DIR}/glog-src)
find_package(glog REQUIRED CONFIG HINTS ${GLOG_ROOT_DIR})
set(GLOG_INCLUDE_DIR ${GLOG_ROOT_DIR}/include)
# glog::glog is imported target
list(APPEND third_party_libraries glog::glog) list(APPEND third_party_libraries glog::glog)

+ 12
- 8
cmake-local/openfst.cmake

@ -18,10 +18,15 @@ if(NOT EXISTS ${openfst_BUILD})
endif() endif()
# We can't build glog with gflags, unless gflags is pre-installed. # We can't build glog with gflags, unless gflags is pre-installed.
# If build glog with pre-installed gflags, there will be conflict. # If build glog with pre-installed gflags, there will be conflict.
# gflagsglog/usr/lib/x86_64-linux-gnu
find_package(gflags) find_package(gflags)
if(TARGET gflags)
message(STATUS "${BoldGreen}TARGET: ${gflags_FOUND}${ColourReset}")
set_target_properties(gflags PROPERTIES INTERFACE_COMPILE_OPTIONS "-fPIC")
endif()
set(WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE) set(WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE)
find_package(glog) find_package(glog)
# cmake
if(NOT GRAPH_TOOLS) if(NOT GRAPH_TOOLS)
set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE) set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE)
set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE) set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE)
@ -39,14 +44,13 @@ set(HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE)
FetchContent_Declare(openfst FetchContent_Declare(openfst
SOURCE_DIR ${LIB_BASE_DIR}/openfst-src) SOURCE_DIR ${LIB_BASE_DIR}/openfst-src)
#
FetchContent_MakeAvailable(openfst) FetchContent_MakeAvailable(openfst)
include_directories(${openfst_SOURCE_DIR}/src/include)
set(openfst_BINARY_DIR "${grpc_build_dir}/src/lib")
add_dependencies(fst glog::glog gflags)
list(APPEND third_party_libraries fst glog::glog gflags)
include_directories(${LIB_BASE_DIR}/openfst-src/src/include)
message(STATUS "${BoldGreen}openfst_BINARY_DIR: ${openfst_BINARY_DIR}${ColourReset}")
#list(APPEND third_party_libraries )
add_dependencies(fst gflags_nothreads_static glog::glog)
#set_target_properties(fst PROPERTIES COMPILE_FLAGS "-fPIC")
target_link_libraries(fst PUBLIC gflags_nothreads_static glog)
#
list(APPEND third_party_libraries fst)

Loading…
Cancel
Save