janitor

janitor
git clone https://git.prime8.dev/janitor.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (2275B)


      1 
      2 include_directories(${PROJECT_SOURCE_DIR})
      3 set(sources
      4   feature-fbank.cc
      5   feature-functions.cc
      6   feature-mfcc.cc
      7   feature-window.cc
      8   fftsg.cc
      9   kaldi-math.cc
     10   mel-computations.cc
     11   online-feature.cc
     12   rfft.cc
     13   whisper-feature.cc
     14 )
     15 
     16 if(KALDI_NATIVE_FBANK_ENABLE_CHECK)
     17   list(APPEND sources log.cc)
     18 endif()
     19 
     20 add_library(kaldi-native-fbank-core ${sources})
     21 if(KALDI_NATIVE_FBANK_ENABLE_CHECK)
     22   target_compile_definitions(kaldi-native-fbank-core PUBLIC KNF_ENABLE_CHECK=1)
     23 
     24   if(KNF_HAVE_EXECINFO_H)
     25     target_compile_definitions(kaldi-native-fbank-core PRIVATE KNF_HAVE_EXECINFO_H=1)
     26   endif()
     27 
     28   if(KNF_HAVE_CXXABI_H)
     29     target_compile_definitions(kaldi-native-fbank-core PRIVATE KNF_HAVE_CXXABI_H=1)
     30   endif()
     31 endif()
     32 
     33 # We are using std::call_once() in log.h,which requires us to link with -pthread
     34 if(NOT WIN32 AND KALDI_NATIVE_FBANK_ENABLE_CHECK)
     35   target_link_libraries(kaldi-native-fbank-core -pthread)
     36 endif()
     37 
     38 if(KALDI_NATIVE_FBANK_BUILD_TESTS)
     39   add_executable(test-online-fbank test-online-fbank.cc)
     40   target_link_libraries(test-online-fbank kaldi-native-fbank-core)
     41 endif()
     42 
     43 function(kaldi_native_fbank_add_test source)
     44   get_filename_component(name ${source} NAME_WE)
     45   add_executable(${name} "${source}")
     46   target_link_libraries(${name}
     47     PRIVATE
     48       kaldi-native-fbank-core
     49       gtest
     50       gtest_main
     51   )
     52 
     53   add_test(NAME "Test.${name}"
     54     COMMAND
     55     $<TARGET_FILE:${name}>
     56   )
     57 endfunction()
     58 
     59 # please sort the source files alphabetically
     60 set(test_srcs
     61   # test-online-feature.cc
     62   test-log.cc
     63   test-rfft.cc
     64 )
     65 
     66 if(KALDI_NATIVE_FBANK_BUILD_TESTS)
     67   foreach(source IN LISTS test_srcs)
     68     kaldi_native_fbank_add_test(${source})
     69   endforeach()
     70 endif()
     71 
     72 install(TARGETS kaldi-native-fbank-core
     73   DESTINATION lib
     74 )
     75 if(KALDI_NATIVE_FBANK_BUILD_PYTHON AND WIN32)
     76   install(TARGETS kaldi-native-fbank-core
     77     DESTINATION ..
     78   )
     79 endif()
     80 
     81 if(KALDI_NATIVE_FBANK_BUILD_TESTS)
     82   install(TARGETS test-online-fbank
     83     DESTINATION bin
     84   )
     85 endif()
     86 
     87 file(MAKE_DIRECTORY
     88   DESTINATION
     89     ${PROJECT_BINARY_DIR}/include/kaldi-native-fbank/csrc
     90 )
     91 file(GLOB_RECURSE all_headers *.h)
     92 
     93 file(COPY
     94   ${all_headers}
     95   DESTINATION
     96     ${PROJECT_BINARY_DIR}/include/kaldi-native-fbank/csrc
     97 )
     98 
     99 install(FILES ${all_headers}
    100   DESTINATION include/kaldi-native-fbank/csrc
    101 )