Skip to content
Snippets Groups Projects
Commit 9dd1a405 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

build/cmake: build jamid (DBUS binding)

Change-Id: I3f22b989d406eabd4f2715c95a94df1618f8df0d
parent 61dfbe41
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ option(JAMI_NATPMP "Build with NAT-PMP" ON) ...@@ -12,6 +12,7 @@ option(JAMI_NATPMP "Build with NAT-PMP" ON)
option(JAMI_PUPNP "Build with PUPNP" ON) option(JAMI_PUPNP "Build with PUPNP" ON)
option(JAMI_PLUGIN "Build with plugin support" ON) option(JAMI_PLUGIN "Build with plugin support" ON)
option(JAMI_JNI "Build the JNI binding" OFF) option(JAMI_JNI "Build the JNI binding" OFF)
option(JAMI_DBUS "Build the DBUS binding" OFF)
option(JAMI_VIDEO "Build with video support" ON) option(JAMI_VIDEO "Build with video support" ON)
option(BUILD_CONTRIB "Build contrib to CONTRIB_PATH" ON) option(BUILD_CONTRIB "Build contrib to CONTRIB_PATH" ON)
option(BUILD_EXTRA_TOOLS "Build extra tools" OFF) option(BUILD_EXTRA_TOOLS "Build extra tools" OFF)
...@@ -110,8 +111,8 @@ if(NOT MSVC) ...@@ -110,8 +111,8 @@ if(NOT MSVC)
if (JAMI_NATPMP) if (JAMI_NATPMP)
pkg_search_module (natpmp IMPORTED_TARGET natpmp) pkg_search_module (natpmp IMPORTED_TARGET natpmp)
if (NOT natpmp_FOUND) if (NOT natpmp_FOUND)
find_library(natpmp natpmp) find_library(natpmp_LIBRARIES natpmp)
if (natpmp_NOTFOUND) if (NOT natpmp_LIBRARIES)
message("NAT-PMP not found: disabling") message("NAT-PMP not found: disabling")
set(JAMI_NATPMP Off) set(JAMI_NATPMP Off)
endif() endif()
...@@ -123,6 +124,10 @@ if(NOT MSVC) ...@@ -123,6 +124,10 @@ if(NOT MSVC)
set(JAMI_PUPNP Off) set(JAMI_PUPNP Off)
endif() endif()
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
pkg_search_module (udev REQUIRED IMPORTED_TARGET libudev)
pkg_search_module (pulseaudio REQUIRED IMPORTED_TARGET libpulse)
endif()
endif() endif()
################################################################################ ################################################################################
...@@ -204,8 +209,18 @@ if (ANDROID) ...@@ -204,8 +209,18 @@ if (ANDROID)
${CMAKE_CURRENT_SOURCE_DIR}/src/media/audio/opensl/audio_recorder.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/media/audio/opensl/audio_recorder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/media/audio/opensl/opensllayer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/media/audio/opensl/opensllayer.cpp
) )
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (JAMI_VIDEO)
list (APPEND ALL_FILES ${ALL_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/src/media/video/v4l2/video_device_impl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/media/video/v4l2/video_device_monitor_impl.cpp
)
endif() endif()
if(MSVC) list (APPEND ALL_FILES ${ALL_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/src/media/audio/pulseaudio/audiostream.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/media/audio/pulseaudio/pulselayer.cpp
)
elseif(MSVC)
list (APPEND ALL_FILES ${ALL_FILES} list (APPEND ALL_FILES ${ALL_FILES}
"${Source_Files__media__audio__portaudio}" "${Source_Files__media__audio__portaudio}"
"${Source_Files__media__video__uwpvideo}" "${Source_Files__media__video__uwpvideo}"
...@@ -453,7 +468,7 @@ else() ...@@ -453,7 +468,7 @@ else()
find_package (jsoncpp REQUIRED) find_package (jsoncpp REQUIRED)
find_package (yaml-cpp REQUIRED) find_package (yaml-cpp REQUIRED)
find_package (fmt REQUIRED) pkg_search_module (fmt REQUIRED IMPORTED_TARGET fmt)
pkg_search_module (webrtcap REQUIRED IMPORTED_TARGET webrtc-audio-processing) pkg_search_module (webrtcap REQUIRED IMPORTED_TARGET webrtc-audio-processing)
pkg_search_module (gnutls REQUIRED IMPORTED_TARGET gnutls) pkg_search_module (gnutls REQUIRED IMPORTED_TARGET gnutls)
pkg_search_module (opendht REQUIRED IMPORTED_TARGET opendht) pkg_search_module (opendht REQUIRED IMPORTED_TARGET opendht)
...@@ -484,8 +499,8 @@ else() ...@@ -484,8 +499,8 @@ else()
PkgConfig::swscale PkgConfig::swscale
jsoncpp jsoncpp
yaml-cpp yaml-cpp
fmt PkgConfig::fmt
secp256k1 PkgConfig::secp256k1
PUBLIC PUBLIC
PkgConfig::avutil PkgConfig::avutil
) )
...@@ -503,9 +518,18 @@ else() ...@@ -503,9 +518,18 @@ else()
) )
if (ANDROID) if (ANDROID)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSLES log) target_link_libraries(${PROJECT_NAME} PRIVATE OpenSLES log)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(${PROJECT_NAME} PRIVATE
PkgConfig::udev
PkgConfig::pulseaudio
)
endif() endif()
if (JAMI_NATPMP) if (JAMI_NATPMP)
target_link_libraries(${PROJECT_NAME} PRIVATE natpmp) if (natpmp_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::natpmp)
elseif (natpmp_LIBRARIES)
target_link_libraries(${PROJECT_NAME} PRIVATE natpmp_LIBRARIES)
endif()
endif() endif()
if (JAMI_PUPNP) if (JAMI_PUPNP)
target_link_libraries(${PROJECT_NAME} PRIVATE upnp) target_link_libraries(${PROJECT_NAME} PRIVATE upnp)
...@@ -517,10 +541,71 @@ else() ...@@ -517,10 +541,71 @@ else()
target_link_directories(${PROJECT_NAME}-jni PRIVATE ${CONTRIB_PATH}/lib) target_link_directories(${PROJECT_NAME}-jni PRIVATE ${CONTRIB_PATH}/lib)
target_link_libraries(${PROJECT_NAME}-jni ${PROJECT_NAME} android log) target_link_libraries(${PROJECT_NAME}-jni ${PROJECT_NAME} android log)
set_target_properties(${PROJECT_NAME}-jni PROPERTIES CXX_STANDARD 17) set_target_properties(${PROJECT_NAME}-jni PROPERTIES CXX_STANDARD 17)
target_compile_options(${PROJECT_NAME}-jni PRIVATE
-fvisibility=hidden
-Wall -Wextra
-Wnon-virtual-dtor
-Wno-deprecated
-Wno-deprecated-declarations
-Wno-unknown-pragmas
-Wno-unused-function
-Wno-unused-parameter
)
target_link_options(${PROJECT_NAME}-jni PRIVATE target_link_options(${PROJECT_NAME}-jni PRIVATE
-Wl,-Bsymbolic -Wl,-Bsymbolic
-Wall -Wextra -Wall -Wextra
) )
endif() endif()
if (JAMI_DBUS)
find_program(DBusXml2Cpp dbusxx-xml2cpp REQUIRED)
pkg_search_module (DBusCpp REQUIRED IMPORTED_TARGET dbus-c++-1)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/net.jami.daemon.service.in
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.service
@ONLY)
set(DBUS_XML_FILES
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.CallManager.xml
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.ConfigurationManager.xml
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.Instance.xml
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.PresenceManager.xml
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.VideoManager.xml
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/cx.ring.Ring.PluginManagerInterface.xml
)
set(DBUS_ADAPTOR_FILES
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbuscallmanager.adaptor.h
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbusconfigurationmanager.adaptor.h
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbusinstance.adaptor.h
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbuspresencemanager.adaptor.h
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbusvideomanager.adaptor.h
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbuspluginmanagerinterface.adaptor.h
)
set(DBUS_FILES
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbuscallmanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbusclient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbusconfigurationmanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbusinstance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/dbuspresencemanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bin/dbus/main.cpp
)
# XML adaptors
foreach(DBUS_XML_FILE ${DBUS_XML_FILES})
list(FIND DBUS_XML_FILES ${DBUS_XML_FILE} DBUS_XML_FILE_INDEX)
list(GET DBUS_ADAPTOR_FILES ${DBUS_XML_FILE_INDEX} DBUS_ADAPTOR_FILE)
add_custom_command(
OUTPUT ${DBUS_ADAPTOR_FILE}
COMMAND ${DBusXml2Cpp} ${DBUS_XML_FILE} --adaptor=${DBUS_ADAPTOR_FILE}
DEPENDS ${DBUS_XML_FILE}
)
endforeach()
# Jamid
add_executable(jamid
${DBUS_FILES}
${DBUS_ADAPTOR_FILES}
)
target_link_libraries(jamid ${PROJECT_NAME} PkgConfig::DBusCpp)
endif()
endif() endif()
...@@ -8,8 +8,7 @@ PKGS_FOUND += fmt ...@@ -8,8 +8,7 @@ PKGS_FOUND += fmt
endif endif
FMT_CMAKECONF = -DBUILD_SHARED_LIBS=Off \ FMT_CMAKECONF = -DBUILD_SHARED_LIBS=Off \
-DFMT_TEST=Off \ -DFMT_TEST=Off
CMAKE_INSTALL_LIBDIR=$(PREFIX)/lib
$(TARBALLS)/fmt-$(FMT_VERSION).tar.gz: $(TARBALLS)/fmt-$(FMT_VERSION).tar.gz:
$(call download,$(FMT_URL)) $(call download,$(FMT_URL))
......
...@@ -23,6 +23,6 @@ libgit2: libgit2-v$(LIBGIT2_VERSION).tar.gz .sum-libgit2 ...@@ -23,6 +23,6 @@ libgit2: libgit2-v$(LIBGIT2_VERSION).tar.gz .sum-libgit2
# TODO windows pcre? # TODO windows pcre?
.libgit2: libgit2 .libgit2: libgit2
cd $< && mkdir -p build && cd build \ cd $< && mkdir -p build && cd build \
&& $(CMAKE) -DCMAKE_C_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DUSE_HTTPS=OFF -DCURL=OFF -DUSE_HTTP_PARSER=system -DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_SSH=OFF -DREGEX_BACKEND=regcomp .. \ && $(CMAKE) -DCMAKE_C_FLAGS=-fPIC -DUSE_HTTPS=OFF -DCURL=OFF -DUSE_HTTP_PARSER=system -DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_SSH=OFF -DREGEX_BACKEND=regcomp .. \
&& $(MAKE) install && $(MAKE) install
touch $@ touch $@
...@@ -403,7 +403,8 @@ CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(ANDROID_NDK)/build/cmake/android.toolch ...@@ -403,7 +403,8 @@ CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(ANDROID_NDK)/build/cmake/android.toolch
-DCMAKE_INSTALL_PREFIX=$(PREFIX) -DCMAKE_INSTALL_PREFIX=$(PREFIX)
else else
CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \ CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \
-DCMAKE_INSTALL_PREFIX=$(PREFIX) -DCMAKE_INSTALL_PREFIX=$(PREFIX) \
-DCMAKE_INSTALL_LIBDIR=$(PREFIX)/lib
endif endif
# #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment