0029643: Samples: create .bat files for building AndroidQt sample on Windows platform
authorapn <apn@opencascade.com>
Mon, 26 Mar 2018 10:10:59 +0000 (13:10 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 6 Apr 2018 13:09:37 +0000 (16:09 +0300)
Create environment (genproj.bat, msvc.bat, etc) for building AndroidQt sample on Windows platform (as well as it's done in other OCCT Qt samples)

samples/qt/AndroidQt/AndroidQt0.pro [new file with mode: 0644]
samples/qt/AndroidQt/OCCT.pri
samples/qt/AndroidQt/custom.bat [new file with mode: 0644]
samples/qt/AndroidQt/env.bat [new file with mode: 0644]
samples/qt/AndroidQt/genproj.bat [new file with mode: 0644]
samples/qt/AndroidQt/msvc.bat [new file with mode: 0644]

diff --git a/samples/qt/AndroidQt/AndroidQt0.pro b/samples/qt/AndroidQt/AndroidQt0.pro
new file mode 100644 (file)
index 0000000..26610ec
--- /dev/null
@@ -0,0 +1,5 @@
+TEMPLATE=subdirs
+
+SUBDIRS=AndroidQt0
+
+AndroidQt0.file=AndroidQt.pro
index aa151af..2a5e52a 100644 (file)
@@ -4,9 +4,6 @@ DEPENDPATH  += $$_PRO_FILE_PWD_/occt/inc $$_PRO_FILE_PWD_/3rdparty/include
 
 DEFINES += OCC_CONVERT_SIGNALS
 
-QMAKE_CFLAGS   += -fexceptions -Wno-ignored-qualifiers
-QMAKE_CXXFLAGS += -fexceptions -Wno-ignored-qualifiers
-
 CONFIG(debug,debug|release) {
   DEFINES += DEB
 }
@@ -16,9 +13,19 @@ occt_lib_subpath = libs/armeabi-v7a
 occt_lib_path      = $$_PRO_FILE_PWD_/occt/$$occt_lib_subpath
 3rdparty_lib_path  = $$_PRO_FILE_PWD_/3rdparty/$$occt_lib_subpath
 
+android {
+    QMAKE_CFLAGS   += -fexceptions -Wno-ignored-qualifiers
+    QMAKE_CXXFLAGS += -fexceptions -Wno-ignored-qualifiers
+    LIBS += -L$$occt_lib_path -lEGL
+}
+win32 {
+    QMAKE_CXXFLAGS_WARN_ON += -W4
+    INCLUDEPATH += $$(CSF_OCCTIncludePath)
+    LIBS += -L$(CSF_OCCTLibPath);$(CSF_PRODLibPath)
+    LIBS += -lopengl32
+}
 
-LIBS += -L$$occt_lib_path \
-        -lTKernel \
+LIBS += -lTKernel \
         -lTKMath \
         -lTKG2d \
         -lTKG3d \
@@ -31,8 +38,7 @@ LIBS += -L$$occt_lib_path \
         -lTKMesh \
         -lTKHLR \
         -lTKV3d \
-        -lTKOpenGl \
-        -lEGL
+        -lTKOpenGl
 
 # IMPORTANT. load libraries in a proper order
 ANDROID_EXTRA_LIBS =  $$3rdparty_lib_path/libfreeimage.so \
diff --git a/samples/qt/AndroidQt/custom.bat b/samples/qt/AndroidQt/custom.bat
new file mode 100644 (file)
index 0000000..b5eea52
--- /dev/null
@@ -0,0 +1,4 @@
+@echo off
+rem Define QTDIR variable
+
+set "QTDIR="
diff --git a/samples/qt/AndroidQt/env.bat b/samples/qt/AndroidQt/env.bat
new file mode 100644 (file)
index 0000000..ab5d45e
--- /dev/null
@@ -0,0 +1,10 @@
+@echo off
+
+call "%~dp0..\..\..\env.bat" %1 %2 %3
+
+call "custom.bat" %1 %2 %3
+
+set "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
+set "CSF_ResourcesDefaults=%RES_DIR%"
+
+set "PATH=%QTDIR%/bin;%PATH%"
diff --git a/samples/qt/AndroidQt/genproj.bat b/samples/qt/AndroidQt/genproj.bat
new file mode 100644 (file)
index 0000000..d1abb73
--- /dev/null
@@ -0,0 +1,11 @@
+@echo off
+REM Generation of vcproj files with qmake utilite
+REM Variable QTDIR and PATH to qmake executable must be defined without fail
+
+REM Use first argument to specify version of Visual Studio (vc10, vc11, vc12 or vc14),
+REM second argument specifies architecture) (win32 or win64)
+REM third argument specifies Debug or Release mode
+
+call "%~dp0env.bat" %1 %2 %3
+call "%VCVARS%" %VCARCH%
+qmake -tp vc -r -o AndroidQt.sln AndroidQt0.pro
diff --git a/samples/qt/AndroidQt/msvc.bat b/samples/qt/AndroidQt/msvc.bat
new file mode 100644 (file)
index 0000000..79ccc41
--- /dev/null
@@ -0,0 +1,19 @@
+@echo off
+
+Setlocal EnableDelayedExpansion
+
+rem Setup environment
+call "%~dp0env.bat" %1 %2 %3
+
+rem Define path to project file
+set "PRJFILE=%~dp0AndroidQt.sln"
+
+rem Launch Visual Studio - either professional (devenv) or Express, as available
+if exist "%DevEnvDir%\devenv.exe"  (
+  start "" "%DevEnvDir%\devenv.exe" "%PRJFILE%"
+) else if exist "%DevEnvDir%\%VisualStudioExpressName%.exe"  (
+  start "" "%DevEnvDir%\%VisualStudioExpressName%.exe" "%PRJFILE%"
+) else (
+  echo Error: Could not find MS Visual Studio ^(%VCVER%^)
+  echo Check relevant environment variable ^(e.g. VS100COMNTOOLS for vc10^)
+)