Commit f92eab14 authored by Ghislain MARY's avatar Ghislain MARY

Enable strict compilation + fix build errors caused by warnings.

parent c32dfd53
......@@ -24,6 +24,25 @@ cmake_minimum_required(VERSION 3.0)
project(MSWINRTVID CXX)
option(ENABLE_STRICT "Build with strict compile options." YES)
macro(apply_compile_flags SOURCE_FILES)
if(${SOURCE_FILES})
set(options "")
foreach(a ${ARGV})
if(STRICT_OPTIONS_${a})
string(REPLACE ";" " " options_${a} "${STRICT_OPTIONS_${a}}")
set(options "${options} ${options_${a}}")
endif()
endforeach()
if(options)
set_source_files_properties(${${SOURCE_FILES}} PROPERTIES COMPILE_FLAGS "${options}")
endif()
endif()
endmacro()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake")
else()
......@@ -35,6 +54,11 @@ include_directories(
${MEDIASTREAMER2_INCLUDE_DIRS}
)
set(STRICT_OPTIONS_CPP )
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "/WX")
endif()
set(SOURCE_FILES
"IVideoDispatcher.h"
"IVideoRenderer.h"
......@@ -60,6 +84,7 @@ set(SOURCE_FILES
"SharedData.h"
"VideoBuffer.h"
)
apply_compile_flags(SOURCE_FILES "CPP")
set(LIBS ${MEDIASTREAMER2_LIBRARIES} mfplat.lib;mfuuid.lib)
add_library(mswinrtvid MODULE ${SOURCE_FILES})
......
......@@ -442,8 +442,8 @@ void MSWinRTCap::registerCameras(MSWebCamManager *manager)
if (bctbx_list_size(smCameras) == 0) {
ms_warning("[MSWinRTCap] No camera detected!");
}
for (int i = 0; i < bctbx_list_size(smCameras); i++) {
ms_web_cam_manager_prepend_cam(manager, (MSWebCam *)bctbx_list_nth_data(smCameras, i));
for (size_t i = 0; i < bctbx_list_size(smCameras); i++) {
ms_web_cam_manager_prepend_cam(manager, (MSWebCam *)bctbx_list_nth_data(smCameras, (int)i));
}
bctbx_list_free(smCameras);
smCameras = NULL;
......
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