summaryrefslogtreecommitdiffhomepage
path: root/cmake/mingw-w64.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-09-22 10:27:57 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-09-22 10:27:57 +0200
commit2d20f6cc87a3f1e9470f1fc4718e4ddf64cac57c (patch)
tree5fad81a83c8d81b652cd80f2f14b5c69432ac463 /cmake/mingw-w64.cmake
parent6f2a292bb7f84470354e5bc707a1f3eea9d824e3 (diff)
cmake: add cross-compile example
Diffstat (limited to 'cmake/mingw-w64.cmake')
-rw-r--r--cmake/mingw-w64.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake
new file mode 100644
index 00000000..5cb63674
--- /dev/null
+++ b/cmake/mingw-w64.cmake
@@ -0,0 +1,28 @@
+# this file only serves as toolchain file when specified so explicitly
+# when building the software. from repository's root directory:
+# mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w64.cmake
+# -sh 20140922
+
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+# specify the cross compiler
+SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
+set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
+
+SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
+
+# search for programs in the host directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# don't poison with system compile-time data
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+set(CMAKE_C_FLAGS_RELEASE "-O3 -flto -march=i686 -mtune=prescott -mno-sse3 -mno-avx -frename-registers" CACHE STRING "" FORCE)
+set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
+set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
+
+# these are merely for my own convenience
+set(OpenCV_DIR /home/sthalik/opentrack-win32-sdk/opencv/build)
+set(Qt5_DIR /home/sthalik/opentrack-win32-sdk/qt-install-5.3.1/lib/cmake/Qt5)