Commit 5ff6590a authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

ms2.cmake: factorize option code in a single function ms2_add_option. OpenH264...

ms2.cmake: factorize option code in a single function ms2_add_option. OpenH264 and X264 can be built simultanously.
parent 165cdc3c
......@@ -22,9 +22,24 @@
# Mediastreamer2 build options
option(ENABLE_GPL_THIRD_PARTIES "Enable GPL third-parties (FFmpeg)." ${DEFAULT_VALUE_ENABLE_GPL_THIRD_PARTIES})
add_feature_info("GPL third parties" ENABLE_GPL_THIRD_PARTIES "Usage of GPL third-party code (FFmpeg and x264).")
option(ENABLE_NON_FREE_CODECS "Allow inclusion of non-free codecs in the build." OFF)
# This function can be used to add an option. Give it option name and description,
# default value and optionally dependent predicate and value
function (ms2_add_option NAME DESCRIPTION DEFAULT_VALUE)
string(TOUPPER ${NAME} UPPERCASE_NAME)
string(REGEX REPLACE " " "_" UPPERCASE_NAME ${UPPERCASE_NAME})
string(REGEX REPLACE "\\+" "P" UPPERCASE_NAME ${UPPERCASE_NAME})
if (ARGC EQUAL 5)
cmake_dependent_option(ENABLE_${UPPERCASE_NAME} "${DESCRIPTION}" "${DEFAULT_VALUE}" "${ARGV3}" "${ARGV4}")
elseif (ARGC EQUAL 3)
option(ENABLE_${UPPERCASE_NAME} "Enable ${NAME}: ${DESCRIPTION}" "${DEFAULT_VALUE}")
else()
message(FATAL_ERROR "Invalid arguments count: ${ARGC}. Expected 3 or 5")
endif()
add_feature_info(${NAME} ENABLE_${UPPERCASE_NAME} ${DESCRIPTION})
endfunction()
ms2_add_option("GPL third parties" "Usage of GPL third-party code (FFmpeg and x264)." ${DEFAULT_VALUE_ENABLE_GPL_THIRD_PARTIES})
ms2_add_option("Non free codecs" "Allow inclusion of non-free codecs in the build." OFF)
# by default, non free codecs must be disabled BUT they can be enabled one by one
# using command line -DENABLE_CODEC=YES for instance
......@@ -41,62 +56,41 @@ if (NOT ENABLE_NON_FREE_CODECS)
endif()
endif()
option(ENABLE_SRTP "Enable SRTP support." ${DEFAULT_VALUE_ENABLE_SRTP})
add_feature_info("SRTP" ENABLE_SRTP "SRTP media encryption support.")
cmake_dependent_option(ENABLE_ZRTP "Enable ZRTP support." ${DEFAULT_VALUE_ENABLE_ZRTP} "ENABLE_SRTP" OFF)
add_feature_info("ZRTP" ENABLE_ZRTP "ZRTP media encryption support.")
cmake_dependent_option(ENABLE_DTLS "Enable DTLS support." ${DEFAULT_VALUE_ENABLE_DTLS} "ENABLE_SRTP" OFF)
add_feature_info("DTLS" ENABLE_DTLS "DTLS media encryption support.")
#security options
ms2_add_option("SRTP" "SRTP media encryption support." ${DEFAULT_VALUE_ENABLE_SRTP})
ms2_add_option("ZRTP" "ZRTP media encryption support." ${DEFAULT_VALUE_ENABLE_ZRTP} "ENABLE_SRTP" OFF)
ms2_add_option("DTLS" "DTLS media encryption support." ${DEFAULT_VALUE_ENABLE_DTLS} "ENABLE_SRTP" OFF)
option(ENABLE_AMRNB "Enable AMR narrow-band audio codec support." ${DEFAULT_VALUE_ENABLE_AMRNB})
add_feature_info("AMR-NB" ENABLE_AMRNB "AMR narrow-band audio encoding/decoding support (require license).")
option(ENABLE_AMRWB "Enable AMR wide-band audio codec support." ${DEFAULT_VALUE_ENABLE_AMRWB})
add_feature_info("AMR-WB" ENABLE_AMRWB "AMR wide-band audio encoding/decoding support (require license).")
#audio codecs
ms2_add_option("AMR-NB" "AMR narrow-band audio encoding/decoding support (require license)." ${DEFAULT_VALUE_ENABLE_AMRNB})
ms2_add_option("AMR-WB" "AMR wide-band audio encoding/decoding support (require license)." ${DEFAULT_VALUE_ENABLE_AMRWB})
if(ENABLE_AMRNB OR ENABLE_AMRWB)
set(ENABLE_AMR ON CACHE BOOL "" FORCE)
endif()
option(ENABLE_G729 "Enable G.729 audio codec support." ${DEFAULT_VALUE_ENABLE_G729})
add_feature_info("G.729" ENABLE_G729 "G.729 audio encoding/decoding support (require license).")
option(ENABLE_GSM "Enable GSM audio codec support." ${DEFAULT_VALUE_ENABLE_GSM})
add_feature_info("GSM" ENABLE_GSM "GSM audio encoding/decoding support.")
option(ENABLE_ILBC "Enable iLBC audio codec support." ${DEFAULT_VALUE_ENABLE_ILBC})
add_feature_info("iLBC" ENABLE_ILBC "iLBC audio encoding/decoding support.")
option(ENABLE_ISAC "Enable ISAC audio codec support." ${DEFAULT_VALUE_ENABLE_ISAC})
add_feature_info("ISAC" ENABLE_ISAC "ISAC audio encoding/decoding support.")
option(ENABLE_OPUS "Enable OPUS audio codec support." ${DEFAULT_VALUE_ENABLE_OPUS})
add_feature_info("OPUS" ENABLE_OPUS "OPUS audio encoding/decoding support.")
option(ENABLE_SILK "Enable SILK audio codec support." ${DEFAULT_VALUE_ENABLE_SILK})
add_feature_info("Silk" ENABLE_SILK "Silk audio encoding/decoding support.")
option(ENABLE_SPEEX "Enable speex audio codec support." ${DEFAULT_VALUE_ENABLE_SPEEX})
add_feature_info("Speex" ENABLE_SPEEX "Speex audio encoding/decoding support.")
ms2_add_option("G.729" "G.729 audio encoding/decoding support (require license)." ${DEFAULT_VALUE_ENABLE_G729})
ms2_add_option("GSM" "GSM audio encoding/decoding support." ${DEFAULT_VALUE_ENABLE_GSM})
ms2_add_option("iLBC" "iLBC audio encoding/decoding support." ${DEFAULT_VALUE_ENABLE_ILBC})
ms2_add_option("ISAC" "ISAC audio encoding/decoding support." ${DEFAULT_VALUE_ENABLE_ISAC})
ms2_add_option("OPUS" "OPUS audio encoding/decoding support." ${DEFAULT_VALUE_ENABLE_OPUS})
ms2_add_option("Silk" "Silk audio encoding/decoding support." ${DEFAULT_VALUE_ENABLE_SILK})
ms2_add_option("Speex" "Speex audio encoding/decoding support." ${DEFAULT_VALUE_ENABLE_SPEEX})
cmake_dependent_option(ENABLE_WASAPI "Enable Windows Audio Session API (WASAPI) sound card support." ${DEFAULT_VALUE_ENABLE_WASAPI} "MSVC" OFF)
add_feature_info("WASAPI" ENABLE_WASAPI "Windows Audio Session API (WASAPI) sound card support.")
option(ENABLE_WEBRTC_AEC "Enable WebRTC echo canceller support." ${DEFAULT_VALUE_ENABLE_WEBRTC_AEC})
add_feature_info("WebRTC AEC" ENABLE_WEBRTC_AEC "WebRTC echo canceller support.")
ms2_add_option("WASAPI" "Windows Audio Session API (WASAPI) sound card support." ${DEFAULT_VALUE_ENABLE_WASAPI} "MSVC" OFF)
ms2_add_option("WebRTC AEC" "WebRTC echo canceller support." ${DEFAULT_VALUE_ENABLE_WEBRTC_AEC})
option(ENABLE_VIDEO "Enable video support." ${DEFAULT_VALUE_ENABLE_VIDEO})
add_feature_info("Video" ENABLE_VIDEO "Ability to capture and display video.")
#video option and codecs
ms2_add_option("Video" "Ability to capture and display video." ${DEFAULT_VALUE_ENABLE_VIDEO})
# FFMpeg is LGPL which is an issue only for iOS applications; otherwise it can be used in proprietary software as well
set(FFMPEG_DEPENDENT_PRED "ENABLE_VIDEO")
if (IOS)
cmake_dependent_option(ENABLE_FFMPEG "Enable ffmpeg support." ${DEFAULT_VALUE_ENABLE_FFMPEG} "ENABLE_VIDEO; ENABLE_GPL_THIRD_PARTIES" OFF)
else()
cmake_dependent_option(ENABLE_FFMPEG "Enable ffmpeg support." ${DEFAULT_VALUE_ENABLE_FFMPEG} "ENABLE_VIDEO" OFF)
set(FFMPEG_DEPENDENT_PRED "${FFMPEG_DEPENDENT_PRED}; ENABLE_GPL_THIRD_PARTIES")
endif()
add_feature_info("FFmpeg" ENABLE_FFMPEG "Some video processing features via FFmpeg: MPEG4 encoding/decoding, video scaling...")
cmake_dependent_option(ENABLE_H263 "Enable H263 video codec support." ${DEFAULT_VALUE_ENABLE_H263} "ENABLE_FFMPEG" OFF)
add_feature_info("H263" ENABLE_H263 "H263 video encoding/decoding support (require license).")
cmake_dependent_option(ENABLE_H263P "Enable H263+ video codec support." ${DEFAULT_VALUE_ENABLE_H263P} "ENABLE_FFMPEG" OFF)
add_feature_info("H263+" ENABLE_H263P "H263+ video encoding/decoding support (require license).")
cmake_dependent_option(ENABLE_MPEG4 "Enable MPEG4 video codec support." ${DEFAULT_VALUE_ENABLE_MPEG4} "ENABLE_FFMPEG" OFF)
add_feature_info("MPEG4" ENABLE_MPEG4 "MPEG4 video encoding/decoding support (require license).")
cmake_dependent_option(ENABLE_VPX "Enable VPX (VP8) video codec support." ${DEFAULT_VALUE_ENABLE_VPX} "ENABLE_VIDEO" OFF)
add_feature_info("VPX" ENABLE_VPX "VPX (VP8) video encoding/decoding support.")
cmake_dependent_option(ENABLE_OPENH264 "Enable H.264 video encoder support with the openh264 library." ${DEFAULT_VALUE_ENABLE_OPENH264} "ENABLE_VIDEO; NOT ENABLE_X264" OFF)
add_feature_info("openh264" ENABLE_OPENH264 "H.264 video encoding support with the openh264 library (require license).")
cmake_dependent_option(ENABLE_X264 "Enable H.264 video encoder support with the x264 library." ${DEFAULT_VALUE_ENABLE_X264} "ENABLE_VIDEO; NOT ENABLE_OPENH264" OFF)
add_feature_info("x264" ENABLE_X264 "H.264 video encoding support with the x264 library (require license).")
cmake_dependent_option(ENABLE_V4L "Enable V4L camera driver." ON "ENABLE_VIDEO; UNIX; NOT APPLE" OFF)
add_feature_info("v4l" ENABLE_V4L "V4L camera driver.")
option(ENABLE_MKV "Enable MKV playing and recording support" ${DEFAULT_VALUE_ENABLE_MKV})
add_feature_info("MKV" ENABLE_MKV "MKV playing and recording support.")
ms2_add_option("FFmpeg" "Some video processing features via FFmpeg: JPEG encoding/decoding, video scaling, H264 decoding..." ${DEFAULT_VALUE_ENABLE_FFMPEG} "${FFMPEG_DEPENDENT_PRED}" OFF)
ms2_add_option("H263" "H263 video encoding/decoding support (require license)." ${DEFAULT_VALUE_ENABLE_H263} "ENABLE_FFMPEG" OFF)
ms2_add_option("H263+" "H263+ video encoding/decoding support (require license)." ${DEFAULT_VALUE_ENABLE_H263P} "ENABLE_FFMPEG" OFF)
ms2_add_option("VPX" "VPX (VP8) video encoding/decoding support." ${DEFAULT_VALUE_ENABLE_VPX} "ENABLE_VIDEO" OFF)
ms2_add_option("MPEG4" "MPEG4 video encoding/decoding support (require license)." ${DEFAULT_VALUE_ENABLE_MPEG4} "ENABLE_FFMPEG" OFF)
ms2_add_option("OpenH264" "H.264 video encoding/decoding support with the openh264 library (require license)." ${DEFAULT_VALUE_ENABLE_OPENH264} "ENABLE_VIDEO" OFF)
ms2_add_option("X264" "H.264 video encoding support with the x264 library (require license)." ${DEFAULT_VALUE_ENABLE_X264} "ENABLE_VIDEO" OFF)
ms2_add_option("V4L" "V4L camera driver." ON "ENABLE_VIDEO; UNIX; NOT APPLE" OFF)
ms2_add_option("MKV" "MKV playing and recording support." ${DEFAULT_VALUE_ENABLE_MKV})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment