diff --git a/.gitignore b/.gitignore index 82b3720df..b9ff354c8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,8 @@ /src/Core/stack.hh # From build. -.build +.build* +cmake-build* *.a *.pyc *.o @@ -49,7 +50,6 @@ /Sprint.includes # CLion /.idea -/CMakeLists.txt # Other .history* *.autosave diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..a84e4d443 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.22) +project(RASR) + +include(cmake_resources/ConfigurationTypes.cmake) +include(cmake_resources/Modules.cmake) +include(cmake_resources/GeneralCompileOptions.cmake) + +if (${MODULE_PYTHON}) + include(cmake_resources/Python.cmake) +endif () + +if (${MODULE_TENSORFLOW}) + include(cmake_resources/Tensorflow.cmake) +endif () + +if (${MODULE_ONNX}) + include(cmake_resources/Onnx.cmake) +endif () + +string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME) +string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE) +set(ARCH_DESCRIPTION + "${SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}-${BUILD_TYPE}") +set(CMAKE_INSTALL_PREFIX + "${CMAKE_CURRENT_SOURCE_DIR}/arch/${ARCH_DESCRIPTION}/") +set(INSTALL_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/${ARCH_DESCRIPTION}") + +function(add_install_executable EXECUTABLE_NAME) + install(TARGETS ${EXECUTABLE_NAME} RUNTIME DESTINATION .) + set_target_properties( + ${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME + "${EXECUTABLE_NAME}.${ARCH_DESCRIPTION}") +endfunction() + +function(add_install_library LIBRARY_NAME) + install(TARGETS ${LIBRARY_NAME} LIBRARY DESTINATION ${INSTALL_LIB_DIR}) +endfunction() + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/SourceVersion.cc + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/src/SourceVersion.release + ${CMAKE_CURRENT_SOURCE_DIR}/src/SourceVersion.cc + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/SourceVersion.release) + +add_custom_target(SourceVersion + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/SourceVersion.cc) + +add_subdirectory(src/) diff --git a/cmake_resources/ConfigurationTypes.cmake b/cmake_resources/ConfigurationTypes.cmake new file mode 100644 index 000000000..2ddc4300e --- /dev/null +++ b/cmake_resources/ConfigurationTypes.cmake @@ -0,0 +1,22 @@ +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "standard" "debug" + "release") + +if (NOT CMAKE_BUILD_TYPE) + message(STATUS "Setting build type to 'standard' as none was specified.") + set(CMAKE_BUILD_TYPE standard CACHE STRING "Choose the type of build." FORCE) +endif () + +set(CMAKE_C_FLAGS_STANDARD "-O2") +set(CMAKE_CXX_FLAGS_STANDARD "-O2") +set(CMAKE_EXE_LINKER_FLAGS_STANDARD "") +set(CMAKE_DEF_FLAGS_STANDARD "-DSPRINT_STANDARD_BUILD") + +set(CMAKE_C_FLAGS_RELEASE "-O3") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-rdynamic") +set(CMAKE_DEF_FLAGS_RELEASE "-DSPRINT_RELEASE_BUILD -DNDEBUG") + +set(CMAKE_C_FLAGS_DEBUG "-O0 -g") +set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "") +set(CMAKE_DEF_FLAGS_DEBUG "-D_GLIBCXX_DEBUG -DDEBUG") diff --git a/cmake_resources/GeneralCompileOptions.cmake b/cmake_resources/GeneralCompileOptions.cmake new file mode 100644 index 000000000..29cc46af3 --- /dev/null +++ b/cmake_resources/GeneralCompileOptions.cmake @@ -0,0 +1,85 @@ +set(CMAKE_CXX_STANDARD 17) + +add_compile_definitions(CMAKE_DISABLE_MODULES_HH) + +add_compile_definitions(_GNU_SOURCE) +add_compile_options( + -fPIC + -pipe + -funsigned-char + -fno-exceptions + -Wno-unknown-pragmas + -Wall + -Wno-long-long + -Wno-deprecated + -fno-strict-aliasing + -ffast-math) + +if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "linux-x86_64") + add_compile_options(-msse3) +endif () + +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message(STATUS "Using GCC compiler") +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + message(STATUS "Using Clang compiler") + add_compile_definitions(_GLIBCXX_PERMIT_BACKWARD_HASH) + add_compile_options(-D__float128=void) # hack: http://llvm.org/bugs/show_bug.cgi?id=13530 +else () + message(WARNING "Compiler might not be supported. Use at your own risk") +endif () + +if (NOT DEFINED MARCH) + set(MARCH "native" CACHE STRING "Default target architecture") +endif () +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag("-march=${MARCH}" COMPILER_SUPPORTS_MARCH) +if (COMPILER_SUPPORTS_MARCH) + add_compile_options("-march=${MARCH}") + message(STATUS "Using -march=${MARCH}") +else () + message(STATUS "Architecture -march=${MARCH} is not supported") +endif () + +find_package(LibXml2 REQUIRED) +find_package(Threads REQUIRED) +find_package(ZLIB REQUIRED) +find_package(LAPACK REQUIRED) + +find_library(LIB_RT rt REQUIRED) + +link_libraries(LibXml2::LibXml2 ZLIB::ZLIB Threads::Threads LAPACK::LAPACK ${LIB_RT}) + +include_directories(${LIBXML2_INCLUDE_DIR}) +include_directories(${CMAKE_SOURCE_DIR}/src) + +if (${MODULE_AUDIO_FFMPEG}) + find_package(PkgConfig REQUIRED) + pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat) + pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample) + pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec) + pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil) + + include_directories(${AVFORMAT_INCLUDE_DIRS} ${SWRESAMPLE_INCLUDE_DIRS} ${AVCODEC_INCLUDE_DIRS} ${AVUTIL_INCLUDE_DIRS}) + link_libraries(PkgConfig::AVFORMAT PkgConfig::SWRESAMPLE PkgConfig::AVCODEC PkgConfig::AVUTIL) +endif () + +if (${MODULE_OPENMP}) + find_package(OpenMP REQUIRED) + add_compile_options(OpenMP_CXX_FLAGS) + include_directories(OpenMP_CXX_INCLUDE_DIRS) + link_libraries(OpenMP::OpenMP_CXX) +endif () + +if (${MODULE_CUDA}) + enable_language(CUDA) + set(CMAKE_CUDA_ARCHITECTURES 61;75;86;89) +endif () + +if (${MODULE_AUDIO_FLAC}) + link_libraries(FLAC) +endif () + +if (${MODULE_AUDIO_WAV_SYSTEM}) + link_libraries(sndfile) +endif () diff --git a/cmake_resources/Modules.cmake b/cmake_resources/Modules.cmake new file mode 100644 index 000000000..25ffbbbcb --- /dev/null +++ b/cmake_resources/Modules.cmake @@ -0,0 +1,156 @@ +function(add_module_option MODULE_NAME DEFAULT_VALUE) + option(${MODULE_NAME} "Enable module ${MODULE_NAME}" ${DEFAULT_VALUE}) + if (${MODULE_NAME}) + add_compile_definitions(${MODULE_NAME}) + message(STATUS "Module ${MODULE_NAME} is enabled") + else () + message(STATUS "Module ${MODULE_NAME} disabled") + endif () +endfunction() + +set(TOOLS "") + +function(add_tool_option TOOL_NAME DEFAULT_VALUE) + option(${TOOL_NAME} "Enable tool ${TOOL_NAME}" ${DEFAULT_VALUE}) + if (${TOOL_NAME}) + set(TOOLS ${TOOLS} ${TOOL_NAME} PARENT_SCOPE) + message(STATUS "Tool ${TOOL_NAME} is enabled") + else () + message(STATUS "Tool ${TOOL_NAME} is disabled") + endif () +endfunction() + +# ****** Adaptation ****** +add_module_option(MODULE_ADAPT_CMLLR ON) +add_module_option(MODULE_ADAPT_MLLR ON) +add_module_option(MODULE_ADAPT_ADVANCED ON) + +# ****** Audio ****** +add_module_option(MODULE_AUDIO_FFMPEG OFF) +add_module_option(MODULE_AUDIO_FLAC ON) +add_module_option(MODULE_AUDIO_OTK ON) +add_module_option(MODULE_AUDIO_OSS ON) +add_module_option(MODULE_AUDIO_RAW ON) +add_module_option(MODULE_AUDIO_WAV_SYSTEM ON) + +# ****** Cache Manager integration ****** +add_module_option(MODULE_CORE_CACHE_MANAGER ON) + +# ****** Cart ****** +add_module_option(MODULE_CART ON) + +# ****** Flf ****** +add_module_option(MODULE_FLF_CORE ON) +add_module_option(MODULE_FLF_EXT ON) +add_module_option(MODULE_FLF ON) + +# ****** Lattice ****** +add_module_option(MODULE_LATTICE_BASIC ON) +add_module_option(MODULE_LATTICE_HTK ON) +add_module_option(MODULE_LATTICE_DT ON) + +# ****** Lm ****** +add_module_option(MODULE_LM_ARPA ON) +add_module_option(MODULE_LM_FSA ON) +add_module_option(MODULE_LM_ZEROGRAM ON) +add_module_option(MODULE_LM_FFNN ON) +add_module_option(MODULE_LM_TFRNN ON) + +# ****** Math ****** +add_module_option(MODULE_MATH_NR ON) + +# ****** Mm ****** +add_module_option(MODULE_MM_BATCH ON) +add_module_option(MODULE_MM_DT ON) + +# ****** Neural Network ****** +add_module_option(MODULE_NN ON) +add_module_option(MODULE_NN_SEQUENCE_TRAINING ON) +add_module_option(MODULE_THEANO_INTERFACE ON) +add_module_option(MODULE_PYTHON ON) + +# ****** OpenFst ****** +add_module_option(MODULE_OPENFST OFF) + +# ****** Search ****** +add_module_option(MODULE_SEARCH_MBR ON) +add_module_option(MODULE_SEARCH_WFST OFF) +add_module_option(MODULE_SEARCH_LINEAR ON) +add_module_option(MODULE_ADVANCED_TREE_SEARCH ON) +add_module_option(MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH ON) + +# ****** Signal ****** +add_module_option(MODULE_SIGNAL_GAMMATONE ON) +add_module_option(MODULE_SIGNAL_PLP ON) +add_module_option(MODULE_SIGNAL_VTLN ON) +add_module_option(MODULE_SIGNAL_VOICEDNESS ON) +add_module_option(MODULE_SIGNAL_ADVANCED ON) +add_module_option(MODULE_SIGNAL_ADVANCED_NR ON) + +# ****** Speech ****** +add_module_option(MODULE_SPEECH_DT ON) +add_module_option(MODULE_SPEECH_DT_ADVANCED ON) +add_module_option(MODULE_SPEECH_ALIGNMENT_FLOW_NODES ON) +add_module_option(MODULE_SPEECH_LATTICE_FLOW_NODES ON) +add_module_option(MODULE_SPEECH_LATTICE_ALIGNMENT ON) +add_module_option(MODULE_SPEECH_LATTICE_RESCORING ON) + +# ****** Unit Tests ****** +add_module_option(MODULE_TEST OFF) + +# ****** Intel Threading Building Blocks ****** +add_module_option(MODULE_TBB OFF) + +# ****** OpenMP library ****** +add_module_option(MODULE_OPENMP OFF) +# **** choose optimized blas library if available ****** +add_module_option(MODULE_INTEL_MKL OFF) +add_module_option(MODULE_ACML OFF) +add_module_option(MODULE_CUDA OFF) + +# ****** Tensorflow integration ****** +add_module_option(MODULE_TENSORFLOW ON) + +# ****** ONNX integration ****** +add_module_option(MODULE_ONNX ON) + +# ****** Tools ****** +add_tool_option(AcousticModelTrainer ON) +add_tool_option(Archiver ON) +add_tool_option(CorpusStatistics ON) +add_tool_option(FeatureExtraction ON) +add_tool_option(FeatureStatistics ON) +add_tool_option(Fsa ON) +add_tool_option(LibRASR ON) +add_tool_option(Lm ON) +add_tool_option(SpeechRecognizer ON) +add_tool_option(Xml ON) + +if (${MODULE_CART}) + add_tool_option(Cart ON) +endif () + +if (${MODULE_MM_DT} + AND ${MODULE_LATTICE_DT} + AND ${MODULE_SPEECH_DT}) + add_tool_option(LatticeProcessor ON) +endif () + +if (${MODULE_FLF}) + add_tool_option(Flf ON) +endif () + +if (${MODULE_NN}) + add_tool_option(NnTrainer ON) +endif () + +set(SEARCH_LIBS RasrSearch) +if (${MODULE_SEARCH_WFST}) + list(APPEND SEARCH_LIBS RasrSearchWfst RasrOpenFst) +endif () +if (${MODULE_ADVANCED_TREE_SEARCH}) + list(APPEND SEARCH_LIBS RasrAdvancedTreeSearch) +endif () +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH}) + list(APPEND SEARCH_LIBS RasrGenericSeq2SeqTreeSearch) +endif () diff --git a/cmake_resources/Onnx.cmake b/cmake_resources/Onnx.cmake new file mode 100644 index 000000000..ba9f8c568 --- /dev/null +++ b/cmake_resources/Onnx.cmake @@ -0,0 +1,9 @@ +set(onnx_INCLUDE_DIR "/opt/thirdparty/usr/include") + +find_library(onnxruntime_LIBRARY onnxruntime REQUIRED HINTS "/opt/thirdparty/usr/lib") + +function(add_onnx_dependencies TARGET) + target_compile_options(${TARGET} PUBLIC "-fexceptions") + target_include_directories(${TARGET} PUBLIC ${onnx_INCLUDE_DIR}) + target_link_libraries(${TARGET} PUBLIC ${onnxruntime_LIBRARY}) +endfunction() diff --git a/cmake_resources/Python.cmake b/cmake_resources/Python.cmake new file mode 100644 index 000000000..edb4740ce --- /dev/null +++ b/cmake_resources/Python.cmake @@ -0,0 +1,7 @@ +find_package(Python3 REQUIRED COMPONENTS Development NumPy) + +function(add_python_dependencies TARGET) + target_compile_definitions(${TARGET} PUBLIC ${Python3_DEFINITIONS}) + target_include_directories(${TARGET} PUBLIC ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS}) + target_link_libraries(${TARGET} PUBLIC ${Python3_LIBRARIES}) +endfunction() diff --git a/cmake_resources/Tensorflow.cmake b/cmake_resources/Tensorflow.cmake new file mode 100644 index 000000000..9533a7ca1 --- /dev/null +++ b/cmake_resources/Tensorflow.cmake @@ -0,0 +1,61 @@ +find_package(Python3 REQUIRED COMPONENTS Interpreter) + +# Get the TensorFlow include directory by executing a Python command +execute_process( + COMMAND "${Python3_EXECUTABLE}" -c + "import tensorflow as tf; print(tf.sysconfig.get_include())" + RESULT_VARIABLE _tensorflow_include_res + OUTPUT_VARIABLE Tensorflow_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + +execute_process( + COMMAND "${Python3_EXECUTABLE}" -c + "import tensorflow as tf; print(tf.sysconfig.get_lib())" + RESULT_VARIABLE _tensorflow_lib_res + OUTPUT_VARIABLE Tensorflow_LIB_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Check if we got the include directory +if (NOT _tensorflow_include_res EQUAL "0") + message(FATAL_ERROR "Failed to get TensorFlow include directory") +endif () + +# Output the found directory for debugging purposes +message(STATUS "Tensorflow include directory: ${Tensorflow_INCLUDE_DIR}") + +set(CMAKE_FIND_LIBRARY_SUFFIXES .so .so.1 .so.2) + +find_library( + Tensorflow_CC + NAMES tensorflow_cc + HINTS ${Tensorflow_LIB_DIR} /usr/local/lib/tensorflow + PATH_SUFFIXES lib REQUIRED) + +find_library( + Tensorflow_FRAMEWORK + NAMES tensorflow_framework + HINTS ${Tensorflow_LIB_DIR} /usr/local/lib/tensorflow + PATH_SUFFIXES lib REQUIRED) + +if (Tensorflow_CC) + message(STATUS "Tensorflow CC library found at ${Tensorflow_CC}") +else () + message(FATAL_ERROR "Tensorflow CC library not found") +endif () + +if (Tensorflow_FRAMEWORK) + message( + STATUS "Tensorflow Framework library found at ${Tensorflow_FRAMEWORK}") +else () + message(FATAL_ERROR "TensorFlow Framework library not found") +endif () + +find_package(OpenSSL REQUIRED) + +function(add_tf_dependencies TARGET) + target_compile_options(${TARGET} PUBLIC "-fexceptions") + target_include_directories(${TARGET} PUBLIC ${Tensorflow_INCLUDE_DIR}) + target_link_options(${TARGET} PUBLIC "LINKER:--no-as-needed" "LINKER:--allow-multiple-definition") + target_link_libraries(${TARGET} PUBLIC OpenSSL::Crypto) + target_link_libraries(${TARGET} PUBLIC ${Tensorflow_CC} ${Tensorflow_FRAMEWORK}) +endfunction() diff --git a/src/Am/AdaptedAcousticModel.hh b/src/Am/AdaptedAcousticModel.hh index 908e4d5a2..31701b158 100644 --- a/src/Am/AdaptedAcousticModel.hh +++ b/src/Am/AdaptedAcousticModel.hh @@ -22,7 +22,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include namespace Am { diff --git a/src/Am/CMakeLists.txt b/src/Am/CMakeLists.txt new file mode 100644 index 000000000..b508a4196 --- /dev/null +++ b/src/Am/CMakeLists.txt @@ -0,0 +1,42 @@ +set(Am_SOURCES + AcousticModel.cc + AcousticModelAdaptor.cc + ClassicAcousticModel.cc + ClassicHmmTopologySet.cc + ClassicStateModel.cc + ClassicStateTying.cc + ClassicTransducerBuilder.cc + Module.cc + TransitionModel.cc + Utilities.cc) + +if (${MODULE_CART}) + list(APPEND Am_SOURCES DecisionTreeStateTying.cc ClassicDecisionTree.cc) +endif () + +if (${MODULE_ADAPT_MLLR}) + list(APPEND Am_SOURCES AdaptedAcousticModel.cc AdaptationTree.cc) +endif () + +add_library(RasrAm ${Am_SOURCES}) + +target_link_libraries( + RasrAm + INTERFACE RasrMm + RasrBliss + RasrFsa + RasrCore + RasrMc + RasrMath + RasrMathLapack) + +if (${MODULE_CART}) + target_link_libraries(RasrAm INTERFACE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(RasrAm INTERFACE RasrMathNr) +endif () + +add_executable(check-am check.cc) +target_link_libraries(check-am PRIVATE RasrAm) diff --git a/src/Am/Module.cc b/src/Am/Module.cc index 0052c7863..ae91c485f 100644 --- a/src/Am/Module.cc +++ b/src/Am/Module.cc @@ -15,7 +15,9 @@ #include "Module.hh" #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "ClassicAcousticModel.hh" #ifdef MODULE_CART diff --git a/src/Am/TransitionModel.cc b/src/Am/TransitionModel.cc index 10894ae43..5e986996b 100644 --- a/src/Am/TransitionModel.cc +++ b/src/Am/TransitionModel.cc @@ -17,7 +17,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include // implementation details for the TransitionModel::apply function diff --git a/src/Audio/CMakeLists.txt b/src/Audio/CMakeLists.txt new file mode 100644 index 000000000..7adf5ee47 --- /dev/null +++ b/src/Audio/CMakeLists.txt @@ -0,0 +1,28 @@ +set(Audio_SOURCES Module.cc Node.cc) + +if (${MODULE_AUDIO_FFMPEG}) + list(APPEND Audio_SOURCES Ffmpeg.cc) +endif () + +if (${MODULE_AUDIO_FLAC}) + list(APPEND Audio_SOURCES Flac.cc flac/FlacDecoder.cc) +endif () + +if (${SYSTEM_NAME} STREQUAL "linux" AND ${MODULE_AUDIO_OSS}) + list(APPEND Audio_SOURCES Oss.cc) +endif () + +if (${MODULE_AUDIO_RAW}) + list(APPEND Audio_SOURCES Raw.cc) +endif () + +if (${MODULE_AUDIO_WAV_SYSTEM}) + list(APPEND Audio_SOURCES Wav.cc) +endif () + +add_library(RasrAudio STATIC ${Audio_SOURCES}) + +target_link_libraries(RasrAudio INTERFACE RasrFlow RasrCore) + +add_executable(check-audio check.cc) +target_link_libraries(check-audio PRIVATE RasrAudio) diff --git a/src/Audio/Module.cc b/src/Audio/Module.cc index c79734ff7..28802065a 100644 --- a/src/Audio/Module.cc +++ b/src/Audio/Module.cc @@ -14,7 +14,9 @@ */ #include "Module.hh" #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif // predefined filter #ifdef MODULE_AUDIO_RAW diff --git a/src/Audio/Wav.cc b/src/Audio/Wav.cc index 13b687f7a..1da84e763 100644 --- a/src/Audio/Wav.cc +++ b/src/Audio/Wav.cc @@ -15,7 +15,9 @@ #include "Wav.hh" #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include diff --git a/src/Bliss/CMakeLists.txt b/src/Bliss/CMakeLists.txt new file mode 100644 index 000000000..62cde38df --- /dev/null +++ b/src/Bliss/CMakeLists.txt @@ -0,0 +1,37 @@ +set(Bliss_SOURCES + CorpusDescription.cc + CorpusKey.cc + CorpusParser.cc + CorpusStatistics.cc + EditDistance.cc + Evaluation.cc + Fsa.cc + Lexicon.cc + LexiconParser.cc + Orthography.cc + Phoneme.cc + Phonology.cc + PrefixTree.cc + SegmentOrdering.cc + Symbol.cc + Unknown.cc) + +if (${MODULE_THEANO_INTERFACE}) + list(APPEND Bliss_SOURCES TheanoCommunicator.cc + TheanoSegmentOrderingVisitor.cc) +endif () + +if (${MODULE_PYTHON}) + list(APPEND Bliss_SOURCES PythonSegmentOrdering.cc) +endif () + +add_library(RasrBliss ${Bliss_SOURCES}) + +target_link_libraries(RasrBliss INTERFACE RasrFsa RasrMath RasrCore) + +if (${MODULE_PYTHON}) + add_python_dependencies(RasrBliss) +endif () + +add_executable(check-bliss check.cc) +target_link_libraries(check-bliss PRIVATE RasrBliss) diff --git a/src/Bliss/CorpusDescription.cc b/src/Bliss/CorpusDescription.cc index 0e54b0aac..1adb74ceb 100644 --- a/src/Bliss/CorpusDescription.cc +++ b/src/Bliss/CorpusDescription.cc @@ -23,7 +23,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #ifdef MODULE_THEANO_INTERFACE diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..2c38fc28d --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,47 @@ +add_subdirectory(Am) +add_subdirectory(Audio) +add_subdirectory(Bliss) +add_subdirectory(Core) +add_subdirectory(Flow) +add_subdirectory(Fsa) +add_subdirectory(Lattice) +add_subdirectory(Lm) +add_subdirectory(Math) +add_subdirectory(Mc) +add_subdirectory(Mm) +add_subdirectory(Search) +add_subdirectory(Signal) +add_subdirectory(Speech) +add_subdirectory(Tools) + +if (${MODULE_CART}) + add_subdirectory(Cart) +endif () + +if (${MODULE_FLF}) + add_subdirectory(Flf) +endif () + +if (${MODULE_OPENFST}) + add_subdirectory(OpenFst) +endif () + +if (${MODULE_NN}) + add_subdirectory(Nn) +endif () + +if (${MODULE_ONNX}) + add_subdirectory(Onnx) +endif () + +if (${MODULE_PYTHON}) + add_subdirectory(Python) +endif () + +if (${MODULE_TENSORFLOW}) + add_subdirectory(Tensorflow) +endif () + +if (${MODULE_TEST}) + add_subdirectory(Test) +endif () diff --git a/src/Cart/CMakeLists.txt b/src/Cart/CMakeLists.txt new file mode 100644 index 000000000..3e96b34a8 --- /dev/null +++ b/src/Cart/CMakeLists.txt @@ -0,0 +1,16 @@ +set(Cart_SOURCES + Conditions.cc + Properties.cc + Example.cc + BinaryTree.cc + DecisionTree.cc + Cluster.cc + DecisionTreeTrainer.cc + Parser.cc) + +add_library(RasrCart STATIC ${Cart_SOURCES}) + +target_link_libraries(RasrCart INTERFACE RasrCore) + +add_executable(check-cart check.cc) +target_link_libraries(check-cart PRIVATE RasrCart) diff --git a/src/Core/Application.cc b/src/Core/Application.cc index 8de675e27..b45a7f500 100644 --- a/src/Core/Application.cc +++ b/src/Core/Application.cc @@ -22,7 +22,9 @@ #ifdef OS_linux #include #endif +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Application.hh" #include "CacheManager.hh" #include "Channel.hh" diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt new file mode 100644 index 000000000..143d42ebc --- /dev/null +++ b/src/Core/CMakeLists.txt @@ -0,0 +1,62 @@ +set(Core_SOURCES + Application.cc + Archive.cc + ArithmeticExpressionParser.cc + Assertions.cc + BinaryStream.cc + BinaryTree.cc + BundleArchive.cc + CacheManager.cc + Channel.cc + Choice.cc + CodeGenerator.cc + Component.cc + CompressedStream.cc + Configuration.cc + Debug.cc + Dependency.cc + Description.cc + Directory.cc + DirectoryArchive.cc + FileArchive.cc + FormatSet.cc + IoUtilities.cc + MappedArchive.cc + MemoryInfo.cc + MD5.cc + MurmurHash.cc + Parameter.cc + ProgressIndicator.cc + ReferenceCounting.cc + ResourceUsageInfo.cc + Statistics.cc + StringExpression.cc + StringUtilities.cc + TextStream.cc + Tokenizer.cc + Types.cc + Unicode.cc + Utility.cc + Version.cc + XmlBuilder.cc + XmlBuilder2.cc + XmlParser.cc + XmlStream.cc) + +find_package(BISON REQUIRED) + +bison_target( + ArithmeticExpressionParser + ${CMAKE_CURRENT_SOURCE_DIR}/ArithmeticExpressionParser.yy + ${CMAKE_CURRENT_SOURCE_DIR}/ArithmeticExpressionParser.cc + DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/ArithmeticExpressionParser.hh + COMPILE_FLAGS "-d") +list(APPEND Core_SOURCES ${BISON_ArithmeticExpressionParser_OUTPUTS}) + +add_library(RasrCore STATIC ${Core_SOURCES}) +add_dependencies(RasrCore SourceVersion) + +target_compile_options(RasrCore PRIVATE "-fexceptions") + +add_executable(check-core check.cc) +target_link_libraries(check-core PRIVATE RasrCore) diff --git a/src/Core/CacheManager.hh b/src/Core/CacheManager.hh index 246aa8057..66f779d88 100644 --- a/src/Core/CacheManager.hh +++ b/src/Core/CacheManager.hh @@ -1,8 +1,9 @@ #ifndef _CORE_CACHE_MANAGER #define _CORE_CACHE_MANAGER +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif #ifdef MODULE_CORE_CACHE_MANAGER #include diff --git a/src/Core/Configuration.hh b/src/Core/Configuration.hh index 3af6f281e..14fccd4ab 100644 --- a/src/Core/Configuration.hh +++ b/src/Core/Configuration.hh @@ -17,8 +17,9 @@ #ifndef _CORE_CONFIGURATION_HH #define _CORE_CONFIGURATION_HH +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif #include #include #include diff --git a/src/Core/OpenMPWrapper.hh b/src/Core/OpenMPWrapper.hh index 2c80d34a4..d0f68d412 100644 --- a/src/Core/OpenMPWrapper.hh +++ b/src/Core/OpenMPWrapper.hh @@ -16,7 +16,9 @@ #define OPENMP_WRAPPER_HH_ #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #ifdef MODULE_OPENMP #include diff --git a/src/Core/Statistics.cc b/src/Core/Statistics.cc index 25ad4cf83..6bbe01954 100644 --- a/src/Core/Statistics.cc +++ b/src/Core/Statistics.cc @@ -15,7 +15,7 @@ // $Id$ #include "Statistics.hh" -#include +#include "Application.hh" #include #include #include diff --git a/src/Core/Utility.hh b/src/Core/Utility.hh index 68074f040..d5bf39e17 100644 --- a/src/Core/Utility.hh +++ b/src/Core/Utility.hh @@ -15,7 +15,9 @@ #ifndef _CORE_UTILITY_HH #define _CORE_UTILITY_HH +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Flf/Archive.cc b/src/Flf/Archive.cc index 506f26a44..7fdb09d53 100644 --- a/src/Flf/Archive.cc +++ b/src/Flf/Archive.cc @@ -20,7 +20,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Archive.hh" #include "ConfusionNetworkIo.hh" diff --git a/src/Flf/CMakeLists.txt b/src/Flf/CMakeLists.txt new file mode 100644 index 000000000..7359c888c --- /dev/null +++ b/src/Flf/CMakeLists.txt @@ -0,0 +1,90 @@ +add_subdirectory(FlfCore) + +if (${MODULE_FLF_EXT}) + add_subdirectory(FlfExt) +endif () + +set(Flf_SOURCES + Archive.cc + Best.cc + Cache.cc + CenterFrameConfusionNetworkBuilder.cc + Combination.cc + Compose.cc + Concatenate.cc + ConfusionNetwork.cc + ConfusionNetworkCombination.cc + ConfusionNetworkIo.cc + CorpusProcessor.cc + Copy.cc + Convert.cc + Draw.cc + Determinize.cc + EpsilonRemoval.cc + Evaluate.cc + Filter.cc + Formattings.cc + FlfIo.cc + FwdBwd.cc + GammaCorrection.cc + HtkSlfIo.cc + Info.cc + Io.cc + LanguageModel.cc + LatticeAdaptor.cc + LatticeHandler.cc + Lexicon.cc + LocalCostDecoder.cc + Map.cc + Miscellaneous.cc + Module.cc + NBest.cc + Network.cc + NodeFactory.cc + NonWordFilter.cc + PivotArcConfusionNetworkBuilder.cc + Processor.cc + Prune.cc + PushForwardRescoring.cc + Recognizer.cc + IncrementalRecognizer.cc + Rescore.cc + RescoreLm.cc + RescoreInternal.cc + Rescale.cc + Segment.cc + SegmentwiseSpeechProcessor.cc + StateClusterConfusionNetworkBuilder.cc + TimeAlignment.cc + TimeframeConfusionNetwork.cc + TimeframeConfusionNetworkBuilder.cc + TimeframeConfusionNetworkCombination.cc + TimeframeConfusionNetworkIo.cc + TimeframeError.cc + Traceback.cc + Union.cc) + +add_library(RasrFlf STATIC ${Flf_SOURCES}) + +target_link_libraries(RasrFlf INTERFACE RasrFlfCore) + +if (${MODULE_FLF_EXT}) + target_link_libraries(RasrFlf INTERFACE RasrFlfExt) +endif () + +target_link_libraries( + RasrFlf + INTERFACE RasrSpeech + RasrLattice + RasrLm + RasrAm + RasrMm + RasrMc + RasrCart + RasrBliss + RasrFlow + RasrFsa + RasrCore) + +add_executable(check-flf check.cc) +target_link_libraries(check-flf PRIVATE RasrFlf) diff --git a/src/Flf/FlfCore/CMakeLists.txt b/src/Flf/FlfCore/CMakeLists.txt new file mode 100644 index 000000000..1a4342384 --- /dev/null +++ b/src/Flf/FlfCore/CMakeLists.txt @@ -0,0 +1,20 @@ +set(FlfCore_SOURCES + Ftl.cc + Basic.cc + Boundaries.cc + Lattice.cc + LatticeInternal.cc + Semiring.cc + TopologicalOrderQueue.cc + Traverse.cc + Types.cc + Utility.cc + Weight.cc +) + +add_library(RasrFlfCore STATIC ${FlfCore_SOURCES}) + +target_link_libraries(RasrFlfCore INTERFACE RasrFsa RasrCore) + +add_executable(check-flf-core check.cc) +target_link_libraries(check-flf-core PRIVATE RasrFlfCore) diff --git a/src/Flf/FlfExt/CMakeLists.txt b/src/Flf/FlfExt/CMakeLists.txt new file mode 100644 index 000000000..21c887e2d --- /dev/null +++ b/src/Flf/FlfExt/CMakeLists.txt @@ -0,0 +1,9 @@ +set(FlfExt_SOURCES + AcousticAlignment.cc + MapDecoder.cc + MtConfusionNetwork.cc + WindowedLevenshteinDistanceDecoder.cc +) + +add_library(RasrFlfExt STATIC ${FlfExt_SOURCES}) +target_link_libraries(RasrFlfExt INTERFACE RasrFlf RasrFsa RasrCore) diff --git a/src/Flf/GammaCorrection.cc b/src/Flf/GammaCorrection.cc index 700f7de02..cfcd91fd2 100644 --- a/src/Flf/GammaCorrection.cc +++ b/src/Flf/GammaCorrection.cc @@ -14,7 +14,7 @@ */ #include #include -#include +#include "GammaCorrection.hh" namespace Flf { diff --git a/src/Flf/NodeRegistration.hh b/src/Flf/NodeRegistration.hh index 8beb4e47f..0cabadeab 100644 --- a/src/Flf/NodeRegistration.hh +++ b/src/Flf/NodeRegistration.hh @@ -15,8 +15,9 @@ #ifndef _FLF_NODE_REGISTRATION_HH #define _FLF_NODE_REGISTRATION_HH +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif #include "Archive.hh" #include "Best.hh" #include "Cache.hh" diff --git a/src/Flf/SegmentwiseSpeechProcessor.cc b/src/Flf/SegmentwiseSpeechProcessor.cc index 0f42fff39..10adf79a8 100644 --- a/src/Flf/SegmentwiseSpeechProcessor.cc +++ b/src/Flf/SegmentwiseSpeechProcessor.cc @@ -14,7 +14,7 @@ */ #include #include -#include +#include "SegmentwiseSpeechProcessor.hh" #include namespace Flf { diff --git a/src/Flf/Traceback.cc b/src/Flf/Traceback.cc index 289ae6978..96a7d6c26 100644 --- a/src/Flf/Traceback.cc +++ b/src/Flf/Traceback.cc @@ -18,7 +18,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include "Best.hh" diff --git a/src/Flow/CMakeLists.txt b/src/Flow/CMakeLists.txt new file mode 100644 index 000000000..dcedd6a15 --- /dev/null +++ b/src/Flow/CMakeLists.txt @@ -0,0 +1,33 @@ +set(Flow_SOURCES + AbstractNode.cc + Aggregate.cc + Attributes.cc + Cache.cc + Cutter.cc + CorpusKeyMap.cc + Data.cc + DataAdaptor.cc + Datatype.cc + Demo.cc + Dump.cc + Link.cc + Module.cc + Network.cc + NetworkParser.cc + Node.cc + Registry.cc + Repeater.cc + SequenceFilter.cc + WarpTimeFilter.cc + StringExpressionNode.cc + Synchronization.cc + Timestamp.cc + Vector.cc + VectorTextInput.cc) + +add_library(RasrFlow STATIC ${Flow_SOURCES}) + +target_link_libraries(RasrFlow INTERFACE RasrCore) + +add_executable(check-flow check.cc) +target_link_libraries(check-flow PRIVATE RasrFlow) diff --git a/src/Flow/NetworkParser.cc b/src/Flow/NetworkParser.cc index a3e8af6c2..3ab1f94c5 100644 --- a/src/Flow/NetworkParser.cc +++ b/src/Flow/NetworkParser.cc @@ -15,7 +15,9 @@ #include "NetworkParser.hh" #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include "Filter.hh" #include "Network.hh" diff --git a/src/Fsa/CMakeLists.txt b/src/Fsa/CMakeLists.txt new file mode 100644 index 000000000..d4b26f824 --- /dev/null +++ b/src/Fsa/CMakeLists.txt @@ -0,0 +1,43 @@ +set(Fsa_SOURCES + Accessible.cc + Alphabet.cc + AlphabetUtility.cc + AlphabetXml.cc + Archive.cc + Arithmetic.cc + Basic.cc + Best.cc + Cache.cc + Compose.cc + Determinize.cc + Input.cc + Levenshtein.cc + Linear.cc + Minimize.cc + Output.cc + Packed.cc + Permute.cc + Properties.cc + Project.cc + Prune.cc + Random.cc + Resources.cc + Rational.cc + RemoveEpsilons.cc + Semiring.cc + Semiring64.cc + Sort.cc + Sssp.cc + Sssp4SpecialSymbols.cc + Static.cc + Storage.cc + Types.cc + Utility.cc) + +add_library(RasrFsa STATIC ${Fsa_SOURCES}) + +target_link_libraries(RasrFsa INTERFACE RasrCore) + +# check.cc code is broken +# add_executable(check-fsa check.cc) +# target_link_libraries(check-fsa PRIVATE RasrFsa) diff --git a/src/Lattice/Archive.cc b/src/Lattice/Archive.cc index c43ddd6a0..b8ea84924 100644 --- a/src/Lattice/Archive.cc +++ b/src/Lattice/Archive.cc @@ -21,7 +21,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Archive.hh" #ifdef MODULE_LATTICE_HTK diff --git a/src/Lattice/CMakeLists.txt b/src/Lattice/CMakeLists.txt new file mode 100644 index 000000000..b35772d1e --- /dev/null +++ b/src/Lattice/CMakeLists.txt @@ -0,0 +1,53 @@ +set(Lattice_SOURCES Archive.cc Basic.cc Lattice.cc LatticeAdaptor.cc + Morphism.cc Utilities.cc) + +if (${MODULE_LATTICE_BASIC}) + list(APPEND Lattice_SOURCES Cache.cc Static.cc Compose.cc) +endif () + +if (${MODULE_LATTICE_DT}) + list( + APPEND + Lattice_SOURCES + Accuracy.cc + Arithmetic.cc + Best.cc + Merge.cc + Posterior.cc + Rational.cc + RemoveEpsilons.cc + SmoothedAccuracy.cc + SmoothingFunction.cc + TimeframeError.cc) +endif () + +if (${MODULE_LATTICE_HTK}) + list(APPEND Lattice_SOURCES HtkReader.cc HtkWriter.cc) +endif () + +add_library(RasrLattice STATIC ${Lattice_SOURCES}) + +target_link_libraries( + RasrLattice + INTERFACE RasrSpeech + RasrLm + RasrAm + RasrMm + RasrMc + RasrBliss + RasrFsa + RasrAudio + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + RasrCore + RasrCart) + +if (${MODULE_MATH_NR}) + target_link_libraries(RasrLattice INTERFACE RasrMathNr) +endif () + +# check.cc code is broken +# add_executable(check-lattice check.cc) +# target_link_libraries(check-lattice PRIVATE RasrLattice) diff --git a/src/Lm/CMakeLists.txt b/src/Lm/CMakeLists.txt new file mode 100644 index 000000000..028553e8e --- /dev/null +++ b/src/Lm/CMakeLists.txt @@ -0,0 +1,87 @@ +set(Lm_SOURCES + AbstractNNLanguageModel.cc + BackingOff.cc + ClassLm.cc + CombineLm.cc + Compose.cc + CorpusStatistics.cc + IndexMap.cc + LanguageModel.cc + Module.cc + NNHistoryManager.cc + ReverseArpaLm.cc + ScaledLanguageModel.cc + WordlistInterface.cc) + +if (${MODULE_LM_ARPA}) + list(APPEND Lm_SOURCES ArpaLm.cc) +endif () + +if (${MODULE_LM_FSA}) + list(APPEND Lm_SOURCES FsaLm.cc CheatingSegmentLm.cc) +endif () + +if (${MODULE_LM_ZEROGRAM}) + list(APPEND Lm_SOURCES Zerogram.cc) +endif () + +if (${MODULE_LM_FFNN}) + list(APPEND Lm_SOURCES FFNeuralNetworkLanguageModel.cc) +endif () + +if (${MODULE_TENSORFLOW} AND ${MODULE_LM_TFRNN}) + list( + APPEND + Lm_SOURCES + BlasNceSoftmaxAdapter.cc + CompressedVector.cc + FixedQuantizationCompressedVectorFactory.cc + LstmStateManager.cc + NceSoftmaxAdapter.cc + PassthroughSoftmaxAdapter.cc + QuantizedBlasNceSoftmaxAdapter.cc + QuantizedCompressedVectorFactory.cc + ReducedPrecisionCompressedVectorFactory.cc + TransformerStateManager.cc + TFRecurrentLanguageModel.cc) +endif () + +add_library(RasrLm STATIC ${Lm_SOURCES}) + +target_compile_options(RasrLm PRIVATE "-fexceptions") + +target_link_libraries( + RasrLm + INTERFACE RasrFlf + RasrFlfCore + RasrSpeech + RasrAm + RasrMc + RasrBliss + RasrNn + RasrMm + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + ${SEARCH_LIBS} + RasrLattice + RasrFsa + RasrCore) +if (${MODULE_CART}) + target_link_libraries(RasrLm INTERFACE RasrCart) +endif () +if (${MODULE_MATH_NR}) + target_link_libraries(RasrLm INTERFACE RasrMathNr) +endif () +if (${MODULE_PYTHON}) + target_link_libraries(RasrLm INTERFACE RasrPython) +endif () +if (${MODULE_TENSORFLOW} AND ${MODULE_LM_TFRNN}) + target_link_libraries(RasrLm INTERFACE RasrTensorflow) + add_tf_dependencies(RasrLm) +endif () + +# check.cc code is broken +# add_executable(check-lm check.cc) +# target_link_libraries(check-lm PRIVATE RasrLm) diff --git a/src/Lm/Module.cc b/src/Lm/Module.cc index 845a5f789..cf195ed13 100644 --- a/src/Lm/Module.cc +++ b/src/Lm/Module.cc @@ -14,7 +14,9 @@ */ #include "Module.hh" #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "ClassLm.hh" #ifdef MODULE_LM_ARPA #include "ArpaLm.hh" diff --git a/src/Math/Blas.hh b/src/Math/Blas.hh index ae5513a83..6a0d57132 100644 --- a/src/Math/Blas.hh +++ b/src/Math/Blas.hh @@ -16,7 +16,9 @@ #define MATH_BLAS_HH_ // ACML is included with cblas.h and linking to correct cblas library +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #ifdef MODULE_INTEL_MKL diff --git a/src/Math/CMakeLists.txt b/src/Math/CMakeLists.txt new file mode 100644 index 000000000..e21a211cf --- /dev/null +++ b/src/Math/CMakeLists.txt @@ -0,0 +1,32 @@ +add_subdirectory(Lapack) +if (${MODULE_MATH_NR}) + add_subdirectory(Nr) +endif () + +set(RasrMath_SOURCES + AcousticalAnalyticFunctions.cc + AnalyticFunctionFactory.cc + EigenvalueProblem.cc + FastFourierTransform.cc + Module.cc + PiecewiseLinearFunction.cc + Random.cc + CudaDataStructure.cc) + +if (${MODULE_CUDA}) + list(APPEND RasrMath_SOURCES CudaMatrixKernels.cu) +endif () + +if (${MODULE_SIGNAL_PLP}) + list(APPEND RasrMath_SOURCES LevinsonLse.cc) +endif () + +add_library(RasrMath STATIC ${RasrMath_SOURCES}) + +target_compile_options(RasrMath PRIVATE "-fexceptions") + +target_link_libraries(RasrMath INTERFACE RasrMathNr RasrMathLapack RasrCore) + +# check.cc code is broken +# add_executable(check-math check.cc) +# target_link_libraries(check-math PRIVATE RasrMath) diff --git a/src/Math/CublasWrapper.hh b/src/Math/CublasWrapper.hh index a4958a875..64f6c4a9f 100644 --- a/src/Math/CublasWrapper.hh +++ b/src/Math/CublasWrapper.hh @@ -17,7 +17,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include diff --git a/src/Math/CudaMatrixKernelsWrapper.hh b/src/Math/CudaMatrixKernelsWrapper.hh index 58d2f6641..ff840015a 100644 --- a/src/Math/CudaMatrixKernelsWrapper.hh +++ b/src/Math/CudaMatrixKernelsWrapper.hh @@ -15,8 +15,9 @@ #ifndef CUDAMATRIXKERNELSWRAPPER_HH_ #define CUDAMATRIXKERNELSWRAPPER_HH_ +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif /** * Macro CUDACALL inserts the first parameter, if MODULE_CUDA is enabled. * Otherwise, a critical error is raised. diff --git a/src/Math/CudaWrapper.hh b/src/Math/CudaWrapper.hh index 8fdfc736e..9441db6b6 100644 --- a/src/Math/CudaWrapper.hh +++ b/src/Math/CudaWrapper.hh @@ -17,7 +17,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #ifdef MODULE_CUDA #include diff --git a/src/Math/FastVectorOperations.hh b/src/Math/FastVectorOperations.hh index 3f105b653..b16edb5df 100644 --- a/src/Math/FastVectorOperations.hh +++ b/src/Math/FastVectorOperations.hh @@ -15,8 +15,9 @@ #ifndef FAST_VECTOR_OPERATIONS_HH_ #define FAST_VECTOR_OPERATIONS_HH_ +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif #include #include #include diff --git a/src/Math/Lapack/CMakeLists.txt b/src/Math/Lapack/CMakeLists.txt new file mode 100644 index 000000000..4627d6637 --- /dev/null +++ b/src/Math/Lapack/CMakeLists.txt @@ -0,0 +1,12 @@ +set(RasrMathLapack_SOURCES + Lapack.cc + EigenvalueProblem.cc + Svd.cc +) + +add_library(RasrMathLapack STATIC ${RasrMathLapack_SOURCES}) + +target_link_libraries(RasrMathLapack INTERFACE RasrCore) + +add_executable(check-math-lapack check.cc) +target_link_libraries(check-math-lapack PRIVATE RasrMathLapack) diff --git a/src/Math/Nr/CMakeLists.txt b/src/Math/Nr/CMakeLists.txt new file mode 100644 index 000000000..f43127567 --- /dev/null +++ b/src/Math/Nr/CMakeLists.txt @@ -0,0 +1,18 @@ +set(RasrMathNr_SOURCES + BesselFunctions.cc + ConjugateGradient.cc + FastFourierTransform.cc + integration.cc + ludcmp.cc + pythag.cc + PowerSpectrum.cc + Random.cc + svdcmp.cc +) + +add_library(RasrMathNr STATIC ${RasrMathNr_SOURCES}) + +target_link_libraries(RasrMathNr INTERFACE RasrCore) + +add_executable(check-math-nr check.cc) +target_link_libraries(check-math-nr PRIVATE RasrMathNr) diff --git a/src/Math/ProfileMatrix.cc b/src/Math/ProfileMatrix.cc index 6690ead3f..4b9216d35 100644 --- a/src/Math/ProfileMatrix.cc +++ b/src/Math/ProfileMatrix.cc @@ -21,7 +21,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "ProfileMatrix.hh" const Core::ParameterInt MatrixProfiler::paramNumberOfRepetitions("number-of-repetitions", "number of repetitions", 5); diff --git a/src/Math/Random.cc b/src/Math/Random.cc index 60b939f69..fea157ae3 100644 --- a/src/Math/Random.cc +++ b/src/Math/Random.cc @@ -13,7 +13,9 @@ * limitations under the License. */ #include "Random.hh" +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #ifdef MODULE_MATH_NR #include "Nr/Random.hh" #endif diff --git a/src/Math/Random.hh b/src/Math/Random.hh index 450c642c3..5ebd0f0a8 100644 --- a/src/Math/Random.hh +++ b/src/Math/Random.hh @@ -16,7 +16,9 @@ #define _MATH_RANDOM_HH #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include diff --git a/src/Mc/CMakeLists.txt b/src/Mc/CMakeLists.txt new file mode 100644 index 000000000..16d91446c --- /dev/null +++ b/src/Mc/CMakeLists.txt @@ -0,0 +1 @@ +add_library(RasrMc STATIC Component.cc) diff --git a/src/Mm/CMakeLists.txt b/src/Mm/CMakeLists.txt new file mode 100644 index 000000000..e337ee0e7 --- /dev/null +++ b/src/Mm/CMakeLists.txt @@ -0,0 +1,73 @@ +set(RasrMm_SOURCES + AbstractMixtureSetEstimator.cc + CombinedFeatureScorer.cc + CovarianceFeatureScorerElement.cc + CovarianceWeightedFeatureScorerElement.cc + Feature.cc + GaussDensity.cc + GaussDensityEstimator.cc + GaussDiagonalMaximumFeatureScorer.cc + IntelCodeGenerator.cc + IntelOptimization.cc + Mixture.cc + MixtureEstimator.cc + MixtureFeatureScorerElement.cc + MixtureSet.cc + MixtureSetBuilder.cc + MixtureSetEstimator.cc + MixtureSetLoader.cc + MixtureSetReader.cc + MixtureSetSplitter.cc + MixtureSetTopology.cc + Module.cc + StatePosteriorFeatureScorer.cc + SimdFeatureScorer.cc + SSE2CodeGenerator.cc + Utilities.cc) + +if (${MODULE_MM_DT}) + list( + APPEND + RasrMm_SOURCES + ConvertGaussDensityEstimator.cc + ConvertMixtureEstimator.cc + ConvertMixtureSetEstimator.cc + DiscriminativeGaussDensityEstimator.cc + DiscriminativeMixtureEstimator.cc + DiscriminativeMixtureSetEstimator.cc + EbwDiscriminativeGaussDensityEstimator.cc + EbwDiscriminativeMixtureEstimator.cc + EbwDiscriminativeMixtureSetEstimator.cc + ISmoothingGaussDensityEstimator.cc + ISmoothingMixtureEstimator.cc + ISmoothingMixtureSetEstimator.cc + IterationConstants.cc + RpropOptimization.cc + RpropDiscriminativeGaussDensityEstimator.cc + RpropDiscriminativeMixtureEstimator.cc + RpropDiscriminativeMixtureSetEstimator.cc) +endif () +if (${MODULE_MM_BATCH}) + list(APPEND RasrMm_SOURCES BatchFeatureScorer.cc DensityClustering.cc) +endif () +if (${MODULE_ADAPT_ADVANCED}) + list(APPEND RasrMm_SOURCES BandMllrAdaptation.cc SemiTiedAdaptation.cc) +endif () +if (${MODULE_ADAPT_MLLR}) + list(APPEND RasrMm_SOURCES MllrAdaptation.cc) +endif () +if (${MODULE_ADAPT_CMLLR}) + list(APPEND RasrMm_SOURCES AffineFeatureTransformAccumulator.cc) +endif () + +add_library(RasrMm STATIC ${RasrMm_SOURCES}) + +target_link_libraries(RasrMm INTERFACE RasrMath RasrMathLapack RasrFsa RasrCore + RasrMc) + +if (${MODULE_MM_BATCH}) + target_compile_options(RasrMm PRIVATE "-msse2") +endif () + +add_executable(check-mm check.cc) +target_link_libraries(check-mm PRIVATE RasrMm) diff --git a/src/Mm/MixtureSet.cc b/src/Mm/MixtureSet.cc index 0d300a14c..6e221385c 100644 --- a/src/Mm/MixtureSet.cc +++ b/src/Mm/MixtureSet.cc @@ -15,7 +15,9 @@ #include "MixtureSet.hh" #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include using namespace Mm; diff --git a/src/Mm/MixtureSetReader.cc b/src/Mm/MixtureSetReader.cc index f11490922..3ce7ed347 100644 --- a/src/Mm/MixtureSetReader.cc +++ b/src/Mm/MixtureSetReader.cc @@ -15,7 +15,9 @@ #include "MixtureSetReader.hh" #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Module.hh" namespace Mm { class LogLinearMixtureSet : public Core::ReferenceCounted {}; diff --git a/src/Mm/Module.cc b/src/Mm/Module.cc index 75b97b6d6..6d544cb92 100644 --- a/src/Mm/Module.cc +++ b/src/Mm/Module.cc @@ -15,7 +15,9 @@ #include "Module.hh" #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "FeatureScorerFactory.hh" #include "GaussDiagonalMaximumFeatureScorer.hh" #include "MixtureSet.hh" diff --git a/src/Mm/Module.hh b/src/Mm/Module.hh index 8510902f4..8d770c34d 100644 --- a/src/Mm/Module.hh +++ b/src/Mm/Module.hh @@ -17,7 +17,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "AssigningFeatureScorer.hh" #include "MixtureSetEstimator.hh" #include "ScaledFeatureScorer.hh" diff --git a/src/Nn/BufferedAlignedFeatureProcessor.cc b/src/Nn/BufferedAlignedFeatureProcessor.cc index 2f2e21cfc..30da22777 100644 --- a/src/Nn/BufferedAlignedFeatureProcessor.cc +++ b/src/Nn/BufferedAlignedFeatureProcessor.cc @@ -18,7 +18,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include "FeedForwardTrainer.hh" diff --git a/src/Nn/BufferedFeatureExtractor.cc b/src/Nn/BufferedFeatureExtractor.cc index a1b8caa52..714d6423d 100644 --- a/src/Nn/BufferedFeatureExtractor.cc +++ b/src/Nn/BufferedFeatureExtractor.cc @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include "BufferedFeatureExtractor.hh" #include #include diff --git a/src/Nn/CMakeLists.txt b/src/Nn/CMakeLists.txt new file mode 100644 index 000000000..7fc44a7f3 --- /dev/null +++ b/src/Nn/CMakeLists.txt @@ -0,0 +1,78 @@ +set(RasrNn_SOURCES Module.cc) + +if (${MODULE_NN}) + list( + APPEND + RasrNn_SOURCES + ActivationLayer.cc + Activations.cc + AllophoneStateFsaExporter.cc + BatchEstimator.cc + BatchFeatureScorer.cc + BufferedAlignedFeatureProcessor.cc + BufferedFeatureExtractor.cc + BufferedSegmentFeatureProcessor.cc + ClassLabelWrapper.cc + Criterion.cc + CtcCriterion.cc + Estimator.cc + FeatureScorer.cc + FeedForwardTrainer.cc + GradientCheck.cc + LinearAndActivationLayer.cc + LinearLayer.cc + LookupLayer.cc + MeanNormalizedSgdEstimator.cc + NetworkTopology.cc + NeuralNetwork.cc + NeuralNetworkForwardNode.cc + NeuralNetworkLayer.cc + NeuralNetworkTrainer.cc + OperationLayer.cc + PoolingLayer.cc + PreprocessingLayer.cc + Prior.cc + Regularizer.cc + RpropEstimator.cc + Statistics.cc + TrainerFeatureScorer.cc) +endif () +if (${MODULE_NN_SEQUENCE_TRAINING}) + list( + APPEND + RasrNn_SOURCES + EmissionLatticeRescorer.cc + LatticeAccumulators.cc + SegmentwiseNnTrainer.cc + MmiSegmentwiseNnTrainer.cc + MeSegmentwiseNnTrainer.cc + SharedNeuralNetwork.cc) +endif () +if (${MODULE_PYTHON}) + list(APPEND RasrNn_SOURCES PythonFeatureScorer.cc PythonTrainer.cc + PythonControl.cc PythonLayer.cc) +endif () +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH}) + list(APPEND RasrNn_SOURCES LabelScorer.cc) + if (${MODULE_TENSORFLOW}) + list(APPEND RasrNn_SOURCES TFLabelScorer.cc) + endif () +endif () + +add_library(RasrNn STATIC ${RasrNn_SOURCES}) + +target_link_libraries(RasrNn INTERFACE RasrCore RasrMath RasrMathLapack + RasrFlow RasrSignal RasrSpeech) + +target_compile_options(RasrNn PRIVATE "-fexceptions") + +if (${MODULE_PYTHON}) + add_python_dependencies(RasrNn) +endif () + +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH} AND ${MODULE_TENSORFLOW}) + add_tf_dependencies(RasrNn) +endif () + +add_executable(check-nn check.cc) +target_link_libraries(check-nn PRIVATE RasrNn) diff --git a/src/Nn/FeedForwardTrainer.hh b/src/Nn/FeedForwardTrainer.hh index 5a04be44f..85d281ab0 100644 --- a/src/Nn/FeedForwardTrainer.hh +++ b/src/Nn/FeedForwardTrainer.hh @@ -18,7 +18,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include "BufferedAlignedFeatureProcessor.hh" diff --git a/src/Nn/Module.cc b/src/Nn/Module.cc index efb1485d5..4d461c3ad 100644 --- a/src/Nn/Module.cc +++ b/src/Nn/Module.cc @@ -15,7 +15,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Module.hh" #include "Statistics.hh" diff --git a/src/Nn/NeuralNetworkTrainer.cc b/src/Nn/NeuralNetworkTrainer.cc index c3eb5ae37..215d1f856 100644 --- a/src/Nn/NeuralNetworkTrainer.cc +++ b/src/Nn/NeuralNetworkTrainer.cc @@ -22,8 +22,9 @@ #include #include // XML I/O stuff for writing parameters +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif #ifdef MODULE_PYTHON #include "PythonTrainer.hh" #endif diff --git a/src/Nn/SegmentwiseNnTrainer.hh b/src/Nn/SegmentwiseNnTrainer.hh index 39b5920a4..e3f7ee8d7 100644 --- a/src/Nn/SegmentwiseNnTrainer.hh +++ b/src/Nn/SegmentwiseNnTrainer.hh @@ -17,7 +17,9 @@ #include #include // for mix2phoneme map ( lattice coverage statistics) +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include "ActivationLayer.hh" diff --git a/src/Onnx/CMakeLists.txt b/src/Onnx/CMakeLists.txt new file mode 100644 index 000000000..cbfd71a46 --- /dev/null +++ b/src/Onnx/CMakeLists.txt @@ -0,0 +1,11 @@ +set(RasrOnnx_SOURCES Session.cc IOSpecification.cc Module.cc + OnnxFeatureScorer.cc OnnxForwardNode.cc Value.cc) + +add_library(RasrOnnx STATIC ${RasrOnnx_SOURCES}) + +add_onnx_dependencies(RasrOnnx) +target_link_libraries(RasrOnnx INTERFACE RasrCore) + +add_executable(check-onnx check.cc) +target_link_libraries(check-onnx PRIVATE RasrOnnx) +add_onnx_dependencies(check-onnx) diff --git a/src/OpenFst/CMakeLists.txt b/src/OpenFst/CMakeLists.txt new file mode 100644 index 000000000..ebe2c69af --- /dev/null +++ b/src/OpenFst/CMakeLists.txt @@ -0,0 +1,8 @@ +set(RasrOpenFst_SOURCES Input.cc Module.cc Output.cc SymbolTable.cc) + +add_library(RasrOpenFst STATIC ${RasrOpenFst_SOURCES}) + +target_link_libraries(RasrOpenFst INTERFACE RasrBliss RasrFsa RasrCore) + +add_executable(check-openfst check.cc) +target_link_libraries(check-openfst PRIVATE RasrOpenFst) diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt new file mode 100644 index 000000000..455c36cc9 --- /dev/null +++ b/src/Python/CMakeLists.txt @@ -0,0 +1,11 @@ +set(RasrPython_SOURCES + AllophoneStateFsaBuilder.cc + Configuration.cc + Init.cc + Numpy.cc + Utilities.cc +) + +add_library(RasrPython STATIC ${RasrPython_SOURCES}) +add_python_dependencies(RasrPython) +target_compile_options(RasrPython PRIVATE "-fexceptions") diff --git a/src/Python/Numpy.hh b/src/Python/Numpy.hh index 10ded046d..fc3b37256 100644 --- a/src/Python/Numpy.hh +++ b/src/Python/Numpy.hh @@ -22,7 +22,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include diff --git a/src/Python/check.cc b/src/Python/check.cc index df24ea1e3..814b4630d 100644 --- a/src/Python/check.cc +++ b/src/Python/check.cc @@ -13,7 +13,9 @@ * limitations under the License. */ #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Init.hh" #include "Numpy.hh" diff --git a/src/Search/AdvancedTreeSearch/CMakeLists.txt b/src/Search/AdvancedTreeSearch/CMakeLists.txt new file mode 100644 index 000000000..30dc088e6 --- /dev/null +++ b/src/Search/AdvancedTreeSearch/CMakeLists.txt @@ -0,0 +1,30 @@ +set(RasrAdvancedTreeSearch_SOURCES + AcousticLookAhead.cc + AdvancedTreeSearch.cc + DynamicBeamPruningStrategy.cc + Helpers.cc + LanguageModelLookahead.cc + PathRecombination.cc + PathRecombinationApproximation.cc + PersistentStateTree.cc + PrefixFilter.cc + SearchSpace.cc + SearchSpaceHelpers.cc + SearchSpaceStatistics.cc + SimpleThreadPool.cc + Trace.cc + TreeBuilder.cc + TreeStructure.cc +) + +add_library(RasrAdvancedTreeSearch STATIC ${RasrAdvancedTreeSearch_SOURCES}) +target_link_libraries(RasrAdvancedTreeSearch INTERFACE + RasrSearch + RasrBliss + RasrFsa + RasrCore +) + +target_compile_options(RasrAdvancedTreeSearch PRIVATE + "-Wno-sign-compare -Winline --param max-inline-insns-auto=10000 --param max-inline-insns-single=10000 --param large-function-growth=25000 --param inline-unit-growth=400" +) diff --git a/src/Search/CMakeLists.txt b/src/Search/CMakeLists.txt new file mode 100644 index 000000000..39182b0e3 --- /dev/null +++ b/src/Search/CMakeLists.txt @@ -0,0 +1,35 @@ +if (${MODULE_SEARCH_WFST}) + add_subdirectory(Wfst) +endif () +if (${MODULE_ADVANCED_TREE_SEARCH}) + add_subdirectory(AdvancedTreeSearch) +endif () +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH}) + add_subdirectory(GenericSeq2SeqTreeSearch) +endif () + +set(RasrSearch_SOURCES + Aligner.cc + LatticeHandler.cc + LanguageModelLookahead.cc + Module.cc + Search.cc + StateTree.cc + StateTreeIo.cc + WordConditionedTreeSearch.cc) + +if (${MODULE_SEARCH_MBR}) + list(APPEND RasrSearch_SOURCES MinimumBayesRiskSearch.cc + MinimumBayesRiskAStarSearch.cc MinimumBayesRiskNBestListSearch.cc + MinimumBayesRiskSearchUtil.cc) +endif () +if (${MODULE_SEARCH_LINEAR}) + list(APPEND RasrSearch_SOURCES LinearSearch.cc) +endif () + +add_library(RasrSearch STATIC ${RasrSearch_SOURCES}) + +target_link_libraries(RasrSearch INTERFACE RasrBliss RasrFsa RasrCore RasrLattice) + +add_executable(check-search check.cc) +target_link_libraries(check-search PRIVATE RasrSearch) diff --git a/src/Search/GenericSeq2SeqTreeSearch/CMakeLists.txt b/src/Search/GenericSeq2SeqTreeSearch/CMakeLists.txt new file mode 100644 index 000000000..9c0d40f46 --- /dev/null +++ b/src/Search/GenericSeq2SeqTreeSearch/CMakeLists.txt @@ -0,0 +1,15 @@ +set(RasrGenericSeq2SeqTreeSearch_SOURCES + Seq2SeqTreeSearch.cc + Seq2SeqAligner.cc +) + +add_library(RasrGenericSeq2SeqTreeSearch STATIC ${RasrGenericSeq2SeqTreeSearch_SOURCES}) +target_link_libraries(RasrGenericSeq2SeqTreeSearch INTERFACE + RasrSearch + RasrBliss + RasrFsa + RasrCore +) +target_compile_options(RasrGenericSeq2SeqTreeSearch PRIVATE + "-Wno-sign-compare -Winline --param max-inline-insns-auto=10000 --param max-inline-insns-single=10000 --param large-function-growth=25000 --param inline-unit-growth=400" +) diff --git a/src/Search/Module.cc b/src/Search/Module.cc index 2dd703b21..5eb4afae4 100644 --- a/src/Search/Module.cc +++ b/src/Search/Module.cc @@ -12,7 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Search/Wfst/CMakeLists.txt b/src/Search/Wfst/CMakeLists.txt new file mode 100644 index 000000000..0e3214af4 --- /dev/null +++ b/src/Search/Wfst/CMakeLists.txt @@ -0,0 +1,57 @@ +set(RasrSearchWfst_SOURCES + BookKeeping.cc + Builder.cc + ComposedNetwork.cc + CompressedNetwork.cc + ContextTransducerBuilder.cc + CreateOperations.cc + DynamicLmFst.cc + ExpandingFsaSearch.cc + GrammarFst.cc + IoOperations.cc + Lattice.cc + LatticeAdaptor.cc + LatticeArchive.cc + LatticeGenerator.cc + LatticeHandler.cc + LatticeNetwork.cc + LatticeReader.cc + LexiconBuilder.cc + LexiconFst.cc + Module.cc + NonWordTokens.cc + Network.cc + SearchSpace.cc + StateSequence.cc + StateTree.cc + Traceback.cc + FstOperations.cc + UtilityOperations.cc + WordEnd.cc +) + +add_library(RasrSearchWfst STATIC ${RasrSearchWfst_SOURCES}) + +target_compile_options(RasrSearchWfst PRIVATE "-Wno-sign-compare") + +target_link_libraries(RasrSearchWfst INTERFACE + RasrSearch + RasrSpeech + RasrAm + RasrCart + RastMath + RasrMathLapack + RasrMathNr + RasrBliss + RasrLm + RasrFsa + RasrOpenFst + RasrMc + RasrCore +) + +add_executable(check-search-wfst check.cc) +target_link_libraries(check-search-wfst PRIVATE RasrSearchWfst) + +add_executable(check-search-wfst-ctrans check_ctrans.cc) +target_link_libraries(check-search-wfst-ctrans PRIVATE RasrSearchWfst) diff --git a/src/Search/Wfst/check.cc b/src/Search/Wfst/check.cc index aaa7ae83e..350d64936 100644 --- a/src/Search/Wfst/check.cc +++ b/src/Search/Wfst/check.cc @@ -14,7 +14,9 @@ */ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Search/Wfst/check_ctrans.cc b/src/Search/Wfst/check_ctrans.cc index ada0066fe..32938a574 100644 --- a/src/Search/Wfst/check_ctrans.cc +++ b/src/Search/Wfst/check_ctrans.cc @@ -17,7 +17,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Search/WordConditionedTreeSearch.cc b/src/Search/WordConditionedTreeSearch.cc index f37da4646..13fe7f9ca 100644 --- a/src/Search/WordConditionedTreeSearch.cc +++ b/src/Search/WordConditionedTreeSearch.cc @@ -29,7 +29,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "Histogram.hh" #include "LanguageModelLookahead.hh" #include "StateTree.hh" diff --git a/src/Search/check.cc b/src/Search/check.cc index 58db27399..f583806bf 100644 --- a/src/Search/check.cc +++ b/src/Search/check.cc @@ -13,7 +13,9 @@ * limitations under the License. */ #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "StateTree.hh" #ifdef MODULE_SEARCH_WFST #include diff --git a/src/Signal/CMakeLists.txt b/src/Signal/CMakeLists.txt new file mode 100644 index 000000000..2a5d0c021 --- /dev/null +++ b/src/Signal/CMakeLists.txt @@ -0,0 +1,96 @@ +set(RasrSignal_SOURCES + CosineTransform.cc + DcDetection.cc + SilenceNormalization.cc + Delay.cc + Delimiter.cc + EigenTransform.cc + FramePrediction.cc + FastFourierTransform.cc + Filterbank.cc + Module.cc + Mrasta.cc + Normalization.cc + Preemphasis.cc + RepeatingFramePrediction.cc + Regression.cc + ScatterEstimator.cc + ScatterTransform.cc + SegmentClustering.cc + SegmentEstimator.cc + TempoRAlPattern.cc + VectorSequenceAggregation.cc + VectorSequenceConcatenation.cc + VectorResize.cc + Window.cc + WindowBuffer.cc + WindowFunction.cc) + +if (${MODULE_SIGNAL_GAMMATONE}) + list(APPEND RasrSignal_SOURCES GammaTone.cc SpectralIntegration.cc + TemporalIntegration.cc TimeWindowBuffer.cc) +endif () + +if (${MODULE_SIGNAL_VTLN}) + list(APPEND RasrSignal_SOURCES LikelihoodFunction.cc BayesClassification.cc + AprioriProbability.cc) +endif () + +if (${MODULE_SIGNAL_VOICEDNESS}) + list(APPEND RasrSignal_SOURCES CrossCorrelation.cc PeakDetection.cc) +endif () + +if (${MODULE_SIGNAL_PLP}) + list(APPEND RasrSignal_SOURCES ArEstimator.cc VectorTransform.cc + AutoregressionToCepstrum.cc AutoregressionToSpectrum.cc) +endif () + +if (${MODULE_SIGNAL_ADVANCED}) + list( + APPEND + RasrSignal_SOURCES + ArxEstimator.cc + Convolution.cc + FastHartleyTransform.cc + Formant.cc + FrameInterpolation.cc + GenericWarping.cc + HarmonicSum.cc + Histogram.cc + HistogramNormalization.cc + LinearFilter.cc + LinearWarping.cc + Lpc.cc + MeanEstimator.cc + NthOrderFeatures.cc + PolinomialVectorInterpolation.cc + QuantileEqualization.cc + SampleNormalization.cc + SegmentwiseFormantExtraction.cc + SilenceDetection.cc + Warping.cc) +endif () + +if (${MODULE_SIGNAL_ADVANCED_NR}) + list(APPEND RasrSignal_SOURCES AllPolesPowerSpectrum.cc + KaiserWindowFunction.cc RandomVector.cc WindowingFirFilter.cc) +endif () + +add_library(RasrSignal STATIC ${RasrSignal_SOURCES}) + +target_link_libraries( + RasrSignal + INTERFACE RasrFlow + RasrBliss + RasrMm + RasrMath + RasrMathLapack + RasrMc + RasrCore) + +if (${MODULE_SIGNAL_ADVANCED_NR}) + target_link_libraries(RasrSignal INTERFACE RasrMathNr) +endif () + +add_executable(check-signal check.cc) +target_link_libraries(check-signal PRIVATE RasrSignal) diff --git a/src/Signal/Module.cc b/src/Signal/Module.cc index 910d21b39..7abf72cef 100644 --- a/src/Signal/Module.cc +++ b/src/Signal/Module.cc @@ -14,7 +14,9 @@ */ #include "Module.hh" #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "ComplexVectorFunction.hh" #include "CosineTransform.hh" #include "DcDetection.hh" diff --git a/src/Signal/RandomVector.cc b/src/Signal/RandomVector.cc index 944b93909..db81f7665 100644 --- a/src/Signal/RandomVector.cc +++ b/src/Signal/RandomVector.cc @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include "RandomVector.hh" using namespace Signal; diff --git a/src/Signal/WindowFunction.cc b/src/Signal/WindowFunction.cc index 9a50c4651..c8e88a998 100644 --- a/src/Signal/WindowFunction.cc +++ b/src/Signal/WindowFunction.cc @@ -13,7 +13,9 @@ * limitations under the License. */ #include "WindowFunction.hh" +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #if defined(MODULE_MATH_NR) && defined(MODULE_SIGNAL_ADVANCED) #include "KaiserWindowFunction.hh" #endif diff --git a/src/Speech/AbstractSegmentwiseTrainer.cc b/src/Speech/AbstractSegmentwiseTrainer.cc index ab82dfe4e..109c2d802 100644 --- a/src/Speech/AbstractSegmentwiseTrainer.cc +++ b/src/Speech/AbstractSegmentwiseTrainer.cc @@ -18,7 +18,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "AcousticSegmentwiseTrainer.hh" using namespace Speech; diff --git a/src/Speech/AcousticSegmentwiseTrainer.cc b/src/Speech/AcousticSegmentwiseTrainer.cc index afb43db14..faeccc946 100644 --- a/src/Speech/AcousticSegmentwiseTrainer.cc +++ b/src/Speech/AcousticSegmentwiseTrainer.cc @@ -14,7 +14,9 @@ */ #include "AcousticSegmentwiseTrainer.hh" +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "SegmentwiseGmmTrainer.hh" #ifdef MODULE_NN_SEQUENCE_TRAINING #include diff --git a/src/Speech/AdvancedLatticeExtractor.cc b/src/Speech/AdvancedLatticeExtractor.cc index e5a38790c..6bb4fd6f2 100644 --- a/src/Speech/AdvancedLatticeExtractor.cc +++ b/src/Speech/AdvancedLatticeExtractor.cc @@ -33,7 +33,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include "AdvancedAccuracyFsaBuilder.hh" diff --git a/src/Speech/CMakeLists.txt b/src/Speech/CMakeLists.txt new file mode 100644 index 000000000..6c1cc5937 --- /dev/null +++ b/src/Speech/CMakeLists.txt @@ -0,0 +1,155 @@ +set(Speech_SOURCES + AcousticModelTrainer.cc + AlignerModelAcceptor.cc + AligningFeatureExtractor.cc + Alignment.cc + AlignmentNode.cc + AlignmentWithLinearSegmentation.cc + AllophoneStateGraphBuilder.cc + AverageFeatureScorerActivation.cc + CorpusProcessor.cc + CorpusVisitor.cc + CovarianceEstimator.cc + DataExtractor.cc + DataSource.cc + DelayedRecognizer.cc + Feature.cc + FeatureScorer.cc + FeatureScorerNode.cc + FsaCache.cc + LabelingFeatureExtractor.cc + MixtureSetTrainer.cc + ModelCombination.cc + Module.cc + Recognizer.cc + ScatterMatricesEstimator.cc + TextDependentSequenceFiltering.cc + TextIndependentMixtureSetTrainer.cc) + +if (${MODULE_SPEECH_LATTICE_ALIGNMENT}) + list(APPEND Speech_SOURCES PhonemeSequenceAlignmentGenerator.cc + SegmentwiseAlignmentGenerator.cc SegmentwiseFeatureExtractor.cc) +endif () + +if (${MODULE_SPEECH_DT}) + list( + APPEND + Speech_SOURCES + AbstractSegmentwiseTrainer.cc + AccuracyFsaBuilder.cc + AcousticSegmentwiseTrainer.cc + Confidences.cc + DiscriminativeMixtureSetTrainer.cc + EbwDiscriminativeMixtureSetTrainer.cc + LatticeExtractor.cc + LatticeSetExtractor.cc + LatticeSetProcessor.cc + PruningLatticeSetNode.cc + SegmentwiseGmmTrainer.cc + WordLatticeExtractor.cc) +endif () + +if (${MODULE_SPEECH_DT_ADVANCED}) + list( + APPEND + Speech_SOURCES + AdvancedAccuracyFsaBuilder.cc + AdvancedLatticeExtractor.cc + AuxiliarySegmentwiseTrainer.cc + ClusterMixtureSetTrainer.cc + AdvancedLatticeSetProcessor.cc + NBestListExtractor.cc + RpropDiscriminativeMixtureSetTrainer.cc) +endif () + +if (${MODULE_FLF_EXT}) + list(APPEND Speech_SOURCES AlignedFeatureCache.cc) +endif () + +if (${MODULE_SPEECH_LATTICE_FLOW_NODES}) + list(APPEND Speech_SOURCES AlignmentFromLattice.cc LatticeNodes.cc + LatticeArcAccumulator.cc) +endif () + +if (${MODULE_SPEECH_ALIGNMENT_FLOW_NODES}) + list(APPEND Speech_SOURCES AlignmentGeneratorNode.cc + AlignmentTransformNode.cc SegmentNode.cc) +endif () + +if (${MODULE_ADAPT_MLLR}) + list(APPEND Speech_SOURCES ModelTransformEstimator.cc FeatureShiftAdaptor.cc) +endif () + +if (${MODULE_ADAPT_CMLLR}) + list(APPEND Speech_SOURCES AffineFeatureTransformEstimator.cc + KeyedEstimator.cc) +endif () + +if (${MODULE_CART}) + list(APPEND Speech_SOURCES DecisionTreeTrainer.cc) +endif () + +if (${MODULE_SPEECH_LATTICE_RESCORING}) + list(APPEND Speech_SOURCES LatticeRescorerAutomaton.cc + LatticeRescorerNodes.cc StatePosteriorFeatureScorerNode.cc) +endif () + +if (${MODULE_SIGNAL_ADVANCED}) + list(APPEND Speech_SOURCES HistogramEstimator.cc MeanEstimator.cc) +endif () + +if (${MODULE_SEARCH_MBR}) + list(APPEND Speech_SOURCES MinimumBayesRiskSearch.cc) +endif () + +add_library(RasrSpeech STATIC ${Speech_SOURCES}) + +target_link_libraries( + RasrSpeech + INTERFACE + RasrLm + RasrAm + RasrMm + RasrMc + RasrNn + RasrSearch + RasrBliss + RasrFlow + RasrFsa + RasrCore + RasrLattice + RasrMath + RasrMathLapack) + +if (${MODULE_CART}) + target_link_libraries(RasrSpeech INTERFACE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(RasrSpeech INTERFACE RasrMathNr) +endif () + +if (${MODULE_SEARCH_WFST}) + target_link_libraries(RasrSpeech INTERFACE RasrSearchWfst RasrOpenFst) +endif () + +if (${MODULE_ADVANCED_TREE_SEARCH}) + target_link_libraries(RasrSpeech INTERFACE RasrAdvancedTreeSearch) +endif () + +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH}) + target_link_libraries(RasrSpeech INTERFACE RasrGenericSeq2SeqTreeSearch) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(RasrSpeech INTERFACE RasrPython) + add_python_dependencies(RasrSpeech) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(RasrSpeech INTERFACE RasrTensorflow) + add_tf_dependencies(RasrSpeech) +endif () + +add_executable(check-speech check.cc) +target_link_libraries(check-speech PRIVATE RasrSpeech) diff --git a/src/Speech/LatticeSetExtractor.cc b/src/Speech/LatticeSetExtractor.cc index 4fc263b29..34850dbde 100644 --- a/src/Speech/LatticeSetExtractor.cc +++ b/src/Speech/LatticeSetExtractor.cc @@ -16,7 +16,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include diff --git a/src/Speech/Module.hh b/src/Speech/Module.hh index 9b670cdaf..184f228d9 100644 --- a/src/Speech/Module.hh +++ b/src/Speech/Module.hh @@ -16,7 +16,9 @@ #define _SPEECH_MODULE_HH #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include namespace Search { diff --git a/src/Speech/Recognizer.hh b/src/Speech/Recognizer.hh index da8c2c66b..797891df6 100644 --- a/src/Speech/Recognizer.hh +++ b/src/Speech/Recognizer.hh @@ -18,7 +18,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include "DataExtractor.hh" diff --git a/src/Speech/SegmentwiseGmmTrainer.cc b/src/Speech/SegmentwiseGmmTrainer.cc index 31ca80639..a9f8d365b 100644 --- a/src/Speech/SegmentwiseGmmTrainer.cc +++ b/src/Speech/SegmentwiseGmmTrainer.cc @@ -25,9 +25,9 @@ #include "AlignmentNode.hh" #include "Module.hh" -/*! @todo: remove Modules.hh dependency (see below) */ +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif using namespace Speech; /** diff --git a/src/Speech/WordLatticeExtractor.hh b/src/Speech/WordLatticeExtractor.hh index 0e29bdbe7..485a80707 100644 --- a/src/Speech/WordLatticeExtractor.hh +++ b/src/Speech/WordLatticeExtractor.hh @@ -19,7 +19,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include "CorpusProcessor.hh" #include "LatticeSetProcessor.hh" diff --git a/src/Tensorflow/CMakeLists.txt b/src/Tensorflow/CMakeLists.txt new file mode 100644 index 000000000..ee56302a1 --- /dev/null +++ b/src/Tensorflow/CMakeLists.txt @@ -0,0 +1,19 @@ +set(RasrTensorflow_SOURCES + Graph.cc + GraphLoader.cc + MetaGraphLoader.cc + Module.cc + Session.cc + Tensor.cc + TensorflowForwardNode.cc + TensorMap.cc + VanillaGraphLoader.cc) + +add_library(RasrTensorflow STATIC ${RasrTensorflow_SOURCES}) + +target_link_libraries(RasrTensorflow INTERFACE RasrCore) +add_tf_dependencies(RasrTensorflow) + +add_executable(check-tensorflow check.cc) +target_link_libraries(check-tensorflow PRIVATE RasrTensorflow) +add_tf_dependencies(check-tensorflow) diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt new file mode 100644 index 000000000..f341831c1 --- /dev/null +++ b/src/Test/CMakeLists.txt @@ -0,0 +1,116 @@ +set(RasrTest_SOURCES Registry.cc Lexicon.cc File.cc) + +add_library(RasrTest ${RasrTest_SOURCES}) + +set(test_SOURCES + UnitTester.cc + Bliss_SegmentOrdering.cc + Core_StringUtilities.cc + Core_Thread.cc + Core_ThreadPool.cc + Fsa_Sssp4SpecialSymbols.cc + Math_Utilities.cc + Math_Blas.cc + Math_FastVectorOperations.cc + Math_CudaVector.cc + Math_CudaMatrix.cc + Math_FastMatrix.cc + Test_File.cc + Test_Lexicon.cc) + +if (${MODULE_NN}) + list( + APPEND + test_SOURCES + Nn_NetworkTopology.cc + Nn_BufferedFeatureExtractor.cc + Nn_BufferedAlignedFeatureProcessor.cc + Nn_ClassLabelWrapper.cc + Nn_FeedForwardCrossEntropyTrainer.cc + Nn_LinearAndActivationLayer.cc + Nn_LinearLayer.cc + Nn_NeuralNetwork.cc + Nn_NeuralNetworkLayer.cc + Nn_NeuralNetworkTrainer.cc + Nn_PreprocessingLayer.cc + Nn_Statistics.cc) +endif () + +if (${MODULE_OPENMP}) + list(APPEND test_SOURCES Math_MultithreadingHelper.cc) +endif () + +if (${MODULE_TBB}) + list(APPEND test_SOURCES Core_Tbb.cc) +endif () + +add_executable(unit-test ${test_SOURCES}) +add_install_executable(unit-test) + +target_link_libraries( + unit-test + PRIVATE RasrTest + RasrBliss + RasrFsa + RasrCore + RasrSpeech + RasrSearch + RasrLattice + RasrAm + RasrLm + RasrMc + RasrAudio + RasrSignal + RasrFlow + RasrMath + RasrMathLapack) + +if (${MODULE_FLF}) + target_link_libraries(unit-test PRIVATE RasrFlf) +endif () + +if (${MODULE_FLF_CORE}) + target_link_libraries(unit-test PRIVATE RasrFlfCore) +endif () + +if (${MODULE_FLF_EXT}) + target_link_libraries(unit-test PRIVATE RasrFlfExt) +endif () + +if (${MODULE_ADVANCED_TREE_SEARCH}) + target_link_libraries(unit-test PRIVATE RasrAdvancedTreeSearch) +endif () + +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH}) + target_link_libraries(unit-test PRIVATE RasrGenericSeq2SeqTreeSearch) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(unit-test PRIVATE RasrPython) + add_python_dependencies(unit-test) +endif () + +if (${MODULE_NN}) + target_link_libraries(unit-test PRIVATE RasrNn) +endif () + +if (${MODULE_CART}) + target_link_libraries(unit-test PRIVATE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(unit-test PRIVATE RasrMathNr) +endif () + +if (${MODULE_SEARCH_WFST}) + target_link_libraries(unit-test PRIVATE RasrSearchWfst) +endif () + +if (${MODULE_OPENFST}) + target_link_libraries(unit-test PRIVATE RasrOpenFst) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(unit-test PRIVATE RasrTensorflow) + add_tf_dependencies(unit-test) +endif () diff --git a/src/Tools/AcousticModelTrainer/AcousticModelTrainer.hh b/src/Tools/AcousticModelTrainer/AcousticModelTrainer.hh index ceae424e9..27b18e618 100644 --- a/src/Tools/AcousticModelTrainer/AcousticModelTrainer.hh +++ b/src/Tools/AcousticModelTrainer/AcousticModelTrainer.hh @@ -15,7 +15,9 @@ #ifndef _TOOLS_ACOUSTIC_MODEL_TRAINER_ACOUSTIC_MODEL_TRAINER_HH #define _TOOLS_ACOUSTIC_MODEL_TRAINER_ACOUSTIC_MODEL_TRAINER_HH +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Tools/AcousticModelTrainer/CMakeLists.txt b/src/Tools/AcousticModelTrainer/CMakeLists.txt new file mode 100644 index 000000000..9a96f1b30 --- /dev/null +++ b/src/Tools/AcousticModelTrainer/CMakeLists.txt @@ -0,0 +1,64 @@ +add_executable(acoustic-model-trainer AcousticModelTrainer.cc) +add_install_executable(acoustic-model-trainer) +target_link_libraries( + acoustic-model-trainer + PRIVATE RasrSpeech + RasrFlow + RasrAm + RasrMm + RasrLm + RasrMc + RasrBliss + RasrAudio + RasrSignal + RasrMath + RasrMathLapack + RasrCore + RasrFsa + ${SEARCH_LIBS}) + +add_executable(allophone-tool AllophoneTool.cc) +add_install_executable(allophone-tool) +target_link_libraries( + allophone-tool + PRIVATE RasrAm + RasrMm + RasrBliss + RasrFsa + RasrMc + RasrCore + RasrMathLapack) + +if (${MODULE_CART}) + target_link_libraries(acoustic-model-trainer PRIVATE RasrCart) + target_link_libraries(allophone-tool PRIVATE RasrCart) +endif () + +if (${MODULE_FLF_CORE}) + target_link_libraries(acoustic-model-trainer PRIVATE RasrFlfCore) + target_link_libraries(allophone-tool PRIVATE RasrFlfCore) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(acoustic-model-trainer PRIVATE RasrMathNr) + target_link_libraries(allophone-tool PRIVATE RasrMathNr) +endif () + +if (${MODULE_ONNX}) + add_onnx_dependencies(acoustic-model-trainer) + target_link_libraries(acoustic-model-trainer PRIVATE RasrOnnx) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(acoustic-model-trainer PRIVATE RasrPython) + add_python_dependencies(acoustic-model-trainer) +endif () + +if (${MODULE_NN}) + target_link_libraries(acoustic-model-trainer PRIVATE RasrNn) +endif () + +if (${MODULE_TENSORFLOW}) + add_tf_dependencies(acoustic-model-trainer) + target_link_libraries(acoustic-model-trainer PRIVATE RasrTensorflow) +endif () diff --git a/src/Tools/Aligner/CMakeLists.txt b/src/Tools/Aligner/CMakeLists.txt new file mode 100644 index 000000000..3a0b290c6 --- /dev/null +++ b/src/Tools/Aligner/CMakeLists.txt @@ -0,0 +1,13 @@ +set(aligner_SOURCES + Aligner.cc + AlignAutomaton.cc + SimpleAlignAutomaton.cc + ZeroOrderAlignAutomaton.cc + Common.cc + ConditionalLexicon.cc + ConditionalLexiconPlain.cc + ConditionalLexiconSri.cc) +add_executable(aligner ${ALIGNER_SOURCES}) +add_install_executable(aligner) + +target_link_libraries(aligner PRIVATE RasrFsa RasrCore) diff --git a/src/Tools/Archiver/CMakeLists.txt b/src/Tools/Archiver/CMakeLists.txt new file mode 100644 index 000000000..18cf8933b --- /dev/null +++ b/src/Tools/Archiver/CMakeLists.txt @@ -0,0 +1,50 @@ +add_executable(archiver Archiver.cc) +add_install_executable(archiver) + +target_link_libraries( + archiver + PRIVATE RasrSpeech + RasrSearch + RasrAdvancedTreeSearch + RasrLattice + RasrLm + RasrFlf + RasrFlfCore + RasrMc + RasrAm + RasrMm + RasrCart + RasrSignal + RasrBliss + RasrMath + RasrMathLapack + RasrMathNr + RasrCore + RasrFlow + RasrFsa) + +if (${MODULE_GENERIC_SEQ2SEQ_TREE_SEARCH}) + target_link_libraries(archiver PRIVATE RasrGenericSeq2SeqTreeSearch) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(archiver PRIVATE RasrPython) + add_python_dependencies(archiver) +endif () + +if (${MODULE_NN}) + target_link_libraries(archiver PRIVATE RasrNn) +endif () + +if (${MODULE_SEARCH_WFST}) + target_link_libraries(archiver PRIVATE RasrSearchWfst) +endif () + +if (${MODULE_OPENFST}) + target_link_libraries(archiver PRIVATE RasrOpenFst) +endif () + +if (${MODULE_LM_TFRNN}) + target_link_libraries(archiver PRIVATE RasrTensorflow) + add_tf_dependencies(archiver) +endif () diff --git a/src/Tools/CMakeLists.txt b/src/Tools/CMakeLists.txt new file mode 100644 index 000000000..3b1580f8a --- /dev/null +++ b/src/Tools/CMakeLists.txt @@ -0,0 +1,3 @@ +foreach (TOOL ${TOOLS}) + add_subdirectory(${TOOL}) +endforeach () diff --git a/src/Tools/Cart/CMakeLists.txt b/src/Tools/Cart/CMakeLists.txt new file mode 100644 index 000000000..68ab7fe70 --- /dev/null +++ b/src/Tools/Cart/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(cart-trainer CartTrainer.cc) +target_link_libraries(cart-trainer PRIVATE RasrCart RasrCore) +add_install_executable(cart-trainer) + +add_executable(cart-viewer CartViewer.cc) +target_link_libraries(cart-viewer PRIVATE RasrCart RasrCore) +add_install_executable(cart-viewer) diff --git a/src/Tools/CorpusStatistics/CMakeLists.txt b/src/Tools/CorpusStatistics/CMakeLists.txt new file mode 100644 index 000000000..3d57ff5bd --- /dev/null +++ b/src/Tools/CorpusStatistics/CMakeLists.txt @@ -0,0 +1,43 @@ +add_executable(costa Costa.cc) +add_install_executable(costa) + +target_link_libraries( + costa + PRIVATE RasrLm + RasrMc + RasrBliss + RasrFsa + RasrFlfCore + RasrAudio + RasrSignal + RasrSpeech + RasrAm + RasrMm + RasrFlow + RasrCore + RasrMath + RasrMathLapack + RasrLattice + ${SEARCH_LIBS}) + +if (${MODULE_CART}) + target_link_libraries(costa PRIVATE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(costa PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(costa PRIVATE RasrPython) + add_python_dependencies(costa) +endif () + +if (${MODULE_NN}) + target_link_libraries(costa PRIVATE RasrNn) +endif () + +if (${MODULE_TENSORFLOW}) + add_tf_dependencies(costa) + target_link_libraries(costa PRIVATE RasrTensorflow) +endif () diff --git a/src/Tools/CorpusStatistics/Costa.cc b/src/Tools/CorpusStatistics/Costa.cc index c3520c6ba..dbfe892c1 100644 --- a/src/Tools/CorpusStatistics/Costa.cc +++ b/src/Tools/CorpusStatistics/Costa.cc @@ -21,7 +21,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #ifdef MODULE_TENSORFLOW diff --git a/src/Tools/FeatureExtraction/CMakeLists.txt b/src/Tools/FeatureExtraction/CMakeLists.txt new file mode 100644 index 000000000..0978aa7c0 --- /dev/null +++ b/src/Tools/FeatureExtraction/CMakeLists.txt @@ -0,0 +1,46 @@ +add_executable(feature-extraction FeatureExtraction.cc FeatureExtractor.cc) +add_install_executable(feature-extraction) + +target_link_libraries( + feature-extraction + PRIVATE RasrSpeech + RasrLattice + RasrLm + RasrAm + RasrMm + RasrMc + RasrBliss + RasrAudio + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + RasrCore + RasrFsa + ${SEARCH_LIBS}) + +if (${MODULE_CART}) + target_link_libraries(feature-extraction PRIVATE RasrCart) +endif () + +if (${MODULE_FLF_CORE}) + target_link_libraries(feature-extraction PRIVATE RasrFlfCore) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(feature-extraction PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(feature-extraction PRIVATE RasrPython) + add_python_dependencies(feature-extraction) +endif () + +if (${MODULE_NN}) + target_link_libraries(feature-extraction PRIVATE RasrNn) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(feature-extraction PRIVATE RasrTensorflow) + add_tf_dependencies(feature-extraction) +endif () diff --git a/src/Tools/FeatureExtraction/FeatureExtraction.cc b/src/Tools/FeatureExtraction/FeatureExtraction.cc index c648bd79f..806380bd5 100644 --- a/src/Tools/FeatureExtraction/FeatureExtraction.cc +++ b/src/Tools/FeatureExtraction/FeatureExtraction.cc @@ -20,7 +20,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Tools/FeatureStatistics/CMakeLists.txt b/src/Tools/FeatureStatistics/CMakeLists.txt new file mode 100644 index 000000000..6f2283357 --- /dev/null +++ b/src/Tools/FeatureStatistics/CMakeLists.txt @@ -0,0 +1,45 @@ +add_executable(feature-statistics FeatureStatistics.cc) +add_install_executable(feature-statistics) + +target_link_libraries( + feature-statistics + PRIVATE RasrSpeech + RasrLm + RasrAm + RasrMm + RasrMc + RasrBliss + RasrAudio + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + ${SEARCH_LIBS} + RasrCore + RasrFsa) + +if (${MODULE_CART}) + target_link_libraries(feature-statistics PRIVATE RasrCart) +endif () + +if (${MODULE_FLF_CORE}) + target_link_libraries(feature-statistics PRIVATE RasrFlfCore) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(feature-statistics PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(feature-statistics PRIVATE RasrPython) + add_python_dependencies(feature-statistics) +endif () + +if (${MODULE_NN}) + target_link_libraries(feature-statistics PRIVATE RasrNn) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(feature-statistics PRIVATE RasrTensorflow) + add_tf_dependencies(feature-statistics) +endif () diff --git a/src/Tools/Flf/CMakeLists.txt b/src/Tools/Flf/CMakeLists.txt new file mode 100644 index 000000000..51b44d948 --- /dev/null +++ b/src/Tools/Flf/CMakeLists.txt @@ -0,0 +1,52 @@ +add_executable(flf-tool FlfTool.cc) +add_install_executable(flf-tool) + +target_link_libraries( + flf-tool + PRIVATE RasrFlf + RasrFlfCore + RasrSpeech + RasrLm + RasrAm + RasrMm + RasrMc + RasrBliss + RasrAudio + RasrCore + RasrFsa + ${SEARCH_LIBS} + RasrLattice) + +if (${MODULE_FLF_EXT}) + target_link_libraries(flf-tool PRIVATE RasrFlfExt) +endif () + +target_link_libraries(flf-tool PRIVATE RasrSignal RasrFlow RasrMath + RasrMathLapack) + +if (${MODULE_CART}) + target_link_libraries(flf-tool PRIVATE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(flf-tool PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(flf-tool PRIVATE RasrPython) + add_python_dependencies(flf-tool) +endif () + +if (${MODULE_NN}) + target_link_libraries(flf-tool PRIVATE RasrNn) +endif () + +if (${MODULE_ONNX}) + add_onnx_dependencies(flf-tool) + target_link_libraries(flf-tool PRIVATE RasrOnnx) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(flf-tool PRIVATE RasrTensorflow) + add_tf_dependencies(flf-tool) +endif () diff --git a/src/Tools/Flf/FlfTool.cc b/src/Tools/Flf/FlfTool.cc index 53fc9d6d9..d4333f76f 100644 --- a/src/Tools/Flf/FlfTool.cc +++ b/src/Tools/Flf/FlfTool.cc @@ -25,7 +25,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include diff --git a/src/Tools/Fsa/CMakeLists.txt b/src/Tools/Fsa/CMakeLists.txt new file mode 100644 index 000000000..8e64d4e29 --- /dev/null +++ b/src/Tools/Fsa/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(fsa Fsa.cc) +add_install_executable(fsa) + +target_link_libraries(fsa PRIVATE RasrFsa RasrCore) + +if (${MODULE_OPENFST}) + target_link_libraries(fsa PRIVATE RasrOpenFst) +endif () diff --git a/src/Tools/Fsa/Fsa.cc b/src/Tools/Fsa/Fsa.cc index 6f0506ba3..3ec6b50b7 100644 --- a/src/Tools/Fsa/Fsa.cc +++ b/src/Tools/Fsa/Fsa.cc @@ -44,8 +44,9 @@ #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include - +#endif #ifdef MODULE_OPENFST #include #endif diff --git a/src/Tools/LatticeProcessor/CMakeLists.txt b/src/Tools/LatticeProcessor/CMakeLists.txt new file mode 100644 index 000000000..fdd647322 --- /dev/null +++ b/src/Tools/LatticeProcessor/CMakeLists.txt @@ -0,0 +1,43 @@ +add_executable(lattice-processor LatticeProcessor.cc) +add_install_executable(lattice-processor) + +target_link_libraries( + lattice-processor + PRIVATE RasrSpeech + RasrLattice + RasrLm + RasrAm + RasrMm + RasrMc + RasrBliss + RasrAudio + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + RasrCore + RasrFsa + RasrFlfCore + ${SEARCH_LIBS}) + +if (${MODULE_CART}) + target_link_libraries(lattice-processor PRIVATE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(lattice-processor PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(lattice-processor PRIVATE RasrPython) + add_python_dependencies(lattice-processor) +endif () + +if (${MODULE_NN}) + target_link_libraries(lattice-processor PRIVATE RasrNn) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(lattice-processor PRIVATE RasrTensorflow) + add_tf_dependencies(lattice-processor) +endif () diff --git a/src/Tools/LatticeProcessor/LatticeProcessor.hh b/src/Tools/LatticeProcessor/LatticeProcessor.hh index fd911dc29..bd7ae3aa4 100644 --- a/src/Tools/LatticeProcessor/LatticeProcessor.hh +++ b/src/Tools/LatticeProcessor/LatticeProcessor.hh @@ -23,7 +23,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Tools/LibRASR/CMakeLists.txt b/src/Tools/LibRASR/CMakeLists.txt new file mode 100644 index 000000000..705aa09a9 --- /dev/null +++ b/src/Tools/LibRASR/CMakeLists.txt @@ -0,0 +1,63 @@ +find_package(pybind11 REQUIRED) + +set(librasr_SOURCES + LibRASR.cc +) + +if (${MODULE_PYTHON}) + list(APPEND librasr_SOURCES PybindModule.cc) +endif () + +pybind11_add_module(librasr PybindModule.cc LibRASR.cc) + +target_link_libraries(librasr PRIVATE + RasrFlf + RasrFlfCore + RasrSpeech + RasrLattice + RasrLm + RasrAm + RasrMm + RasrMc + RasrBliss + RasrAudio + RasrCore + RasrFsa + RasrFlow + RasrSignal + RasrMath + RasrMathLapack +) + +add_install_library(librasr) + +if (${MODULE_FLF_EXT}) + target_link_libraries(librasr PRIVATE RasrFlfExt) +endif () + +if (${MODULE_CART}) + target_link_libraries(librasr PRIVATE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(librasr PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(librasr PRIVATE RasrPython) + add_python_dependencies(librasr) +endif () + +if (${MODULE_NN}) + target_link_libraries(librasr PRIVATE RasrNn) +endif () + +if (${MODULE_ONNX}) + target_link_libraries(librasr PRIVATE RasrOnnx) + add_onnx_dependencies(librasr) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(librasr PRIVATE RasrTensorflow) + add_tf_dependencies(librasr) +endif () diff --git a/src/Tools/LibRASR/LibRASR.cc b/src/Tools/LibRASR/LibRASR.cc index ee676611b..94c1be53a 100644 --- a/src/Tools/LibRASR/LibRASR.cc +++ b/src/Tools/LibRASR/LibRASR.cc @@ -7,7 +7,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #ifdef MODULE_NN diff --git a/src/Tools/Lm/CMakeLists.txt b/src/Tools/Lm/CMakeLists.txt new file mode 100644 index 000000000..c854787df --- /dev/null +++ b/src/Tools/Lm/CMakeLists.txt @@ -0,0 +1,44 @@ +add_executable(lm-util LmUtilityTool.cc) +add_install_executable(lm-util) + +target_link_libraries( + lm-util + PRIVATE RasrFlf + RasrFlfCore + RasrSpeech + RasrAm + RasrMc + RasrBliss + RasrNn + RasrMm + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + ${SEARCH_LIBS} + RasrLattice + RasrFsa + RasrLm + RasrCore) + +if (${MODULE_FLF_EXT}) + target_link_libraries(lm-util PRIVATE RasrFlfExt) +endif () + +if (${MODULE_CART}) + target_link_libraries(lm-util PRIVATE RasrCart) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(lm-util PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(lm-util PRIVATE RasrPython) + add_python_dependencies(lm-util) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(lm-util PRIVATE RasrTensorflow) + add_tf_dependencies(lm-util) +endif () diff --git a/src/Tools/Math/CMakeLists.txt b/src/Tools/Math/CMakeLists.txt new file mode 100644 index 000000000..0b7f17465 --- /dev/null +++ b/src/Tools/Math/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(matrix-tool MatrixTool.cc) +add_install_executable(matrix-tool) + +target_link_libraries(matrix-tool PRIVATE RasrMath RasrMathNr RasrMathLapack + RasrCore) diff --git a/src/Tools/NnTrainer/CMakeLists.txt b/src/Tools/NnTrainer/CMakeLists.txt new file mode 100644 index 000000000..92f568491 --- /dev/null +++ b/src/Tools/NnTrainer/CMakeLists.txt @@ -0,0 +1,44 @@ +add_executable(nn-trainer NnTrainer.cc) +add_install_executable(nn-trainer) + +target_link_libraries( + nn-trainer + PRIVATE RasrAm + RasrAudio + RasrBliss + RasrFlow + RasrLm + RasrMathLapack + RasrMath + RasrMc + RasrMm + RasrSignal + RasrSpeech + ${SEARCH_LIBS} + RasrNn + RasrFsa + RasrCore) + +target_compile_options(nn-trainer PRIVATE "-fexceptions") + +if (${MODULE_CART}) + target_link_libraries(nn-trainer PRIVATE RasrCart) +endif () + +if (${MODULE_FLF_CORE}) + target_link_libraries(nn-trainer PRIVATE RasrFlfCore) +endif () + +if (${MODULE_MATH_NR}) + target_link_libraries(nn-trainer PRIVATE RasrMathNr) +endif () + +if (${MODULE_PYTHON}) + target_link_libraries(nn-trainer PRIVATE RasrPython) + add_python_dependencies(nn-trainer) +endif () + +if (${MODULE_TENSORFLOW}) + target_link_libraries(nn-trainer PRIVATE RasrTensorflow) + add_tf_dependencies(nn-trainer) +endif () diff --git a/src/Tools/NnTrainer/NnTrainer.hh b/src/Tools/NnTrainer/NnTrainer.hh index 0e21933ab..e26dba60b 100644 --- a/src/Tools/NnTrainer/NnTrainer.hh +++ b/src/Tools/NnTrainer/NnTrainer.hh @@ -16,7 +16,9 @@ #define _TOOLS_NN_TRAINER_NN_TRAINER_HH #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include diff --git a/src/Tools/SpeechRecognizer/CMakeLists.txt b/src/Tools/SpeechRecognizer/CMakeLists.txt new file mode 100644 index 000000000..44f157260 --- /dev/null +++ b/src/Tools/SpeechRecognizer/CMakeLists.txt @@ -0,0 +1,64 @@ +add_executable(speech-recognizer SpeechRecognizer.cc) +add_install_executable(speech-recognizer) + +set(SpeechRecognizer_LIBRARIES + RasrSpeech + RasrLattice + RasrAm + RasrLm + RasrMm + RasrMc + RasrBliss + RasrAudio + RasrSignal + RasrFlow + RasrMath + RasrMathLapack + ${SEARCH_LIBS} + RasrCore + RasrFsa) + +if (${MODULE_CART}) + list(APPEND SpeechRecognizer_LIBRARIES RasrCart) +endif () + +if (${MODULE_FLF_CORE}) + list(APPEND SpeechRecognizer_LIBRARIES RasrFlfCore) +endif () + +if (${MODULE_MATH_NR}) + list(APPEND SpeechRecognizer_LIBRARIES RasrMathNr) +endif () + +if (${MODULE_SEARCH_WFST}) + list(APPEND SpeechRecognizer_LIBRARIES RasrSearchWfst) +endif () + +if (${MODULE_PYTHON}) + list(APPEND SpeechRecognizer_LIBRARIES RasrPython) +endif () + +if (${MODULE_ONNX}) + list(APPEND SpeechRecognizer_LIBRARIES RasrOnnx) +endif () + +if (${MODULE_NN}) + list(APPEND SpeechRecognizer_LIBRARIES RasrNn) +endif () + +if (${MODULE_TENSORFLOW}) + list(APPEND SpeechRecognizer_LIBRARIES RasrTensorflow) +endif () + +target_link_libraries(speech-recognizer PRIVATE ${SpeechRecognizer_LIBRARIES}) + +if (${MODULE_ONNX}) + add_onnx_dependencies(speech-recognizer) +endif () + +if (${MODULE_SEARCH_WFST}) + add_executable(fsa-search-builder FsaSearchBuilder.cc) + add_install_executable(fsa-search-builder) + target_link_libraries(fsa-search-builder + PRIVATE ${SpeechRecognizer_LIBRARIES}) +endif () diff --git a/src/Tools/SpeechRecognizer/SpeechRecognizer.cc b/src/Tools/SpeechRecognizer/SpeechRecognizer.cc index 266bf9e7d..25fe7ed2c 100644 --- a/src/Tools/SpeechRecognizer/SpeechRecognizer.cc +++ b/src/Tools/SpeechRecognizer/SpeechRecognizer.cc @@ -20,7 +20,9 @@ #include #include #include +#ifndef CMAKE_DISABLE_MODULES_HH #include +#endif #include #include #include diff --git a/src/Tools/Xml/CMakeLists.txt b/src/Tools/Xml/CMakeLists.txt new file mode 100644 index 000000000..5b3c63a52 --- /dev/null +++ b/src/Tools/Xml/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(xml2line xml2line.c) +add_install_executable(xml2line) + +add_executable(line2xml line2xml.c) +add_install_executable(line2xml)