|
| 1 | +From d5bd7254c037a04a1139e192e088d3f3258c1c15 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Artur Gebicz < [email protected]> |
| 3 | +Date: Mon, 29 Jun 2020 08:57:21 +0200 |
| 4 | +Subject: [PATCH] Build SampleApp as library |
| 5 | + |
| 6 | +--- |
| 7 | + modules/Alexa/SampleApp/CMakeLists.txt | 6 +-- |
| 8 | + .../include/SampleApp/SampleApplication.h | 2 +- |
| 9 | + modules/Alexa/SampleApp/src/CMakeLists.txt | 46 ++++++++++--------- |
| 10 | + .../Alexa/SampleApp/src/SampleApplication.cpp | 3 +- |
| 11 | + .../SmartScreenSDKInterfaces/CMakeLists.txt | 2 +- |
| 12 | + .../Alexa/build/cmake/PrepareInstall.cmake | 11 +++-- |
| 13 | + 6 files changed, 39 insertions(+), 31 deletions(-) |
| 14 | + |
| 15 | +diff --git a/modules/Alexa/SampleApp/CMakeLists.txt b/modules/Alexa/SampleApp/CMakeLists.txt |
| 16 | +index b31f47b..c4adb48 100644 |
| 17 | +--- a/modules/Alexa/SampleApp/CMakeLists.txt |
| 18 | ++++ b/modules/Alexa/SampleApp/CMakeLists.txt |
| 19 | +@@ -1,7 +1,7 @@ |
| 20 | + |
| 21 | +-if ((PORTAUDIO AND GSTREAMER_MEDIA_PLAYER) OR (ANDROID_MEDIA_PLAYER AND ANDROID_MICROPHONE)) |
| 22 | ++if (GSTREAMER_MEDIA_PLAYER) |
| 23 | + cmake_minimum_required(VERSION 3.1 FATAL_ERROR) |
| 24 | +- project(SampleApp LANGUAGES CXX) |
| 25 | ++ project(SmartScreenSampleApp LANGUAGES CXX) |
| 26 | + |
| 27 | + include(../build/BuildDefaults.cmake) |
| 28 | + |
| 29 | +@@ -15,5 +15,5 @@ if ((PORTAUDIO AND GSTREAMER_MEDIA_PLAYER) OR (ANDROID_MEDIA_PLAYER AND ANDROID_ |
| 30 | + |
| 31 | + add_subdirectory("src") |
| 32 | + else() |
| 33 | +- message("To build the sample app, please enable microphone and media player modules.") |
| 34 | ++ message("To build the sample app, please enable media player modules.") |
| 35 | + endif() |
| 36 | +diff --git a/modules/Alexa/SampleApp/include/SampleApp/SampleApplication.h b/modules/Alexa/SampleApp/include/SampleApp/SampleApplication.h |
| 37 | +index 014d3d6..3beb38d 100644 |
| 38 | +--- a/modules/Alexa/SampleApp/include/SampleApp/SampleApplication.h |
| 39 | ++++ b/modules/Alexa/SampleApp/include/SampleApp/SampleApplication.h |
| 40 | +@@ -145,7 +145,7 @@ public: |
| 41 | + MediaPlayerCreateFunction createFunction); |
| 42 | + }; |
| 43 | + |
| 44 | +-private: |
| 45 | ++protected: |
| 46 | + /** |
| 47 | + * Initialize a SampleApplication. |
| 48 | + * |
| 49 | +diff --git a/modules/Alexa/SampleApp/src/CMakeLists.txt b/modules/Alexa/SampleApp/src/CMakeLists.txt |
| 50 | +index 9498e5f..f237b1d 100644 |
| 51 | +--- a/modules/Alexa/SampleApp/src/CMakeLists.txt |
| 52 | ++++ b/modules/Alexa/SampleApp/src/CMakeLists.txt |
| 53 | +@@ -38,10 +38,10 @@ IF (HAS_EXTERNAL_MEDIA_PLAYER_ADAPTERS) |
| 54 | + endforeach(myfile) |
| 55 | + ENDIF() |
| 56 | + |
| 57 | +-add_executable(SampleApp ${SampleApp_SOURCES}) |
| 58 | +-target_include_directories(SampleApp PUBLIC |
| 59 | ++add_library(SmartScreenSampleApp ${SampleApp_SOURCES}) |
| 60 | ++target_include_directories(SmartScreenSampleApp PUBLIC |
| 61 | ++ "${SmartScreenSampleApp_SOURCE_DIR}/include" |
| 62 | + "${ASDK_INCLUDE_DIRS}" |
| 63 | +- "${SampleApp_SOURCE_DIR}/include" |
| 64 | + "${AudioResources_SOURCE_DIR}/include" |
| 65 | + "${RegistrationManager_SOURCE_DIR}/include" |
| 66 | + "${ESP_SOURCE_DIR}/include" |
| 67 | +@@ -49,7 +49,7 @@ target_include_directories(SampleApp PUBLIC |
| 68 | + "${Utils_SOURCE_DIR}/include" |
| 69 | + "${Communication_SOURCE_DIR/include}") |
| 70 | + |
| 71 | +-target_link_libraries(SampleApp |
| 72 | ++target_link_libraries(SmartScreenSampleApp |
| 73 | + "${ASDK_LDFLAGS}" |
| 74 | + Communication |
| 75 | + AlexaPresentation |
| 76 | +@@ -64,25 +64,25 @@ target_link_libraries(SampleApp |
| 77 | + "${PORTAUDIO_LIB_PATH}") |
| 78 | + |
| 79 | + if (PCC) |
| 80 | +- target_link_libraries(SampleApp AVSCommon) |
| 81 | ++ target_link_libraries(SmartScreenSampleApp AVSCommon) |
| 82 | + endif() |
| 83 | + |
| 84 | + if (ANDROID) |
| 85 | +- target_include_directories(SampleApp PUBLIC "${AndroidUtilities}/include") |
| 86 | +- target_link_libraries(SampleApp AndroidUtilities) |
| 87 | ++ target_include_directories(SmartScreenSampleApp PUBLIC "${AndroidUtilities}/include") |
| 88 | ++ target_link_libraries(SmartScreenSampleApp AndroidUtilities) |
| 89 | + if (ANDROID_MEDIA_PLAYER) |
| 90 | +- target_include_directories(SampleApp PUBLIC "${AndroidSLESMediaPlayer}/include") |
| 91 | +- target_link_libraries(SampleApp AndroidSLESMediaPlayer) |
| 92 | ++ target_include_directories(SmartScreenSampleApp PUBLIC "${AndroidSLESMediaPlayer}/include") |
| 93 | ++ target_link_libraries(SmartScreenSampleApp AndroidSLESMediaPlayer) |
| 94 | + endif() |
| 95 | + endif() |
| 96 | + |
| 97 | + if (GSTREAMER_MEDIA_PLAYER) |
| 98 | +- target_include_directories(SampleApp PUBLIC "${MediaPlayer_SOURCE_DIR}/include") |
| 99 | +- target_link_libraries(SampleApp MediaPlayer) |
| 100 | ++ target_include_directories(SmartScreenSampleApp PUBLIC "${MediaPlayer_SOURCE_DIR}/include") |
| 101 | ++ target_link_libraries(SmartScreenSampleApp MediaPlayer) |
| 102 | + endif() |
| 103 | + |
| 104 | + if(KWD) |
| 105 | +- target_link_libraries(SampleApp KeywordDetectorProvider) |
| 106 | ++ target_link_libraries(SmartScreenSampleApp KeywordDetectorProvider) |
| 107 | + endif() |
| 108 | + |
| 109 | + if(NOT WEBSOCKETPP_INCLUDE_DIR) |
| 110 | +@@ -97,8 +97,8 @@ if(NOT ASIO_INCLUDE_DIR) |
| 111 | + endif() |
| 112 | + endif() |
| 113 | + |
| 114 | +-target_compile_definitions(SampleApp PUBLIC ASIO_STANDALONE) |
| 115 | +-target_include_directories(SampleApp PUBLIC |
| 116 | ++target_compile_definitions(SmartScreenSampleApp PUBLIC ASIO_STANDALONE) |
| 117 | ++target_include_directories(SmartScreenSampleApp PUBLIC |
| 118 | + "${ASIO_INCLUDE_DIR}" |
| 119 | + "${WEBSOCKETPP_INCLUDE_DIR}") |
| 120 | + |
| 121 | +@@ -112,15 +112,15 @@ else() |
| 122 | + find_package(OpenSSL REQUIRED) |
| 123 | + add_definitions(-DENABLE_WEBSOCKET_SSL) |
| 124 | + |
| 125 | +- target_include_directories(SampleApp PUBLIC "${OPENSSL_INCLUDE_DIR}") |
| 126 | +- target_link_libraries(SampleApp |
| 127 | ++ target_include_directories(SmartScreenSampleApp PUBLIC "${OPENSSL_INCLUDE_DIR}") |
| 128 | ++ target_link_libraries(SmartScreenSampleApp |
| 129 | + "${OPENSSL_SSL_LIBRARY}" |
| 130 | + "${OPENSSL_CRYPTO_LIBRARY}") |
| 131 | + endif() |
| 132 | + |
| 133 | + |
| 134 | + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 135 | +- target_link_libraries(SampleApp |
| 136 | ++ target_link_libraries(SmartScreenSampleApp |
| 137 | + "-rpath ${ASDK_LIBRARY_DIRS}" |
| 138 | + "-framework CoreAudio" |
| 139 | + "-framework AudioToolbox" |
| 140 | +@@ -128,7 +128,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 141 | + "-framework CoreServices" |
| 142 | + "-framework Carbon") |
| 143 | + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 144 | +- target_link_libraries(SampleApp |
| 145 | ++ target_link_libraries(SmartScreenSampleApp |
| 146 | + rt m pthread asound |
| 147 | + "-Wl,-rpath,${ASDK_LIBRARY_DIRS}") |
| 148 | + endif() |
| 149 | +@@ -150,15 +150,17 @@ if(NOT YOGA_LIB_DIR) |
| 150 | + endif() |
| 151 | + |
| 152 | + if(APL_CORE) |
| 153 | +- target_include_directories(SampleApp PUBLIC |
| 154 | ++ target_include_directories(SmartScreenSampleApp PUBLIC |
| 155 | + "${APLCORE_INCLUDE_DIR}" |
| 156 | + "${YOGA_INCLUDE_DIR}") |
| 157 | + |
| 158 | +- target_link_libraries(SampleApp ${APLCORE_LIB_DIR}/libapl.a) |
| 159 | +- target_link_libraries(SampleApp ${YOGA_LIB_DIR}/libyogacore.a) |
| 160 | ++ target_link_libraries(SmartScreenSampleApp ${APLCORE_LIB_DIR}/libapl.a) |
| 161 | ++ target_link_libraries(SmartScreenSampleApp ${YOGA_LIB_DIR}/libyogacore.a) |
| 162 | + |
| 163 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error -Wno-reorder") |
| 164 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error -Wno-reorder") |
| 165 | + |
| 166 | + add_definitions(-DAPL_CORE) |
| 167 | +-endif() |
| 168 | +\ No newline at end of file |
| 169 | ++endif() |
| 170 | ++ |
| 171 | ++asdk_install() |
| 172 | +\ No newline at end of file |
| 173 | +diff --git a/modules/Alexa/SampleApp/src/SampleApplication.cpp b/modules/Alexa/SampleApp/src/SampleApplication.cpp |
| 174 | +index a10467e..61c75d3 100644 |
| 175 | +--- a/modules/Alexa/SampleApp/src/SampleApplication.cpp |
| 176 | ++++ b/modules/Alexa/SampleApp/src/SampleApplication.cpp |
| 177 | +@@ -798,7 +798,8 @@ bool SampleApplication::initialize( |
| 178 | + std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESMicrophone> micWrapper = |
| 179 | + m_openSlEngine->createMicrophoneRecorder(sharedDataStream); |
| 180 | + #else |
| 181 | +-#error "No audio input provided" |
| 182 | ++ std::shared_ptr<applicationUtilities::resources::audio::MicrophoneInterface> micWrapper = nullptr; |
| 183 | ++ ACSDK_CRITICAL(LX("Missing implemetation for the micWrapper")); |
| 184 | + #endif |
| 185 | + if (!micWrapper) { |
| 186 | + ACSDK_CRITICAL(LX("Failed to create PortAudioMicrophoneWrapper!")); |
| 187 | +diff --git a/modules/Alexa/SmartScreenSDKInterfaces/CMakeLists.txt b/modules/Alexa/SmartScreenSDKInterfaces/CMakeLists.txt |
| 188 | +index b12ac56..22cee2f 100644 |
| 189 | +--- a/modules/Alexa/SmartScreenSDKInterfaces/CMakeLists.txt |
| 190 | ++++ b/modules/Alexa/SmartScreenSDKInterfaces/CMakeLists.txt |
| 191 | +@@ -9,4 +9,4 @@ target_include_directories(SmartScreenSDKInterfaces INTERFACE |
| 192 | + "${SmartScreenSDKInterfaces_SOURCE_DIR}/include" |
| 193 | + "${SmartScreenSDKInterfaces_SOURCE_DIR}/test") |
| 194 | + |
| 195 | +-asdk_install() |
| 196 | ++asdk_install_interface() |
| 197 | +diff --git a/modules/Alexa/build/cmake/PrepareInstall.cmake b/modules/Alexa/build/cmake/PrepareInstall.cmake |
| 198 | +index bba980a..76986ab 100644 |
| 199 | +--- a/modules/Alexa/build/cmake/PrepareInstall.cmake |
| 200 | ++++ b/modules/Alexa/build/cmake/PrepareInstall.cmake |
| 201 | +@@ -13,7 +13,12 @@ endfunction() |
| 202 | + function(asdk_install) |
| 203 | + SET(PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -l${PROJECT_NAME}" CACHE INTERNAL "" FORCE) |
| 204 | + install(TARGETS ${PROJECT_NAME} DESTINATION "${ASDK_LIB_INSTALL_DIR}") |
| 205 | +- install(DIRECTORY "${PROJECT_SOURCE_DIR}/include" DESTINATION "${ASDK_INCLUDE_INSTALL_DIR}") |
| 206 | ++ install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${ASDK_INCLUDE_INSTALL_DIR}/include/SmartScreen/") |
| 207 | ++endfunction() |
| 208 | ++ |
| 209 | ++function(asdk_install_interface) |
| 210 | ++ install(TARGETS ${PROJECT_NAME} DESTINATION "${ASDK_LIB_INSTALL_DIR}") |
| 211 | ++ install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${ASDK_INCLUDE_INSTALL_DIR}/include/SmartScreen/") |
| 212 | + endfunction() |
| 213 | + |
| 214 | + # Function to install the target with list of include paths |
| 215 | +@@ -21,7 +26,7 @@ function(asdk_install_multiple path_list) |
| 216 | + SET(PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -l${PROJECT_NAME}" CACHE INTERNAL "" FORCE) |
| 217 | + install(TARGETS ${PROJECT_NAME} DESTINATION "${ASDK_LIB_INSTALL_DIR}") |
| 218 | + foreach(path IN LISTS path_list) |
| 219 | +- install(DIRECTORY ${path} DESTINATION "${ASDK_INCLUDE_INSTALL_DIR}") |
| 220 | ++ install(DIRECTORY "${path}/" DESTINATION "${ASDK_INCLUDE_INSTALL_DIR}/include/SmartScreen") |
| 221 | + endforeach() |
| 222 | + endfunction() |
| 223 | + |
| 224 | +@@ -37,7 +42,7 @@ if(BLUETOOTH_BLUEZ) |
| 225 | + endif() |
| 226 | + SET(PKG_CONFIG_LIBS "-L\${libdir}" CACHE INTERNAL "" FORCE) |
| 227 | + SET(PKG_CONFIG_LIBDIR "\${prefix}/lib") |
| 228 | +-SET(PKG_CONFIG_INCLUDEDIR "\${prefix}/include") |
| 229 | ++SET(PKG_CONFIG_INCLUDEDIR "\${prefix}/include/SmartScreen") |
| 230 | + SET(PKG_CONFIG_CFLAGS "-I\${includedir}") |
| 231 | + |
| 232 | + # Set library and header files install directory |
| 233 | +-- |
| 234 | +2.17.1 |
| 235 | + |
0 commit comments