Skip to content

Commit

Permalink
qmake: correct the backslash from string. use '/' for qmake
Browse files Browse the repository at this point in the history
qmake knows how to deal with '/'. '\' is only used for win command.
if '\' appears in qmake file, qmake will give a warning
  • Loading branch information
wang-bin committed Mar 7, 2013
1 parent 337eea1 commit 6944ee7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions QtAV.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ OTHER_FILES += templates/vo.h templates/vo.cpp templates/COPYRIGHT.h templates/m

#cache mkspecs. compare mkspec with cached one. if not equal, remove old cache to run new compile tests
mkspecs_build = $$[QMAKE_MKSPECS]
mkspecs_build ~= s,\\\\,/,g #avoid warning for '\'. qmake knows how to deal with '/'
!isEmpty(mkspecs_cached) {
!isEqual(mkspecs_cached, $$mkspecs_build):new_compile_tests = 1
} else {
Expand All @@ -21,7 +22,9 @@ mkspecs_build = $$[QMAKE_MKSPECS]
##TODO: BUILD_DIR=>BUILD_ROOT
#if not empty, it means the parent project may already set it
isEmpty(out_dir):out_dir = $$OUT_PWD
out_dir ~= s,\\\\,/,g #avoid warning for '\'. qmake knows how to deal with '/'
isEmpty(SOURCE_ROOT):SOURCE_ROOT = $$PWD
SOURCE_ROOT ~= s,\\\\,/,g #avoid warning for '\'. qmake knows how to deal with '/'
isEmpty(BUILD_DIR):BUILD_DIR=$$out_dir
message("BUILD_DIR=$$BUILD_DIR")

Expand Down
8 changes: 4 additions & 4 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ defineReplace(clean_path) {
return($$join(out, /, $$pfx))
}

#make sure BUILD_DIR is already defined. otherwise return the input path
#make sure BUILD_DIR and SOURCE_ROOT is already defined. otherwise return the input path
#only operate on string, seperator is always "/"
defineReplace(shadowed) {
isEmpty(SOURCE_ROOT):return($$1)
isEmpty(SOURCE_ROOT)|isEmpty(BUILD_DIR):return($$1)
1 ~= s,$$SOURCE_ROOT,,g
shadow_dir = $$BUILD_DIR/$$1
shadow_dir ~= s,//,/,g
Expand All @@ -219,9 +219,9 @@ defineReplace(shell_quote) {

defineReplace(system_path) {
win32 {
1 ~= s,/,\\,g
1 ~= s,/,\\,g #qmake \\=>put \\=>real \?
} else {
1 ~= s,\\,/,g
1 ~= s,\\\\,/,g ##why is \\\\. real \=>we read \\=>qmake \\\\?
}
return($$1)
}
Expand Down
3 changes: 2 additions & 1 deletion configure.prf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ defineTest(cache) {
} else:isEqual(2, sub) {
varstr = "$$1 -= $$srcval"
} else:isEqual(2, set) {
##TODO: erase existing VAR in cache
varstr = "$$1 = $$srcval"
} else {
error("cache(): invalid flag $$2.")
Expand All @@ -39,7 +40,7 @@ defineTest(cache) {
#log("varstr: $$varstr")
##TODO: remove existing lines contain $$srcvar
#because write_file() will write 1 line for each value(seperated by space), so the value must be closed with "", then it's 1 value, not list
#erase the existing value
#erase the existing var and value pair
win32 {#:isEmpty(QMAKE_SH) { #windows sucks. can not access the cache

} else {
Expand Down

0 comments on commit 6944ee7

Please sign in to comment.