diff options
author | fulup <fulup.arfoll@iot.bzh> | 2017-04-09 14:35:00 +0200 |
---|---|---|
committer | fulup <fulup.arfoll@iot.bzh> | 2017-04-09 14:35:00 +0200 |
commit | 6e70aac6c9f02496978d3d02efb355d66fb36ceb (patch) | |
tree | d50df20591076b3da2031b2b9eb249f2a1921f53 | |
parent | c75c329e08f4c189419aa4c5607f38890885b46c (diff) |
Clean CMAKE structure and rename files/directories
-rw-r--r-- | ALSA-afb/AlsaCoreBinding.c (renamed from AlsaSound/CoreBinding/AlsaCoreBinding.c) | 0 | ||||
-rw-r--r-- | ALSA-afb/AlsaCoreBinding.h (renamed from AlsaSound/CoreBinding/AlsaCoreBinding.h) | 2 | ||||
-rw-r--r-- | ALSA-afb/AlsaCtlSetGet.c (renamed from AlsaSound/CoreBinding/AlsaCtlSetGet.c) | 0 | ||||
-rw-r--r-- | ALSA-afb/AlsaUseCase.c (renamed from AlsaSound/CoreBinding/AlsaUseCase.c) | 0 | ||||
-rw-r--r-- | ALSA-afb/CMakeLists.txt (renamed from AlsaSound/CoreBinding/CMakeLists.txt) | 27 | ||||
-rw-r--r-- | ALSA-afb/README.md (renamed from AlsaSound/CoreBinding/README.md) | 0 | ||||
-rw-r--r-- | AlsaSound/HALayer/SharedHal/CMakeLists.txt | 29 | ||||
-rw-r--r-- | Audio-Interface/CMakeLists.txt (renamed from Common/CMakeLists.txt) | 24 | ||||
-rw-r--r-- | Audio-Interface/audio-interface.c (renamed from Common/AudioCommonLib.c) | 2 | ||||
-rw-r--r-- | Audio-Interface/audio-interface.h (renamed from Common/AudioCommonLib.h) | 0 | ||||
-rw-r--r-- | CMakeLists.txt | 157 | ||||
-rw-r--r-- | HAL-afb/CMakeLists.txt (renamed from AlsaSound/CMakeLists.txt) | 20 | ||||
-rw-r--r-- | HAL-afb/HAL-interface/CMakeLists.txt (renamed from AlsaSound/HALayer/CMakeLists.txt) | 24 | ||||
-rw-r--r-- | HAL-afb/HAL-interface/hal-interface.c (renamed from AlsaSound/HALayer/SharedHal/SharedHalLib.c) | 2 | ||||
-rw-r--r-- | HAL-afb/HAL-interface/hal-interface.h (renamed from AlsaSound/HALayer/SharedHal/SharedHalLib.h) | 2 | ||||
-rw-r--r-- | HAL-afb/HDA-intel/CMakeLists.txt (renamed from AudioLogic/CMakeLists.txt) | 27 | ||||
-rw-r--r-- | HAL-afb/HDA-intel/IntelHdaHAL.c (renamed from AlsaSound/HALayer/IntelHda/IntelHdaHAL.c) | 4 | ||||
-rw-r--r-- | HighLevel-afb/CMakeLists.txt (renamed from AlsaSound/HALayer/IntelHda/CMakeLists.txt) | 28 | ||||
-rw-r--r-- | HighLevel-afb/HighLevelApiConf.c (renamed from AudioLogic/AudioLogicBinding.c) | 2 | ||||
-rw-r--r-- | HighLevel-afb/HighLevelBinding.c (renamed from AudioLogic/AudioLogicLib.c) | 2 | ||||
-rw-r--r-- | HighLevel-afb/HighLevelBinding.h (renamed from AudioLogic/AudioLogicLib.h) | 3 | ||||
-rw-r--r-- | HighLevel-afb/README.md (renamed from AudioLogic/README.md) | 0 | ||||
-rw-r--r-- | README.md | 27 | ||||
-rw-r--r-- | cd | 0 | ||||
-rw-r--r-- | etc/config.cmake | 64 | ||||
-rw-r--r-- | htdocs/CMakeLists.txt | 1 | ||||
-rw-r--r-- | nbproject/configurations.xml | 18 | ||||
-rw-r--r-- | nbproject/project.xml | 2 |
28 files changed, 269 insertions, 198 deletions
diff --git a/AlsaSound/CoreBinding/AlsaCoreBinding.c b/ALSA-afb/AlsaCoreBinding.c index d866daf..d866daf 100644 --- a/AlsaSound/CoreBinding/AlsaCoreBinding.c +++ b/ALSA-afb/AlsaCoreBinding.c diff --git a/AlsaSound/CoreBinding/AlsaCoreBinding.h b/ALSA-afb/AlsaCoreBinding.h index 2852384..c0fd51f 100644 --- a/AlsaSound/CoreBinding/AlsaCoreBinding.h +++ b/ALSA-afb/AlsaCoreBinding.h @@ -19,7 +19,7 @@ #ifndef ALSALIBMAPPING_H #define ALSALIBMAPPING_H -#include "AudioCommonLib.h" +#include "audio-interface.h" typedef enum { diff --git a/AlsaSound/CoreBinding/AlsaCtlSetGet.c b/ALSA-afb/AlsaCtlSetGet.c index a41e390..a41e390 100644 --- a/AlsaSound/CoreBinding/AlsaCtlSetGet.c +++ b/ALSA-afb/AlsaCtlSetGet.c diff --git a/AlsaSound/CoreBinding/AlsaUseCase.c b/ALSA-afb/AlsaUseCase.c index 8e23e3c..8e23e3c 100644 --- a/AlsaSound/CoreBinding/AlsaUseCase.c +++ b/ALSA-afb/AlsaUseCase.c diff --git a/AlsaSound/CoreBinding/CMakeLists.txt b/ALSA-afb/CMakeLists.txt index e14432e..d7ace36 100644 --- a/AlsaSound/CoreBinding/CMakeLists.txt +++ b/ALSA-afb/CMakeLists.txt @@ -16,21 +16,26 @@ # limitations under the License. ########################################################################### +# Add target to project dependency list +PROJECT_TARGET_ADD(alsa-afb) -INCLUDE_DIRECTORIES(${include_dirs}) + # Define project Targets + ADD_LIBRARY(alsa-afb MODULE AlsaCoreBinding.c AlsaCtlSetGet.c AlsaUseCase.c) -################################################## -# AlsaBinding -################################################## -ADD_LIBRARY(alsacore-afb MODULE AlsaCoreBinding.c AlsaCtlSetGet.c AlsaUseCase.c) - -SET_TARGET_PROPERTIES(alsacore-afb PROPERTIES + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(alsa-afb PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/export.map" -) + OUTPUT_NAME alsabinding + ) -TARGET_LINK_LIBRARIES(alsacore-afb ${link_libraries}) -INSTALL(TARGETS alsacore-afb - LIBRARY DESTINATION ${binding_install_dir}) + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(alsa-afb + audio-interface + ${link_libraries} + ) + # installation directory + INSTALL(TARGETS alsa-afb + LIBRARY DESTINATION ${binding_install_dir}) diff --git a/AlsaSound/CoreBinding/README.md b/ALSA-afb/README.md index a4b0395..a4b0395 100644 --- a/AlsaSound/CoreBinding/README.md +++ b/ALSA-afb/README.md diff --git a/AlsaSound/HALayer/SharedHal/CMakeLists.txt b/AlsaSound/HALayer/SharedHal/CMakeLists.txt deleted file mode 100644 index d789367..0000000 --- a/AlsaSound/HALayer/SharedHal/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -########################################################################### -# Copyright 2015, 2016, 2017 IoT.bzh -# -# author: Fulup Ar Foll <fulup@iot.bzh> -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -########################################################################### - -INCLUDE_DIRECTORIES(${include_dirs}) - -################################################## -# Shared HAL(Hardware Abstraction Layer) -################################################## -ADD_LIBRARY(sharedhal STATIC SharedHalLib.c) -SET_TARGET_PROPERTIES(sharedhal PROPERTIES OUTPUT_NAME sharedhal) -SET(link_libraries ${libefence_LIBRARIES} ${json-c_LIBRARIES}) -TARGET_LINK_LIBRARIES(sharedhal ${link_libraries}) - - diff --git a/Common/CMakeLists.txt b/Audio-Interface/CMakeLists.txt index 79ee8ac..665007f 100644 --- a/Common/CMakeLists.txt +++ b/Audio-Interface/CMakeLists.txt @@ -16,16 +16,22 @@ # limitations under the License. ########################################################################### -PROJECT(audio-common C) +# Add target to project dependency list +PROJECT_TARGET_ADD(audio-interface) -INCLUDE_DIRECTORIES(${include_dirs}) + # Define targets + ADD_LIBRARY(audio-interface STATIC audio-interface.c) -################################################## -# AudioCommon is a local static Library -################################################## -ADD_LIBRARY(audiocommon STATIC AudioCommonLib.c) -SET_TARGET_PROPERTIES(audiocommon PROPERTIES OUTPUT_NAME audiocommon) -SET(link_libraries ${libefence_LIBRARIES} ${json-c_LIBRARIES}) -TARGET_LINK_LIBRARIES(audiocommon ${link_libraries}) + # Library properties + SET_TARGET_PROPERTIES(audio-interface PROPERTIES OUTPUT_NAME audiointerface) + # Library dependencies + #TARGET_LINK_LIBRARIES(audio-interface + # empty + #) + + # Define target includes + TARGET_INCLUDE_DIRECTORIES(audio-interface + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ) diff --git a/Common/AudioCommonLib.c b/Audio-Interface/audio-interface.c index 0055896..c1c4054 100644 --- a/Common/AudioCommonLib.c +++ b/Audio-Interface/audio-interface.c @@ -23,7 +23,7 @@ #include <semaphore.h> #include <string.h> -#include "AudioCommonLib.h" +#include "audio-interface.h" typedef struct { int index; diff --git a/Common/AudioCommonLib.h b/Audio-Interface/audio-interface.h index ffefbfc..ffefbfc 100644 --- a/Common/AudioCommonLib.h +++ b/Audio-Interface/audio-interface.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bd639d..90ecf5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,48 +17,63 @@ ########################################################################### -# Select GCC5 is avaliable -########################################################################### -execute_process(COMMAND gcc-5 -dumpversion RESULT_VARIABLE GCC5RC OUTPUT_QUIET ERROR_QUIET) -if(GCC5RC EQUAL 0) -message(STATUS "GCC version-5 selected") -set(CMAKE_C_COMPILER "gcc-5") -set(CMAKE_CXX_COMPILER "g++-5") -endif(GCC5RC EQUAL 0) - - -# Compiler should be selected before projet() -project(audio-binding) -SET(PROJECT_NAME "AFB Audio Binding") -SET(PROJECT_PRETTY_NAME "Audio Binding") -SET(PROJECT_DESCRIPTION "Expose Audio API through AGL Framework") -SET(PROJECT_VERSION "1.0") -SET(PROJECT_URL "https://github.com/iotbzh/afb-audio") - -CMAKE_MINIMUM_REQUIRED(VERSION 3.3) -SET(CMAKE_BUILD_TYPE Debug) -SET(CMAKE_POSITION_INDEPENDENT_CODE ON) - -INCLUDE(FindPkgConfig) -INCLUDE(CheckIncludeFiles) -INCLUDE(CheckLibraryExists) -INCLUDE(GNUInstallDirs) +#-------------------------------------------------------------------------- +# WARNING: +# Do not change this cmake template +# Customise your preferences in "./etc/config.cmake" +#-------------------------------------------------------------------------- -SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/audio) - # Generic useful macro -########################################################### +# ----------------------- +macro(PROJECT_TARGET_ADD TARGET_NAME) + set(PROJECT_TARGETS ${PROJECT_TARGETS} ${TARGET_NAME} CACHE INTERNAL PROJECT_TARGETS) +endmacro(PROJECT_TARGET_ADD) + macro(defstr name value) - add_definitions(-D${name}=${value}) + add_definitions(-D${name}=${value}) endmacro(defstr) macro(setc name value) - if(NOT DEFINED ${name}) - set(${name} ${value}) - endif(NOT DEFINED ${name}) + if(NOT DEFINED ${name}) + set(${name} ${value}) + endif(NOT DEFINED ${name}) endmacro(setc) +CMAKE_MINIMUM_REQUIRED(VERSION 3.3) +setc(CMAKE_BUILD_TYPE Debug) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMP0048 1) + + +# Compiler selection should append before project definition +# ----------------------------------------------------------- +foreach (GCC_VERSION "6" "5") + execute_process(COMMAND gcc-${GCC_VERSION} -dumpversion RESULT_VARIABLE GCCRC OUTPUT_QUIET ERROR_QUIET) + if(GCCRC EQUAL 0) + set(CMAKE_C_COMPILER "gcc-${GCC_VERSION}") + set(CMAKE_CXX_COMPILER "g++-${GCC_VERSION}") + set(CMAKE_C_VERSION ${GCC_VERSION}) + break() + endif(GCCRC EQUAL 0) +endforeach(GCC_VERSION) + +# Include project configuration +# ------------------------------ +include(${CMAKE_CURRENT_SOURCE_DIR}/etc/config.cmake) +project(${NAME} VERSION ${VERSION}) +setc (PROJECT_PRETTY_NAME ${PRETTY_NAME}) +setc (PROJECT_DESCRIPTION ${DESCRIPTION}) +message(STATUS "") +message(STATUS "Project=${PROJECT_NAME}/${VERSION}[${PRETTY_NAME} ${DESCRIPTION}]") +message(STATUS "") +message(STATUS "gcc/g++ version-${CMAKE_C_VERSION}.x selected") + +INCLUDE(FindPkgConfig) +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) +INCLUDE(GNUInstallDirs) + # Default compilation options ############################################################################ link_libraries(-Wl,--as-needed -Wl,--gc-sections) @@ -73,46 +88,66 @@ add_compile_options(-g) setc(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE") setc(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE") -setc(CMAKE_C_FLAGS_RELEASE "-g -O2") +setc(CMAKE_C_FLAGS_RELEASE "-O2") setc(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage") setc(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/Install") -# Warning as PKG_CONFIG_PATH does not work [should be en env variable] -set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1) -set(CMAKE_PREFIX_PATH ${HOME}/opt/lib64/pkgconfig) +# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable] +setc(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1) +# Loop on required package and add options +foreach (PKG_CONFIG ${PKG_REQUIRED_LIST}) + PKG_CHECK_MODULES(${PKG_CONFIG} REQUIRED ${PKG_CONFIG}) -# Generic Package dependencies -############################################################################ -PKG_CHECK_MODULES(json-c REQUIRED json-c) -PKG_CHECK_MODULES(afb-daemon REQUIRED afb-daemon) + INCLUDE_DIRECTORIES(${${PKG_CONFIG}_INCLUDE_DIRS}) + list (APPEND link_libraries ${${PKG_CONFIG}_LIBRARIES}) + add_compile_options (${${PKG_CONFIG}_CFLAGS}) +endforeach(PKG_CONFIG) -IF(CMAKE_BUILD_TYPE MATCHES Debug) +# Optional LibEfence Malloc debug library +IF(CMAKE_BUILD_TYPE MATCHES DEBUG) CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE) IF(HAVE_LIBEFENCE) MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...") SET(libefence_LIBRARIES "-lefence") + list (APPEND link_libraries libefence_LIBRARIES}) ENDIF(HAVE_LIBEFENCE) -ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) - - -SET(include_dirs - ${INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/Common - ${json-c_INCLUDE_DIRS} - ${afb-daemon_INCLUDE_DIRS} - ) +ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG) -# AudioCommon is linked statically with each audiobindings -SET(link_libraries - ${CMAKE_BINARY_DIR}/Common/libaudiocommon.a - ${libefence_LIBRARIES} - ${json-c_LIBRARIES} - ) +# set default include directories +INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS}) # Bindings to compile # -------------------- -add_subdirectory(Common) -add_subdirectory(AlsaSound) -add_subdirectory(AudioLogic) -add_subdirectory(htdocs) +file(GLOB filelist "[A-z]*") +foreach(filename ${filelist}) + if(EXISTS "${filename}/CMakeLists.txt") + add_subdirectory(${filename}) + endif(EXISTS "${filename}/CMakeLists.txt") +endforeach() + +# Add a dummy target to enable global dependency order +# ----------------------------------------------------- +if(EXTRA_DEPENDENCIES_ORDER) + set(DEPENDENCIES_TARGET ${PROJECT_NAME}_extra_dependencies) + add_custom_target(${DEPENDENCIES_TARGET} ALL + DEPENDS ${EXTRA_DEPENDENCY_ORDER} + ) +endif() + +# Cmake does not maintain targets list before 3.7 +# ------------------------------------------------- +if(${CMAKE_VERSION} VERSION_LESS 3.7) + set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS}) +else() + get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList) +endif() + +# Print developer helper message when everything is done +# ------------------------------------------------------- +if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST) + add_custom_target(${PROJECT_NAME}_done ALL + DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST} + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}" + ) +endif() diff --git a/AlsaSound/CMakeLists.txt b/HAL-afb/CMakeLists.txt index 7356ca4..c36f530 100644 --- a/AlsaSound/CMakeLists.txt +++ b/HAL-afb/CMakeLists.txt @@ -16,17 +16,13 @@ # limitations under the License. ########################################################################### -PROJECT(alsa-bindings C) -PKG_CHECK_MODULES(alsa REQUIRED alsa) -# Max Sound Card Number eligible to ctlevent subscription -defstr(MAX_SND_CARD 16) - -SET(link_libraries - ${alsa_LIBRARIES} - ${link_libraries} - ) - -ADD_SUBDIRECTORY(CoreBinding) -ADD_SUBDIRECTORY(HALayer) +# Include any directory starting with a Capital letter +# ----------------------------------------------------- +file(GLOB filelist "[A-Z]*") +foreach(filename ${filelist}) + if(EXISTS "${filename}/CMakeLists.txt") + add_subdirectory(${filename}) + endif(EXISTS "${filename}/CMakeLists.txt") +endforeach() diff --git a/AlsaSound/HALayer/CMakeLists.txt b/HAL-afb/HAL-interface/CMakeLists.txt index 4601c79..0ea298f 100644 --- a/AlsaSound/HALayer/CMakeLists.txt +++ b/HAL-afb/HAL-interface/CMakeLists.txt @@ -16,16 +16,22 @@ # limitations under the License. ########################################################################### -PROJECT(hadware-abstraction-layer C) -SET(include_dirs ${CMAKE_CURRENT_SOURCE_DIR}/SharedHal ${include_dirs}) +# Add target to project dependency list +PROJECT_TARGET_ADD(hal-interface) -# Add ShareHalLib statically within each HAL bindings -SET(link_libraries - ${CMAKE_BINARY_DIR}/AlsaSound/HALayer/SharedHal/libsharedhal.a - ${link_libraries} -) + # Define targets + ADD_LIBRARY(hal-interface STATIC hal-interface.c) -ADD_SUBDIRECTORY(SharedHal) -ADD_SUBDIRECTORY(IntelHda) + # Library properties + SET_TARGET_PROPERTIES(hal-interface PROPERTIES OUTPUT_NAME halinterface) + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(hal-interface + audio-interface + ) + + # Define target includes + TARGET_INCLUDE_DIRECTORIES(hal-interface + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ) diff --git a/AlsaSound/HALayer/SharedHal/SharedHalLib.c b/HAL-afb/HAL-interface/hal-interface.c index 43d0cfe..7876715 100644 --- a/AlsaSound/HALayer/SharedHal/SharedHalLib.c +++ b/HAL-afb/HAL-interface/hal-interface.c @@ -29,7 +29,7 @@ #include <sys/time.h> #include <sys/types.h> -#include "SharedHalLib.h" +#include "hal-interface.h" typedef struct { int index; diff --git a/AlsaSound/HALayer/SharedHal/SharedHalLib.h b/HAL-afb/HAL-interface/hal-interface.h index 7cf4489..cebbd21 100644 --- a/AlsaSound/HALayer/SharedHal/SharedHalLib.h +++ b/HAL-afb/HAL-interface/hal-interface.h @@ -19,7 +19,7 @@ #define SHAREHALLIB_H #include <stdio.h> -#include "AudioCommonLib.h" +#include "audio-interface.h" typedef struct { halCtlsEnumT control; diff --git a/AudioLogic/CMakeLists.txt b/HAL-afb/HDA-intel/CMakeLists.txt index 0b72b5c..26be621 100644 --- a/AudioLogic/CMakeLists.txt +++ b/HAL-afb/HDA-intel/CMakeLists.txt @@ -17,20 +17,25 @@ ########################################################################### -INCLUDE_DIRECTORIES(${include_dirs}) +# Add target to project dependency list +PROJECT_TARGET_ADD(hal-intel-hda) -################################################## -# AudioLogicBinding -################################################## -ADD_LIBRARY(audiologic-afb MODULE AudioLogicBinding.c AudioLogicLib.c) + # Define project Targets + ADD_LIBRARY(hal-intel-hda MODULE IntelHdaHAL.c) -SET_TARGET_PROPERTIES(audiologic-afb PROPERTIES + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(hal-intel-hda PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/export.map" -) - -TARGET_LINK_LIBRARIES(audiologic-afb ${link_libraries}) -INSTALL(TARGETS audiologic-afb - LIBRARY DESTINATION ${binding_install_dir}) + OUTPUT_NAME intel-hda-binding + ) + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(hal-intel-hda + hal-interface + audio-interface + ) + # installation directory + INSTALL(TARGETS hal-intel-hda + LIBRARY DESTINATION ${binding_install_dir}) diff --git a/AlsaSound/HALayer/IntelHda/IntelHdaHAL.c b/HAL-afb/HDA-intel/IntelHdaHAL.c index 5d668ba..bc8fc43 100644 --- a/AlsaSound/HALayer/IntelHda/IntelHdaHAL.c +++ b/HAL-afb/HDA-intel/IntelHdaHAL.c @@ -15,8 +15,8 @@ * limitations under the License. */ #define _GNU_SOURCE -#include "AudioCommonLib.h" -#include "SharedHalLib.h" // Include Share Interface to Alsa Sound Card HAL +#include "hal-interface.h" +#include "audio-interface.h" // Force a hard dependency to ShareHallLib PUBLIC char* SharedHalLibVersion; diff --git a/AlsaSound/HALayer/IntelHda/CMakeLists.txt b/HighLevel-afb/CMakeLists.txt index 89665e4..de59686 100644 --- a/AlsaSound/HALayer/IntelHda/CMakeLists.txt +++ b/HighLevel-afb/CMakeLists.txt @@ -16,21 +16,25 @@ # limitations under the License. ########################################################################### +# Add target to project dependency list +PROJECT_TARGET_ADD(audio-afb) -INCLUDE_DIRECTORIES(${include_dirs}) + # Define project Targets + ADD_LIBRARY(audio-afb MODULE HighLevelApiConf.c HighLevelBinding.c) -################################################## -# Inte-HDA sound card Hardware Abstraction Layer -################################################## -ADD_LIBRARY(intel-hda-hal MODULE IntelHdaHAL.c ) - -SET_TARGET_PROPERTIES(intel-hda-hal PROPERTIES + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(audio-afb PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/export.map" -) - -TARGET_LINK_LIBRARIES(intel-hda-hal ${link_libraries}) -INSTALL(TARGETS intel-hda-hal - LIBRARY DESTINATION ${binding_install_dir}) + OUTPUT_NAME audio-highlevel-binding + ) + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(audio-afb + audio-interface + ${link_libraries} + ) + # installation directory + INSTALL(TARGETS audio-afb + LIBRARY DESTINATION ${binding_install_dir}) diff --git a/AudioLogic/AudioLogicBinding.c b/HighLevel-afb/HighLevelApiConf.c index 002ff42..75e4a2f 100644 --- a/AudioLogic/AudioLogicBinding.c +++ b/HighLevel-afb/HighLevelApiConf.c @@ -26,7 +26,7 @@ #include <sys/time.h> #include <sys/types.h> -#include "AudioLogicLib.h" +#include "HighLevelBinding.h" PUBLIC const struct afb_binding_interface *afbIface; diff --git a/AudioLogic/AudioLogicLib.c b/HighLevel-afb/HighLevelBinding.c index e9d7104..df5f2c3 100644 --- a/AudioLogic/AudioLogicLib.c +++ b/HighLevel-afb/HighLevelBinding.c @@ -26,7 +26,7 @@ #include <sys/time.h> #include <sys/types.h> -#include "AudioLogicLib.h" +#include "HighLevelBinding.h" static struct afb_service srvitf; diff --git a/AudioLogic/AudioLogicLib.h b/HighLevel-afb/HighLevelBinding.h index 77b8b7b..a2ca61c 100644 --- a/AudioLogic/AudioLogicLib.h +++ b/HighLevel-afb/HighLevelBinding.h @@ -18,11 +18,12 @@ #ifndef AUDIOLOGIC_H #define AUDIOLOGIC_H -#include "AudioCommonLib.h" #include <json-c/json.h> #include <afb/afb-binding.h> #include <afb/afb-service-itf.h> +#include "audio-interface.h" + // import from AlsaAfbBinding extern const struct afb_binding_interface *afbIface; diff --git a/AudioLogic/README.md b/HighLevel-afb/README.md index fa50173..fa50173 100644 --- a/AudioLogic/README.md +++ b/HighLevel-afb/README.md @@ -19,31 +19,29 @@ AFB_daemon dependency on Standard Linux Distributions libopenssl-devel libgcrypt-devel libgnutls-devel (optional but requested by libmicrohttpd for https) OpenSuse >=42.2 - zypper in gcc5 gdb gcc5-c++ cmake ElectricFence systemd-devel libopenssl-devel libuuid-devel alsa-devel libgcrypt-devel libgnutls-devel libjson-c-devel file-devel + zypper in gcc5 gdb gcc5-c++ cit make ElectricFence systemd-devel libopenssl-devel libuuid-devel alsa-devel libgcrypt-devel libgnutls-devel libjson-c-devel file-devel Ubuntu >= 16.4libuuid-devel - apt-get install cmake electric-fence libsystemd-dev libssl-dev uuid-dev libasound2-dev libgcrypt20-dev libgnutls-dev libgnutls-dev libjson-c-dev libmagic-dev + apt-get install cmake git electric-fence libsystemd-dev libssl-dev uuid-dev libasound2-dev libgcrypt20-dev libgnutls-dev libgnutls-dev libjson-c-dev libmagic-dev libmicrohttpd with AGL patches http://iot.bzh/download/public/2016/appfw/libmicrohttpd-0.9.49-agl.tgz afb-daemon from AGL Gerrit git clone https://gerrit.automotivelinux.org/gerrit/src/app-framework-binder ``` # Might want to add following variables into ~/.bashrc - # export CC=gcc-5; export CXX=g++-5 # if using gcc5 - - echo 'export LIBPOSTFIX=64'>>~/.bashrc + export CC=gcc-5; export CXX=g++-5 # if using gcc5 echo 'export DEST=$HOME/opt' >>~/.bashrc - echo 'export LD_LIBRARY_PATH=$DEST/lib${LIBPOSTFIX}' >>~/.bashrc - echo 'export LIBRARY_PATH=$DEST/lib${LIBPOSTFIX}' >>~/.bashrc - echo 'export PKG_CONFIG_PATH=$DEST/lib${LIBPOSTFIX}/pkgconfig' >>~/.bashrc - echo 'export PATH=$DEST/bin:$PATH' >>~/.bashrc + echo 'export LD_LIBRARY_PATH=$INSTALL_DIR/lib64:$INSTALL_DIR/lib' >>~/.bashrc + echo 'export LIBRARY_PATH=$INSTALL_DIR/lib64:$INSTALL_DIR/lib' >>~/.bashrc + echo 'export PKG_CONFIG_PATH=$INSTALL_DIR/lib64/pkgconfig:$INSTALL_DIR/lib/pkgconfig' >>~/.bashrc + echo 'export PATH=$INSTALL_DIR/bin:$PATH' >>~/.bashrc source ~/.bashrc # install AGL pached version of LibMicroHttpd wget http://iot.bzh/download/public/2016/appfw/libmicrohttpd-0.9.49-agl.tgz tar -xzf libmicrohttpd-0.9.49-agl.tgz cd libmicrohttpd-0.9.49-agl - ./configure --prefix=$DEST + ./configure --prefix=$INSTALL_DIR make make install-strip @@ -52,7 +50,7 @@ AFB_daemon dependency on Standard Linux Distributions # Warning: previous GCC options should be set before initial cmake (clean Build/*) cd app-framework-binder; mkdir build; cd build - cmake -DCMAKE_INSTALL_PREFIX=$DEST .. + cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR .. make make install ``` @@ -66,17 +64,16 @@ cd build cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR .. make make install -ls # Start the binder # From Development Tree - mkdir $DEST/share/wssocks - afb-daemon --verbose --token="" --ldpaths=./build --port=1234 --roothttp=./htdoc --ws-server=unix:$DEST/share/wssocks/alsacore + mkdir $INSTALL_DIR/share/wssocks + afb-daemon --verbose --token="" --ldpaths=./build --port=1234 --roothttp=./htdocs # From $INSTALL_DIR mkdir $INSTALL_DIR/share/wssocks - afb-daemon --verbose --token="" --ldpaths=$INSTALL_DIR/lib/audio --port=1234 --roothttp=$INSTALL_DIR/htdocs/audio-bindings --ws-server=unix:$INSTALL_DIR/share/wssocks/alsacore + afb-daemon --verbose --token="" --ldpaths=$INSTALL_DIR/lib/audio --port=1234 --roothttp=$INSTALL_DIR/htdocs/audio-bindings ``` # replace hd:XX with your own sound card ID ex: "hw:0", "hw:PCH", ... Start a browser on http://localhost:1234?devid=hw:XX diff --git a/etc/config.cmake b/etc/config.cmake new file mode 100644 index 0000000..f8d11dc --- /dev/null +++ b/etc/config.cmake @@ -0,0 +1,64 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll <fulup@iot.bzh> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + +# Project Info +# ------------------ + set(NAME audio-bindings) + set(VERSION "1.0") + set(PRETTY_NAME "Audio Bindings") + set(DESCRIPTION "Expose ALSA Sound Low+High Level APIs through AGL Framework") + set(URL "https://github.com/iotbzh/auto-bindings") + +# Compilation Mode (DEBUG, RELEASE) +# ---------------------------------- + setc(CMAKE_BUILD_TYPE "DEBUG") + +# PKG_CONFIG required packages +# ----------------------------- + set (PKG_REQUIRED_LIST + alsa + json-c + afb-daemon + ) + +# Static constante definition +# ----------------------------- + add_compile_options(-DMAX_SND_CARD=16) + add_compile_options(-DCONTROL_CDEV_RX="/dev/inic-usb-crx") + +# Optional dependencies order +# --------------------------- + #set(EXTRA_DEPENDENCY_ORDER target1 target2 ...) + +# Optional Extra global include path +# ------------------------------------ + #set(EXTRA_INCLUDE_DIRS incdir1 incdir2 ...) + +# Optional extra libraries +# ------------------------- + # set(EXTRA_LINK_LIBRARIES lib1 lib2 ... ) + +# Install default destination +# -------------------------------- + set(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}) + +# Print a helper message when every thing is finished +# ---------------------------------------------------- + setc(CLOSING_MESSAGE "Test with: afb-daemon --ldpaths=. --port=1234 --roothttp=../htdocs --tracereq=common --token="" --verbose") + + diff --git a/htdocs/CMakeLists.txt b/htdocs/CMakeLists.txt index 22a4d63..1266d70 100644 --- a/htdocs/CMakeLists.txt +++ b/htdocs/CMakeLists.txt @@ -18,7 +18,6 @@ - ################################################## # HTML Testing Files ################################################## diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index dbdc7fc..370176d 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -2,14 +2,6 @@ <configurationDescriptor version="100"> <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT"> <df root="." name="0"> - <df name="AlsaSound"> - <df name="HALayer"> - <df name="include"> - <in>AlsaHalIface.h</in> - <in>AudioCommonLib.h</in> - </df> - </df> - </df> <df name="MostVolume"> <df name="external"> <in>ConnectionInfo.cpp</in> @@ -65,16 +57,6 @@ <preBuildFirst>true</preBuildFirst> </preBuild> </makefileType> - <item path="AlsaSound/HALayer/include/AlsaHalIface.h" - ex="false" - tool="3" - flavor2="0"> - </item> - <item path="AlsaSound/HALayer/include/AudioCommonLib.h" - ex="false" - tool="3" - flavor2="0"> - </item> <item path="MostVolume/DeviceContainer.cpp" ex="false" tool="1" flavor2="0"> </item> <item path="MostVolume/DeviceValue.cpp" ex="false" tool="1" flavor2="0"> diff --git a/nbproject/project.xml b/nbproject/project.xml index be8b144..144cd73 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@ <type>org.netbeans.modules.cnd.makeproject</type> <configuration> <data xmlns="http://www.netbeans.org/ns/make-project/1"> - <name>AGL-AudioBindings</name> + <name>Audio-Bindings</name> <c-extensions>c</c-extensions> <cpp-extensions>cpp,cxx</cpp-extensions> <header-extensions>h</header-extensions> |