update makefile

Signed-off-by: lizimian <lizimian@huawei.com>
This commit is contained in:
lizimian
2022-05-23 20:51:03 +08:00
parent 094bde1ead
commit 86fd1eab80
7 changed files with 139 additions and 64 deletions
+3 -6
View File
@@ -1,5 +1,5 @@
language: cpp
dist: trusty
dist: xenial
compiler:
- g++
@@ -7,11 +7,8 @@ compiler:
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386 python3-pip unzip
- sudo python3 -m pip install meson==0.44.1
- wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
- unzip ninja-linux.zip
- export PATH=$PATH:$PWD
- sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386 python3-pip python3-setuptools
- sudo python3 -m pip install meson==0.50.1 ninja
install:
- make gmp-bootstrap
+5 -4
View File
@@ -34,9 +34,10 @@ GTEST_VER=release-1.8.1
CCASFLAGS=$(CFLAGS)
STATIC_LDFLAGS=-lstdc++
STRIP ?= strip
USE_STACK_PROTECTOR = Yes
SHAREDLIB_MAJORVERSION=5
FULL_VERSION := 2.0.0
SHAREDLIB_MAJORVERSION=6
FULL_VERSION := 2.2.0
ifeq (,$(wildcard $(SRC_PATH)gmp-api))
HAVE_GMP_API=No
@@ -285,10 +286,10 @@ endif
endif
$(PROJECT_NAME).pc: $(PROJECT_NAME).pc.in
@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(FULL_VERSION);' -e 's;@LIBS@;;' -e 's;@LIBS_PRIVATE@;$(STATIC_LDFLAGS);' < $< > $@
@sed -e 's;@prefix@;$(PREFIX);' -e 's;@libdir@;$(PREFIX)/lib;' -e 's;@VERSION@;$(FULL_VERSION);' -e 's;@LIBS@;;' -e 's;@LIBS_PRIVATE@;$(STATIC_LDFLAGS);' < $< > $@
$(PROJECT_NAME)-static.pc: $(PROJECT_NAME).pc.in
@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(FULL_VERSION);' -e 's;@LIBS@;$(STATIC_LDFLAGS);' -e 's;@LIBS_PRIVATE@;;' < $< > $@
@sed -e 's;@prefix@;$(PREFIX);' -e 's;@libdir@;$(PREFIX)/lib;' -e 's;@VERSION@;$(FULL_VERSION);' -e 's;@LIBS@;$(STATIC_LDFLAGS);' -e 's;@LIBS_PRIVATE@;;' < $< > $@
install-headers:
mkdir -p $(DESTDIR)$(PREFIX)/include/wels
+1 -1
View File
@@ -1,4 +1,4 @@
Name: gmpopenh264
Description: GMP Plugin for OpenH264.
Version: 2.0.0
Version: 2.2.0
APIs: encode-video[h264], decode-video[h264]
+124 -48
View File
@@ -1,10 +1,10 @@
project('openh264', ['c', 'cpp'],
version : '1.8.0',
meson_version : '>= 0.43',
version : '2.2.0',
meson_version : '>= 0.52',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
major_version = '4'
major_version = '6'
cpp = meson.get_compiler('cpp')
@@ -36,10 +36,6 @@ encoder_inc = include_directories([
join_paths('codec', 'encoder', 'plus', 'inc'),
])
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
nasm = find_program('nasm', 'nasm.exe')
system = host_machine.system()
cpu_family = host_machine.cpu_family()
@@ -54,45 +50,133 @@ deps = [dependency('threads')]
c_args = []
cpp_args = []
asm_args = []
asm_inc = []
casm_inc = []
cpp_lib = '-lstdc++'
if system == 'linux'
# TODO: should rely on dependency('threads') instead and change the pkg-config
# generator below
pthread_dep = cpp.find_library('pthread', required : false)
libm_dep = cpp.find_library('libm', required : false)
deps += [libm_dep]
if ['linux', 'android', 'ios', 'darwin'].contains(system)
asm_format32 = 'elf'
asm_format64 = 'elf64'
if ['ios', 'darwin'].contains(system)
asm_format32 = 'macho32'
asm_format64 = 'macho64'
endif
if cpu_family == 'x86'
asm_format = 'elf'
asm_args += ['-DX86_32']
add_project_arguments('-DX86_32_ASM', language: 'c')
asm_format = asm_format32
asm_args += ['-DX86_32', '-DHAVE_AVX2']
add_project_arguments('-DHAVE_AVX2', language: 'cpp')
add_project_arguments('-DHAVE_AVX2', '-DX86_ASM', '-DX86_32_ASM', language: 'c')
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
elif cpu_family == 'x86_64'
asm_format = 'elf64'
asm_args += ['-DUNIX64']
asm_format = asm_format64
asm_args += ['-DUNIX64', '-DHAVE_AVX2']
add_project_arguments('-DHAVE_AVX2', language: 'cpp')
add_project_arguments('-DHAVE_AVX2', '-DX86_ASM', language: 'c')
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
elif cpu_family == 'arm'
asm_format = asm_format32
add_project_arguments('-DHAVE_NEON', language: 'c')
add_project_arguments('-DHAVE_NEON', language: 'c')
casm_inc = include_directories(join_paths('codec', 'common', 'arm'))
elif cpu_family == 'aarch64'
asm_format = asm_format64
add_project_arguments('-DHAVE_NEON_ARM64', language: 'c')
add_project_arguments('-DHAVE_NEON_ARM64', language: 'cpp')
casm_inc = include_directories(join_paths('codec', 'common', 'arm64'))
else
error ('FIXME: unhandled CPU family @0@ for Linux'.format(cpu_family))
error('FIXME: unhandled CPU family @0@ for @1@'.format(cpu_family, system))
endif
deps += [cpp.find_library('libm')]
asm_args += ['-DHAVE_AVX2']
add_project_arguments('-DHAVE_AVX2', language: 'cpp')
add_project_arguments('-DHAVE_AVX2', '-DX86_ASM', language: 'c')
if ['ios', 'darwin', 'android'].contains(system)
cpp_lib = '-lc++'
endif
elif system == 'windows'
if cpu_family == 'x86'
asm_format = 'win32'
asm_args += ['-DPREFIX', '-DX86_32']
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
elif cpu_family == 'x86_64'
asm_format = 'win64'
asm_args += ['-DWIN64']
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
elif cpu_family == 'arm'
if cpp.get_argument_syntax() == 'msvc'
asm_format = 'armasm'
asm_args += ['-nologo', '-DHAVE_NEON', '-ignore', '4509']
asm_cmds = ['armasm']
else
asm_format = 'clang'
asm_args += ['-DHAVE_NEON', '-mimplicit-it=always']
asm_cmds = cpp.cmd_array()
endif
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'arm', '')
elif cpu_family == 'aarch64'
asm_format = 'armasm'
asm_args += ['-nologo', '-DHAVE_NEON_AARCH64']
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'arm64', '')
else
error ('FIXME: unhandled CPU family @0@ for Windows'.format(cpu_family))
error('FIXME: unhandled CPU family @0@ for Windows'.format(cpu_family))
endif
else
error ('FIXME: Unhandled system @0@'.format(system))
error('FIXME: Unhandled system @0@'.format(system))
endif
asm_gen = generator(nasm,
output : '@BASENAME@.o',
arguments : [
'-f', asm_format,
'-i', asm_inc,
'@INPUT@',
'-o', '@OUTPUT@'] + asm_args)
use_asm_gen = false
if cpu_family in ['x86', 'x86_64']
nasm = find_program('nasm')
use_asm_gen = true
asm_gen = generator(nasm,
output : '@BASENAME@.o',
arguments : [
'-f', asm_format,
'-i', asm_inc,
'@INPUT@',
'-o', '@OUTPUT@'] + asm_args)
elif system == 'windows'
if cpu_family == 'arm'
# For ARM, gas-preprocessor is needed for converting the asm to be
# buildable as thumb even with Clang.
use_asm_gen = true
gasprep = find_program('gas-preprocessor.pl')
asm_gen = generator(gasprep,
output : '@BASENAME@.obj',
arguments : [
'-as-type', asm_format,
'-force-thumb',
'--'
] + asm_cmds + [
'-I' + asm_inc] + asm_args + [
'@INPUT@',
'-c', '-o', '@OUTPUT@'])
elif cpu_family == 'aarch64'
# For ARM64, Clang can build the assembly as-is without needing to use
# either gas-preprocessor or armasm64.
if cpp.get_argument_syntax() == 'msvc'
use_asm_gen = true
gasprep = find_program('gas-preprocessor.pl')
asm_gen = generator(gasprep,
output : '@BASENAME@.obj',
arguments : [
'-as-type', asm_format,
'-arch', 'aarch64',
'--',
'armasm64',
'-I' + asm_inc] + asm_args + [
'@INPUT@',
'-c', '-o', '@OUTPUT@'])
endif
else
# Windows only supports x86, x86_64, arm, arm64
error('unreachable code')
endif
endif
api_headers = []
api_header_deps = []
@@ -100,44 +184,36 @@ api_header_deps = []
subdir ('codec')
subdir ('test')
all_objects = [
libcommon.extract_all_objects(),
libprocessing.extract_all_objects(),
libencoder.extract_all_objects(),
libdecoder.extract_all_objects()
]
libopenh264_shared = shared_library('openh264',
objects: all_objects,
libopenh264_shared = library('openh264',
link_with: [libcommon, libprocessing, libencoder, libdecoder],
install: true,
soversion: major_version,
version: meson.project_version(),
vs_module_defs: 'openh264.def',
dependencies: deps)
libopenh264_static = static_library('openh264',
objects: all_objects,
install: true,
dependencies: deps)
pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
foreach t : ['', '-static']
pkgconf = configuration_data()
pkgconf.set('prefix', join_paths(get_option('prefix')))
pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
pkgconf.set('VERSION', meson.project_version())
pkglibs = cpp_lib
if libm_dep.found()
pkglibs += ' -lm'
endif
if pthread_dep.found()
pkglibs += ' -lpthread'
endif
if t == '-static'
do_install = false
pkgconf.set('LIBS', '-lstdc++ -lpthread -lm')
pkgconf.set('LIBS', pkglibs)
pkgconf.set('LIBS_PRIVATE', '')
else
do_install = true
pkgconf.set('LIBS', '')
pkgconf.set('LIBS_PRIVATE', '-lstdc++ -lpthread -lm')
pkgconf.set('LIBS_PRIVATE', pkglibs)
endif
message('do_install: @0@'.format(do_install))
configure_file(
input: 'openh264.pc.in',
output: 'openh264@0@.pc'.format(t),
+1
View File
@@ -0,0 +1 @@
option('tests', type : 'feature', value : 'auto', yield : true)
+1 -1
View File
@@ -1,5 +1,5 @@
prefix=@prefix@
libdir=${prefix}/lib
libdir=@libdir@
includedir=${prefix}/include
Name: OpenH264
+4 -4
View File
@@ -24,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,0,1905
PRODUCTVERSION 2,0,0,1905
FILEVERSION 2,2,0,2201
PRODUCTVERSION 2,2,0,2201
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -43,12 +43,12 @@ BEGIN
VALUE "Comments", "Cisco OpenH264 codec"
VALUE "CompanyName", "Cisco Systems Inc."
VALUE "FileDescription", "Cisco OpenH264 codec"
VALUE "FileVersion", "2.0.0.1905"
VALUE "FileVersion", "2.2.0.2201"
VALUE "InternalName", "openh264.dll"
VALUE "LegalCopyright", "© 2011-2015 Cisco and/or its affiliates. All rights reserved."
VALUE "OriginalFilename", "openh264.dll"
VALUE "ProductName", "Cisco OpenH264 codec"
VALUE "ProductVersion", "2.0.0.1905"
VALUE "ProductVersion", "2.2.0.2201"
END
END
BLOCK "VarFileInfo"