1set(_trout_AUDIOFOCUS_CXX_FLAGS -Wall -Werror -std=c++17) 2 3include(${trout_SRC_ROOT}/cmake/grpc.cmake) 4include(${trout_SRC_ROOT}/cmake/protobuf.cmake) 5include(${trout_SRC_ROOT}/cmake/utils/grpc_cpp_generator.cmake) 6 7get_filename_component(trout_AUDIOFOCUS_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE) 8 9if (NOT trout_GENS_DIR) 10 set(trout_GENS_DIR ${PROJECT_BINARY_DIR}/gens) 11endif() 12 13trout_generate_grpc_cpp_from_proto( 14 SRCS 15 ${trout_AUDIOFOCUS_SRC_ROOT}/proto/AudioFocusControl.proto) 16 17# ========== Protobuf generated code ================== 18 19add_library(audiocontrol_protobuf_gen 20 ${trout_GENS_DIR}/AudioFocusControl.pb.cc 21 ${trout_GENS_DIR}/AudioFocusControl.grpc.pb.cc 22) 23 24target_link_libraries(audiocontrol_protobuf_gen 25 ${trout_GRPCXX_LIBRARIES} 26) 27 28target_compile_options(audiocontrol_protobuf_gen PRIVATE ${_trout_AUDIOFOCUS_CXX_FLAGS} -Wno-array-bounds) 29 30# ========== libandroid_audio_controller ============== 31 32add_library(android_audio_controller 33 ${trout_AUDIOFOCUS_SRC_ROOT}/libandroid_audio_controller/android_audio_controller.cpp 34) 35 36target_include_directories(android_audio_controller 37 PRIVATE ${trout_GENS_DIR} 38) 39 40target_link_libraries(android_audio_controller 41 audiocontrol_protobuf_gen 42) 43 44target_compile_options(android_audio_controller PRIVATE ${_trout_AUDIOFOCUS_CXX_FLAGS}) 45 46# ========== libandroid_audio_controller_test ============== 47 48add_executable(android_audio_controller_test ${trout_AUDIOFOCUS_SRC_ROOT}/libandroid_audio_controller_test/main.cpp) 49 50target_compile_options(android_audio_controller_test PRIVATE ${_trout_AUDIOFOCUS_CXX_FLAGS}) 51 52target_include_directories(android_audio_controller_test 53 PRIVATE ${trout_GENS_DIR} 54 PRIVATE ${trout_AUDIOFOCUS_SRC_ROOT}/libandroid_audio_controller 55) 56 57target_link_libraries(android_audio_controller_test android_audio_controller) 58