Skip to content

Commit

Permalink
Update Mac deps and reduce CI time with new log4cxx (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Sep 21, 2021
1 parent d5b7b65 commit f79bbf2
Show file tree
Hide file tree
Showing 43 changed files with 2,815 additions and 1,859 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

MAINTAINER Lynckia
LABEL maintainer="Lynckia"

WORKDIR /opt

Expand Down Expand Up @@ -28,11 +28,11 @@ RUN mkdir /opt/licode/.git
# Clone and install licode
WORKDIR /opt/licode/scripts

RUN ./installErizo.sh -dfeacs && \
RUN ./installErizo.sh -dfEAcs && \
./../nuve/installNuve.sh && \
./installBasicExample.sh

RUN ldconfig /opt/licode/build/libdeps/build/lib
RUN ldconfig /opt/licode/build/libdeps/build/lib

WORKDIR /opt/licode

Expand Down
4 changes: 3 additions & 1 deletion erizo/conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[requires]
boost/1.69.0
boost/1.76.0
apr/1.7.0
apr-util/1.6.1
IncludePathsGenerator/0.1@lynckia/includes

[generators]
Expand Down
38 changes: 37 additions & 1 deletion erizo/generateProject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ FILENAME=`basename $SCRIPT`
PATHNAME=`dirname $SCRIPT`
BASE_BIN_DIR="build"

usage()
{
cat << EOF
usage: $0 options
Generate Erizo projects. It will generate all builds if no option is passed.
OPTIONS:
-h Show this message
-d Generate debug
-r Generate release
EOF
}


generateVersion() {
echo "generating $1"
Expand All @@ -20,6 +32,30 @@ generateVersion() {
cd $PATHNAME
}

if [ "$#" -eq 0 ]
then
generateVersion debug
generateVersion release
else
while getopts “hdr” OPTION
do
case $OPTION in
h)
usage
exit 1
;;
d)
generateVersion debug
;;
r)
generateVersion release
;;
?)
usage
exit
;;
esac
done
fi

generateVersion release
generateVersion debug
24 changes: 21 additions & 3 deletions erizo/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ set(THIRD_PARTY_LIB "${CMAKE_CURRENT_SOURCE_DIR}/../../build/libdeps/build/lib/"

## Depencencies

include(${CMAKE_CURRENT_SOURCE_DIR}/../conan_paths.cmake)

# Add /usr/local/include
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories("/usr/local/include")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

# BOOST
include(${CMAKE_CURRENT_SOURCE_DIR}/../conan_paths.cmake)
set (BOOST_LIBS thread regex system)
find_package(Boost)
include_directories(${Boost_INCLUDE_DIRS})
Expand Down Expand Up @@ -96,8 +97,25 @@ test_lib(${AVFORMAT})
set (LIBS ${LIBS} ${AVFORMAT})

# LOG4CXX
find_library(LOG log4cxx)
test_lib(${LOG})
# find_package(log4cxx)
# include_directories(${log4cxx_INCLUDE_DIRS})
find_package(apr)
find_package(apr-util)
find_package(Iconv)

set(LOG4CXX_BUILD "${CMAKE_CURRENT_BINARY_DIR}/libdeps/log4cxx")
set(LOG4CXX_VERSION "0.11.0")
ExternalProject_Add(log4cxxInstall
URL "https://archive.apache.org/dist/logging/log4cxx/${LOG4CXX_VERSION}/apache-log4cxx-${LOG4CXX_VERSION}.tar.gz"
PREFIX ${LOG4CXX_BUILD}
CONFIGURE_COMMAND cd ${LOG4CXX_BUILD}/src/log4cxxInstall && ./autogen.sh && ./configure --with-apr=${apr_LIB_DIRS}/.. --with-apr-util=${apr-util_LIB_DIRS}/.. --prefix=${LOG4CXX_BUILD} --disable-doxygen --enable-silent-rules "CPPFLAGS=-fPIC -I${apr_INCLUDES} -I${apr-util_INCLUDES}" "LDFLAGS=-L${apr_LIB_DIRS} -L${apr-util_LIB_DIRS} -L${Iconv_LIB_DIRS}"
BUILD_COMMAND cd ${LOG4CXX_BUILD}/src/log4cxxInstall && make
INSTALL_COMMAND cd ${LOG4CXX_BUILD}/src/log4cxxInstall && make install
)
add_library(log4cxx STATIC IMPORTED)
set_target_properties(log4cxx PROPERTIES IMPORTED_LOCATION ${LOG4CXX_BUILD}/lib/liblog4cxx.a)

include_directories("${LOG4CXX_BUILD}/include")

# WEBRTC
include("${CMAKE_CURRENT_SOURCE_DIR}/third_party/webrtc.cmake")
Expand Down
11 changes: 6 additions & 5 deletions erizo/src/erizo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ set(ERIZO_VERSION_MAJOR 0)
set(ERIZO_VERSION_MINOR 1)
if(${ERIZO_BUILD_TYPE} STREQUAL "debug")
message("Generating DEBUG project")
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++14 ${ERIZO_CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++17 ${ERIZO_CMAKE_CXX_FLAGS}")
elseif(${ERIZO_BUILD_TYPE} STREQUAL "sanitizer")
message("Generating SANITIZER project")
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++14 ${ERIZO_CMAKE_CXX_FLAGS} -O1 -fno-omit-frame-pointer -fsanitize=address -fno-optimize-sibling-calls")
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++17 ${ERIZO_CMAKE_CXX_FLAGS} -O1 -fno-omit-frame-pointer -fsanitize=address -fno-optimize-sibling-calls")
else()
message("Generating RELEASE project")
set(CMAKE_CXX_FLAGS "-g -Wall -O3 -std=c++14 ${ERIZO_CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-g -Wall -O3 -std=c++17 ${ERIZO_CMAKE_CXX_FLAGS}")
endif()


include_directories("${ERIZO_SOURCE_DIR}" "${THIRD_PARTY_INCLUDE}" "${NICER_INCLUDE}")
include_directories("${ERIZO_SOURCE_DIR}" "${THIRD_PARTY_INCLUDE}" "${NICER_INCLUDE}" "${LOG4CXX_BUILD}/include")

file(GLOB_RECURSE ERIZO_SOURCES "${ERIZO_SOURCE_DIR}/*.h" "${ERIZO_SOURCE_DIR}/*.c" "${ERIZO_SOURCE_DIR}/*.cpp" "${ERIZO_SOURCE_DIR}/*.cc")

add_library(erizo SHARED ${ERIZO_SOURCES})


target_link_libraries(erizo ${Boost_LIBRARIES} ${SRTP} ${SSL} ${CRYPTO} ${LIBS} ${LOG} webrtc nicer nrappkit)
target_link_libraries(erizo ${Boost_LIBRARIES} ${apr_LIBRARIES} ${apr-util_LIBRARIES} ${SRTP} ${SSL} ${CRYPTO} ${LIBS} webrtc nicer nrappkit log4cxx)
add_dependencies(erizo log4cxxInstall)
2 changes: 1 addition & 1 deletion erizo/src/erizo/thread/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <assert.h>

#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <utility>


Expand Down
2 changes: 1 addition & 1 deletion erizo/src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ else()
set(SANITIZER_OPTION "")
endif()

set(CMAKE_CXX_FLAGS "-g -Wall -std=c++14 ${ERIZO_CMAKE_CXX_FLAGS} ${SANITIZER_OPTION}")
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++17 ${ERIZO_CMAKE_CXX_FLAGS} ${SANITIZER_OPTION}")

file(GLOB_RECURSE ERIZO_TEST_SDPS ${ERIZO_TEST_SOURCE_DIR}/*.sdp)
file(COPY ${ERIZO_TEST_SDPS} DESTINATION ${ERIZO_TEST_BINARY_DIR})
Expand Down
2 changes: 1 addition & 1 deletion erizo/src/third_party/webrtc/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ add_library(webrtc STATIC ${WEBRTC_SOURCES} )

target_include_directories(webrtc PUBLIC ${WEBRTC_SOURCE_DIR})

target_link_libraries(webrtc ${LOG})
target_link_libraries(webrtc ${log4cxx_LIBRARIES})
59 changes: 33 additions & 26 deletions erizoAPI/binding.gyp
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
{
'variables' : {
'no_debug': '0',
'common_sources': [ 'addon.cc', 'PromiseDurationDistribution.cc', 'IOThreadPool.cc', 'AsyncPromiseWorker.cc', 'ThreadPool.cc', 'MediaStream.cc', 'WebRtcConnection.cc', 'OneToManyProcessor.cc', 'ExternalInput.cc', 'ExternalOutput.cc', 'SyntheticInput.cc', 'ConnectionDescription.cc'],
'common_include_dirs' : ["<!(node -e \"require('nan')\")", '$(ERIZO_HOME)/src/erizo', '$(ERIZO_HOME)/../build/libdeps/build/include', '$(ERIZO_HOME)/src/third_party/webrtc/src','$(ERIZO_HOME)/src/erizo/handlers']
},
'targets': [
{
'target_name': 'addon',
'sources': ['<@(common_sources)'],
'include_dirs' : ['<@(common_include_dirs)'],
'include_dirs' : ['<@(common_include_dirs)', '$(ERIZO_HOME)/build/release/libdeps/log4cxx/include'],
'libraries': ['-L$(ERIZO_HOME)/build/release/erizo -lerizo -Wl,-rpath,<(module_root_dir)/../erizo/build/release/erizo'],
'conditions': [
[ 'OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'YES', # -fno-rtti
'MACOSX_DEPLOYMENT_TARGET' : '10.15', #from MAC OS 10.7
'OTHER_CFLAGS': ['-Werror -Qunused-arguments -g -O3 -stdlib=libc++ -std=c++14 -DBOOST_THREAD_PROVIDES_FUTURE -DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION -DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY @$(ERIZO_HOME)/conanbuildinfo.args',]
'OTHER_CFLAGS': ['-Werror -Qunused-arguments -g -O3 -stdlib=libc++ -std=c++17 -DBOOST_THREAD_PROVIDES_FUTURE -DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION -DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY @$(ERIZO_HOME)/conanbuildinfo.args',]
},
}, { # OS!="mac"
'cflags!' : ['-fno-exceptions'],
'cflags' : ['-D__STDC_CONSTANT_MACROS'],
'cflags_cc' : ['-Werror', '-Wall', '-O3', '-g' , '-std=c++14', '-fexceptions', '-DBOOST_THREAD_PROVIDES_FUTURE', '-DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION', '-DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY', '@$(ERIZO_HOME)/conanbuildinfo.args'],
'cflags_cc' : ['-Werror', '-Wall', '-O3', '-g' , '-std=c++17', '-fexceptions', '-DBOOST_THREAD_PROVIDES_FUTURE', '-DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION', '-DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY', '@$(ERIZO_HOME)/conanbuildinfo.args'],
'cflags_cc!' : ['-fno-exceptions'],
'cflags_cc!' : ['-fno-rtti']
}],
]
},
{
'target_name': 'addonDebug',
'sources': ['<@(common_sources)'],
'include_dirs' : ['<@(common_include_dirs)'],
'libraries': ['-L$(ERIZO_HOME)/build/debug/erizo -lerizo -Wl,-rpath,<(module_root_dir)/../erizo/build/debug/erizo'],
'conditions': [
[ 'OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'YES', # -fno-rtti
'MACOSX_DEPLOYMENT_TARGET' : '10.15', #from MAC OS 10.7
'OTHER_CFLAGS': ['-Werror -Qunused-arguments -g -stdlib=libc++ -std=c++14 -DBOOST_THREAD_PROVIDES_FUTURE -DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION -DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY @$(ERIZO_HOME)/conanbuildinfo.args']
},
}, { # OS!="mac"
'cflags!' : ['-fno-exceptions'],
'cflags' : ['-D__STDC_CONSTANT_MACROS'],
'cflags_cc' : ['-Werror', '-Wall', '-g' , '-std=c++14', '-fexceptions', '-DBOOST_THREAD_PROVIDES_FUTURE', '-DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION', '-DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY', '@$(ERIZO_HOME)/conanbuildinfo.args'],
'cflags_cc!' : ['-fno-exceptions'],
'cflags_cc!' : ['-fno-rtti']
}],
]
}
]
],
'conditions': [
['no_debug!=1', {
'targets': [
{
'target_name': 'addonDebug',
'sources': ['<@(common_sources)'],
'include_dirs' : ['<@(common_include_dirs)', '$(ERIZO_HOME)/build/debug/libdeps/log4cxx/include'],
'libraries': ['-L$(ERIZO_HOME)/build/debug/erizo -lerizo -Wl,-rpath,<(module_root_dir)/../erizo/build/debug/erizo'],
'conditions': [
[ 'OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'YES', # -fno-rtti
'MACOSX_DEPLOYMENT_TARGET' : '10.15', #from MAC OS 10.7
'OTHER_CFLAGS': ['-Werror -Qunused-arguments -g -stdlib=libc++ -std=c++17 -DBOOST_THREAD_PROVIDES_FUTURE -DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION -DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY @$(ERIZO_HOME)/conanbuildinfo.args']
},
}, { # OS!="mac"
'cflags!' : ['-fno-exceptions'],
'cflags' : ['-D__STDC_CONSTANT_MACROS'],
'cflags_cc' : ['-Werror', '-Wall', '-g' , '-std=c++14', '-fexceptions', '-DBOOST_THREAD_PROVIDES_FUTURE', '-DBOOST_THREAD_PROVIDES_FUTURE_CONTINUATION', '-DBOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY', '@$(ERIZO_HOME)/conanbuildinfo.args'],
'cflags_cc!' : ['-fno-exceptions'],
'cflags_cc!' : ['-fno-rtti']
}],
]
}
],
}],
],
}
6 changes: 3 additions & 3 deletions erizoAPI/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions erizo_controller/common/logger.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

// eslint-disable-next-line import/no-extraneous-dependencies
const log4js = require('log4js');

global.config = global.config || {};

global.config.logger = global.config.logger || {};

const logFile = global.config.logger.configFile || '../log4js_configuration.json';
let logFile = global.config.logger.configFile || '../log4js_configuration.json';


const logJsonReplacer = (key, value) => {
Expand All @@ -22,6 +21,25 @@ const logJsonReplacer = (key, value) => {
return value;
};

if (logFile === true) {
logFile = {
appenders: {
out: {
type: 'stdout',
layout: {
type: 'pattern',
pattern: '%d - %p: %c - %m',
},
},
},
categories: {
default: {
appenders: ['out'],
level: 'OFF',
},
},
};
}
log4js.configure(logFile);

exports.logger = log4js;
Expand Down
2 changes: 1 addition & 1 deletion erizo_controller/erizoAgent/erizoAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const spawn = require('child_process').spawn;
const config = require('./../../licode_config');
const ErizoList = require('./erizoList').ErizoList;
const fs = require('fs');
const RovReplManager = require('./../common/ROV/rovReplManager').RovReplManager;

// Configuration default values
global.config = config || {};
Expand Down Expand Up @@ -101,6 +100,7 @@ Object.keys(opt.options).forEach((prop) => {
// Load submodules with updated config
const logger = require('./../common/logger').logger;
const amqper = require('./../common/amqper');
const RovReplManager = require('./../common/ROV/rovReplManager').RovReplManager;

// Logger
const log = logger.getLogger('ErizoAgent');
Expand Down
1 change: 1 addition & 0 deletions erizo_controller/erizoClient/gulp/erizoTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const erizoTasks = (gulp, plugins, config) => {
gulp.src(`${erizoConfig.debug}/**/*.js`, { base: './' })
.pipe(plugins.sourcemaps.init())
.pipe(plugins.closureCompiler({
warning_level: 'QUIET',
languageIn: 'ECMASCRIPT6',
languageOut: 'ECMASCRIPT5',
jsOutputFile: 'erizo.js',
Expand Down
2 changes: 0 additions & 2 deletions erizo_controller/erizoClient/src/utils/Base64.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global unescape */

const Base64 = (() => {
let base64Str;
let base64Count;
Expand Down
2 changes: 0 additions & 2 deletions erizo_controller/erizoClient/src/utils/ErizoMap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global unescape */

const ErizoMap = () => {
const that = {};
let values = {};
Expand Down
6 changes: 2 additions & 4 deletions erizo_controller/erizoClient/src/utils/Logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global console */

/*
* API to write logs based on traditional logging mechanisms: debug, trace, info, warning, error
*/
Expand Down Expand Up @@ -37,8 +35,8 @@ const Logger = (() => {
logPrefix = newLogPrefix;
};

// Generic function to print logs for a given level:
// Logger.[DEBUG, TRACE, INFO, WARNING, ERROR]
// Generic function to print logs for a given level:
// Logger.[DEBUG, TRACE, INFO, WARNING, ERROR]
const log = (level, ...args) => {
let out = logPrefix;
if (level === Logger.DEBUG) {
Expand Down
2 changes: 1 addition & 1 deletion erizo_controller/erizoClient/src/views/Bar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global document, clearTimeout, setTimeout */
/* global document */

import View from './View';
import Speaker from './Speaker';
Expand Down
1 change: 1 addition & 0 deletions erizo_controller/erizoClient/webpack.config.erizo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');

module.exports = {
entry: './src/Erizo.js',
mode: 'production',
output: {
filename: 'erizo.js',
path: path.resolve(__dirname, 'dist'),
Expand Down
1 change: 1 addition & 0 deletions erizo_controller/erizoClient/webpack.config.erizofc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');

module.exports = {
mode: 'production',
entry: './src/ErizoFc.js',
output: {
filename: 'erizofc.js',
Expand Down
Loading

0 comments on commit f79bbf2

Please sign in to comment.