0029589: Configuration - allow MFC samples to be built when OCCT is linked statically
authorabv <abv@opencascade.com>
Mon, 19 Mar 2018 06:04:17 +0000 (09:04 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 22 Mar 2018 16:51:20 +0000 (19:51 +0300)
CMake scripts are corrected to do perform search of libs and dlls of third-party libraries even for static builds of OCCT.
Treatment of errors in this case is relaxed: not found DLLs are reported as warnings, and not found libs as warning for static build, and continuable error for shared build.

Code of samples is corrected to allow building with OCCT linked statically.
Implementation of main application class is corrected to ensure that initialization is done after all global objects are created.
Note however that samples still fails to start for unclear reason (creation of MFC frame window fails).

25 files changed:
CMakeLists.txt
adm/cmake/3rdparty_macro.cmake
adm/cmake/ffmpeg.cmake
adm/cmake/freetype.cmake
adm/cmake/qt.cmake
adm/cmake/tbb.cmake
adm/cmake/tcl.cmake
adm/cmake/tk.cmake
adm/cmake/vtk.cmake
samples/mfc/standard/05_ImportExport/src/ImportExportApp.cpp
samples/mfc/standard/06_Ocaf/CMakeLists.txt
samples/mfc/standard/Common/OCC_2dChildFrame.h
samples/mfc/standard/Common/OCC_2dDoc.h
samples/mfc/standard/Common/OCC_2dView.h
samples/mfc/standard/Common/OCC_3dBaseDoc.h
samples/mfc/standard/Common/OCC_3dChildFrame.h
samples/mfc/standard/Common/OCC_3dDoc.h
samples/mfc/standard/Common/OCC_3dView.h
samples/mfc/standard/Common/OCC_App.cpp
samples/mfc/standard/Common/OCC_App.h
samples/mfc/standard/Common/OCC_BaseChildFrame.h
samples/mfc/standard/Common/OCC_BaseDoc.h
samples/mfc/standard/Common/OCC_BaseView.h
samples/mfc/standard/Common/OCC_StereoConfigDlg.h
samples/mfc/standard/mfcsample/CMakeLists.txt

index beee192894dd9a5e25c38d2972f9763e05c7014c..3007cc69c6f87cff53977b485fc1727a5e3adbad 100644 (file)
@@ -32,7 +32,6 @@ if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
   endif()
 else()
   unset (BUILD_SHARED_LIBS)
-  message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries")
   unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
 endif()
 
@@ -703,11 +702,10 @@ else()
   OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE")
 endif()
 
+# check all 3rdparty include paths
 string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
-
-# check all 3rdparty paths
 if (3RDPARTY_NOT_INCLUDED)
-  message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
+  message (FATAL_ERROR "Could not find headers of used third-party products: ${3RDPARTY_NOT_INCLUDED}" )
 endif()
 
 if (3RDPARTY_INCLUDE_DIRS)
@@ -720,13 +718,28 @@ endif()
 # include <cmake binary folder>/inc
 include_directories (${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE})
 
-if (3RDPARTY_LIBRARY_DIRS AND BUILD_SHARED_LIBS)
+# check all 3rdparty library paths
+string (REGEX REPLACE ";" " " 3RDPARTY_NO_LIBS "${3RDPARTY_NO_LIBS}")
+if (3RDPARTY_NO_LIBS)
+  if (BUILD_SHARED_LIBS)
+    message (SEND_ERROR "Could not find libraries of used third-party products: ${3RDPARTY_NO_LIBS}" )
+  else()
+    message (WARNING "Could not find libraries of used third-party products: ${3RDPARTY_NO_LIBS}" )
+  endif()
+endif()
+if (3RDPARTY_LIBRARY_DIRS)
   list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
   string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
   message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
   link_directories (${3RDPARTY_LIBRARY_DIRS})
 endif()
 
+# report not found 3rdparty dll paths
+string (REGEX REPLACE ";" " " 3RDPARTY_NO_DLLS "${3RDPARTY_NO_DLLS}")
+if (3RDPARTY_NO_DLLS)
+  message (WARNING "Could not find DLLs of used third-party products: ${3RDPARTY_NO_DLLS}" )
+endif()
+
 # build directories
 if (SINGLE_GENERATOR)
   set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
index 7ac1d0424611ac0e752ea0e421620d5b3e853bb0..4bc9a71f247c2bc188f357be2026b7599762b5b7 100644 (file)
@@ -117,7 +117,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
 
   foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
     string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
-    if (BUILD_SHARED_LIBS)
+#    if (BUILD_SHARED_LIBS)
       # library
       if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}")
         set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
@@ -167,7 +167,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
       if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
         list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
       else()
-        list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX})
+        list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX})
 
         set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
       endif()
@@ -213,7 +213,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
         if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}")
           list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}")
         else()
-          list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX})
+          list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX})
         endif()
       endif()
 
@@ -311,7 +311,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
       endif()
 
       mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX})
-    endif()
+#    endif()
   endforeach()
 endmacro()
 
index 8c5bfb5c25396deee11202372ae81997b8cd972f..89c53769bdb8465d013859241d4c3143885ac3a4 100644 (file)
@@ -140,7 +140,7 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
   if (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}}")
     list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME})
+    list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME})
 
     set (3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME} "" CACHE FILEPATH "The path to FFmpeg library (${LIBRARY_NAME})" FORCE)
   endif()
@@ -167,7 +167,7 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
     if (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} OR EXISTS "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}")
       list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME})
+      list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME})
     endif()
   endif()
 
index 8d4ebe73534f926cbaa3747ac4301c1425a11b9c..220e57a62ab612882487665ff4da8f638dc1691c 100644 (file)
@@ -218,7 +218,7 @@ else()
 endif()
 
 # freetype library
-if (BUILD_SHARED_LIBS)
+#if (BUILD_SHARED_LIBS)
   if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
     set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
 
@@ -253,7 +253,7 @@ if (BUILD_SHARED_LIBS)
   if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
     list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_FREETYPE_LIBRARY_DIR)
 
     set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
   endif()
@@ -290,7 +290,7 @@ if (BUILD_SHARED_LIBS)
     if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
       list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
+      list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_FREETYPE_DLL_DIR)
     endif()
   endif()
 
@@ -345,7 +345,7 @@ if (BUILD_SHARED_LIBS)
       set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
     endif()
   endif()
-endif()
+#endif()
 
 # unset all redundant variables
 OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
index 0f76c9482444fc7ef25d52bbf5da1a7228d8cc5e..922177b8b66eaa93446c8769af30d78d0759ac0e 100644 (file)
@@ -7,8 +7,8 @@ THIRDPARTY_PRODUCT("QT" "" "CSF_QtCore" "d")
 list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_QT_DIR}/bin")
 
 list (REMOVE_ITEM 3RDPARTY_NOT_INCLUDED "3RDPARTY_QT_INCLUDE_DIR")
-list (REMOVE_ITEM 3RDPARTY_NOT_INCLUDED "3RDPARTY_QT_LIBRARY_DIR")
-list (REMOVE_ITEM 3RDPARTY_NOT_INCLUDED "3RDPARTY_QT_DLL_DIR")
+list (REMOVE_ITEM 3RDPARTY_NO_LIBS "3RDPARTY_QT_LIBRARY_DIR")
+list (REMOVE_ITEM 3RDPARTY_NO_DLLS "3RDPARTY_QT_DLL_DIR")
 
 UNSET (${3RDPARTY_QT_DLL} CACHE)
 UNSET (${3RDPARTY_QT_DLL_DIR} CACHE)
index 52cff5319a612e43b0f01ad13e513e8929ead58b..670fa4d338ca944e31d163d29764e4f02b9b0da2 100644 (file)
@@ -173,7 +173,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
   if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
     list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
 
     set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
   endif()
@@ -226,7 +226,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
     if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
       list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
+      list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
     endif()
   endif()
 
@@ -275,7 +275,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
   mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
 endmacro()
 
-if (BUILD_SHARED_LIBS)
+#if (BUILD_SHARED_LIBS)
   separate_arguments (CSF_TBB)
   foreach (LIB IN LISTS CSF_TBB)
     TBB_PRODUCT_SEARCH (${LIB})
@@ -291,4 +291,4 @@ if (BUILD_SHARED_LIBS)
       set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
     endif()
   endif()
-endif()
\ No newline at end of file
+#endif()
index cde10152507ab06182bef874bd2f4e4b8d3356ad..f9cb8938df1a7d469921ff9cf811d5b4e4cdd73e 100644 (file)
@@ -184,14 +184,14 @@ if (BUILD_SHARED_LIBS)
   if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
     list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TCL_LIBRARY_DIR)
   endif()
 
   if (WIN32)
     if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
       list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
+      list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_TCL_DLL_DIR)
     endif()
   endif()
 
index b751099fdc1b77bd9613dbe0a4e8737c04d0a0e8..5e6d4299f35170be40f366fd489b9fe4d7c0fac8 100644 (file)
@@ -190,14 +190,14 @@ if (BUILD_SHARED_LIBS)
   if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
     list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TK_LIBRARY_DIR)
   endif()
 
   if (WIN32)
     if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
       list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
+      list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_TK_DLL_DIR)
     endif()
   endif()
 
index f9e268b59fe06664a506d2508a65472e851c7d82..c5692fd60eac6a8df49409308221072cc6934427 100644 (file)
@@ -31,7 +31,7 @@ if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
   set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE PATH "The directory containing headers of VTK")
 endif()
 
-if (BUILD_SHARED_LIBS)
+#if (BUILD_SHARED_LIBS)
   # vtk library directory
   if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
     set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
@@ -41,7 +41,7 @@ if (BUILD_SHARED_LIBS)
   if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
     set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
   endif()
-endif()
+#endif()
 
 # check 3RDPARTY_VTK_ paths for consistency with specified 3RDPARTY_VTK_DIR
 if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
@@ -75,10 +75,10 @@ if (VTK_FOUND)
 
     set (3RDPARTY_VTK_INCLUDE_DIRS)
 
-    if (BUILD_SHARED_LIBS)
+#    if (BUILD_SHARED_LIBS)
       set (3RDPARTY_VTK_LIBRARY_DIRS)
       set (3RDPARTY_VTK_DLL_DIRS)
-    endif()
+#    endif()
 
     foreach (VTK_LIBRARY ${VTK_LIBRARIES})
       string (REGEX MATCH "^vtk" IS_VTK_LIBRARY ${VTK_LIBRARY})
@@ -168,7 +168,7 @@ if (VTK_FOUND)
     set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_INCLUDE_DIR}" CACHE PATH "The directory containing headers of VTK" FORCE)
   endif()
 
-  if (BUILD_SHARED_LIBS)
+#  if (BUILD_SHARED_LIBS)
     if (3RDPARTY_VTK_LIBRARY_DIRS)
       list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
       list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
@@ -186,7 +186,7 @@ if (VTK_FOUND)
         set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
       endif()
     endif()
-  endif()
+#  endif()
 
 if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
   list (APPEND 3RDPARTY_INCLUDE_DIRS ${3RDPARTY_VTK_INCLUDE_DIR})
@@ -198,14 +198,14 @@ if (BUILD_SHARED_LIBS)
   if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
     list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_VTK_LIBRARY_DIR)
   endif()
 
   if (WIN32)
     if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
       list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
+      list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_VTK_DLL_DIR)
     endif()
   endif()
 endif()
index 6e43e0aeca71e651927d7c16bccf54802af83719..733021c3b2e8f653a1af2f184d1935a0c6a52023 100755 (executable)
@@ -21,6 +21,18 @@ END_MESSAGE_MAP()
 // CImportExportApp construction
 
 CImportExportApp::CImportExportApp() : OCC_App()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// The one and only CImportExportApp object
+
+CImportExportApp theApp;
+
+/////////////////////////////////////////////////////////////////////////////
+// CImportExportApp initialization
+
+BOOL CImportExportApp::InitInstance()
 {
   // Set the local system units
   try
@@ -34,19 +46,8 @@ CImportExportApp::CImportExportApp() : OCC_App()
 
   SampleName = "ImportExport"; //for about dialog
   SetSamplePath (L"..\\..\\05_ImportExport");
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// The one and only CImportExportApp object
-
-CImportExportApp theApp;
 
-/////////////////////////////////////////////////////////////////////////////
-// CImportExportApp initialization
-
-BOOL CImportExportApp::InitInstance()
-{
-       AfxEnableControlContainer();
+  AfxEnableControlContainer();
 
        // Standard initialization
        // If you are not using these features and wish to reduce the size
index 8186e5042975f338ad99c5e70e97895bcf90ea6a..9584cc79f36d4fcb7b019642d216d8ee97f6c0e6 100644 (file)
@@ -67,4 +67,4 @@ include_directories (${CMAKE_BINARY_DIR}/inc
                      ${Ocaf_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
 
-target_link_libraries (Ocaf mfcsample TKLCAF TKVCAF TKBO TKBin TKXml)
+target_link_libraries (Ocaf mfcsample TKLCAF TKVCAF TKBO TKBin TKXml TKBinL TKXmlL)
index a4075ef850ffeb79b941d23a78bdc8f9483155bf..cec6bf57d5617bb19b876507f9d9fa8655b9d1e8 100755 (executable)
@@ -11,7 +11,7 @@
 
 #include "OCC_BaseChildFrame.h"
 
-class AFX_EXT_CLASS OCC_2dChildFrame : public OCC_BaseChildFrame  
+class Standard_EXPORT OCC_2dChildFrame : public OCC_BaseChildFrame  
 {
        DECLARE_DYNCREATE(OCC_2dChildFrame)
 public:
index 7186c1ebc7ecd76a84572521b52aa0897ebebdf5..e868dbc9860e1befea54d53017de6572cac052bd 100755 (executable)
@@ -15,7 +15,7 @@
 
 // Mouse and clipboard event tracker for OCC_2dView
 // NO 3D operation are supported (like rotation)
-class AFX_EXT_CLASS OCC_2dDoc : public OCC_BaseDoc
+class Standard_EXPORT OCC_2dDoc : public OCC_BaseDoc
 {
   DECLARE_DYNCREATE(OCC_2dDoc)
 
index 5fe262073fd77faaa7355f3275c7332a99183fa6..9c15e71a558b6b65bfabfd17ce2697e8f44a8f7d 100755 (executable)
@@ -23,7 +23,7 @@ enum CurrentAction2d
   CurAction2d_GlobalPanning,
 };
 
-class AFX_EXT_CLASS OCC_2dView : public OCC_BaseView  
+class Standard_EXPORT OCC_2dView : public OCC_BaseView  
 {
   DECLARE_DYNCREATE(OCC_2dView)
 
index eff59545b14213fd378898a47e576d15df7b45b4..2495567dda109fa2ee6669cb8c72031704980857 100755 (executable)
@@ -13,7 +13,7 @@
 #include "DimensionDlg.h"
 #include <Standard_Macro.hxx>
 
-class AFX_EXT_CLASS OCC_3dBaseDoc : public OCC_BaseDoc
+class Standard_EXPORT OCC_3dBaseDoc : public OCC_BaseDoc
 {
 public:
 
index ecc5b1a3bf08c391ea5a2a9c0b3982270412fd7b..7b024b1e30c1c228373c05b122da6494adc1b6ad 100755 (executable)
@@ -12,7 +12,7 @@
 #include "OCC_BaseChildFrame.h"
 #include <Standard_Macro.hxx>
 
-class AFX_EXT_CLASS OCC_3dChildFrame : public OCC_BaseChildFrame  
+class Standard_EXPORT OCC_3dChildFrame : public OCC_BaseChildFrame  
 {
        DECLARE_DYNCREATE(OCC_3dChildFrame)
 public:
index 2c29340afd5f67741f73593aa14ab5825e447fe0..9df82db329af619bbdc0c94536426ab630e0b918 100755 (executable)
@@ -15,7 +15,7 @@
 
 // Event tracker for 3D views with support of advanced message dialog operations
 // and dimensions dialog
-class AFX_EXT_CLASS OCC_3dDoc : public OCC_3dBaseDoc
+class Standard_EXPORT OCC_3dDoc : public OCC_3dBaseDoc
 {
 public:
 
index e701a2b18fb63ea6c7d3c5757f82451c22e35ac9..469d8fe6adfbb8f0d66b134cf0c80257d636a634 100755 (executable)
@@ -23,7 +23,7 @@ enum CurAction3d {
   CurAction3d_DynamicRotation
 };
 
-class AFX_EXT_CLASS OCC_3dView : public OCC_BaseView  
+class Standard_EXPORT OCC_3dView : public OCC_BaseView  
 {
        DECLARE_DYNCREATE(OCC_3dView)
 public:
index 93b13536783984829f02df0dde18eb5956a8b34c..4809291f68937b675e9f5b85c994febe27059f8c 100644 (file)
@@ -33,7 +33,7 @@ END_MESSAGE_MAP()
 /////////////////////////////////////////////////////////////////////////////
 // OCC_App construction
 
-OCC_App::OCC_App() : CWinApp()
+BOOL OCC_App::InitApplication()
 {
   OSD::SetSignal (Standard_True);
   SampleName = "";
@@ -48,6 +48,8 @@ OCC_App::OCC_App() : CWinApp()
     AfxMessageBox (L"Fatal error during graphic initialization", MB_ICONSTOP);
     ExitProcess (1);
   }
+
+  return TRUE;
 }
 
 void OCC_App::SetSamplePath(LPCTSTR aPath)
index c5a415586478e5d2a93cfd17e2e73e3de32625cf..5e9447d9490232b7797eeb04822b7ae841880a51 100755 (executable)
 #include <Standard_Macro.hxx>
 #include <Graphic3d_GraphicDriver.hxx>
 
-class AFX_EXT_CLASS OCC_App : public CWinApp 
+class Standard_EXPORT OCC_App : public CWinApp 
 {
 public:
   void SetSampleName (const wchar_t* theName);
   virtual const wchar_t* GetSampleName() const;
        const wchar_t* GetInitDataDir() const;
   void SetSamplePath (const wchar_t* thePath);
-       OCC_App();
+
+  virtual BOOL InitApplication ();
+
   Handle(Graphic3d_GraphicDriver) GetGraphicDriver() const
   {
     return myGraphicDriver;
index 3fb7dee076f3604c10c91fa359f00d684f0a5574..22b7405780cffca0d1e440cc3c39fa6201bee887 100755 (executable)
@@ -9,7 +9,7 @@
 #pragma once
 #endif // _MSC_VER > 1000
 
-class AFX_EXT_CLASS OCC_BaseChildFrame : public CMDIChildWnd  
+class Standard_EXPORT OCC_BaseChildFrame : public CMDIChildWnd  
 {
        DECLARE_DYNCREATE(OCC_BaseChildFrame)
 public:
index e4897a471f2774d24f1d770ba5a1f14ad85f03c5..8b297df8ebb1533361d6c34776efd20c563263e5 100755 (executable)
@@ -20,7 +20,7 @@
 // Common methods:
 // - base events
 // - export into one of supported export formats.
-class AFX_EXT_CLASS OCC_BaseDoc : public CDocument
+class Standard_EXPORT OCC_BaseDoc : public CDocument
 {
 public:
 
index 357e510edafd2fc1d3f11c8f979b35cd3ffe9680..15630eea1eb9d4952ba57abba107a5a19b05af31 100755 (executable)
@@ -14,7 +14,7 @@
 #include "OCC_BaseDoc.h"
 #include "AIS_RubberBand.hxx"
 
-class AFX_EXT_CLASS OCC_BaseView  : public CView
+class Standard_EXPORT OCC_BaseView  : public CView
 {
   
 public:
index dd21ca0baf6d1904ff17ac662b72bdd249b52a3a..84e04f7e89a19dcd936652b800395078d0b7a485 100644 (file)
@@ -14,7 +14,7 @@
 
 // Dialog to dynamically configure 3D Viewer stereo
 // projection properties.
-class AFX_EXT_CLASS OCC_StereoConfigDlg : public CDialog
+class Standard_EXPORT OCC_StereoConfigDlg : public CDialog
 {
 public:
 
index 767bf853a77a9484fe6c947c6898daef6bd59256..f4c35bf4b8d73429e7748cb8951dbe8cb8e102bf 100644 (file)
@@ -3,6 +3,11 @@ cmake_minimum_required (VERSION 2.6)
 project (mfcsample)
 
 add_definitions(-DWINVER=0x0501 -D_AFXEXT -DUNICODE -D_UNICODE)
+
+if (NOT BUILD_SHARED_LIBS AND WIN32)
+  add_definitions ("-DOCCT_STATIC_BUILD")
+endif()
+
 set (CMAKE_MFC_FLAG 2)
 
 # mfcsample
@@ -121,7 +126,7 @@ source_group ("Source Files" FILES    ${mfcsample_SOURCE_FILES}
 source_group ( "Resource Files" FILES ${COMMON_RESOURCE_FILES})
 
 # mfcsample library
-add_library ( mfcsample SHARED ${mfcsample_SOURCE_FILES}
+add_library ( mfcsample        ${mfcsample_SOURCE_FILES}
                                ${COMMON_HEADER_FILES}
                                ${COMMON_SOURCE_FILES}
                                ${COMMON_IE_HEADER_FILES}
@@ -168,8 +173,12 @@ set (mfcsample_USED_LIBS  TKVRML
                           TKIGES
                           TKShHealing
                           TKSTEP
+                          TKSTEPBase
+                          TKSTEP209
+                          TKSTEPAttr
                           TKXSBase
                           TKBool
+                          TKBO
                           TKCAF
                           TKCDF
                           TKernel
@@ -187,6 +196,7 @@ set (mfcsample_USED_LIBS  TKVRML
                           TKService
                           TKTopAlgo
                           TKMesh
-                          TKV3d)
+                          TKV3d
+                          ${CSF_OpenGlLibs})
 
-target_link_libraries (mfcsample ${mfcsample_USED_LIBS})
\ No newline at end of file
+target_link_libraries (mfcsample ${mfcsample_USED_LIBS})