windowsmeson,ninja安装以及vs2017编译libnice
在windows下编译,需要安装 meson 和 ninja。 安装好之后要配置环境变量在PATH中, 确保敲命令 meson 或 ninja 时能找到此应⽤程序即可。meson是⼀个类似cmake的⼯具,其⽤python3实现,Python版本必须3.6以上。
1,安装meson
pip install meson
命令⾏输⼊:
meson --version
0.60.0
2,安装ninja
先下载ninja:
加压后,把所在⽬录加⼊环境变量
命令⾏输⼊:
>ninja --version
1.8.2
3,下载Libnice 源码
4,编译
C:\windows> cd D:\\ibnice-master 进⼊到源代码根⽬录
D:\libnice-master> meson build 在根⽬录执⾏此命令会在更⽬录创建build编译⽬录,cmake是要进⼊build⽬录,在build⽬录执⾏ cmake ../ 然后会⽣成M D:\libnice-master> ninja -C build ⽤ninja进⾏编译, build是⽬录名称
执⾏ meson build 会出错, 原因是或者gnuTLS库找不到,不要紧, 关键是要修改 根⽬录下⾯的meson.build⽂件,修改openssl的路
手机cpu型号
径,根据⾃⼰的实际⽬录修改,位置:
libcrypto_dep = cc.find_library('crypto', required: fal, dirs: 'I:\webrtc\openssl-1.1.1k')
openssl的编译这⾥就不介绍了, ⼤家⾃⾏百度。附上修改好的meson.build
project('libnice', 'c',
version: '0.1.18',
meson_version : '>= 0.52',
default_options : ['warning_level=1', 'buildtype=debugoptimized'])
nice_version = meson.project_version()
version_arr = nice_version.split('.')
version_major = version_arr[0]
version_minor = version_arr[1]
version_micro = version_arr[2]
if version_arr.length() == 4
version_nano = version_arr[3]
el
version_nano = 0
endif
# maintain compatibility with the previous libtool versioning
# libversion has 3 parts A.B.C
# A is the ABI version, change it if the ABI is broken, changing it rets B and C to 0. It matches soversion
# B is the ABI age, change it on new APIs that don't break existing ones, changing it rets C to 0
# C is the revision, change on new updates that don't change APIs
soversion = 10
libversion = '10.11.0'
glib_req = '>= 2.54'
gnutls_req = '>= 2.12.0'
gupnp_igd_req = '>= 0.2.4'
gst_req = '>= 1.0.0'
nice_datadir = join_paths(get_option('prefix'), get_option('datadir'))忘了就好
cc = _compiler('c')
syslibs = []
_id() == 'msvc'
add_project_arguments(
<_supported_arguments(['/utf-8']), # t the input encoding to utf-8
language : 'c')
endif
if host_machine.system() == 'windows'
syslibs += [cc.find_library('iphlpapi')]
syslibs += [cc.find_library('ws2_32')]
elif host_machine.system() == 'sunos'
add_project_arguments('-D_XOPEN_SOURCE=600', language: 'c')
add_project_arguments('-D__EXTENSIONS__=1', language: 'c')
# inet_pton() is only ud by the tests
syslibs += [cc.find_library('nsl')]
if not cc.has_function('inet_pton')
if not cc.has_function('inet_pton')
libnsl = cc.find_library('nsl', required: fal)
if libnsl.found() and cc.has_function('inet_pton', dependencies: libnsl)
syslibs += [libnsl]
endif
endif
if not cc.has_function('socket')
libsocket = cc.find_library('socket', required: fal)
libinet = cc.find_library('inet', required: fal)
if cc.has_function('socket', dependencies: libsocket)
syslibs += [libsocket]
elif cc.has_function('socket', dependencies: libinet)
syslibs += [libinet]
el我国三大林区
error('Could not find right library for socket() on Solaris')
endif
endif
endif
if not cc.has_function('clock_gettime')
librt = cc.find_library('rt', required: fal)
if cc.has_function('clock_gettime', dependencies: librt)
syslibs += [librt]
endif
endif
glib_req_minmax_str = glib_req.split().get(1).underscorify()
add_project_arguments('-D_GNU_SOURCE',
'-DHAVE_CONFIG_H',
'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_' + glib_req_minmax_str, '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_' + glib_req_minmax_str, language: 'c')
cdata = configuration_data()
cdata.t_quoted('PACKAGE_STRING', meson.project_name())
cdata.t_quoted('PACKAGE_NAME', meson.project_name())
cdata.t_quoted('PACKAGE', meson.project_name())
cdata.t_quoted('VERSION', meson.project_version())
cdata.t('NICEAPI_EXPORT', true,
description: 'Public library function implementation')
# headers
foreach h : ['arpa/inet.h', 'net/in.h', 'netdb.h', 'ifaddrs.h', 'unistd.h']
if cc.has_header(h)
define = 'HAVE_' + h.underscorify().to_upper()
cdata.t(define, 1)
endif
endforeach
# functions
foreach f : ['poll', 'getifaddrs']
if cc.has_function(f)
define = 'HAVE_' + f.underscorify().to_upper()
cdata.t(define, 1)
endif
endforeach
if cc.has_argument('-fno-strict-aliasing')
add_project_arguments('-fno-strict-aliasing', language: 'c')
endif
# Extra compiler warnings (FIXME: not sure this makes n to keep like this) warning_level = get_option('warning_level').to_int()
werror = get_option('werror')
werror = get_option('werror')
warnings = []
message('warning level: @0@'.format(warning_level))
message('werror enabled: @0@'.format(werror))
if warning_level >= 2
warnings += [
'-Wundef',
'-Wnested-externs',
'-Wwrite-strings',
'-Wpointer-arith',
'-Wmissing-declarations',
'-Wmissing-prototypes',
'-Wstrict-prototypes',
'-Wredundant-decls',
'-Wno-unud-parameter',
'-Wno-missing-field-initializers',
'-Wdeclaration-after-statement',
'-Wformat=2',
'-Wold-style-definition',
'-Wcast-align',
'-Wformat-nonliteral',
'-Wformat-curity',
]
endif
if warning_level >= 3
warnings += [
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wshadow',
'-Winline',
'-Wpacked',
'-Wmissing-format-attribute',
'-Winit-lf',
'-Wredundant-decls',
'-Wmissing-include-dirs',
'-Wunud-but-t-variable',
'-Warray-bounds',
]
warnings += [
'-Wswitch-default',
'-Waggregate-return',
]
endif
if werror
warnings += [
'-Wno-suggest-attribute=format',
'-Wno-cast-function-type',
]
endif
foreach w : warnings
if cc.has_argument(w)
add_project_arguments(w, language: 'c')
endif
endforeach
# Dependencies
一张白纸gio_dep = dependency('gio-2.0', version: glib_req,
fallback: ['glib', 'libgio_dep'])
gio_deps = [gio_dep]
if pe_name() == 'internal'
韩宇飞
# A workaround for libgio_dep not having its dependencies correctly declared. # Should be fixed in GLib 2.60.
# Should be fixed in GLib 2.60.
gio_deps += [
dependency('', fallback: ['glib', 'libglib_dep']),
dependency('', fallback: ['glib', 'libgmodule_dep']),
dependency('', fallback: ['glib', 'libgobject_dep'])
]
企业会计核算endif
gthread_dep = dependency('gthread-2.0',
fallback: ['glib', 'libgthread_dep'])
# Cryto library
opt_cryptolib = 'openssl'
message('Crypto library requested: ' + opt_cryptolib)
if opt_cryptolib == 'openssl'
crypto_dep = dependency('openssl', required: fal)
cdata.t('HAVE_OPENSSL', true)
endif
if opt_cryptolib == 'openssl'
# MSVC builds of OpenSSL does not generate pkg-config files,
# so we check for it manually here in this ca, if we can't find tho files
# Bad on the CMake check for OpenSSL in CURL',
# on which headers we should check for
openssl_headers = []
foreach h : ['crypto.h', 'engine.h', 'err.h', 'pem.h', 'rsa.h', 'ssl.h', 'x509.h', 'rand.h', 'tls1.h']
openssl_headers += 'openssl/' + h
endforeach
# OpenSSL 1.1.x and 1.0.x (or earlier) have different .lib names,
# so we need to look for the correct pair
# Find either libcrypto.lib (1.1.x) or libeay32.lib (1.0.x or earlier) first
libcrypto_dep = cc.find_library('crypto', required: fal, dirs: 'I:\webrtc\openssl-1.1.1k')
if libcrypto_dep.found()
# Find the corresponding SSL library depending on which crypto .lib we found
libssl_dep = cc.find_library('libssl', required: fal, has_headers: openssl_headers, dirs: 'I:\webrtc\openssl-1.1.1k') endif
crypto_dep = [libcrypto_dep, libssl_dep]
endif
# GStreamer
gst_dep = dependency('gstreamer-ba-1.0', version: gst_req,
required: get_option('gstreamer'),
鱼丸的做法fallback : ['gstreamer', 'gst_ba_dep'])
cdata.t('HAVE_GSTREAMER', gst_dep.found(), description: 'Build GStreamer plugin')
过年周记300字
# GUPnP IGD
gupnp_igd_dep = dependency('gupnp-igd-1.0', version: gupnp_igd_req, required: get_option('gupnp'))
cdata.t('HAVE_GUPNP', gupnp_igd_dep.found(), description: 'U the GUPnP IGD library')
libm = cc.find_library('m', required: fal)
nice_incs = include_directories('.', 'agent', 'random', 'socket', 'stun', 'I:\webrtc\openssl-1.1.1k\include')
nice_deps = gio_deps + [gthread_dep, crypto_dep, gupnp_igd_dep] + syslibs
ignored_iface_prefix = get_option('ignored-network-interface-prefix')
if ignored_iface_prefix != []
ignored_iface_prefix_quoted = []
foreach i : ignored_iface_prefix