Support cross compile for windows via mingw64.
BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1170 Change-Id: I8430600ceb610fbf1ecff34f0a2d2c1a57627692
This commit is contained in:
parent
596f5e0544
commit
a1cba3409a
@ -118,4 +118,26 @@ standard include files occur, one solution can be found here:
|
||||
https://github.com/include-what-you-use/include-what-you-use/issues/100
|
||||
|
||||
|
||||
CMake cross compile
|
||||
To cross compile libwebm for Windows using mingw64 run cmake with the following
|
||||
arguments:
|
||||
|
||||
$ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/libwebm/build/mingw64_toolchain.cmake \
|
||||
path/to/libwebm
|
||||
|
||||
Note1: As of this writing googletest will not build via mingw64 without
|
||||
disabling pthreads.
|
||||
googletest hash: d225acc90bc3a8c420a9bcd1f033033c1ccd7fe0
|
||||
|
||||
To build with tests when using mingw64 use the following arguments when running
|
||||
CMake:
|
||||
|
||||
$ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/libwebm/build/mingw64_toolchain.cmake \
|
||||
-DENABLE_TESTS=ON -Dgtest_disable_pthreads=ON path/to/libwebm
|
||||
|
||||
Note2: i686-w64-mingw32 is the default compiler. This can be controlled using
|
||||
the MINGW_PREFIX variable:
|
||||
|
||||
$ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/libwebm/build/mingw64_toolchain.cmake \
|
||||
-DMINGW_PREFIX=x86_64-w64-mingw32 path/to/libwebm
|
||||
|
||||
|
23
build/mingw64_toolchain.cmake
Normal file
23
build/mingw64_toolchain.cmake
Normal file
@ -0,0 +1,23 @@
|
||||
## Copyright (c) 2016 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.
|
||||
|
||||
set(MINGW_PREFIX "i686-w64-mingw32" CACHE STRING "MinGW cross compiler")
|
||||
|
||||
# Target OS name.
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# Cross compiler values.
|
||||
set(CMAKE_C_COMPILER ${MINGW_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${MINGW_PREFIX}-g++)
|
||||
set(CMAKE_RC_COMPILER ${MINGW_PREFIX}-windres)
|
||||
|
||||
# Tell CMake not to look too hard for things; we want the target toolchain
|
||||
# defaults.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -20,7 +20,7 @@
|
||||
namespace libwebm {
|
||||
|
||||
std::string GetTempFileName() {
|
||||
#ifndef _MSC_VER
|
||||
#if !defined _MSC_VER && !defined __MINGW32__
|
||||
char temp_file_name_template[] = "libwebm_temp.XXXXXX";
|
||||
int fd = mkstemp(temp_file_name_template);
|
||||
if (fd != -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user