diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2012-10-13 19:07:56 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2013-01-08 02:46:07 +0100 |
commit | 48d353a5cb22e596f12946ef7202e9946679e2c8 (patch) | |
tree | afe2ff2ab2f97f3be32afa99cb24fa374a0607d3 | |
parent | 313a47843fc40e461a67149cf1f40be0a90385d7 (diff) | |
download | logdiag-48d353a5cb22e596f12946ef7202e9946679e2c8.tar.gz logdiag-48d353a5cb22e596f12946ef7202e9946679e2c8.tar.xz logdiag-48d353a5cb22e596f12946ef7202e9946679e2c8.zip |
Make MinGW{,-w64} crosscompilation working.
Also fix the 7za download path in Win32Depends.cmake.
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | ToolchainDebianMinGW.cmake | 13 | ||||
-rw-r--r-- | ToolchainDebianMinGWW64.cmake | 13 | ||||
-rw-r--r-- | Win32Depends.cmake | 12 |
4 files changed, 38 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d21d8e1..931255b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,10 @@ if (WIN32) list (APPEND CMAKE_INCLUDE_PATH ${WIN32_DEPENDS_PATH}/lib) list (APPEND CMAKE_C_FLAGS "-mms-bitfields") + if (CMAKE_CROSSCOMPILING) + list (APPEND CMAKE_FIND_ROOT_PATH ${WIN32_DEPENDS_PATH}) + endif (CMAKE_CROSSCOMPILING) + add_custom_target (win32-depends COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Win32Depends.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/ToolchainDebianMinGW.cmake b/ToolchainDebianMinGW.cmake new file mode 100644 index 0000000..19f6ff1 --- /dev/null +++ b/ToolchainDebianMinGW.cmake @@ -0,0 +1,13 @@ +set (CMAKE_SYSTEM_NAME "Windows") +set (CMAKE_SYSTEM_PROCESSOR "x86") + +set (CMAKE_C_COMPILER "i586-mingw32msvc-gcc") +set (CMAKE_CXX_COMPILER "i586-mingw32msvc-g++") +set (CMAKE_RC_COMPILER "i586-mingw32msvc-windres") + +set (CMAKE_FIND_ROOT_PATH "/usr/i586-mingw32msvc") + +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + diff --git a/ToolchainDebianMinGWW64.cmake b/ToolchainDebianMinGWW64.cmake new file mode 100644 index 0000000..a1f4378 --- /dev/null +++ b/ToolchainDebianMinGWW64.cmake @@ -0,0 +1,13 @@ +set (CMAKE_SYSTEM_NAME "Windows") +set (CMAKE_SYSTEM_PROCESSOR "x86") + +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") + +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + diff --git a/Win32Depends.cmake b/Win32Depends.cmake index c22cf4c..f51667e 100644 --- a/Win32Depends.cmake +++ b/Win32Depends.cmake @@ -21,7 +21,7 @@ endif (files) set (pkg_list "7za" "gtk" "winlibs" "mingw_lua") set (pkg_7za_root "http://sourceforge.net/projects/sevenzip/files") -set (pkg_7za_urls "${pkg_7z_root}/7-Zip/9.20/7za920.zip") +set (pkg_7za_urls "${pkg_7za_root}/7-Zip/9.20/7za920.zip") set (pkg_7za_md5 "2fac454a90ae96021f4ffc607d4c00f8") set (pkg_gtk_root "http://ftp.gnome.org/pub/gnome/binaries/win32") @@ -81,7 +81,11 @@ foreach (pkg_set ${pkg_list}) endforeach (pkg_set) if (NOT WIN32) - message (FATAL_ERROR "Must run on Windows to extract packages; aborting") + unset (sevenzip_executable) + find_program (sevenzip_executable 7za) + if (NOT sevenzip_executable) + message (FATAL_ERROR "Could not find 7za (part of p7zip)") + endif (NOT sevenzip_executable) endif (NOT WIN32) # Stage 2: setup 7za first @@ -104,7 +108,7 @@ file (COPY ${tmp_dir}/7za.exe DESTINATION ${tools_dir}) file (REMOVE_RECURSE ${tmp_dir}) list (REMOVE_ITEM pkg_list "7za") -# Stage 4: extract the rest of packages +# Stage 3: extract the rest of packages foreach (pkg_set ${pkg_list}) foreach (url ${pkg_${pkg_set}_urls}) get_filename_component (filename ${url} NAME) @@ -139,6 +143,6 @@ foreach (pkg_set ${pkg_list}) endforeach (url) endforeach (pkg_set) -# Stage 5: final touches +# Stage 4: final touches file (WRITE ${working_dir}/etc/gtk-2.0/gtkrc "gtk-theme-name = \"MS-Windows\"") |