2 # Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 cmake_minimum_required(VERSION 3.0)
20 set(TARGET_LIBSM soundmanager)
21 add_definitions("-std=c++11")
23 pkg_check_modules(libsm_depends json-c libafbwsc libsystemd audiomanager)
24 set(libsm_sources libsoundmanager.cpp)
26 include_directories(${LIBSM_INCLUDE_DIR})
27 link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
29 add_library(${TARGET_LIBSM} SHARED ${libsm_sources})
30 target_compile_options(${TARGET_LIBSM} PUBLIC ${libsm_depends_CFLAGS})
33 target_compile_options(${TARGET_LIBSM} PRIVATE -g -O0)
34 else(DEFINED DEBUGMODE)
35 target_compile_options(${TARGET_LIBSM} PRIVATE -g -O2)
36 endif(DEFINED DEBUGMODE)
38 include_directories(${TARGET_LIBSM} ${libsm_depends_INCLUDE_DIRS})
39 target_link_libraries(${TARGET_LIBSM} afbwsc -lpthread ${link_libraries} ${libsm_depends_LIBRARIES})
41 INSTALL(TARGETS ${TARGET_LIBSM}
42 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
45 pkg_check_modules(test_depends glib-2.0 gio-2.0 gio-unix-2.0)
46 add_executable(libsoundmanager-demo test.cpp)
47 include_directories(libsoundmanager-demo ${test_depends_INCLUDE_DIRS})
48 TARGET_LINK_LIBRARIES(libsoundmanager-demo
52 ${test_depends_LIBRARIES}
53 ${libsm_depends_LIBRARIES}
56 add_subdirectory(test)