Skip to content

Commit

Permalink
qmake: cross build for win
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Sep 5, 2014
1 parent 6a03ae6 commit 8d515fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ win32-msvc* {
#################################functions#########################################
defineTest(qtRunQuitly) {
#win32 always call windows command
win32 { #QMAKE_HOST.os?
contains(QMAKE_HOST.os,Windows) {
system("$$1 2>&1 >nul")|return(false) #system always call win32 cmd
} else {
system("$$1 2>&1 >/dev/null")|return(false)
Expand Down Expand Up @@ -267,19 +267,19 @@ defineReplace(shell_quote_unix) {
}
##TODO: see qmake/library/ioutils.cpp
defineReplace(shell_quote) {
win32:isEmpty(QMAKE_SH):return($$shell_quote_win($$1))
contains(QMAKE_HOST.os,Windows):isEmpty(QMAKE_SH):return($$shell_quote_win($$1))
return($$shell_quote_unix($$1))
}

##TODO: see qmake/library/ioutils.cpp
defineReplace(system_quote) {
isEmpty(1):error("system_quote(arg) requires one argument.")
unix:return($$shell_quote_unix($$1))
return($$shell_quote_win($$1))
contains(QMAKE_HOST.os,Windows): return($$shell_quote_win($$1))
return($$shell_quote_unix($$1))
}

defineReplace(system_path) {
win32 {
contains(QMAKE_HOST.os,Windows) {
1 ~= s,/,\\,g #qmake \\=>put \\=>real \?
} else {
1 ~= s,\\\\,/,g ##why is \\\\. real \=>we read \\=>qmake \\\\?
Expand Down
3 changes: 1 addition & 2 deletions configure.pri
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ defineTest(qtCompileTest) {
log("Checking for $${1}... ")
msg = "executing config test $$1"
write_file($$QMAKE_CONFIG_LOG, msg, append)

test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$1
test_out_dir = $$shadowed($$test_dir)
#system always call win32 cmd in windows, so we need "cd /d" to ensure success cd to a different partition
win32:test_cmd_base = "cd /d $$system_quote($$system_path($$test_out_dir)) &&"
contains(QMAKE_HOST.os,Windows):test_cmd_base = "cd /d $$system_quote($$system_path($$test_out_dir)) &&"
else: test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
# Disable qmake features which are typically counterproductive for tests
qmake_configs = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""
Expand Down
2 changes: 1 addition & 1 deletion root.pri
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defineTest(testArch) {
test_dir = $$_PRO_FILE_PWD_/tests/arch
test_out_dir = $$shadowed($$test_dir)
qtRunCommandQuitly("$$QMAKE_MKDIR $$system_path($$test_out_dir)") #mkpath. but common.pri may not included
win32:test_cmd_base = "cd /d $$system_quote($$system_path($$test_out_dir)) &&"
contains(QMAKE_HOST.os,Windows): test_cmd_base = "cd /d $$system_quote($$system_path($$test_out_dir)) &&"
else:test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
# Disable qmake features which are typically counterproductive for tests
qmake_configs = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""
Expand Down

0 comments on commit 8d515fe

Please sign in to comment.