0023821: Improve qmake project files for Qt samples
authorsan <san@opencascade.com>
Thu, 14 Mar 2013 13:21:47 +0000 (17:21 +0400)
committersan <san@opencascade.com>
Thu, 14 Mar 2013 13:21:47 +0000 (17:21 +0400)
Project file extension corrected for VS 2010/2012 solutions
Sources and resource files from Common and Interface sub-foldrs added to qmake project files from their original location.
RES_DIR environment variable redirected to the binary directory, all resource files copied there to keep the source tree intact.
RES_DIR environment variable corrected under Linux/MacOS similalry to Windows.
Makefile generation corrected under MacOS:
- filenames used as the output for the extra compilers instead of the absolute paths.
- mkdir and cp command options corrected

17 files changed:
samples/qt/IESample/IESample-vc10.sln
samples/qt/IESample/IESample-vc11.sln
samples/qt/IESample/IESample-vc7.sln
samples/qt/IESample/IESample-vc9.sln
samples/qt/IESample/IESample.pro
samples/qt/IESample/env.bat
samples/qt/IESample/env.sh
samples/qt/IESample/generation-vc-projects.bat
samples/qt/IESample/run.sh
samples/qt/Tutorial/Tutorial-vc10.sln
samples/qt/Tutorial/Tutorial-vc11.sln
samples/qt/Tutorial/Tutorial-vc7.sln
samples/qt/Tutorial/Tutorial.pro
samples/qt/Tutorial/env.bat
samples/qt/Tutorial/env.sh
samples/qt/Tutorial/generation-vc-projects.bat
samples/qt/Tutorial/run.sh

index f358270..70a1667 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
index 8f0d8e1..0893d12 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2012
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
index 7dce70b..945d3bb 100644 (file)
@@ -1,4 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 8.00
+# Visual Studio 2003
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
 EndProject
 Global
index 02baed5..1c0f562 100644 (file)
@@ -1,4 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
 EndProject
 Global
index 9ce5731..f820bdc 100755 (executable)
@@ -1,14 +1,29 @@
 TEMPLATE = app
 CONFIG += debug_and_release qt
+QT += qt3support
 
 TARGET = IESample
 
-HEADERS = src/*.h
-SOURCES = src/*.cxx
+SAMPLESROOT = $$(CASROOT)/samples/qt
 
-TS_FILES = ./src/Common-icon.ts \
-           ./src/Common-string.ts \
-           ./src/Interface-string.ts
+HEADERS   = src/*.h \
+            $${SAMPLESROOT}/Common/src/*.h \
+            $${SAMPLESROOT}/Interface/src/*.h
+
+SOURCES   = src/*.cxx \
+            $${SAMPLESROOT}/Common/src/*.cxx \
+            $${SAMPLESROOT}/Interface/src/*.cxx
+
+TS_FILES  = $${SAMPLESROOT}/Common/src/Common-icon.ts \
+            $${SAMPLESROOT}/Common/src/Common-string.ts \
+            $${SAMPLESROOT}/Interface/src/Interface-string.ts
+
+RES_FILES = $${SAMPLESROOT}/Common/res/*
+
+RES_DIR   = $$quote($$(RES_DIR))
+
+INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
+INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
 
 DEFINES = CSFDB
 
@@ -155,16 +170,33 @@ win32 {
     DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
 }
 
-LIBS += -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d -lTKV2d \
+LIBS += -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d \
         -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
         -lTKSTEPBase -lTKShapeSchema -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
         -lTKXSBase -lTKPShape -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
         -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset \
 
+!exists($${RES_DIR}) {
+    win32 {
+        system(mkdir $${RES_DIR})
+    } else {
+        system(mkdir -p $${RES_DIR})
+    }
+}
+
 lrelease.name = LRELEASE ${QMAKE_FILE_IN}
-lrelease.commands = lrelease ${QMAKE_FILE_IN} -qm ./res/${QMAKE_FILE_BASE}.qm
-lrelease.output = ./res/${QMAKE_FILE_BASE}.qm
+lrelease.commands = lrelease ${QMAKE_FILE_IN} -qm $${RES_DIR}/${QMAKE_FILE_BASE}.qm
+lrelease.output = ${QMAKE_FILE_BASE}.qm
 lrelease.input = TS_FILES
-lrelease.clean = ./res/${QMAKE_FILE_BASE}.qm
+lrelease.clean = $${RES_DIR}/${QMAKE_FILE_BASE}.qm
 lrelease.CONFIG += no_link target_predeps
 QMAKE_EXTRA_COMPILERS += lrelease
+
+copy_res.name = Copy resource ${QMAKE_FILE_IN}
+copy_res.output = ${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+copy_res.clean = $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+copy_res.input = RES_FILES
+copy_res.CONFIG += no_link target_predeps
+win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+unix:  copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
+QMAKE_EXTRA_COMPILERS += copy_res
index d42ee2c..69284cc 100755 (executable)
@@ -1,3 +1,3 @@
-SET RES_DIR=%~dp0res
-SET CSF_ResourcesDefaults=%RES_DIR%
-SET CSF_IEResourcesDefaults=%RES_DIR%
+SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
+SET "CSF_ResourcesDefaults=%RES_DIR%"
+SET "CSF_IEResourcesDefaults=%RES_DIR%"
index a8b897d..dcc2990 100755 (executable)
@@ -17,6 +17,10 @@ if test `uname -s` == "Darwin" && test "${WOKHOME}" == ""; then
    exit 1
 fi
 
+host=`uname -s`
+export STATION=$host
+export RES_DIR=${aSamplePath}/${STATION}/res
+
 export PATH=${QTDIR}/bin:${PATH}
 
 source $CASROOT/env.sh
index 8e9cad2..2599815 100644 (file)
@@ -6,6 +6,7 @@ REM second argument specifies architecture) (win32 or win64)
 REM third argument specifies Debug or Release mode
 
 call .\..\..\..\env.bat %1 %2 %3
+call %~dp0env.bat
 
 if not "%1" == "" (
     if /I "%1" == "vc8" (
index 63dccbe..d9d8d2a 100755 (executable)
@@ -4,11 +4,6 @@ export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
 cd $aSamplePath
 
-host=`uname -s`
-STATION=$host
-
-RES_DIR="${aSamplePath}/res"
-
 aSystem=`uname -s`
 if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
   if [ "${CASDEB}" == "d" ]; then
index ba41bee..4fb1550 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
index 6d86e82..ef211cd 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2012
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
index d1d2281..04c876e 100644 (file)
@@ -1,4 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 8.00
+# Visual Studio 2003
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
 EndProject
 Global
index 10980d7..25793b9 100755 (executable)
@@ -1,16 +1,31 @@
 TEMPLATE = app
 CONFIG += debug_and_release qt
+QT += qt3support
 
 TARGET = Tutorial
 
-HEADERS = src/*.h
-SOURCES = src/*.cxx
+SAMPLESROOT = $$(CASROOT)/samples/qt
 
+HEADERS   = src/*.h \
+            $${SAMPLESROOT}/Common/src/*.h \
+            $${SAMPLESROOT}/Interface/src/*.h
 
-TS_FILES = ./src/Common-icon.ts \
-           ./src/Common-string.ts \
-           ./src/Tutorial-icon.ts \
-          ./src/Tutorial-string.ts
+SOURCES   = src/*.cxx \
+            $${SAMPLESROOT}/Common/src/*.cxx \
+            $${SAMPLESROOT}/Interface/src/*.cxx
+
+TS_FILES  = $${SAMPLESROOT}/Common/src/Common-icon.ts \
+            $${SAMPLESROOT}/Common/src/Common-string.ts \
+            ./src/Tutorial-icon.ts \
+            ./src/Tutorial-string.ts
+
+RES_FILES = $${SAMPLESROOT}/Common/res/* \
+            ./res/*
+
+RES_DIR   = $$quote($$(RES_DIR))
+
+INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
+INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
 
 DEFINES = CSFDB
 
@@ -157,16 +172,34 @@ win32 {
     DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
 }
 
-LIBS += -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d -lTKV2d \
+LIBS += -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d \
         -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
         -lTKSTEPBase -lTKShapeSchema -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
         -lTKXSBase -lTKPShape -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
         -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset \
 
+!exists($${RES_DIR}) {
+    win32 {
+        system(mkdir $${RES_DIR})
+    } else {
+        system(mkdir -p $${RES_DIR})
+    }
+}
+
 lrelease.name = LRELEASE ${QMAKE_FILE_IN}
-lrelease.commands = lrelease ${QMAKE_FILE_IN} -qm ./res/${QMAKE_FILE_BASE}.qm
-lrelease.output = ./res/${QMAKE_FILE_BASE}.qm
+lrelease.commands = lrelease ${QMAKE_FILE_IN} -qm $${RES_DIR}/${QMAKE_FILE_BASE}.qm
+lrelease.output = ${QMAKE_FILE_BASE}.qm
 lrelease.input = TS_FILES
-lrelease.clean = ./res/${QMAKE_FILE_BASE}.qm
+lrelease.clean = $${RES_DIR}/${QMAKE_FILE_BASE}.qm
 lrelease.CONFIG += no_link target_predeps
-QMAKE_EXTRA_COMPILERS += lrelease
\ No newline at end of file
+QMAKE_EXTRA_COMPILERS += lrelease
+
+copy_res.name = Copy resource ${QMAKE_FILE_IN}
+copy_res.output = ${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+copy_res.clean = $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+copy_res.input = RES_FILES
+copy_res.CONFIG += no_link target_predeps
+win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+unix:  copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
+QMAKE_EXTRA_COMPILERS += copy_res
+
index a3b4345..12c9d7f 100755 (executable)
@@ -1,4 +1,4 @@
-SET RES_DIR=%~dp0res
-SET CSF_ResourcesDefaults=%RES_DIR%
-SET CSF_TutorialResourcesDefaults=%RES_DIR%
+SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
+SET "CSF_ResourcesDefaults=%RES_DIR%"
+SET "CSF_TutorialResourcesDefaults=%RES_DIR%"
 
index a8b897d..dcc2990 100755 (executable)
@@ -17,6 +17,10 @@ if test `uname -s` == "Darwin" && test "${WOKHOME}" == ""; then
    exit 1
 fi
 
+host=`uname -s`
+export STATION=$host
+export RES_DIR=${aSamplePath}/${STATION}/res
+
 export PATH=${QTDIR}/bin:${PATH}
 
 source $CASROOT/env.sh
index 1e1d586..d6c7ee4 100644 (file)
@@ -6,6 +6,7 @@ REM second argument specifies architecture) (win32 or win64)
 REM third argument specifies Debug or Release mode
 
 call .\..\..\..\env.bat %1 %2 %3
+call %~dp0env.bat
 
 if not "%1" == "" (
     if /I "%1" == "vc8" (
index 9637375..c2eb834 100755 (executable)
@@ -4,11 +4,6 @@ export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
 cd $aSamplePath
 
-host=`uname -s`
-STATION=$host
-
-RES_DIR="${aSamplePath}/res"
-
 aSystem=`uname -s`
 if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
   if [ "${CASDEB}" == "d" ]; then