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 beee192..3007cc6 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 7ac1d04..4bc9a71 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 8c5bfb5..89c5376 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 8d4ebe7..220e57a 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 0f76c94..922177b 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 52cff53..670fa4d 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 cde1015..f9cb893 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 b751099..5e6d429 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 f9e268b..c5692fd 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 6e43e0a..733021c 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 8186e50..9584cc7 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 a4075ef..cec6bf5 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 7186c1e..e868dbc 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 5fe2620..9c15e71 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 eff5954..2495567 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 ecc5b1a..7b024b1 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 2c29340..9df82db 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 e701a2b..469d8fe 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 93b1353..4809291 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 c5a4155..5e9447d 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 3fb7dee..22b7405 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 e4897a4..8b297df 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 357e510..15630ee 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 dd21ca0..84e04f7 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 767bf85..f4c35bf 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})