Commit d0ed677a authored by John Koleszar's avatar John Koleszar
Browse files

Merge branch 'master' into experimental

Change-Id: Ie648398b82f7311143709f55c0e30ba452f50eff
parents 76e0c95d a43bdcd7
REM Copyright (c) 2013 The WebM project authors. All Rights Reserved.
REM
REM Use of this source code is governed by a BSD-style license
REM that can be found in the LICENSE file in the root of the source
REM tree. An additional intellectual property rights grant can be found
REM in the file PATENTS. All contributing project authors may
REM be found in the AUTHORS file in the root of the source tree.
echo on
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp9/common/vp9_asm_com_offsets.c"
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp9/decoder/vp9_asm_dec_offsets.c"
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp9/encoder/vp9_asm_enc_offsets.c"
obj_int_extract.exe rvds "vp9_asm_com_offsets.obj" > "vp9_asm_com_offsets.asm"
obj_int_extract.exe rvds "vp9_asm_dec_offsets.obj" > "vp9_asm_dec_offsets.asm"
obj_int_extract.exe rvds "vp9_asm_enc_offsets.obj" > "vp9_asm_enc_offsets.asm"
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp8/common/vp8_asm_com_offsets.c"
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp8/decoder/vp8_asm_dec_offsets.c"
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp8/encoder/vp8_asm_enc_offsets.c"
obj_int_extract.exe rvds "vp8_asm_com_offsets.obj" > "vp8_asm_com_offsets.asm"
obj_int_extract.exe rvds "vp8_asm_dec_offsets.obj" > "vp8_asm_dec_offsets.asm"
obj_int_extract.exe rvds "vp8_asm_enc_offsets.obj" > "vp8_asm_enc_offsets.asm"
cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vpx_scale/vpx_scale_asm_offsets.c"
obj_int_extract.exe rvds "vpx_scale_asm_offsets.obj" > "vpx_scale_asm_offsets.asm"
......@@ -388,11 +388,14 @@ ifneq ($(call enabled,DIST-SRCS),)
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/yasm.rules
DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/obj_int_extract.bat
DIST-SRCS-$(CONFIG_MSVS) += build/arm-msvs/obj_int_extract.bat
DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
# Include obj_int_extract if we use offsets from *_asm_*_offsets
DIST-SRCS-$(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64) += build/make/obj_int_extract.c
DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas_apple.pl
DIST-SRCS-$(ARCH_ARM) += build/make/ads2armasm_ms.pl
DIST-SRCS-$(ARCH_ARM) += build/make/thumb.pm
DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
endif
INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS)
......
#!/usr/bin/perl
##
## Copyright (c) 2013 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENTS. All contributing project authors may
## be found in the AUTHORS file in the root of the source tree.
##
use FindBin;
use lib $FindBin::Bin;
use thumb;
print "; This file was created from a .asm file\n";
print "; using the ads2armasm_ms.pl script.\n";
while (<STDIN>)
{
undef $comment;
undef $line;
s/REQUIRE8//;
s/PRESERVE8//;
s/^\s*ARM\s*$//;
s/AREA\s+\|\|(.*)\|\|/AREA |$1|/;
s/qsubaddx/qsax/i;
s/qaddsubx/qasx/i;
thumb::FixThumbInstructions($_, 1);
s/ldrneb/ldrbne/i;
s/ldrneh/ldrhne/i;
print;
}
......@@ -17,9 +17,24 @@
#
# Usage: cat inputfile | perl ads2gas.pl > outputfile
#
use FindBin;
use lib $FindBin::Bin;
use thumb;
my $thumb = 0;
foreach my $arg (@ARGV) {
$thumb = 1 if ($arg eq "-thumb");
}
print "@ This file was created from a .asm file\n";
print "@ using the ads2gas.pl script.\n";
print "\t.equ DO1STROUNDING, 0\n";
if ($thumb) {
print "\t.syntax unified\n";
print "\t.thumb\n";
}
# Stack of procedure names.
@proc_stack = ();
......@@ -151,8 +166,13 @@ while (<STDIN>)
# ALIGN directive
s/\bALIGN\b/.balign/g;
# ARM code
s/\sARM/.arm/g;
if ($thumb) {
# ARM code - we force everything to thumb with the declaration in the header
s/\sARM//g;
} else {
# ARM code
s/\sARM/.arm/g;
}
# push/pop
s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g;
......@@ -162,6 +182,10 @@ while (<STDIN>)
s/(vld1.\d+\s+)(q\d+)/$1\{$2\}/g;
s/(vtbl.\d+\s+[^,]+),([^,]+)/$1,\{$2\}/g;
if ($thumb) {
thumb::FixThumbInstructions($_, 0);
}
# eabi_attributes numerical equivalents can be found in the
# "ARM IHI 0045C" document.
......
......@@ -88,6 +88,7 @@ Build options:
${toggle_debug} enable/disable debug mode
${toggle_gprof} enable/disable gprof profiling instrumentation
${toggle_gcov} enable/disable gcov coverage instrumentation
${toggle_thumb} enable/disable building arm assembly in thumb mode
Install options:
${toggle_install_docs} control whether docs are installed
......@@ -416,6 +417,8 @@ SRC_PATH_BARE=$source_path
BUILD_PFX=${BUILD_PFX}
TOOLCHAIN=${toolchain}
ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl}
GEN_VCPROJ=${gen_vcproj_cmd}
MSVS_ARCH_DIR=${msvs_arch_dir}
CC=${CC}
CXX=${CXX}
......@@ -433,6 +436,7 @@ ASFLAGS = ${ASFLAGS}
extralibs = ${extralibs}
AS_SFX = ${AS_SFX:-.asm}
EXE_SFX = ${EXE_SFX}
VCPROJ_SFX = ${VCPROJ_SFX}
RTCD_OPTIONS = ${RTCD_OPTIONS}
EOF
......@@ -794,7 +798,13 @@ process_common_toolchain() {
check_add_asflags --defsym ARCHITECTURE=${arch_int}
tune_cflags="-mtune="
if [ ${tgt_isa} == "armv7" ]; then
[ -z "${float_abi}" ] && float_abi=softfp
if [ -z "${float_abi}" ]; then
check_cpp <<EOF && float_abi=hard || float_abi=softfp
#ifndef __ARM_PCS_VFP
#error "not hardfp"
#endif
EOF
fi
check_add_cflags -march=armv7-a -mfloat-abi=${float_abi}
check_add_asflags -march=armv7-a -mfloat-abi=${float_abi}
......@@ -814,6 +824,18 @@ process_common_toolchain() {
enabled debug && add_asflags -g
asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
if enabled thumb; then
asm_conversion_cmd="$asm_conversion_cmd -thumb"
check_add_cflags -mthumb
check_add_asflags -mthumb -mimplicit-it=always
fi
;;
vs*)
asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl"
AS_SFX=.s
msvs_arch_dir=arm-msvs
disable multithread
disable unit_tests
;;
rvct)
CC=armcc
......@@ -1057,6 +1079,7 @@ EOF
# invoked directly. Checking at configure time is unnecessary.
# Skip the check by setting AS arbitrarily
AS=msvs
msvs_arch_dir=x86-msvs
;;
esac
......@@ -1180,7 +1203,7 @@ EOF
check_cc <<EOF && INLINE="inline"
static inline function() {}
EOF
check_cc <<EOF && INLINE="__attribute__((always_inline))"
check_cc <<EOF && INLINE="__inline__ __attribute__((always_inline))"
static __attribute__((always_inline)) function() {}
EOF
......
......@@ -25,7 +25,7 @@ files.
Options:
--help Print this message
--out=outfile Redirect output to a file
--ver=version Version (7,8,9) of visual studio to generate for
--ver=version Version (7,8,9,10,11) of visual studio to generate for
--target=isa-os-cc Target specifier
EOF
exit 1
......@@ -55,14 +55,19 @@ indent_pop() {
parse_project() {
local file=$1
local name=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
local guid=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
if [ "$sfx" = "vcproj" ]; then
local name=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
local guid=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
else
local name=`grep RootNamespace "$file" | sed 's,.*<.*>\(.*\)</.*>.*,\1,'`
local guid=`grep ProjectGuid "$file" | sed 's,.*<.*>\(.*\)</.*>.*,\1,'`
fi
# save the project GUID to a varaible, normalizing to the basename of the
# vcproj file without the extension
local var
var=${file##*/}
var=${var%%.vcproj}
var=${var%%.${sfx}}
eval "${var}_file=\"$1\""
eval "${var}_name=$name"
eval "${var}_guid=$guid"
......@@ -83,14 +88,14 @@ process_project() {
# vcproj file without the extension
local var
var=${file##*/}
var=${var%%.vcproj}
var=${var%%.${sfx}}
eval "${var}_guid=$guid"
echo "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"$name\", \"$file\", \"$guid\""
indent_push
eval "local deps=\"\${${var}_deps}\""
if [ -n "$deps" ]; then
if [ -n "$deps" ] && [ "$sfx" = "vcproj" ]; then
echo "${indent}ProjectSection(ProjectDependencies) = postProject"
indent_push
......@@ -221,7 +226,7 @@ for opt in "$@"; do
;;
--ver=*) vs_ver="$optval"
case $optval in
[789])
[789]|10|11)
;;
*) die Unrecognized Visual Studio Version in $opt
;;
......@@ -257,6 +262,20 @@ case "${vs_ver:-8}" in
9) sln_vers="10.00"
sln_vers_str="Visual Studio 2008"
;;
10) sln_vers="11.00"
sln_vers_str="Visual Studio 2010"
;;
11) sln_vers="12.00"
sln_vers_str="Visual Studio 2012"
;;
esac
case "${vs_ver:-8}" in
[789])
sfx=vcproj
;;
10|11)
sfx=vcxproj
;;
esac
for f in "${file_list[@]}"; do
......
#!/bin/bash
##
## Copyright (c) 2013 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENTS. All contributing project authors may
## be found in the AUTHORS file in the root of the source tree.
##
self=$0
self_basename=${self##*/}
self_dirname=$(dirname "$0")
EOL=$'\n'
show_help() {
cat <<EOF
Usage: ${self_basename} --name=projname [options] file1 [file2 ...]
This script generates a Visual Studio project file from a list of source
code files.
Options:
--help Print this message
--exe Generate a project for building an Application
--lib Generate a project for creating a static library
--dll Generate a project for creating a dll
--static-crt Use the static C runtime (/MT)
--target=isa-os-cc Target specifier (required)
--out=filename Write output to a file [stdout]
--name=project_name Name of the project (required)
--proj-guid=GUID GUID to use for the project
--module-def=filename File containing export definitions (for DLLs)
--ver=version Version (10,11) of visual studio to generate for
--src-path-bare=dir Path to root of source tree
-Ipath/to/include Additional include directories
-DFLAG[=value] Preprocessor macros to define
-Lpath/to/lib Additional library search paths
-llibname Library to link against
EOF
exit 1
}
die() {
echo "${self_basename}: $@" >&2
exit 1
}
die_unknown(){
echo "Unknown option \"$1\"." >&2
echo "See ${self_basename} --help for available options." >&2
exit 1
}
generate_uuid() {
local hex="0123456789ABCDEF"
local i
local uuid=""
local j
#93995380-89BD-4b04-88EB-625FBE52EBFB
for ((i=0; i<32; i++)); do
(( j = $RANDOM % 16 ))
uuid="${uuid}${hex:$j:1}"
done
echo "${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12}"
}
indent1=" "
indent=""
indent_push() {
indent="${indent}${indent1}"
}
indent_pop() {
indent="${indent%${indent1}}"
}
tag_attributes() {
for opt in "$@"; do
optval="${opt#*=}"
[ -n "${optval}" ] ||
die "Missing attribute value in '$opt' while generating $tag tag"
echo "${indent}${opt%%=*}=\"${optval}\""
done
}
open_tag() {
local tag=$1
shift
if [ $# -ne 0 ]; then
echo "${indent}<${tag}"
indent_push
tag_attributes "$@"
echo "${indent}>"
else
echo "${indent}<${tag}>"
indent_push
fi
}
close_tag() {
local tag=$1
indent_pop
echo "${indent}</${tag}>"
}
tag() {
local tag=$1
shift
if [ $# -ne 0 ]; then
echo "${indent}<${tag}"
indent_push
tag_attributes "$@"
indent_pop
echo "${indent}/>"
else
echo "${indent}<${tag}/>"
fi
}
tag_content() {
local tag=$1
local content=$2
shift
shift
if [ $# -ne 0 ]; then
echo "${indent}<${tag}"
indent_push
tag_attributes "$@"
echo "${indent}>${content}</${tag}>"
indent_pop
else
echo "${indent}<${tag}>${content}</${tag}>"
fi
}
generate_filter() {
local name=$1
local pats=$2
local file_list_sz
local i
local f
local saveIFS="$IFS"
local pack
echo "generating filter '$name' from ${#file_list[@]} files" >&2
IFS=*
file_list_sz=${#file_list[@]}
for i in ${!file_list[@]}; do
f=${file_list[i]}
for pat in ${pats//;/$IFS}; do
if [ "${f##*.}" == "$pat" ]; then
unset file_list[i]
objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,/,_,g')
if ([ "$pat" == "asm" ] || [ "$pat" == "s" ]) && $asm_use_custom_step; then
open_tag CustomBuild \
Include=".\\$f"
for plat in "${platforms[@]}"; do
for cfg in Debug Release; do
tag_content Message "Assembling %(Filename)%(Extension)" \
Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
tag_content Command "$(eval echo \$asm_${cfg}_cmdline) -o \$(IntDir)$objf" \
Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
tag_content Outputs "\$(IntDir)$objf" \
Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
done
done
close_tag CustomBuild
elif [ "$pat" == "c" ] || [ "$pat" == "cc" ] ; then
open_tag ClCompile \
Include=".\\$f"
# Separate file names with Condition?
tag_content ObjectFileName "\$(IntDir)$objf"
close_tag ClCompile
elif [ "$pat" == "h" ] ; then
tag ClInclude \
Include=".\\$f"
elif [ "$pat" == "vcxproj" ] ; then
open_tag ProjectReference \
Include="$f"
depguid=`grep ProjectGuid "$f" | sed 's,.*<.*>\(.*\)</.*>.*,\1,'`
tag_content Project "$depguid"
tag_content ReferenceOutputAssembly false
close_tag ProjectReference
else
tag None \
Include=".\\$f"
fi
break
fi
done
done
IFS="$saveIFS"
}
# Process command line
unset target
for opt in "$@"; do
optval="${opt#*=}"
case "$opt" in
--help|-h) show_help
;;
--target=*) target="${optval}"
;;
--out=*) outfile="$optval"
;;
--name=*) name="${optval}"
;;
--proj-guid=*) guid="${optval}"
;;
--module-def=*) module_def="${optval}"
;;
--exe) proj_kind="exe"
;;
--dll) proj_kind="dll"
;;
--lib) proj_kind="lib"
;;
--src-path-bare=*) src_path_bare="$optval"
;;
--static-crt) use_static_runtime=true
;;
--ver=*)
vs_ver="$optval"
case "$optval" in
10|11)
;;
*) die Unrecognized Visual Studio Version in $opt
;;
esac
;;
-I*)
opt="${opt%/}"
incs="${incs}${incs:+;}${opt##-I}"
yasmincs="${yasmincs} ${opt}"
;;
-D*) defines="${defines}${defines:+;}${opt##-D}"
;;
-L*) # fudge . to $(OutDir)
if [ "${opt##-L}" == "." ]; then
libdirs="${libdirs}${libdirs:+;}\$(OutDir)"
else
# Also try directories for this platform/configuration
libdirs="${libdirs}${libdirs:+;}${opt##-L}"
libdirs="${libdirs}${libdirs:+;}${opt##-L}/\$(PlatformName)/\$(Configuration)"
libdirs="${libdirs}${libdirs:+;}${opt##-L}/\$(PlatformName)"
fi
;;
-l*) libs="${libs}${libs:+ }${opt##-l}.lib"
;;
-*) die_unknown $opt
;;
*)
file_list[${#file_list[@]}]="$opt"
case "$opt" in
*.asm|*.s) uses_asm=true
;;
esac
;;
esac
done
outfile=${outfile:-/dev/stdout}
guid=${guid:-`generate_uuid`}
asm_use_custom_step=false
uses_asm=${uses_asm:-false}
case "${vs_ver:-11}" in
10|11)
asm_use_custom_step=$uses_asm
;;
esac
[ -n "$name" ] || die "Project name (--name) must be specified!"
[ -n "$target" ] || die "Target (--target) must be specified!"
if ${use_static_runtime:-false}; then
release_runtime=MultiThreaded
debug_runtime=MultiThreadedDebug
lib_sfx=mt
else
release_runtime=MultiThreadedDLL
debug_runtime=MultiThreadedDebugDLL
lib_sfx=md
fi
# Calculate debug lib names: If a lib ends in ${lib_sfx}.lib, then rename
# it to ${lib_sfx}d.lib. This precludes linking to release libs from a
# debug exe, so this may need to be refactored later.
for lib in ${libs}; do
if [ "$lib" != "${lib%${lib_sfx}.lib}" ]; then
lib=${lib%.lib}d.lib
fi
debug_libs="${debug_libs}${debug_libs:+ }${lib}"
done
debug_libs=${debug_libs// /;}
libs=${libs// /;}
# List of all platforms supported for this target
case "$target" in
x86_64*)
platforms[0]="x64"
asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
;;
x86*)
platforms[0]="Win32"
asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
;;
arm*)
asm_Debug_cmdline="armasm -nologo &quot;%(FullPath)&quot;"
asm_Release_cmdline="armasm -nologo &quot;%(FullPath)&quot;"
if [ "$name" = "obj_int_extract" ]; then
# We don't want to build this tool for the target architecture,
# but for an architecture we can run locally during the build.
platforms[0]="Win32"
else
platforms[0]="ARM"
fi
;;
*) die "Unsupported target $target!"
;;
esac
generate_vcxproj() {
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
open_tag Project \
DefaultTargets="Build" \
ToolsVersion="4.0" \
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" \