1cmake_minimum_required (VERSION 2.8) 2 3project(uvoice) 4 5option(target_os "set target os type") 6option(target_host "set target host type") 7option(uvoice_release "build uvoice release version" off) 8 9link_libraries(-lpthread -lm) 10 11link_directories(${PROJECT_SOURCE_DIR}/out/libs ${PROJECT_SOURCE_DIR}/out/prebuilt) 12 13set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/out/libs) 14 15set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/out/bin) 16 17if (target_os STREQUAL "linux") 18add_definitions(-D __os_linux__) 19else() 20message(FATAL_ERROR "target os type not specified !!!") 21endif() 22 23if (target_host STREQUAL "x64") 24add_definitions(-D __cpu_x86_64__) 25else() 26message(FATAL_ERROR "target host type not specified !!!") 27endif() 28 29message("-- target os is ${target_os}") 30message("-- target host is ${target_host}") 31 32set(SRC_LIST 33 test/test_main.c 34 test/test_player.c 35 test/test_recorder.c 36 test/test_tts.c 37 uvoice.c 38 common/event.c 39 common/ringbuffer.c 40 common/message.c 41 common/gbk2utf8.c 42 media/uvoice_format.c 43 media/uvoice_codec.c 44 media/uvoice_stream.c 45 media/uvoice_wave.c 46 media/uvoice_fade.c 47 media/uvoice_mlist.c 48 media/uvoice_player.c 49 media/uvoice_recorder.c 50 stream/uvoice_file.c 51 stream/uvoice_partition.c 52 stream/uvoice_http.c 53 stream/uvoice_cache.c 54 stream/uvoice_download.c 55 stream/uvoice_hls.c 56 audio/audio_stream.c 57 audio/audio_common.c 58 audio/audio_mixer.c 59 audio/audio_process.c 60 audio/audio_trigger.c 61 audio/process/proc_equalizer.c 62 audio/process/proc_resample.c 63 audio/hal/linux/uvoice_pcm.c 64 application/alicloudtts/tts.c 65 application/alicloudtts/alicloudtts.c) 66 67set(SRC_CODEC_LIST 68 codec/pvmp3_decoder.c 69 codec/helixaac_decoder.c 70 codec/ogg_decoder.c 71 codec/flac_decoder.c 72 codec/faad2aac_decoder.c 73 codec/faad2m4a_decoder.c 74 codec/opus_encoder.c 75 codec/opus_decoder.c 76 codec/spx_encoder.c 77 codec/spx_decoder.c 78 codec/amr_encoder.c 79 codec/amr_decoder.c 80 codec/amrwb_encoder.c 81 codec/amrwb_decoder.c) 82 83add_definitions( 84 -D UVOICE_PROJECT 85 -D UVOICE_PLAYER_ENABLE 86 -D UVOICE_EVENT_ENABLE 87 -D UVOICE_EVENT_BY_MESSAGE_QUEUE 88 -D UVOICE_FILE_ENABLE 89 -D UVOICE_PARTITION_ENABLE 90 -D UVOICE_HTTP_ENABLE 91 -D UVOICE_MLIST_ENABLE 92 -D AUDIO_CACHE_ENABLE 93 -D UVOICE_HLS_ENABLE 94 -D ALICLOUD_TTS_SUPPORT 95 -D UVOICE_TTS_ENABLE 96 -D UVOICE_RESAMPLE_ENABLE 97 -D UVOICE_EQ_ENABLE 98 -D UVOICE_DOWNLOAD_ENABLE 99 -D UVOICE_RELEASE_VERSION_MAIN=1 100 -D UVOICE_RELEASE_VERSION_SUB=0) 101 102if (uvoice_release) 103add_definitions(-D UVOICE_BUILD_RELEASE) 104endif() 105 106add_definitions( 107 -D DECODER_PV_MP3_ENABLE 108 -D DECODER_OGG_ENABLE 109 -D DECODER_FLAC_ENABLE 110 -D DECODER_APE_ENABLE 111 -D ENCODER_OPUS_ENABLE 112 -D DECODER_OPUS_ENABLE 113 -D ENCODER_SPEEX_ENABLE 114 -D DECODER_SPEEX_ENABLE 115 -D ENCODER_AMR_ENABLE 116 -D DECODER_AMR_ENABLE 117 -D ENCODER_AMRWB_ENABLE 118 -D DECODER_AMRWB_ENABLE 119 -D DECODER_FAAD2_M4A_ENABLE 120 -D DECODER_FAAD2_AAC_ENABLE) 121 122include_directories( 123 include 124 internal 125 audio 126 codec 127 connect 128 application/alicloudtts/include) 129 130add_subdirectory(codec/opensource/pvmp3) 131#add_subdirectory(codec/opensource/helixaac) 132#add_subdirectory(codec/opensource/libogg) 133#add_subdirectory(codec/opensource/libvorbis) 134#add_subdirectory(codec/opensource/flac) 135#add_subdirectory(codec/opensource/faad2) 136#add_subdirectory(codec/opensource/opus) 137#add_subdirectory(codec/opensource/speex) 138#add_subdirectory(codec/opensource/amr) 139#add_subdirectory(codec/opensource/amrwb) 140#add_subdirectory(codec/opensource/wma) 141 142#add_subdirectory(audio/process/opensource/libsox) 143add_subdirectory(audio/process/opensource/speexdsp) 144 145add_executable(uvoice ${SRC_LIST} ${SRC_CODEC_LIST}) 146 147if (target_os STREQUAL "linux") 148target_link_libraries(uvoice asound) 149endif() 150 151target_link_libraries(uvoice pvmp3) 152target_link_libraries(uvoice helixaac) 153target_link_libraries(uvoice vorbis) 154target_link_libraries(uvoice ogg) 155target_link_libraries(uvoice flac) 156target_link_libraries(uvoice faad2) 157target_link_libraries(uvoice opus) 158target_link_libraries(uvoice speex) 159target_link_libraries(uvoice amr) 160target_link_libraries(uvoice amrwb) 161target_link_libraries(uvoice wma) 162target_link_libraries(uvoice resampler) 163target_link_libraries(uvoice sox) 164