0029668: Configuration: build Inspector aplication independently on BUILD_MODULE_QtSa...
authornds <nds@opencascade.com>
Mon, 2 Apr 2018 11:17:44 +0000 (14:17 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 6 Apr 2018 13:09:33 +0000 (16:09 +0300)
CMakeLists.txt
adm/templates/sample.sh [new file with mode: 0644]

index 7799627..b98eaf3 100644 (file)
@@ -912,8 +912,8 @@ OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${S
 OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}")
 
 if (BUILD_MODULE_MfcSamples OR BUILD_MODULE_QtSamples)
-  OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR_SCRIPT}")
-  OCCT_COPY_FILE_OR_DIR    ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}")
+  OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.${SCRIPT_EXT}" "${INSTALL_DIR_SCRIPT}")
+  OCCT_COPY_FILE_OR_DIR    ("adm/templates/sample.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
 endif()
 
 # env script for draw in building environment
@@ -1017,14 +1017,19 @@ endif()
 
 OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES)
 
-if (BUILD_MODULE_QtSamples)
-  if (NOT Qt5_FOUND OR NOT WIN32)
-    list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt)
-    message (STATUS "Info: AndroidQt sample excluded due to Qt5 usage is disabled or OS is not Windows")
+if (BUILD_Inspector OR BUILD_MODULE_QtSamples)
+  if (BUILD_MODULE_QtSamples)
+    if (NOT Qt5_FOUND OR NOT WIN32)
+      list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt)
+      message (STATUS "Info: AndroidQt sample excluded due to Qt5 usage is disabled or OS is not Windows")
+    endif()
+  else()
+    list (REMOVE_ITEM OCCT_SAMPLES qt)
+    message (STATUS "Info: qt samples excluded due to BUILD_MODULE_QtSamples is disabled")
   endif()
 
   if (NOT BUILD_Inspector)
-    list (REMOVE_ITEM tools_SAMPLES_TOOLKITS TInspectorEXE)
+    list (REMOVE_ITEM OCCT_SAMPLES tools)
     message (STATUS "Info: TInspectorEXE sample excluded due to BUILD_Inspector is disabled")
   endif()
 
diff --git a/adm/templates/sample.sh b/adm/templates/sample.sh
new file mode 100644 (file)
index 0000000..44e337a
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+if [ "$1" == "" ]; then
+  echo Launch selected sample as follows:
+  echo   sample.sh SampleName d
+  echo or to use last sample build configuration:
+  echo   sample.sh SampleName
+  echo available samples:
+  echo    FuncDemo
+  echo    IESample
+  echo    Tutorial
+fi
+
+
+aCurrentPath="$PWD"
+aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
+
+source "${aScriptPath}/env.sh" "$2"
+
+if test "${QTDIR}" == ""; then
+  if [ -d "$QTDIR%\qml" ];
+    then export QML2_IMPORT_PATH="$QTDIR\qml";
+  fi
+fi
+
+export "EXE_PATH=$CSF_OCCTBinPath/$1"
+
+if [ ! -f "$EXE_PATH" ]; then
+  echo "Executable \"$EXE_PATH\" not found."
+  echo "Probably you didn't compile the application."
+  exit 1
+fi
+
+cd ${aCurrentPath}
+"$EXE_PATH"
\ No newline at end of file