Commit 1264fde2 authored by Tom Finegan's avatar Tom Finegan

Add cmake toolchain for x86 support on linux.

- Properly respond to detection of i386 and x86 as the CPU.
- Restrict -Wshadow to C files: it silences a large number of
  warnings caused by test code.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: Ia15ae8ed0fa90aec587818bda778a638c811168d
parent 8f1252d0
......@@ -29,10 +29,15 @@ if (NOT AOM_TARGET_CPU)
" CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}\n"
" CMAKE_GENERATOR=${CMAKE_GENERATOR}\n")
endif ()
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
set(AOM_TARGET_CPU "x86")
endif ()
endif ()
message("--- aom_configure: Detected CPU: ${AOM_TARGET_CPU}")
set(AOM_TARGET_SYSTEM ${CMAKE_SYSTEM_NAME})
if (NOT EXISTS "${AOM_ROOT}/build/cmake/targets/${AOM_TARGET_CPU}.cmake")
message(FATAL_ERROR "No RTCD template for ${AOM_TARGET_CPU}. Create one, or "
"add -DAOM_TARGET_CPU=generic to your cmake command line for a "
......@@ -68,12 +73,15 @@ else ()
add_compiler_flag_if_supported("-Wfloat-conversion")
add_compiler_flag_if_supported("-Wimplicit-function-declaration")
add_compiler_flag_if_supported("-Wpointer-arith")
add_compiler_flag_if_supported("-Wshadow")
add_compiler_flag_if_supported("-Wsign-compare")
add_compiler_flag_if_supported("-Wtype-limits")
add_compiler_flag_if_supported("-Wuninitialized")
add_compiler_flag_if_supported("-Wunused")
add_compiler_flag_if_supported("-Wvla")
# Add -Wshadow only for C files to avoid massive gtest warning spam.
add_c_flag_if_supported("-Wshadow")
if (ENABLE_WERROR)
add_compiler_flag_if_supported("-Werror")
endif ()
......
......@@ -81,6 +81,8 @@ function (get_asm_obj_format out_format)
elseif ("${AOM_TARGET_CPU}" STREQUAL "x86")
if ("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
set(objformat "macho32")
elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
set(objformat "elf32")
elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
set(objformat "win32")
else ()
......
##
## Copyright (c) 2017, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you can
## obtain it at www.aomedia.org/license/software. If the Alliance for Open
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_C_COMPILER_ARG1 "-m32")
set(CMAKE_CXX_COMPILER_ARG1 "-m32")
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