]> OCCT Git - occt-copy.git/commitdiff
0029639: CMake - rename options for building samples
authornds <nds@opencascade.com>
Thu, 12 Apr 2018 03:24:42 +0000 (06:24 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 12 Apr 2018 09:53:10 +0000 (12:53 +0300)
- BUILD_SAMPLES_MFC instead of BUILD_MODULE_MfcSample
- BUILD_SAMPLES_QT instead of BUILD_MODULE_QtSample
- sub-folder "mfc" of Samples folder in VStudio for mfc samples
- qt processing of *.ts resource files is corrected to avoid excessive projects creation under Samples folder in VStudio

15 files changed:
CMakeLists.txt
adm/cmake/qt_macro.cmake
adm/cmake/vardescr.cmake
dox/dev_guides/building/cmake/cmake.md
samples/mfc/standard/01_Geometry/CMakeLists.txt
samples/mfc/standard/02_Modeling/CMakeLists.txt
samples/mfc/standard/03_Viewer2d/CMakeLists.txt
samples/mfc/standard/04_Viewer3d/CMakeLists.txt
samples/mfc/standard/05_ImportExport/CMakeLists.txt
samples/mfc/standard/06_Ocaf/CMakeLists.txt
samples/mfc/standard/07_Triangulation/CMakeLists.txt
samples/mfc/standard/08_HLR/CMakeLists.txt
samples/mfc/standard/09_Animation/CMakeLists.txt
samples/mfc/standard/10_Convert/CMakeLists.txt
samples/mfc/standard/mfcsample/CMakeLists.txt

index a4f93d3aad92372f34a8c02fd2e94e2959e3cd62..fca978164eca08adddb24710bf9a9924276228f9 100644 (file)
@@ -343,9 +343,9 @@ set (BUILD_ADDITIONAL_TOOLKITS "" CACHE STRING "${BUILD_ADDITIONAL_TOOLKITS_DESC
 separate_arguments (BUILD_ADDITIONAL_TOOLKITS)
 
 if (MSVC)
-  set (BUILD_MODULE_MfcSamples OFF CACHE BOOL "${BUILD_MODULE_MfcSamples_DESCR}")
+  set (BUILD_SAMPLES_MFC OFF CACHE BOOL "${BUILD_SAMPLES_MFC_DESCR}")
 endif()
-set (BUILD_MODULE_QtSamples OFF CACHE BOOL "${BUILD_MODULE_QtSamples_DESCR}")
+set (BUILD_SAMPLES_QT OFF CACHE BOOL "${BUILD_SAMPLES_QT_DESCR}")
 
 set (BUILD_Inspector OFF CACHE BOOL "${BUILD_Inspector_DESCR}")
 
@@ -789,7 +789,7 @@ else()
   set (SCRIPT_EXT sh)
 endif()
 
-if (BUILD_Inspector OR BUILD_MODULE_QtSamples)
+if (BUILD_Inspector OR BUILD_SAMPLES_QT)
   # check qt 3rdparty path
   add_definitions (-DHAVE_QT)
   OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
@@ -913,7 +913,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 OR BUILD_MODULE_QtSamples)
+if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
   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()
@@ -941,7 +941,7 @@ foreach(RESOURCE ${RESOURCES})
   endif()
 endforeach()
 
-if (BUILD_MODULE_QtSamples)
+if (BUILD_SAMPLES_QT)
   FILE_TO_LIST ("adm/SAMPLES_RESOURCES" SAMPLES_RESOURCES)
   foreach(RESOURCE ${SAMPLES_RESOURCES})
     OCCT_INSTALL_FILE_OR_DIR ("samples/${RESOURCE}" "${INSTALL_DIR_RESOURCE}/samples")
@@ -994,11 +994,11 @@ endif()
 
 message (STATUS "Info: \(${CURRENT_TIME}\) OCCT toolkits processed")
 # samples do not support patch usage
-if (BUILD_MODULE_MfcSamples OR BUILD_MODULE_QtSamples)
+if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
   set (OCCT_ROOT ${CMAKE_SOURCE_DIR})
 endif()
 
-if (BUILD_MODULE_MfcSamples)
+if (BUILD_SAMPLES_MFC)
   set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard)
   set (COMMON_WINMAIN_FILE      ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp)
 
@@ -1019,15 +1019,15 @@ endif()
 
 OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES)
 
-if (BUILD_Inspector OR BUILD_MODULE_QtSamples)
-  if (BUILD_MODULE_QtSamples)
+if (BUILD_Inspector OR BUILD_SAMPLES_QT)
+  if (BUILD_SAMPLES_QT)
     if (NOT Qt5_FOUND OR "${Qt5Gui_EGL_INCLUDE_DIRS}" STREQUAL "" OR NOT WIN32)
       list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt)
       message (STATUS "Info: AndroidQt sample excluded due to OS is not Windows or Qt is configured without ANGLE")
     endif()
   else()
     list (REMOVE_ITEM OCCT_SAMPLES qt)
-    message (STATUS "Info: qt samples excluded due to BUILD_MODULE_QtSamples is disabled")
+    message (STATUS "Info: qt samples excluded due to BUILD_SAMPLES_QT is disabled")
   endif()
 
   foreach (OCCT_SAMPLE ${OCCT_SAMPLES})
index 82305649e2a972c9d481774c5bc9e4ce8f53d284..ec897384ae28939e0d6bf9e2b320aff2697e5d44 100644 (file)
@@ -68,19 +68,12 @@ macro (FIND_AND_WRAP_RESOURCE_FILE RESOURCE_FILE_NAME RCC_FILES)
   endif()
 endmacro()
 
-macro (FIND_AND_INSTALL_TS_FILE RESOURCE_FILE_NAME TARGET_FOLDER QM_FILES)
+macro (FIND_AND_WRAP_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}")
+    if (${Qt5_FOUND})
+      qt5_add_translation(QM_FILES "${RESOURCE_FILE_NAME}")
+    else()
+      qt4_add_translation(QM_FILES "${RESOURCE_FILE_NAME}")
     endif()
   endif()
 endmacro()
@@ -109,9 +102,10 @@ macro (FIND_AND_INSTALL_QT_RESOURCES OCCT_PACKAGE RESOURCE_FILES)
   #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)
+    FIND_AND_WRAP_TS_FILE(${TS_FILE_RELATIVE} "${TARGET_FOLDER}/${CURRENT_MODULE}" QM_FILES)
     if (EXISTS ${TS_FILE_RELATIVE})
       list (APPEND ${RESOURCE_FILES} "${TS_FILE_RELATIVE}")
+      list (APPEND ${RESOURCE_FILES} "${QM_FILES}")
     endif()
   endforeach()
 
index f5c7d2b3754368ade1c7c84caf74e2d291fe94f7..a9638ad5f97c8c633d7808806e10affca6781d93 100644 (file)
@@ -117,12 +117,12 @@ want to build some particular libraries (toolkits) only, then you may uncheck
 all modules in the corresponding BUILD_MODUE_* options and provide the list of
 necessary libraries here. Of course, all dependencies will be resolved automatically")
 
-set (BUILD_MODULE_MfcSamples_DESCR
+set (BUILD_SAMPLES_MFC_DESCR
 "Indicates whether OCCT MFC 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_MODULE_QtSamples_DESCR
+set (BUILD_SAMPLES_QT_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)")
index 435244f6ea343d0ea2734939c025fe3fac4a067d..7b4b0781c8dd8769eaa78e429567e8ba4f3d7c4e 100644 (file)
@@ -96,7 +96,8 @@ The following table gives the full list of environment variables used at the con
 | BUILD_LIBRARY_TYPE | String |  Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it is disabled for these builds.|
 | BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically |
 | BUILD_YACCLEX | Boolean flag | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files |
-| BUILD_MODULE_MfcSamples | Boolean flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |
+| BUILD_SAMPLES_MFC | Boolean flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |
+| BUILD_SAMPLES_QT | Boolean flag | Indicates whether QT samples should be built together with OCCT. |
 | BUILD_Inspector | Boolean flag | Indicates whether Inspector should be built together with OCCT. |
 | BUILD_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation project should be created together with OCCT. It is not built together with OCCT. Checking this option leads to automatic search of Doxygen binaries. Its building calls Doxygen command to generate the documentation in HTML format |
 | BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
index 9c0eb68ea820cc8a4742b4efed3fa29cdd499a04..62d612231f598c8eef9be31772d70ef653dd7ac5 100644 (file)
@@ -65,7 +65,7 @@ add_executable (Geometry WIN32 ${Geometry_SOURCE_FILES}
                                ${Geometry_RESOURCE_FILES}
                                ${Geometry_RESOURCE_HEADER})
 
-set_property(TARGET Geometry PROPERTY FOLDER Samples)
+set_property(TARGET Geometry PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Geometry DESTINATION "${INSTALL_DIR_BIN}")
index 1b0b3ff2f55cc2ff59070064951901f7793c644a..6a690ba8346f949c0f59722a0da2a03d6d7cade0 100644 (file)
@@ -37,7 +37,7 @@ add_executable ( Modeling WIN32 ${Modeling_SOURCE_FILES}
                                 ${Modeling_RESOURCE_HEADER}
                                 ${Modeling_RESOURCE_FILES})
 
-set_property (TARGET Modeling PROPERTY FOLDER Samples)
+set_property (TARGET Modeling PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Modeling DESTINATION "${INSTALL_DIR_BIN}")
index c1aaee7cb50f90d6dbad9bca10a95a9dadbd016b..45ea6c8a2242c2954c3cfbaec0540add741a04f6 100644 (file)
@@ -33,7 +33,7 @@ add_executable (Viewer2d WIN32 ${Viewer2d_SOURCE_FILES}
                                ${Viewer2d_RESOURCE_HEADER}
                                ${Viewer2d_RESOURCE_FILES})
 
-set_property (TARGET Viewer2d PROPERTY FOLDER Samples)
+set_property (TARGET Viewer2d PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Viewer2d DESTINATION "${INSTALL_DIR_BIN}")
index 1b0d219fad2220cfa8cfd685e32575b566c6e94a..8e57cc5a352997bb648a638a6b96f683e43518f6 100644 (file)
@@ -57,7 +57,7 @@ add_executable (Viewer3d WIN32 ${Viewer3d_SOURCE_FILES}
                                ${COMMON_WINMAIN_FILE}
                                ${Viewer3d_RESOURCE_FILES})
 
-set_property (TARGET Viewer3d PROPERTY FOLDER Samples)
+set_property (TARGET Viewer3d PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Viewer3d DESTINATION "${INSTALL_DIR_BIN}")
index 93af4ff124c634167958f48efbb448160d556537..93f728e36cabe2d4ff3320a0a24dcbeb9edf5013 100644 (file)
@@ -35,7 +35,7 @@ add_executable (ImportExport WIN32 ${ImportExport_SOURCE_FILES}
                                    ${ImportExport_RESOURCE_HEADER}
                                    ${ImportExport_RESOURCE_FILES})
 
-set_property (TARGET ImportExport PROPERTY FOLDER Samples)
+set_property (TARGET ImportExport PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS ImportExport DESTINATION "${INSTALL_DIR_BIN}")
index 9584cc79f36d4fcb7b019642d216d8ee97f6c0e6..8a45d105ef00df710fdfb458b105d58471496fda 100644 (file)
@@ -49,7 +49,7 @@ add_executable (Ocaf WIN32 ${Ocaf_SOURCE_FILES}
                            ${Ocaf_RESOURCE_FILES} )
 
 
-set_property (TARGET Ocaf PROPERTY FOLDER Samples)
+set_property (TARGET Ocaf PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Ocaf DESTINATION "${INSTALL_DIR_BIN}")
index 0e1229f0f57450eeeb9f726a4419659065a0623f..1cf8c5f8fe182822748883a3066e721ae63dfd47 100644 (file)
@@ -39,7 +39,7 @@ add_executable (Triangulation WIN32 ${Triangulation_SOURCE_FILES}
                                     ${Triangulation_RESOURCE_HEADER}
                                     ${Triangulation_RESOURCE_FILES})
 
-set_property (TARGET Triangulation PROPERTY FOLDER Samples)
+set_property (TARGET Triangulation PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Triangulation DESTINATION "${INSTALL_DIR_BIN}")
index 97a35401ee6c51961bf0359ea6b385a637f02714..68785a28cf2120bb8d99a41af580bf1392529f55 100644 (file)
@@ -61,7 +61,7 @@ add_executable (HLR WIN32 ${HLR_SOURCE_FILES}
                           ${HLR_RESOURCE_HEADER}
                           ${HLR_RESOURCE_FILES} )
 
-set_property (TARGET HLR PROPERTY FOLDER Samples)
+set_property (TARGET HLR PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS HLR DESTINATION "${INSTALL_DIR_BIN}")
index 0c6bfa5b0aaf423d5bfb4d778b24c2d74c301a14..8868e7e9fae4093b2f209953c8d94d35cbc8f5d1 100644 (file)
@@ -44,7 +44,7 @@ add_executable (Animation WIN32 ${Animation_SOURCE_FILES}
                                 ${COMMON_WINMAIN_FILE}
                                 ${Animation_RESOURCE_FILES})
 
-set_property (TARGET Animation PROPERTY FOLDER Samples)
+set_property (TARGET Animation PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Animation DESTINATION "${INSTALL_DIR_BIN}")
index 9073756fc2ba6d24c7abef11f3bdd35de8adebcf..d6f6735ecb18d22d3cbc2a3748611c31bd7497f5 100644 (file)
@@ -61,7 +61,7 @@ add_executable (Convert WIN32 ${Convert_SOURCE_FILES}
                               ${COMMON_WINMAIN_FILE}
                               ${WNT_RESOURCE_FILES} )
 
-set_property (TARGET Convert PROPERTY FOLDER Samples)
+set_property (TARGET Convert PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS Convert DESTINATION "${INSTALL_DIR_BIN}")
index f4c35bf4b8d73429e7748cb8951dbe8cb8e102bf..ee9c8b20c5f92e761726d7caa77a42c5d96dc49b 100644 (file)
@@ -139,7 +139,7 @@ add_library ( mfcsample        ${mfcsample_SOURCE_FILES}
                                ${COMMON_ISESSION2D_SOURCE_FILES}
                                ${COMMON_RESOURCE_FILES})
 
-set_property (TARGET mfcsample PROPERTY FOLDER Samples)
+set_property (TARGET mfcsample PROPERTY FOLDER "Samples/mfc")
 
 if (SINGLE_GENERATOR)
   install (TARGETS mfcsample