Make MinGW{,-w64} crosscompilation working.

Also fix the 7za download path in Win32Depends.cmake.
This commit is contained in:
Přemysl Eric Janouch 2012-10-13 19:07:56 +02:00
parent 313a47843f
commit 48d353a5cb
4 changed files with 38 additions and 4 deletions

View File

@ -50,6 +50,10 @@ if (WIN32)
list (APPEND CMAKE_INCLUDE_PATH ${WIN32_DEPENDS_PATH}/lib) list (APPEND CMAKE_INCLUDE_PATH ${WIN32_DEPENDS_PATH}/lib)
list (APPEND CMAKE_C_FLAGS "-mms-bitfields") 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 add_custom_target (win32-depends COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_SOURCE_DIR}/Win32Depends.cmake ${CMAKE_CURRENT_SOURCE_DIR}/Win32Depends.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -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)

View File

@ -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)

View File

@ -21,7 +21,7 @@ endif (files)
set (pkg_list "7za" "gtk" "winlibs" "mingw_lua") set (pkg_list "7za" "gtk" "winlibs" "mingw_lua")
set (pkg_7za_root "http://sourceforge.net/projects/sevenzip/files") 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_7za_md5 "2fac454a90ae96021f4ffc607d4c00f8")
set (pkg_gtk_root "http://ftp.gnome.org/pub/gnome/binaries/win32") set (pkg_gtk_root "http://ftp.gnome.org/pub/gnome/binaries/win32")
@ -81,7 +81,11 @@ foreach (pkg_set ${pkg_list})
endforeach (pkg_set) endforeach (pkg_set)
if (NOT WIN32) 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) endif (NOT WIN32)
# Stage 2: setup 7za first # Stage 2: setup 7za first
@ -104,7 +108,7 @@ file (COPY ${tmp_dir}/7za.exe DESTINATION ${tools_dir})
file (REMOVE_RECURSE ${tmp_dir}) file (REMOVE_RECURSE ${tmp_dir})
list (REMOVE_ITEM pkg_list "7za") 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 (pkg_set ${pkg_list})
foreach (url ${pkg_${pkg_set}_urls}) foreach (url ${pkg_${pkg_set}_urls})
get_filename_component (filename ${url} NAME) get_filename_component (filename ${url} NAME)
@ -139,6 +143,6 @@ foreach (pkg_set ${pkg_list})
endforeach (url) endforeach (url)
endforeach (pkg_set) endforeach (pkg_set)
# Stage 5: final touches # Stage 4: final touches
file (WRITE ${working_dir}/etc/gtk-2.0/gtkrc file (WRITE ${working_dir}/etc/gtk-2.0/gtkrc
"gtk-theme-name = \"MS-Windows\"") "gtk-theme-name = \"MS-Windows\"")