0029571: Samples: build qt samples together with OCCT
authornds <nds@opencascade.com>
Sun, 18 Mar 2018 12:34:17 +0000 (15:34 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 22 Mar 2018 12:11:27 +0000 (15:11 +0300)
Extending CMake procedure by 'BUILD_MODULE_QtSamples' variable to switch on qt samples build.
Implementation required:
- union of occt_toolkit_tool.cmake and occt_toolkit.cmake files;
- correction of qt samples sources by adding path to Qt 'plugins' folder. It helps to avoid definition of additional variable (QT_QPA_PLATFORM_PLUGIN_PATH) when staring sample.bat for qt samples;
- executable processing is extended in cmake procedure by providing 'EXECUTABLE_PROJECT' variable. Now we need not specify custom processing for DRAWEXE in occt_toolkit.cmake

82 files changed:
CMakeLists.txt
adm/SAMPLES [new file with mode: 0644]
adm/SAMPLES_RESOURCES [new file with mode: 0644]
adm/cmake/occt_macros.cmake
adm/cmake/occt_toolkit.cmake
adm/cmake/occt_toolkit_prepare_sample.cmake [new file with mode: 0644]
adm/cmake/occt_toolkit_prepare_tool.cmake [new file with mode: 0644]
adm/cmake/occt_toolkit_tool.cmake [deleted file]
adm/cmake/qt_macro.cmake
adm/cmake/vardescr.cmake
adm/templates/sample.bat
samples/qt/AndroidQt/AndroidQt.pro
samples/qt/AndroidQt/AndroidQt.qrc [deleted file]
samples/qt/AndroidQt/CMakeLists.txt [new file with mode: 0644]
samples/qt/AndroidQt/EXTERNLIB [new file with mode: 0644]
samples/qt/AndroidQt/FILES [new file with mode: 0644]
samples/qt/AndroidQt/PACKAGES [new file with mode: 0644]
samples/qt/AndroidQt/ReadMe.md
samples/qt/AndroidQt/res/qml/main.qml
samples/qt/AndroidQt/src/AndroidQt.cxx [moved from samples/qt/AndroidQt/AndroidQt.cxx with 100% similarity]
samples/qt/AndroidQt/src/AndroidQt.h [moved from samples/qt/AndroidQt/AndroidQt.h with 100% similarity]
samples/qt/AndroidQt/src/AndroidQt.qrc [new file with mode: 0644]
samples/qt/AndroidQt/src/AndroidQt_TouchParameters.cxx [moved from samples/qt/AndroidQt/AndroidQt_TouchParameters.cxx with 100% similarity]
samples/qt/AndroidQt/src/AndroidQt_TouchParameters.h [moved from samples/qt/AndroidQt/AndroidQt_TouchParameters.h with 100% similarity]
samples/qt/AndroidQt/src/AndroidQt_UserInteractionParameters.h [moved from samples/qt/AndroidQt/AndroidQt_UserInteractionParameters.h with 100% similarity]
samples/qt/AndroidQt/src/AndroidQt_Window.cxx [moved from samples/qt/AndroidQt/AndroidQt_Window.cxx with 100% similarity]
samples/qt/AndroidQt/src/AndroidQt_Window.h [moved from samples/qt/AndroidQt/AndroidQt_Window.h with 100% similarity]
samples/qt/AndroidQt/src/FILES [new file with mode: 0644]
samples/qt/AndroidQt/src/Main.cxx [moved from samples/qt/AndroidQt/Main.cxx with 93% similarity]
samples/qt/Common/src/ApplicationCommon.cxx
samples/qt/Common/src/DocumentCommon.cxx
samples/qt/Common/src/FILES [new file with mode: 0644]
samples/qt/Common/src/MDIWindow.cxx
samples/qt/FuncDemo/CMakeLists.txt [new file with mode: 0644]
samples/qt/FuncDemo/EXTERNLIB [new file with mode: 0644]
samples/qt/FuncDemo/FILES [new file with mode: 0644]
samples/qt/FuncDemo/FuncDemo.pro
samples/qt/FuncDemo/PACKAGES [new file with mode: 0644]
samples/qt/FuncDemo/env.bat
samples/qt/FuncDemo/src/FILES [new file with mode: 0644]
samples/qt/FuncDemo/src/FuncDemo.qrc [new file with mode: 0644]
samples/qt/FuncDemo/src/main.cpp
samples/qt/IESample/CMakeLists.txt [new file with mode: 0644]
samples/qt/IESample/EXTERNLIB [new file with mode: 0644]
samples/qt/IESample/FILES [new file with mode: 0644]
samples/qt/IESample/PACKAGES [new file with mode: 0644]
samples/qt/IESample/env.bat
samples/qt/IESample/src/FILES [new file with mode: 0644]
samples/qt/IESample/src/Main.cxx
samples/qt/Interface/src/Application.cxx
samples/qt/Interface/src/FILES [new file with mode: 0644]
samples/qt/Tutorial/CMakeLists.txt [new file with mode: 0644]
samples/qt/Tutorial/EXTERNLIB [new file with mode: 0644]
samples/qt/Tutorial/FILES [new file with mode: 0644]
samples/qt/Tutorial/PACKAGES [new file with mode: 0644]
samples/qt/Tutorial/env.bat
samples/qt/Tutorial/src/ApplicationTut.cxx
samples/qt/Tutorial/src/FILES [new file with mode: 0644]
samples/qt/Tutorial/src/Main.cxx
samples/tools/TInspectorEXE/CMakeLists.txt
samples/tools/TInspectorEXE/FILES
samples/tools/TInspectorEXE/PACKAGES [new file with mode: 0644]
samples/tools/TInspectorEXE/TInspectorEXE.qrc [deleted file]
samples/tools/TInspectorEXE/src/FILES [new file with mode: 0644]
samples/tools/TInspectorEXE/src/TInspectorEXE.cxx [moved from samples/tools/TInspectorEXE/TInspectorEXE.cxx with 93% similarity]
samples/tools/TInspectorEXE/src/TInspectorEXE.qrc [new file with mode: 0644]
samples/tools/TInspectorEXE/src/TInspectorEXE_OpenFileDialog.cxx [moved from samples/tools/TInspectorEXE/TInspectorEXE_OpenFileDialog.cxx with 98% similarity]
samples/tools/TInspectorEXE/src/TInspectorEXE_OpenFileDialog.hxx [moved from samples/tools/TInspectorEXE/TInspectorEXE_OpenFileDialog.hxx with 100% similarity]
samples/tools/TInspectorEXE/src/TInspectorEXE_OpenFileViewModel.cxx [moved from samples/tools/TInspectorEXE/TInspectorEXE_OpenFileViewModel.cxx with 100% similarity]
samples/tools/TInspectorEXE/src/TInspectorEXE_OpenFileViewModel.hxx [moved from samples/tools/TInspectorEXE/TInspectorEXE_OpenFileViewModel.hxx with 100% similarity]
samples/tools/TStandalone/adm/cmake/occt_toolkit_standalone.cmake
src/DRAWEXE/CMakeLists.txt
tools/DFBrowserPane/DFBrowserPane.hxx
tools/TInspector/TInspector_Communicator.cxx
tools/TKDFBrowser/CMakeLists.txt
tools/TKShapeView/CMakeLists.txt
tools/TKTInspector/CMakeLists.txt
tools/TKTInspectorAPI/CMakeLists.txt
tools/TKToolsDraw/CMakeLists.txt
tools/TKTreeModel/CMakeLists.txt
tools/TKVInspector/CMakeLists.txt
tools/TKView/CMakeLists.txt

index 2dbe95f..beee192 100644 (file)
@@ -346,6 +346,7 @@ separate_arguments (BUILD_ADDITIONAL_TOOLKITS)
 if (MSVC)
   set (BUILD_MODULE_MfcSamples OFF CACHE BOOL "${BUILD_MODULE_MfcSamples_DESCR}")
 endif()
+set (BUILD_MODULE_QtSamples OFF CACHE BOOL "${BUILD_MODULE_QtSamples_DESCR}")
 
 set (BUILD_Inspector OFF CACHE BOOL "${BUILD_Inspector_DESCR}")
 
@@ -381,7 +382,7 @@ endif()
 # include the patched or original list of modules
 # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits
 # list <OCCT_MODULES> will contain all modules
-OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES)
+OCCT_MODULES_AND_TOOLKITS (MODULES "TOOLKITS" OCCT_MODULES)
 
 foreach (OCCT_MODULE ${OCCT_MODULES})
   BUILD_MODULE (${OCCT_MODULE})
@@ -775,30 +776,31 @@ else()
   set (SCRIPT_EXT sh)
 endif()
 
+if (BUILD_Inspector OR BUILD_MODULE_QtSamples)
+  # check qt 3rdparty path
+  add_definitions (-DHAVE_QT)
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
+  message (STATUS "Info: Qt is used by OCCT")
+else()
+  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_QT")
+  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TQTMALLOC")
+  OCCT_CHECK_AND_UNSET ("INSTALL_QT")
+endif()
+
 # OCCT tools
 # include the patched or original list of tools
 # list <TOOLNAME>_TOOLKITS is created foreach tool and contains its toolkits
 # list <OCCT_TOOLS> will contain all tools
-if (NOT BUILD_Inspector)
-  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_QT")
-  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TQTMALLOC")
-  OCCT_CHECK_AND_UNSET ("INSTALL_QT")
-else()
-  OCCT_TOOLS_AND_TOOLKITS (OCCT_TOOLS)
+if (BUILD_Inspector)
+  OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
   foreach (OCCT_TOOL ${OCCT_TOOLS})
     list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
   endforeach()
 
-  # collect all the headers to <binary dir>/inc folder
+  # collect all the headers to <binary dir>/inc/inspector folder
   string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
-  message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT tool header files into ${CMAKE_BINARY_DIR}/tools/inc ...")
+  message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT tool header files into ${CMAKE_BINARY_DIR}/inc/inspector ...")
   COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOL_TOOLKITS}" "${CMAKE_SOURCE_DIR}/tools" "${INSTALL_DIR_INCLUDE}/inspector")
-
-
-  # check qt 3rdparty path
-  add_definitions (-DHAVE_QT)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
-  message (STATUS "Info: Qt is used by OCCT")
 endif()
 
 # OCCT samples
@@ -896,7 +898,7 @@ OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${S
 # write current custom.bat/sh (for build directory)
 OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}")
 
-if (BUILD_MODULE_MfcSamples)
+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}")
 endif()
@@ -924,6 +926,15 @@ foreach(RESOURCE ${RESOURCES})
   endif()
 endforeach()
 
+if (BUILD_MODULE_QtSamples)
+  FILE_TO_LIST ("adm/SAMPLES_RESOURCES" SAMPLES_RESOURCES)
+  foreach(RESOURCE ${SAMPLES_RESOURCES})
+    OCCT_INSTALL_FILE_OR_DIR ("samples/${RESOURCE}" "${INSTALL_DIR_RESOURCE}/samples")
+    #message("Copy Sample resources: samples/${RESOURCE} into ${INSTALL_DIR_RESOURCE}/samples")
+  endforeach()
+endif()
+
+
 # patch installed DrawDefault file if BUILD_SHARED_LIBRARY_NAME_POSTFIX is changed
 if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
   OCCT_UPDATE_DRAW_DEFAULT_FILE()
@@ -968,9 +979,11 @@ endif()
 
 message (STATUS "Info: \(${CURRENT_TIME}\) OCCT toolkits processed")
 # samples do not support patch usage
-if (BUILD_MODULE_MfcSamples)
+if (BUILD_MODULE_MfcSamples OR BUILD_MODULE_QtSamples)
   set (OCCT_ROOT ${CMAKE_SOURCE_DIR})
+endif()
 
+if (BUILD_MODULE_MfcSamples)
   set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard)
   set (COMMON_WINMAIN_FILE      ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp)
 
@@ -989,6 +1002,33 @@ if (BUILD_MODULE_MfcSamples)
   message (STATUS "Info: \(${CURRENT_TIME}\) MFC Sample projects added")
 endif()
 
+OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES)
+
+if (BUILD_MODULE_QtSamples)
+  if (NOT Qt5_FOUND OR NOT USE_GLES2)
+    list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt)
+    message (STATUS "Info: AndroidQt sample excluded due to Qt5 or GLES2 usage are disabled")
+  endif()
+
+  if (NOT BUILD_Inspector)
+    list (REMOVE_ITEM tools_SAMPLES_TOOLKITS TInspectorEXE)
+    message (STATUS "Info: TInspectorEXE sample excluded due to BUILD_Inspector is disabled")
+  endif()
+
+  foreach (OCCT_SAMPLE ${OCCT_SAMPLES})
+    list (APPEND BUILD_SAMPLE_TOOLKITS ${${OCCT_SAMPLE}_SAMPLES_TOOLKITS})
+
+    # collect all the headers to <binary dir>/inc/samples folder
+    string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
+    message (STATUS "Info: \(${CURRENT_TIME}\) ${OCCT_SAMPLE} Sample projects added")
+
+    # include patched toolkit projects or original ones
+    foreach (BUILD_SAMPLE_TOOLKIT ${${OCCT_SAMPLE}_SAMPLES_TOOLKITS})
+      OCCT_ADD_SUBDIRECTORY ("samples/${OCCT_SAMPLE}/${BUILD_SAMPLE_TOOLKIT}")
+    endforeach()
+  endforeach()
+endif()
+
 if (BUILD_MODULE_UwpSample)
   add_subdirectory(samples/xaml)
 endif()
@@ -1003,11 +1043,6 @@ if (BUILD_TOOL_TOOLKITS)
             PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
   endif()
 
-  set (BUILD_SAMPLE_TOOLKITS TInspectorEXE)
-  foreach (BUILD_SAMPLE_TOOL_TOOLKIT ${BUILD_SAMPLE_TOOLKITS})
-    OCCT_ADD_SUBDIRECTORY ("samples/tools/${BUILD_SAMPLE_TOOL_TOOLKIT}")
-  endforeach()
-
   # patch TInspectorEXE
   OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/samples/tools/TInspectorEXE/TInspectorEXE.vcxproj.user")
 endif()
diff --git a/adm/SAMPLES b/adm/SAMPLES
new file mode 100644 (file)
index 0000000..d9f7257
--- /dev/null
@@ -0,0 +1,2 @@
+qt AndroidQt FuncDemo IESample Tutorial
+tools TInspectorEXE
\ No newline at end of file
diff --git a/adm/SAMPLES_RESOURCES b/adm/SAMPLES_RESOURCES
new file mode 100644 (file)
index 0000000..a353f3f
--- /dev/null
@@ -0,0 +1,2 @@
+qt/Common/res/
+qt/Tutorial/res/
\ No newline at end of file
index faea170..1ba4f79 100644 (file)
@@ -502,11 +502,11 @@ function (OCCT_TOOLKIT_FULL_DEP TOOLKIT_NAME TOOLKIT_FULL_DEPS)
   set (${TOOLKIT_FULL_DEPS} ${LOCAL_TOOLKIT_FULL_DEPS} PARENT_SCOPE)
 endfunction()
 
-# Function to get list of modules and toolkits from file adm/MODULES.
+# Function to get list of modules/toolkits/samples from file adm/${FILE_NAME}.
 # Creates list <$MODULE_LIST> to store list of MODULES and
-# <NAME_OF_MODULE>_TOOLKITS foreach module to store its toolkits.
-function (OCCT_MODULES_AND_TOOLKITS MODULE_LIST)
-  FILE_TO_LIST ("adm/MODULES" FILE_CONTENT)
+# <NAME_OF_MODULE>_TOOLKITS foreach module to store its toolkits, where "TOOLKITS" is defined by TOOLKITS_NAME_SUFFIX.
+function (OCCT_MODULES_AND_TOOLKITS FILE_NAME TOOLKITS_NAME_SUFFIX MODULE_LIST)
+  FILE_TO_LIST ("adm/${FILE_NAME}" FILE_CONTENT)
 
   foreach (CONTENT_LINE ${FILE_CONTENT})
     string (REPLACE " " ";" CONTENT_LINE ${CONTENT_LINE})
@@ -514,30 +514,12 @@ function (OCCT_MODULES_AND_TOOLKITS MODULE_LIST)
     list (REMOVE_AT CONTENT_LINE 0)
     list (APPEND ${MODULE_LIST} ${MODULE_NAME})
     # (!) REMOVE THE LINE BELOW (implicit variables)
-    set (${MODULE_NAME}_TOOLKITS ${CONTENT_LINE} PARENT_SCOPE)
+    set (${MODULE_NAME}_${TOOLKITS_NAME_SUFFIX} ${CONTENT_LINE} PARENT_SCOPE)
   endforeach()
 
   set (${MODULE_LIST} ${${MODULE_LIST}} PARENT_SCOPE)
 endfunction()
 
-# Function to get list of tools and toolkits from file adm/TOOLS.
-# Creates list <$TOOL_LIST> to store list of TOOLS and
-# <NAME_OF_TOOL>_TOOLKITS foreach tool to store its toolkits.
-function (OCCT_TOOLS_AND_TOOLKITS TOOL_LIST)
-  FILE_TO_LIST ("adm/TOOLS" FILE_CONTENT)
-
-  foreach (CONTENT_LINE ${FILE_CONTENT})
-    string (REPLACE " " ";" CONTENT_LINE ${CONTENT_LINE})
-    list (GET CONTENT_LINE 0 TOOL_NAME)
-    list (REMOVE_AT CONTENT_LINE 0)
-    list (APPEND ${TOOL_LIST} ${TOOL_NAME})
-    # (!) REMOVE THE LINE BELOW (implicit variables)
-    set (${TOOL_NAME}_TOOL_TOOLKITS ${CONTENT_LINE} PARENT_SCOPE)
-  endforeach()
-
-  set (${TOOL_LIST} ${${TOOL_LIST}} PARENT_SCOPE)
-endfunction()
-
 # Returns OCC version string from file Standard_Version.hxx (if available)
 function (OCC_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT)
 
index 4510755..689ed40 100644 (file)
@@ -1,12 +1,40 @@
 # script for each OCCT toolkit
 
+# filling some variables by default values(src) or using custom(tools, samples)
+set (RELATIVE_SOURCES_DIR "${RELATIVE_DIR}")
+if ("${RELATIVE_SOURCES_DIR}" STREQUAL "")
+  #if it is not defined, use default directory
+  set (RELATIVE_SOURCES_DIR "src")
+endif()
+
+set (OCC_MODULES_LIST "${MODULES_LIST}")
+if ("${OCC_MODULES_LIST}" STREQUAL "")
+  set (OCC_MODULES_LIST ${OCCT_MODULES})
+endif()
+
+set (OCC_TARGET_FOLDER "${TARGET_FOLDER}")
+if ("${OCC_TARGET_FOLDER}" STREQUAL "")
+  set (OCC_TARGET_FOLDER "Modules")
+endif()
+
+set (OCCT_TOOLKITS_NAME_SUFFIX "${TOOLKITS_NAME_SUFFIX}")
+if ("${OCCT_TOOLKITS_NAME_SUFFIX}" STREQUAL "")
+  set (OCCT_TOOLKITS_NAME_SUFFIX "TOOLKITS")
+endif()
+
 # parce PACKAGES file
-if ("${PROJECT_NAME}" STREQUAL DRAWEXE)
-  set (USED_PACKAGES DRAWEXE)
-else()
-  FILE_TO_LIST ("src/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
+FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
+if ("${USED_PACKAGES}" STREQUAL "")
+  set (USED_PACKAGES ${PROJECT_NAME})
 endif()
 
+if (USE_QT)
+  # Qt dependencies
+  OCCT_INCLUDE_CMAKE_FILE (adm/cmake/qt_macro)
+  FIND_QT_PACKAGE(PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT_INCLUDES)
+  include_directories("${PROJECT_INCLUDES}")
+endif(USE_QT)
+
 set (PRECOMPILED_DEFS)
 
 if (NOT BUILD_SHARED_LIBS)
@@ -17,16 +45,26 @@ if (NOT BUILD_SHARED_LIBS)
 endif()
 
 # Get all used packages from toolkit
+UNSET(RESOURCE_FILES)
 foreach (OCCT_PACKAGE ${USED_PACKAGES})
-  
+
+  #remove part after "/" in the OCCT_PACKAGE variable if exists
+  string (FIND "${OCCT_PACKAGE}" "/" _index)
+  if (_index GREATER -1)
+    math (EXPR _index "${_index}")
+    string (SUBSTRING "${OCCT_PACKAGE}" 0 ${_index} OCCT_PACKAGE_NAME)
+  else()
+    set (OCCT_PACKAGE_NAME "${OCCT_PACKAGE}")
+  endif()
+
   # TKService contains platform-dependent packages: Xw and WNT
   if ((WIN32 AND "${OCCT_PACKAGE}" STREQUAL "Xw") OR (NOT WIN32 AND "${OCCT_PACKAGE}" STREQUAL "WNT"))
     # do nothing
   else()
 
-#    if (WIN32)
-#      list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE}_DLL")
-#    endif()
+    if (WIN32)
+      list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE_NAME}_DLL")
+    endif()
 
     set (SOURCE_FILES)
     set (HEADER_FILES)
@@ -35,11 +73,11 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
     if (${BUILD_YACCLEX})
 
       # flex files
-      OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
+      OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
       list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
 
       # bison files
-      OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
+      OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
       list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
 
       if (${SOURCE_FILES_FLEX_LEN} EQUAL ${SOURCE_FILES_BISON_LEN} AND NOT ${SOURCE_FILES_FLEX_LEN} EQUAL 0)
@@ -61,8 +99,8 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
           if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
             set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.c)
             set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.c)
-            BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME}")
-            FLEX_TARGET  (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME}")
+            BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME}")
+            FLEX_TARGET  (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME}")
             ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
            
             list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})
@@ -72,23 +110,23 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
     endif()
 
     # header files
-    if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES")
-      file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M   REGEX ".+[.]h")
-      file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
-      file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
+    if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES")
+      file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_M   REGEX ".+[.]h")
+      file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
+      file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
 
-      file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
+      file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
       if(APPLE)
-        file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
+        file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
       endif()
     else()
-      file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES"     HEADER_FILES_M   REGEX ".+[.]h")
-      file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES"     HEADER_FILES_LXX REGEX ".+[.]lxx")
-      file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES"     HEADER_FILES_GXX REGEX ".+[.]gxx")
+      file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"     HEADER_FILES_M   REGEX ".+[.]h")
+      file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"     HEADER_FILES_LXX REGEX ".+[.]lxx")
+      file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"     HEADER_FILES_GXX REGEX ".+[.]gxx")
 
-      file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES"     SOURCE_FILES_C REGEX ".+[.]c")
+      file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"     SOURCE_FILES_C REGEX ".+[.]c")
       if(APPLE)
-        file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES"   SOURCE_FILES_M REGEX ".+[.]mm")
+        file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"   SOURCE_FILES_M REGEX ".+[.]mm")
       endif()
     endif()
     
@@ -99,26 +137,36 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
     endif()
 
     foreach(HEADER_FILE ${HEADER_FILES})
-      if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
-        message (STATUS "Info: consider patched file: ${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
-        list (APPEND USED_INCFILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
-        SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
+      if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
+        message (STATUS "Info: consider patched file: ${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
+        list (APPEND USED_INCFILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
+        SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE_NAME}" FILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
       else()
-        list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
-        SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
+        list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
+        SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE_NAME}" FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
       endif()
     endforeach()
 
     foreach(SOURCE_FILE ${SOURCE_FILES})
-      if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        message (STATUS "Info: consider patched file: ${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        list (APPEND USED_SRCFILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
+      if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
+        message (STATUS "Info: consider patched file: ${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
+        list (APPEND USED_SRCFILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
+        SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE_NAME}" FILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
       else()
-        list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
+        list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
+        SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE_NAME}" FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
       endif()
     endforeach()
+
+    if (USE_QT)
+      FIND_AND_INSTALL_QT_RESOURCES (${OCCT_PACKAGE} RESOURCE_FILES)
+      #message("Qt Resource files are: ${QT_RESOURCE_FILES} in ${OCCT_PACKAGE}")
+    endif(USE_QT)
+
+    #message("Resource files are: ${RESOURCE_FILES} in ${OCCT_PACKAGE}")
+    foreach(RESOURCE_FILE ${RESOURCE_FILES})
+      SOURCE_GROUP ("Resource Files\\${OCCT_PACKAGE_NAME}" FILES "${RESOURCE_FILE}")
+    endforeach()
   endif()
 endforeach()
 string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
@@ -135,8 +183,9 @@ if (MSVC)
 endif()
 
 set (CURRENT_MODULE)
-foreach (OCCT_MODULE ${OCCT_MODULES})
-  list (FIND ${OCCT_MODULE}_TOOLKITS ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
+foreach (OCCT_MODULE ${OCC_MODULES_LIST})
+  list (FIND ${OCCT_MODULE}_${OCCT_TOOLKITS_NAME_SUFFIX} ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
+
   if (NOT ${CURRENT_PROJECT_IS_BUILT} EQUAL -1)
     set (CURRENT_MODULE ${OCCT_MODULE})
   endif()
@@ -146,13 +195,18 @@ if (WIN32)
   OCCT_INSERT_CODE_FOR_TARGET ()
 endif()
 
-if ("${PROJECT_NAME}" STREQUAL "DRAWEXE")
-  add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
+if (USE_QT)
+  FIND_AND_WRAP_MOC_FILES("${USED_INCFILES}" "${PROJECT_NAME}_MOC_FILES")
+  #message("MOC files: ${${PROJECT_NAME}_MOC_FILES}")
+endif (USE_QT)
+
+if (EXECUTABLE_PROJECT)
+  add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
 
   install (TARGETS ${PROJECT_NAME}
            DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
 else()
-  add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
+  add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
 
   if (MSVC)
     install (FILES  ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
@@ -181,7 +235,7 @@ else()
 endif()
 
 if (CURRENT_MODULE)
-  set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
+  set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "${OCC_TARGET_FOLDER}/${CURRENT_MODULE}")
   set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
   if (APPLE)
     if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
@@ -207,7 +261,7 @@ set (USED_TOOLKITS_BY_CURRENT_PROJECT)
 set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
 
 # parce EXTERNLIB file
-FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
+FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
 foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
   string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
   if (NOT COMMENT_FOUND)
@@ -303,6 +357,15 @@ if (BUILD_SHARED_LIBS)
   target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
 endif()
 
+if (USE_QT)
+  foreach (PROJECT_LIBRARY_DEBUG ${PROJECT_LIBRARIES_DEBUG})
+    target_link_libraries (${PROJECT_NAME} debug ${PROJECT_LIBRARY_DEBUG})
+  endforeach()
+  foreach (PROJECT_LIBRARY_RELEASE ${PROJECT_LIBRARIES_RELEASE})
+    target_link_libraries (${PROJECT_NAME} optimized ${PROJECT_LIBRARY_RELEASE})
+  endforeach()
+endif()
+
 # suppress deprecation warnings inside OCCT itself for old gcc versions with unavailable Standard_DISABLE_DEPRECATION_WARNINGS
 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
   if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6.0)
diff --git a/adm/cmake/occt_toolkit_prepare_sample.cmake b/adm/cmake/occt_toolkit_prepare_sample.cmake
new file mode 100644 (file)
index 0000000..ecc5ba0
--- /dev/null
@@ -0,0 +1,18 @@
+if ("${TARGET_FOLDER}" STREQUAL "")
+  set (EXECUTABLE_PROJECT ON)
+  set (USE_QT ON)
+
+  set (RELATIVE_DIR "samples/qt")
+  set (MODULES_LIST ${OCCT_SAMPLES})
+  set (TARGET_FOLDER "Samples")
+  set (TOOLKITS_NAME_SUFFIX "SAMPLES_TOOLKITS")
+
+  include_directories("${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/${RELATIVE_DIR}")
+else()
+  unset (USE_QT)
+  unset (RELATIVE_DIR)
+  unset (EXECUTABLE_PROJECT)
+  unset (MODULES_LIST)
+  unset (TARGET_FOLDER)
+  unset (TOOLKITS_NAME_SUFFIX)
+endif("${TARGET_FOLDER}" STREQUAL "")
diff --git a/adm/cmake/occt_toolkit_prepare_tool.cmake b/adm/cmake/occt_toolkit_prepare_tool.cmake
new file mode 100644 (file)
index 0000000..eed173a
--- /dev/null
@@ -0,0 +1,13 @@
+if ("${TARGET_FOLDER}" STREQUAL "")
+  set (USE_QT ON)
+  set (RELATIVE_DIR "tools")
+  set (MODULES_LIST ${OCCT_TOOLS})
+  set (TARGET_FOLDER "Tools")
+  set (TOOLKITS_NAME_SUFFIX "TOOL_TOOLKITS")
+else()
+  unset (USE_QT)
+  unset (RELATIVE_DIR)
+  unset (MODULES_LIST)
+  unset (TARGET_FOLDER)
+  unset (TOOLKITS_NAME_SUFFIX)
+endif("${TARGET_FOLDER}" STREQUAL "")
diff --git a/adm/cmake/occt_toolkit_tool.cmake b/adm/cmake/occt_toolkit_tool.cmake
deleted file mode 100644 (file)
index d934de6..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-# script for each OCCT tool toolkit
-
-# Qt dependencies
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/qt_macro)
-
-FIND_QT_PACKAGE(PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT_INCLUDES)
-include_directories("${PROJECT_INCLUDES}"
-                    "${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/tools")
-
-FILE_TO_LIST ("tools/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
-# parce PACKAGES file
-
-if ("${PROJECT_NAME}" STREQUAL TInspectorEXE)
-  set (USED_PACKAGES ${PROJECT_NAME})
-  set (PACKAGE_PREFIX_DIR "samples/tools")
-  include_directories("${PROJECT_INCLUDES}"
-                      "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${PROJECT_NAME}")
-else()
-  FILE_TO_LIST ("tools/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
-  set (PACKAGE_PREFIX_DIR "tools")
-endif()
-
-
-SET (RCC_FILES)
-foreach (OCCT_PACKAGE ${USED_PACKAGES})
-  #message("Dir is ${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${OCCT_PACKAGE}.qrc")
-  FIND_AND_WRAP_RESOURCE_FILE("${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${OCCT_PACKAGE}.qrc" RCC_FILES)
-endforeach()
-#message("RCC_FILES for ${PROJECT_NAME} are ${RCC_FILES}")
-
-set (PRECOMPILED_DEFS)
-
-if (NOT BUILD_SHARED_LIBS)
-  list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
-  if (WIN32)
-    list (APPEND PRECOMPILED_DEFS "-DOCCT_STATIC_BUILD")
-  endif()
-endif()
-
-# Get all used packages from toolkit
-foreach (OCCT_PACKAGE ${USED_PACKAGES})
-
-  ADD_DEFINITIONS(-D${OCCT_PACKAGE}_EXPORTS)
-  
-  # TKService contains platform-dependent packages: Xw and WNT
-  if ((WIN32 AND "${OCCT_PACKAGE}" STREQUAL "Xw") OR (NOT WIN32 AND "${OCCT_PACKAGE}" STREQUAL "WNT"))
-    # do nothing
-  else()
-
-#    if (WIN32)
-#      list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE}_DLL")
-#    endif()
-
-    set (SOURCE_FILES)
-    set (HEADER_FILES)
-
-    # Generate Flex and Bison files
-    if (${BUILD_YACCLEX})
-
-      # flex files
-      OCCT_ORIGIN_AND_PATCHED_FILES ("tools/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
-      list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
-
-      # bison files
-      OCCT_ORIGIN_AND_PATCHED_FILES ("tools/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
-      list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
-
-      if (${SOURCE_FILES_FLEX_LEN} EQUAL ${SOURCE_FILES_BISON_LEN} AND NOT ${SOURCE_FILES_FLEX_LEN} EQUAL 0)
-      
-        list (SORT SOURCE_FILES_FLEX)
-        list (SORT SOURCE_FILES_BISON)
-
-        math (EXPR SOURCE_FILES_FLEX_LEN "${SOURCE_FILES_FLEX_LEN} - 1")
-        foreach (FLEX_FILE_INDEX RANGE ${SOURCE_FILES_FLEX_LEN})
-
-          list (GET SOURCE_FILES_FLEX ${FLEX_FILE_INDEX} CURRENT_FLEX_FILE)
-          get_filename_component (CURRENT_FLEX_FILE_NAME ${CURRENT_FLEX_FILE} NAME_WE)
-
-          list (GET SOURCE_FILES_BISON ${FLEX_FILE_INDEX} CURRENT_BISON_FILE)
-          get_filename_component (CURRENT_BISON_FILE_NAME ${CURRENT_BISON_FILE} NAME_WE)
-          
-          string (COMPARE EQUAL ${CURRENT_FLEX_FILE_NAME} ${CURRENT_BISON_FILE_NAME} ARE_FILES_EQUAL)
-
-          if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
-            set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.c)
-            set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.c)
-            BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/tools/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME}")
-            FLEX_TARGET  (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/tools/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME}")
-            ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
-           
-            list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})
-          endif()
-        endforeach()
-      endif()
-    endif()
-
-    # header files
-    if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/FILES")
-      file (STRINGS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/FILES" HEADER_FILES_M   REGEX ".+[.]h")
-      file (STRINGS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
-      file (STRINGS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
-
-      file (STRINGS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
-      if(APPLE)
-        file (STRINGS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
-      endif()
-    else()
-      file (STRINGS "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/FILES"     HEADER_FILES_M   REGEX ".+[.]h")
-      file (STRINGS "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/FILES"     HEADER_FILES_LXX REGEX ".+[.]lxx")
-      file (STRINGS "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/FILES"     HEADER_FILES_GXX REGEX ".+[.]gxx")
-
-      file (STRINGS "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/FILES"     SOURCE_FILES_C REGEX ".+[.]c")
-      if(APPLE)
-        file (STRINGS "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/FILES"   SOURCE_FILES_M REGEX ".+[.]mm")
-      endif()
-    endif()
-
-
-    
-    list (APPEND HEADER_FILES ${HEADER_FILES_M} ${HEADER_FILES_LXX} ${SOURCE_FILES_GXX})
-    list (APPEND SOURCE_FILES ${SOURCE_FILES_C})
-    if(APPLE)
-      list (APPEND SOURCE_FILES ${SOURCE_FILES_M})
-    endif()
-
-    foreach(HEADER_FILE ${HEADER_FILES})
-      if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${HEADER_FILE}")
-        message (STATUS "Info: consider patched file: ${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${HEADER_FILE}")
-        list (APPEND USED_INCFILES "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${HEADER_FILE}")
-        SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${HEADER_FILE}")
-      else()
-        list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
-        SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
-      endif()
-    endforeach()
-
-
-    foreach(SOURCE_FILE ${SOURCE_FILES})
-      if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        message (STATUS "Info: consider patched file: ${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        list (APPEND USED_SRCFILES "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/tools/${OCCT_PACKAGE}/${SOURCE_FILE}")
-      else()
-        list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
-        SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
-      endif()
-    endforeach()
-  endif()
-endforeach()
-string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
-
-set (USED_RCFILE "")
-if (MSVC)
-  set (USED_RCFILE "${CMAKE_BINARY_DIR}/resources/${PROJECT_NAME}.rc")
-
-  if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in")
-    configure_file("${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
-  else()
-    configure_file("${CMAKE_SOURCE_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
-  endif()
-endif()
-
-set (CURRENT_MODULE)
-foreach (OCCT_MODULE ${OCCT_TOOLS})
-  list (FIND ${OCCT_MODULE}_TOOL_TOOLKITS ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
-  if (NOT ${CURRENT_PROJECT_IS_BUILT} EQUAL -1)
-    set (CURRENT_MODULE ${OCCT_MODULE})
-  endif()
-endforeach()
-
-if (WIN32)
-  OCCT_INSERT_CODE_FOR_TARGET ()
-endif()
-
-FIND_AND_WRAP_MOC_FILES("${USED_INCFILES}" "${PROJECT_NAME}_MOC_FILES")
-#message("MOC files: ${${PROJECT_NAME}_MOC_FILES}")
-
-if ("${PROJECT_NAME}" STREQUAL TInspectorEXE)
-  add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RCC_FILES} ${${PROJECT_NAME}_MOC_FILES})
-
-  install (TARGETS ${PROJECT_NAME}
-           DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
-else()
-  add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RCC_FILES} ${${PROJECT_NAME}_MOC_FILES})
-
-  if (MSVC)
-    install (FILES  ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
-             CONFIGURATIONS Debug RelWithDebInfo
-             DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
-  endif()
-
-  if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
-    set (CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT ${CMAKE_SHARED_LIBRARY_SUFFIX})
-    set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-  endif()
-
-  install (TARGETS ${PROJECT_NAME}
-           EXPORT OpenCASCADE${CURRENT_MODULE}Targets
-           RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
-           ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
-           LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
-
-
-  if (NOT WIN32)
-    if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
-      set (LINK_NAME    "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT}/tools")
-      set (LIBRARY_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}/tools")
-      OCCT_CREATE_SYMLINK_TO_FILE (${LIBRARY_NAME} ${LINK_NAME})
-    endif()
-  endif()
-endif()
-
-if (CURRENT_MODULE)
-  set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Tools/${CURRENT_MODULE}")
-  set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
-  if (APPLE)
-    if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
-      set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
-    endif()
-  endif()
-endif()
-
-get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
-get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
-get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
-
-if (ANDROID)
-  # do not append version to the filename
-  set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
-else()
-  set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
-                                                    SOVERSION     "${OCC_VERSION_MAJOR}"
-                                                    VERSION       "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
-endif()
-
-set (USED_TOOLKITS_BY_CURRENT_PROJECT)
-set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
-
-# parce EXTERNLIB file
-FILE_TO_LIST ("${PACKAGE_PREFIX_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
-foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
-  string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
-  if (NOT COMMENT_FOUND)
-    string (REGEX MATCH "^TK" TK_FOUND ${USED_ITEM})
-    string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM})
-    
-    if (NOT "${TK_FOUND}" STREQUAL "" OR NOT "${VTK_FOUND}" STREQUAL "")
-      list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
-      if (NOT "${VTK_FOUND}" STREQUAL "" AND BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
-        OCCT_INSTALL_VTK(${USED_ITEM})
-      endif()
-    else()
-      string (REGEX MATCH "^CSF_" CSF_FOUND ${USED_ITEM})
-      if ("${CSF_FOUND}" STREQUAL "")
-        message (STATUS "Info: ${USED_ITEM} from ${PROJECT_NAME} skipped due to it is empty")
-      else() # get CSF_ value
-        set (CURRENT_CSF ${${USED_ITEM}})
-        if (NOT "x${CURRENT_CSF}" STREQUAL "x")
-          # prepare a list from a string with whitespaces
-          separate_arguments (CURRENT_CSF)
-          list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
-        endif()
-      endif()
-    endif()
-  endif()
-endforeach()
-
-if (APPLE)
-  list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
-  if (NOT ${IS_X11_FOUND} EQUAL -1)
-    find_package (X11 COMPONENTS X11 Xext Xmu Xi)
-    if (NOT X11_FOUND)
-      message (STATUS "Warning: X11 is not found. It's required to install The XQuartz project: http://www.xquartz.org")
-    endif()
-  endif()
-endif()
-
-# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
-# Add VTK_OPENGL2_BACKEND definition.
-if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
-  add_definitions(-DVTK_OPENGL2_BACKEND)
-  foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
-    list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
-    if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
-      list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
-      if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
-        list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
-      endif()
-    endif()
-  endforeach()
-endif()
-
-if (BUILD_SHARED_LIBS)
-  target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
-endif()
-
-# Set Qt dependencies
-target_link_libraries(${PROJECT_NAME} "${PROJECT_LIBRARIES}")
-
-target_link_libraries(${PROJECT_NAME} debug "${PROJECT_LIBRARIES_DEBUG}")
-target_link_libraries(${PROJECT_NAME} optimized "${PROJECT_LIBRARIES_RELEASE}")
-
index 5cdbe9c..c535772 100644 (file)
@@ -12,13 +12,21 @@ macro (FIND_QT_PACKAGE PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT
 
   # Now we can apply standard CMake finder for Qt5. We do this mostly
   # to have qt5_wrap_cpp() function available
-  find_package(Qt5 QUIET COMPONENTS Widgets PATHS ${3RDPARTY_QT_DIR} NO_DEFAULT_PATH)
+  find_package(Qt5 QUIET COMPONENTS Widgets Quick PATHS ${3RDPARTY_QT_DIR} NO_DEFAULT_PATH)
   if (${Qt5_FOUND})
     #message (STATUS "Qt5 cmake configuration")
 
-    set(PROJECT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS}")
-    set(PROJECT_LIBRARIES_DEBUG "${Qt5Widgets_LIBRARIES}")
-    set(PROJECT_LIBRARIES_RELEASE "${Qt5Widgets_LIBRARIES}")
+    set(PROJECT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS}" "${Qt5Quick_INCLUDE_DIRS}")
+    set(PROJECT_LIBRARIES_DEBUG "${Qt5Widgets_LIBRARIES}" "${Qt5Quick_LIBRARIES}")
+    set(PROJECT_LIBRARIES_RELEASE "${Qt5Widgets_LIBRARIES}" "${Qt5Quick_LIBRARIES}")
+
+    # processing *.ts files to generate *.qm
+    find_package(Qt5LinguistTools)
+    get_target_property(QT_LRELEASE_EXECUTABLE Qt5::lrelease LOCATION)
+    mark_as_advanced(QT_LRELEASE_EXECUTABLE)
+
+    GET_FILENAME_COMPONENT(QT_BINARY_DIR ${QT_LRELEASE_EXECUTABLE} DIRECTORY)
+    MARK_AS_ADVANCED(QT_BINARY_DIR)
   else()
     # Now we can apply standard CMake finder for Qt. We do this mostly
     # to have qt4_wrap_cpp() function available
@@ -33,6 +41,7 @@ macro (FIND_QT_PACKAGE PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT
       set(PROJECT_LIBRARIES_DEBUG "${3RDPARTY_QT_DIR}/lib/libQtCore.so;${3RDPARTY_QT_DIR}/lib/libQtGui.so")
       set(PROJECT_LIBRARIES_RELEASE "${3RDPARTY_QT_DIR}/lib/libQtCore.so;${3RDPARTY_QT_DIR}/lib/libQtGui.so")
     endif(WIN32)
+    find_program(QT_LRELEASE_EXECUTABLE lrelease)
   endif()
 endmacro()
 
@@ -69,3 +78,57 @@ macro (FIND_AND_WRAP_RESOURCE_FILE RESOURCE_FILE_NAME RCC_FILES)
     endif()
   endif()
 endmacro()
+
+macro (FIND_AND_INSTALL_TS_FILE RESOURCE_FILE_NAME TARGET_FOLDER QM_FILES)
+  if(EXISTS "${RESOURCE_FILE_NAME}")
+    GET_FILENAME_COMPONENT(_name ${RESOURCE_FILE_NAME} NAME_WE)
+    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_name}.qm)
+    SET(_cmd_${_name} ${QT_LRELEASE_EXECUTABLE} ${RESOURCE_FILE_NAME} -qm ${_output})
+
+    set(TARGET_NAME ${_name}_resources)
+
+    if (NOT TARGET "${TARGET_NAME}")
+      add_custom_target(${TARGET_NAME} ALL COMMAND ${_cmd_${_name}} DEPENDS ${RESOURCE_FILE_NAME})
+      set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "${TARGET_FOLDER}")
+
+      list (APPEND ${QM_FILES} "${_output}")
+    endif()
+  endif()
+endmacro()
+
+macro (FIND_AND_INSTALL_QT_RESOURCES OCCT_PACKAGE RESOURCE_FILES)
+  file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"   TS_FILES   REGEX ".+[.]ts")
+  file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES"   QRC_FILES  REGEX ".+[.]qrc")
+
+  string (FIND "${OCCT_PACKAGE}" "/" _index)
+  if (_index GREATER -1)
+    math (EXPR _index "${_index}")
+    string (SUBSTRING "${OCCT_PACKAGE}" 0 ${_index} OCCT_PACKAGE_NAME)
+  else()
+    set (OCCT_PACKAGE_NAME "${OCCT_PACKAGE}")
+  endif(_index GREATER -1)
+
+  #message("QRC files are: ${QRC_FILES} in ${OCCT_PACKAGE}")
+  foreach (QRC_FILE ${QRC_FILES})
+    set (QRC_FILE_RELATIVE "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${QRC_FILE}")
+    if (EXISTS ${QRC_FILE_RELATIVE})
+      FIND_AND_WRAP_RESOURCE_FILE(${QRC_FILE_RELATIVE} RCC_FILES)
+      list (APPEND ${RESOURCE_FILES} "${RCC_FILES}")
+    endif()
+  endforeach()
+
+  #message("TS files are: ${TS_FILES} in ${OCCT_PACKAGE}")
+  foreach (TS_FILE ${TS_FILES})
+    set (TS_FILE_RELATIVE "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${TS_FILE}")
+    FIND_AND_INSTALL_TS_FILE(${TS_FILE_RELATIVE} "${TARGET_FOLDER}/${CURRENT_MODULE}" QM_FILES)
+    if (EXISTS ${TS_FILE_RELATIVE})
+      list (APPEND ${RESOURCE_FILES} "${TS_FILE_RELATIVE}")
+    endif()
+  endforeach()
+
+  foreach (QM_FILE ${QM_FILES})
+    INSTALL(FILES ${QM_FILE} DESTINATION "${INSTALL_DIR_RESOURCE}/samples")
+    #message("install *.qm files (${QM_FILE}) to: ${INSTALL_DIR_RESOURCE}/samples")
+  endforeach (QM_FILE ${QM_FILES})
+endmacro()
+
index c232762..f5c7d2b 100644 (file)
@@ -122,6 +122,11 @@ set (BUILD_MODULE_MfcSamples_DESCR
 These samples show some possibilities of using OCCT and they can be executed
 with script samples.bat from the installation directory (INSTALL_DIR)")
 
+set (BUILD_MODULE_QtSamples_DESCR
+"Indicates whether OCCT Qt samples should be built together with OCCT.
+These samples show some possibilities of using OCCT and they can be executed
+with script samples.bat from the installation directory (INSTALL_DIR)")
+
 set (BUILD_Inspector_DESCR
 "Indicates whether OCCT inspector should be built together with OCCT.
 This inspector provides functionality to interactively inspect low-level content
index 89b0fdb..0233466 100644 (file)
@@ -16,6 +16,10 @@ if ["%1"] == [""] (
   echo    HLR
   echo    Animation
   echo    Convert
+  echo    AndroidQt
+  echo    FuncDemo
+  echo    IESample
+  echo    Tutorial
   PAUSE
   exit /B
 )
index 7ddc34b..0b1527f 100644 (file)
@@ -2,12 +2,12 @@ TEMPLATE = app
 
 QT += qml quick widgets
 
-SOURCES += Main.cxx \
-           AndroidQt.cxx \
-           AndroidQt_Window.cxx \
-           AndroidQt_TouchParameters.cxx
+SOURCES += src/Main.cxx \
+           src/AndroidQt.cxx \
+           src/AndroidQt_Window.cxx \
+           src/AndroidQt_TouchParameters.cxx
 
-RESOURCES += AndroidQt.qrc
+RESOURCES += ./src/AndroidQt.qrc
 
 # Additional import path used to resolve QML modules in Qt Creator's code model
 QML_IMPORT_PATH =
@@ -19,10 +19,13 @@ include(OCCT.pri)
 include(Deployment.pri)
 
 HEADERS += \
-           AndroidQt.h \
-           AndroidQt_Window.h \
-           AndroidQt_TouchParameters.h \
-           AndroidQt_UserInteractionParameters.h
+           src/AndroidQt.h \
+           src/AndroidQt_Window.h \
+           src/AndroidQt_TouchParameters.h \
+           src/AndroidQt_UserInteractionParameters.h
+
+INCLUDEPATH += $$_PRO_FILE_PWD_/src
+DEPENDPATH  += $$_PRO_FILE_PWD_/src
 
 OTHER_FILES += \
     android/src/org/qtproject/example/AndroidQt/AndroidQt.java \
diff --git a/samples/qt/AndroidQt/AndroidQt.qrc b/samples/qt/AndroidQt/AndroidQt.qrc
deleted file mode 100644 (file)
index bcead84..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<RCC>
-    <qresource prefix="/">
-        <file>res/qml/main.qml</file>
-    </qresource>
-    <qresource prefix="/icons">
-        <file>res/icons/ic_action_collection.png</file>
-    </qresource>
-</RCC>
diff --git a/samples/qt/AndroidQt/CMakeLists.txt b/samples/qt/AndroidQt/CMakeLists.txt
new file mode 100644 (file)
index 0000000..126582e
--- /dev/null
@@ -0,0 +1,9 @@
+project(AndroidQt)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+
+ADD_DEFINITIONS(-DNO_Common_EXPORTS)
+
+
diff --git a/samples/qt/AndroidQt/EXTERNLIB b/samples/qt/AndroidQt/EXTERNLIB
new file mode 100644 (file)
index 0000000..fb5edc8
--- /dev/null
@@ -0,0 +1,17 @@
+TKernel
+TKMath
+TKG2d
+TKG3d
+TKGeomBase
+TKBRep
+TKGeomAlgo
+TKTopAlgo
+TKShHealing
+TKService
+TKMesh
+TKHLR
+TKV3d
+TKOpenGl
+CSF_FreeImagePlus
+CSF_FREETYPE
+CSF_OpenGlLibs
diff --git a/samples/qt/AndroidQt/FILES b/samples/qt/AndroidQt/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/samples/qt/AndroidQt/PACKAGES b/samples/qt/AndroidQt/PACKAGES
new file mode 100644 (file)
index 0000000..089247b
--- /dev/null
@@ -0,0 +1 @@
+AndroidQt/src
index 080f5cb..d39dafb 100644 (file)
@@ -13,8 +13,17 @@ Requirements for building sample:
 * Android SDK  from 2014.07.02 or newer
 * Android NDK r9d or newer
 * Apache Ant 1.9.4 or higher
-Configure project for building sample:
+* OCCT compiled under Android platform and placed in directories:
+  * occt\libs\armeabi-v7a\*.so and occt\inc\*.hxx (libraries and include files of OCCT install)
+  * android\assets\opencascade\shared\Shaders\* (Shaders folder of OCCT install: \share\opencascade\resources\Shaders)
+  * 3rdparty\include\freetype2\*, 3rdparty\include\FreeImage.h and 3rdparty\libs\armeabi-v7a\libFreeImage.so and 3rdparty\libs\armeabi-v7a\libfreetype.so
+
+It is also possible to to correct OCCT.pri file an get resources from another tree of directories.
+
+When AndroidQt will be started, it may be helpful to have some default data files(BRep) on Device for opening in AndroidQt.
+Copy these files into "android\assets\opencascade\shared" and it will be installed to device during compilation procedure.
+
+Having prepared all these products, configure AndroidQt project for building sample:
 
 In QtCreator, open AndroidQt.pro project-file:
 ~~~~
@@ -28,27 +37,52 @@ Tools->Options->Android
 * In JDK location specify path to Java Development Kit
 * In Android SDK location specify path to Android SDK
 * In Android NDK location specify path to Android NDK
+(During this location definition, warning is possible and OK:
+ "Qt version for architecture mips is missing. To add the Qt version, select Options > Build & Run > Qt Versins.")
 * In Ant executable specify path to ant.bat file located in Apache Ant bin directory
 
-Make sure that "Android for armeabi-v7a" kit has been detected
+Make sure that "Android for armeabi-v7a" kit has been detected (present in the list).
 ~~~~
 Tools->Options->Build & Run
 ~~~~ 
 
-The paths to OCCT and 3rdparty libraries are specified in "OCCT.pri" file:
+also or it can be checked or corrected in:
+~~~~
+Projects->Android for armeabi-v7a option should be checked
+~~~~ 
+
+Switch On device, connect it to PC and define it in Qt Creator:
+~~~~
+Projects->Manage Kits...->Devices->Device: Run on Android
+~~~~                                                     
+Check that "Current state" is "Ready to use" on this page.
+
+~~~~
+Projects->Build Settings->General: Shadow build is switched OFF
+~~~~
+
+Start configuration:
+
+~~~~
+Call Build -> Run qmake
+~~~~
+Check content of "Compile Output" view.
 
-the paths to the headers:
+In order to perform qmake correctly, for example if you have the following error:
 ~~~~
-INCLUDEPATH += /occt/inc /3rdparty/include
-DEPENDPATH  += /occt/inc /3rdparty/include
+Running steps for project AndroidQt...
+Could not start process "<qt_dir>\android_armv7\bin\qmake.exe" <occt_dir>\samples\qt\AndroidQt\AndroidQt.pro -r -spec android-g++ "CONFIG+=debug" "CONFIG+=declarative_debug" "CONFIG+=qml_debug"
+Error while building/deploying project AndroidQt (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.3.2))
+When executing step "qmake"
 ~~~~
 
-the libraries location:
 ~~~~
-LIBS += -L/occt/libs/armeabi-v7a
+Projects->Build Settings->General: switch OFF Shadow build
+Build->Build Project "Android Qt"
+Build->Run
 ~~~~
 
-OCCT resources (Shaders, SHMessage, StdResource, TObj, UnitsAPI and XSMessage folder) should be copied to androidqt_dir/android/assets/opencascade/shared/ directory. Current sample requires at least Shaders folder.
+Dialog to "Select Android Device" is shown. Select Compatible Device, Ok.
+In case of any error, see log in "Application Output" view.
 
-Select build configuration: Debug or Release and click Build->Build Project "AndroidQt" or (Ctrl + B).
 After successful build the application can be deployed to device or emulator.
index c80be25..2566fb2 100644 (file)
@@ -62,7 +62,7 @@ Window {
         anchors.horizontalCenter: parent.horizontalCenter
         anchors.verticalCenter: parent.verticalCenter
 
-        source: "qrc:///icons/res/icons/ic_action_collection.png"
+        source: "qrc:/ic_action_collection.png"
       }
 
       MouseArea {
diff --git a/samples/qt/AndroidQt/src/AndroidQt.qrc b/samples/qt/AndroidQt/src/AndroidQt.qrc
new file mode 100644 (file)
index 0000000..fbc4b4a
--- /dev/null
@@ -0,0 +1,8 @@
+<RCC>
+    <qresource prefix="/">
+        <file alias="main.qml">../res/qml/main.qml</file>
+    </qresource>
+    <qresource prefix="/">
+        <file alias="ic_action_collection.png">../res/icons/ic_action_collection.png</file>
+    </qresource>
+</RCC>
diff --git a/samples/qt/AndroidQt/src/FILES b/samples/qt/AndroidQt/src/FILES
new file mode 100644 (file)
index 0000000..0bb880c
--- /dev/null
@@ -0,0 +1,9 @@
+AndroidQt.cxx
+AndroidQt.h
+AndroidQt.qrc
+AndroidQt_TouchParameters.cxx
+AndroidQt_TouchParameters.h
+AndroidQt_UserInteractionParameters.h
+AndroidQt_Window.cxx
+AndroidQt_Window.h
+Main.cxx
similarity index 93%
rename from samples/qt/AndroidQt/Main.cxx
rename to samples/qt/AndroidQt/src/Main.cxx
index 48102a5..dca2797 100644 (file)
@@ -23,7 +23,7 @@ int main(int argc, char *argv[])
   qmlRegisterType<AndroidQt>("AndroidQt", 1, 0, "AndroidQt");
 
   QQmlApplicationEngine engine;
-  engine.load (QUrl (QStringLiteral ("qrc:///res/qml/main.qml")));
+  engine.load (QUrl (QStringLiteral ("qrc:/main.qml")));
 
   return app.exec();
 }
index ee65f37..a3e9490 100755 (executable)
@@ -15,6 +15,7 @@
 
 #include <Graphic3d_GraphicDriver.hxx>
 #include <OpenGl_GraphicDriver.hxx>
+#include <OSD_Environment.hxx>
 
 #include <stdlib.h>
 
@@ -583,8 +584,10 @@ void ApplicationCommonWindow::onSetMaterial( int theMaterial )
 QString ApplicationCommonWindow::getResourceDir()
 {
   static QString aResourceDir =
-    QString::fromUtf8 (qgetenv ("CSF_ResourcesDefaults").constData());
-  
+    QString (OSD_Environment ("CSF_ResourcesDefaults").Value().ToCString());
+  if (aResourceDir.isEmpty())
+    aResourceDir = QString (OSD_Environment ("CSF_OCCTResourcePath").Value().ToCString()) + "/samples";
+
   return aResourceDir;
 }
 
index 19aaac6..f19194e 100755 (executable)
@@ -13,6 +13,9 @@
 #include <AIS_InteractiveObject.hxx>
 #include <Graphic3d_NameOfMaterial.hxx>
 #include <OpenGl_GraphicDriver.hxx>
+#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#include <OSD_Environment.hxx>
+#endif
 #include <TCollection_AsciiString.hxx>
 
 // =======================================================================
@@ -32,7 +35,7 @@ Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString ,
   {
     Handle(Aspect_DisplayConnection) aDisplayConnection;
 #if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
-    aDisplayConnection = new Aspect_DisplayConnection (qgetenv ("DISPLAY").constData());
+    aDisplayConnection = new Aspect_DisplayConnection (OSD_Environment ("DISPLAY").Value());
 #endif
     aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection);
   }
diff --git a/samples/qt/Common/src/FILES b/samples/qt/Common/src/FILES
new file mode 100644 (file)
index 0000000..12ba281
--- /dev/null
@@ -0,0 +1,17 @@
+ApplicationCommon.cxx
+ApplicationCommon.h
+Common-icon.ts
+Common-string.ts
+CommonSample.h
+DocumentCommon.cxx
+DocumentCommon.h
+Material.cxx
+Material.h
+MDIWindow.cxx
+MDIWindow.h
+OcctWindow.cxx
+OcctWindow.h
+Transparency.cxx
+Transparency.h
+View.cxx
+View.h
index e1315ce..f09bce4 100755 (executable)
@@ -105,7 +105,6 @@ void MDIWindow::onWindowActivated ()
 
 void MDIWindow::dump()
 {
-  QString datadir = (QString(qgetenv ("CSF_OCCTDataPath").constData()) + "/images");
   QString filter = "Images Files (*.bmp *.ppm *.png *.jpg *.tiff *.tga *.gif *.exr)";
   QFileDialog fd ( 0 );
   fd.setModal( true );
diff --git a/samples/qt/FuncDemo/CMakeLists.txt b/samples/qt/FuncDemo/CMakeLists.txt
new file mode 100644 (file)
index 0000000..92dc1e6
--- /dev/null
@@ -0,0 +1,5 @@
+project(FuncDemo)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
diff --git a/samples/qt/FuncDemo/EXTERNLIB b/samples/qt/FuncDemo/EXTERNLIB
new file mode 100644 (file)
index 0000000..7ced3fd
--- /dev/null
@@ -0,0 +1,14 @@
+TKBO
+TKBRep
+TKCAF
+TKCDF
+TKG2d
+TKG3d
+TKGeomAlgo
+TKGeomBase
+TKernel
+TKLCAF
+TKMath
+TKMesh
+TKPrim
+TKTopAlgo
diff --git a/samples/qt/FuncDemo/FILES b/samples/qt/FuncDemo/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
index 67df580..d462720 100644 (file)
@@ -14,6 +14,8 @@ OCCT_DEFINES = $$(CSF_DEFINES)
 
 DEFINES = $$split(OCCT_DEFINES, ;)
 
+RESOURCES += ./src/FuncDemo.qrc
+
 unix {
     UNAME = $$system(uname -s)
     LIBLIST = $$(LD_LIBRARY_PATH)
diff --git a/samples/qt/FuncDemo/PACKAGES b/samples/qt/FuncDemo/PACKAGES
new file mode 100644 (file)
index 0000000..6417933
--- /dev/null
@@ -0,0 +1 @@
+FuncDemo/src
\ No newline at end of file
index d0450d7..78c73fc 100644 (file)
@@ -4,5 +4,4 @@ call "%~dp0..\..\..\env.bat" %1 %2 %3
 
 call "custom.bat" %1 %2 %3
 
-set "PATH=%QTDIR%/bin;%PATH%"
-set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
\ No newline at end of file
+set "PATH=%QTDIR%/bin;%PATH%"
\ No newline at end of file
diff --git a/samples/qt/FuncDemo/src/FILES b/samples/qt/FuncDemo/src/FILES
new file mode 100644 (file)
index 0000000..07ace65
--- /dev/null
@@ -0,0 +1,28 @@
+BaseDriver.cpp
+BaseDriver.h
+CircleDriver.cpp
+CircleDriver.h
+ConeDriver.cpp
+ConeDriver.h
+CylinderDriver.cpp
+CylinderDriver.h
+edge.cpp
+edge.h
+FILES
+FThread.cpp
+FThread.h
+graphwidget.cpp
+graphwidget.h
+main.cpp
+mainwindow.cpp
+mainwindow.h
+node.cpp
+node.h
+PointDriver.cpp
+PointDriver.h
+PrismDriver.cpp
+PrismDriver.h
+ShapeSaverDriver.cpp
+ShapeSaverDriver.h
+SimpleDriver.cpp
+SimpleDriver.h
diff --git a/samples/qt/FuncDemo/src/FuncDemo.qrc b/samples/qt/FuncDemo/src/FuncDemo.qrc
new file mode 100644 (file)
index 0000000..57e284e
--- /dev/null
@@ -0,0 +1,7 @@
+<RCC>\r
+  <qresource prefix="/">\r
+    <file alias="new.png">../images/new.png</file>\r
+    <file alias="open.png">../images/open.png</file>\r
+    <file alias="save.png">../images/save.png</file>\r
+  </qresource>\r
+</RCC>\r
index 7ddfdf7..4f35cca 100644 (file)
 #include <QApplication>
 #include "mainwindow.h"
 
+#include <OSD_Environment.hxx>
+
 int main(int argc, char *argv[])
 {
+#if QT_VERSION > 0x050000
+    TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
+    if (!aPlugindsDirName.IsEmpty())
+      QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
+#endif
     QApplication app(argc, argv);
     MainWindow mainWin;
     mainWin.show();
diff --git a/samples/qt/IESample/CMakeLists.txt b/samples/qt/IESample/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d29fa8b
--- /dev/null
@@ -0,0 +1,11 @@
+project(IESample)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+include_directories("${CMAKE_SOURCE_DIR}/${RELATIVE_DIR}/Interface/src")
+include_directories("${CMAKE_SOURCE_DIR}/${RELATIVE_DIR}/Common/src")
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+
+ADD_DEFINITIONS(-DNO_COMMONSAMPLE_EXPORTS -DNO_IESAMPLE_EXPORTS)
+
+
diff --git a/samples/qt/IESample/EXTERNLIB b/samples/qt/IESample/EXTERNLIB
new file mode 100644 (file)
index 0000000..71631a4
--- /dev/null
@@ -0,0 +1,29 @@
+TKBRep
+TKBool
+TKBO
+TKCDF
+TKFillet
+TKG2d
+TKG3d
+TKGeomAlgo
+TKGeomBase
+TKHLR
+TKIGES
+TKernel
+TKMath
+TKMesh
+TKOffset
+TKOpenGl
+TKPrim
+TKShHealing
+TKService
+TKSTEP
+TKSTEP209
+TKSTEPAttr
+TKSTEPBase
+TKSTL
+TKTopAlgo
+TKV3d
+TKVRML
+TKXSBase
+
diff --git a/samples/qt/IESample/FILES b/samples/qt/IESample/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/samples/qt/IESample/PACKAGES b/samples/qt/IESample/PACKAGES
new file mode 100644 (file)
index 0000000..aa9aa1a
--- /dev/null
@@ -0,0 +1,3 @@
+IESample/src
+Common/src
+Interface/src
\ No newline at end of file
index 90a5c2c..3b7e3e4 100755 (executable)
@@ -9,4 +9,3 @@ set "CSF_ResourcesDefaults=%RES_DIR%"
 set "CSF_IEResourcesDefaults=%RES_DIR%"
 
 set "PATH=%QTDIR%/bin;%PATH%"
-set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
\ No newline at end of file
diff --git a/samples/qt/IESample/src/FILES b/samples/qt/IESample/src/FILES
new file mode 100644 (file)
index 0000000..f9dea79
--- /dev/null
@@ -0,0 +1 @@
+Main.cxx
\ No newline at end of file
index 7baef27..87b7924 100755 (executable)
@@ -1,15 +1,20 @@
 #include "Application.h"
 
+#include <OSD_Environment.hxx>
+
 #include <QApplication>
 #include <QTranslator>
 #include <QPixmap>
 #include <QLocale>
   
 
-
 int main ( int argc, char* argv[] )
 {
-  
+#if QT_VERSION > 0x050000
+  TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
+  if (!aPlugindsDirName.IsEmpty())
+    QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
+#endif
   QApplication a( argc, argv );
 
   QString resDir = ApplicationCommonWindow::getResourceDir();
index b14e7d4..ec3cdca 100755 (executable)
@@ -6,6 +6,8 @@
 #include <stdlib.h>
 #include <QMdiSubWindow>
 
+#include <OSD_Environment.hxx>
+
 ApplicationWindow::ApplicationWindow()
     : ApplicationCommonWindow( ),
       myImportPopup( 0 ),
@@ -210,8 +212,10 @@ void ApplicationWindow::onSelectionChanged()
 QString ApplicationWindow::getIEResourceDir()
 {
   static QString aResourceDir =
-    QString::fromUtf8 (qgetenv ("CSF_IEResourcesDefaults").constData());
-  
+    QString (OSD_Environment ("CSF_IEResourcesDefaults").Value().ToCString());
+  if (aResourceDir.isEmpty())
+    aResourceDir = QString (OSD_Environment ("CSF_OCCTResourcePath").Value().ToCString()) + "/samples";
+
   return aResourceDir;
 }
 
diff --git a/samples/qt/Interface/src/FILES b/samples/qt/Interface/src/FILES
new file mode 100644 (file)
index 0000000..c338ab4
--- /dev/null
@@ -0,0 +1,6 @@
+Application.cxx
+Application.h
+IESample.h
+Interface-string.ts
+Translate.cxx
+Translate.h
diff --git a/samples/qt/Tutorial/CMakeLists.txt b/samples/qt/Tutorial/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c5b08c5
--- /dev/null
@@ -0,0 +1,11 @@
+project(Tutorial)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+include_directories("${CMAKE_SOURCE_DIR}/${RELATIVE_DIR}/Interface/src")
+include_directories("${CMAKE_SOURCE_DIR}/${RELATIVE_DIR}/Common/src")
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+
+ADD_DEFINITIONS(-DNO_COMMONSAMPLE_EXPORTS -DNO_IESAMPLE_EXPORTS)
+
+
diff --git a/samples/qt/Tutorial/EXTERNLIB b/samples/qt/Tutorial/EXTERNLIB
new file mode 100644 (file)
index 0000000..8beff5a
--- /dev/null
@@ -0,0 +1,29 @@
+TKBRep
+TKBool
+TKBO
+TKCDF
+TKFillet
+TKG2d
+TKG3d
+TKGeomAlgo
+TKGeomBase
+TKernel
+TKHLR
+TKIGES
+TKMath
+TKMesh
+TKOffset
+TKOpenGl
+TKPrim
+TKService
+TKShHealing
+TKSTEP
+TKSTEP209
+TKSTEPAttr
+TKSTEPBase
+TKSTL
+TKTopAlgo
+TKV3d
+TKVRML
+TKXSBase
+
diff --git a/samples/qt/Tutorial/FILES b/samples/qt/Tutorial/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/samples/qt/Tutorial/PACKAGES b/samples/qt/Tutorial/PACKAGES
new file mode 100644 (file)
index 0000000..bd31a4f
--- /dev/null
@@ -0,0 +1,2 @@
+Tutorial/src
+Common/src
\ No newline at end of file
index 781e09e..56b7eeb 100755 (executable)
@@ -9,4 +9,3 @@ set "CSF_ResourcesDefaults=%RES_DIR%"
 set "CSF_TutorialResourcesDefaults=%RES_DIR%"
 
 set "PATH=%QTDIR%/bin;%PATH%"
-set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
\ No newline at end of file
index 6a6baa5..5be0008 100755 (executable)
@@ -1,6 +1,8 @@
 #include "ApplicationTut.h"
 #include "DocumentTut.h"
 
+#include <OSD_Environment.hxx>
+
 #include <QFileDialog>
 #include <QStatusBar>
 #include <QMdiSubWindow>
@@ -59,7 +61,8 @@ void ApplicationTut::onMakeBottleAction()
 
 QString ApplicationTut::getTutResourceDir()
 {
-  static QString resDir (qgetenv ("CSF_TutorialResourcesDefaults").constData());
+  static QString resDir (OSD_Environment ("CSF_TutorialResourcesDefaults").Value().ToCString());
+  if (resDir.isEmpty())
+    resDir = QString (OSD_Environment ("CSF_OCCTResourcePath").Value().ToCString()) + "/samples";
   return resDir;
 }
-
diff --git a/samples/qt/Tutorial/src/FILES b/samples/qt/Tutorial/src/FILES
new file mode 100644 (file)
index 0000000..54bd00b
--- /dev/null
@@ -0,0 +1,8 @@
+ApplicationTut.cxx
+ApplicationTut.h
+DocumentTut.cxx
+DocumentTut.h
+Main.cxx
+MakeBottle.cxx
+Tutorial-icon.ts
+Tutorial-string.ts
index 1d4cfe4..1603de2 100755 (executable)
@@ -1,10 +1,17 @@
 #include "ApplicationTut.h"
 
+#include <OSD_Environment.hxx>
+
 #include <QApplication>
 #include <QTranslator>
 
 int main ( int argc, char* argv[] )
 {
+#if QT_VERSION > 0x050000
+    TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
+    if (!aPlugindsDirName.IsEmpty())
+      QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
+#endif
     QApplication a( argc, argv );
 
     QString resDir = ApplicationCommonWindow::getResourceDir();
index 070c323..f7eb48e 100644 (file)
@@ -1,5 +1,7 @@
 project(TInspectorEXE)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
-
-set_property (TARGET ${PROJECT_NAME} PROPERTY FOLDER Samples)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+set (RELATIVE_DIR "samples/tools")
+include_directories("${CMAKE_SOURCE_DIR}/${RELATIVE_DIR}/TInspectorEXE/src")
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
index b1a2819..ca4f0e5 100644 (file)
@@ -1,5 +1,2 @@
-TInspectorEXE.cxx
-TInspectorEXE_OpenFileDialog.cxx
-TInspectorEXE_OpenFileDialog.hxx
-TInspectorEXE_OpenFileViewModel.cxx
-TInspectorEXE_OpenFileViewModel.hxx
+EXTERNLIB
+PACKAGES
diff --git a/samples/tools/TInspectorEXE/PACKAGES b/samples/tools/TInspectorEXE/PACKAGES
new file mode 100644 (file)
index 0000000..51a9799
--- /dev/null
@@ -0,0 +1 @@
+TInspectorEXE/src
diff --git a/samples/tools/TInspectorEXE/TInspectorEXE.qrc b/samples/tools/TInspectorEXE/TInspectorEXE.qrc
deleted file mode 100644 (file)
index 331296a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-    <qresource>
-        <file>icons/folder_open.png</file>
-        <file>icons/folder_import.png</file>
-    </qresource>
-</RCC>
diff --git a/samples/tools/TInspectorEXE/src/FILES b/samples/tools/TInspectorEXE/src/FILES
new file mode 100644 (file)
index 0000000..b481576
--- /dev/null
@@ -0,0 +1,6 @@
+TInspectorEXE.cxx
+TInspectorEXE_OpenFileDialog.cxx
+TInspectorEXE_OpenFileDialog.hxx
+TInspectorEXE_OpenFileViewModel.cxx
+TInspectorEXE_OpenFileViewModel.hxx
+TInspectorEXE.qrc
\ No newline at end of file
@@ -74,15 +74,11 @@ void setPluginSampleDirectory (const TCollection_AsciiString& theName, TInspecto
 // =======================================================================
 int main (int argc, char** argv)
 {
-  OSD_Environment anEnvironment ("QTDIR");
-  TCollection_AsciiString aPlugindsDirName = anEnvironment.Value();
-  if (aPlugindsDirName.IsEmpty())
-  {
-    std::cout << "QTDIR is not defined" << std::endl;
-    return 0;
-  }
-  aPlugindsDirName += "/plugins";
-  QApplication::addLibraryPath (aPlugindsDirName.ToCString());
+#if QT_VERSION > 0x050000
+  TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
+  if (!aPlugindsDirName.IsEmpty())
+    QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
+#endif
   QApplication anApp (argc, argv);
 
   std::set<TCollection_AsciiString> aPlugins;
diff --git a/samples/tools/TInspectorEXE/src/TInspectorEXE.qrc b/samples/tools/TInspectorEXE/src/TInspectorEXE.qrc
new file mode 100644 (file)
index 0000000..b3a84f6
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+    <qresource prefix="/">
+        <file alias="folder_open.png">../icons/folder_open.png</file>
+        <file alias="folder_import.png">../icons/folder_import.png</file>
+    </qresource>
+</RCC>
@@ -56,7 +56,7 @@ QPushButton* TInspectorEXE_OpenButton::StartButton()
   if (!myStartButton)
   {
     myStartButton = new QPushButton();
-    myStartButton->setIcon (QIcon (":/icons/folder_open.png"));
+    myStartButton->setIcon (QIcon (":folder_open.png"));
     connect (myStartButton, SIGNAL (clicked()), this, SLOT (onStartButtonClicked()));
   }
   return myStartButton;
@@ -138,11 +138,11 @@ TInspectorEXE_OpenFileDialog::TInspectorEXE_OpenFileDialog (QWidget* theParent,
   aSelectFileLay->addWidget (mySelectedName, 1, 0);
 
   QToolButton* aSelectFileBtn = new QToolButton (aSelectFileBox);
-  aSelectFileBtn->setIcon (QIcon (":/icons/folder_open.png"));
+  aSelectFileBtn->setIcon (QIcon (":folder_open.png"));
   aSelectFileLay->addWidget (aSelectFileBtn, 1, 1);
 
   myFolderApplyOpen = new QToolButton (aSelectFileBox);
-  myFolderApplyOpen->setIcon (QIcon (":/icons/folder_import.png"));
+  myFolderApplyOpen->setIcon (QIcon (":folder_import.png"));
   myFolderApplyOpen->setIconSize (QSize (ICON_SIZE, ICON_SIZE));
   myFolderApplyOpen->setEnabled (false);
   aSelectFileLay->addWidget (myFolderApplyOpen, 0, 2, 2, 1);
index 2eafae1..223c362 100644 (file)
@@ -47,7 +47,7 @@ include_directories(
 
 add_definitions(-D__WIN32__)
 add_definitions(-DWNT)
-add_definitions(-D${PROJECT_NAME}_EXPORTS)
+add_definitions(-D__${PROJECT_NAME}_DLL)
 
 # parce EXTERNLIB file
 FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
index 11673ed..bdf6279 100644 (file)
@@ -1,3 +1,5 @@
 project(DRAWEXE)
 
+set (EXECUTABLE_PROJECT ON)
 OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+unset (EXECUTABLE_PROJECT)
index 6deb03a..be7be47 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef DFBROWSERPANE_H
 #define DFBROWSERPANE_H
 
-#ifdef DFBrowserPane_EXPORTS
+#ifdef __DFBrowserPane_DLL
   #ifdef _WIN32
     #define DFBROWSERPANE_EXPORT __declspec(dllexport)
   #else
index 72771c1..025163e 100644 (file)
@@ -37,10 +37,9 @@ TInspector_Communicator::TInspector_Communicator()
     static int argc = 1;
     static char* argv[] = { (char*)"", 0 };
 #if QT_VERSION > 0x050000
-  OSD_Environment anEnvironment ("QTDIR");
-  TCollection_AsciiString aPlugindsDirName = anEnvironment.Value();
-  aPlugindsDirName += "/plugins";
-  QApplication::addLibraryPath (aPlugindsDirName.ToCString());
+  TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
+  if (!aPlugindsDirName.IsEmpty())
+    QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
 #endif
     new QApplication (argc, argv);
   }
index 1090248..29b45e9 100644 (file)
@@ -1,3 +1,5 @@
 project(TKDFBrowser)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
index d57cc9f..928a72f 100644 (file)
@@ -1,3 +1,5 @@
 project(TKShapeView)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
\ No newline at end of file
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
index 3ed8dce..0a05b7c 100644 (file)
@@ -2,6 +2,8 @@ project(TKTInspector)
 
 set (INSTALL_API ON)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
 
 unset (INSTALL_API)
index a6afae4..d2f21e0 100644 (file)
@@ -2,7 +2,9 @@ project(TKTInspectorAPI)
 
 SET (TOOL_API_LIBRARY ON)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
 
 UNSET (TOOL_API_LIBRARY)
 
index 1812573..f57982c 100644 (file)
@@ -1,3 +1,5 @@
 project(TKToolsDraw)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
index 6247c37..99fc025 100644 (file)
@@ -1,3 +1,5 @@
 project(TKTreeModel)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
index dfdb809..1a6de14 100644 (file)
@@ -1,3 +1,5 @@
 project(TKVInspector)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
\ No newline at end of file
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
index 705ccd4..ed33343 100644 (file)
@@ -1,3 +1,5 @@
 project(TKView)
 
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)