From 0553a8ea9924f42f3dbace50c26f51ec3b4af412 Mon Sep 17 00:00:00 2001 From: abv Date: Mon, 19 Mar 2018 09:04:17 +0300 Subject: [PATCH] 0029589: Configuration - allow MFC samples to be built when OCCT is linked statically 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). --- CMakeLists.txt | 23 ++++++++++++---- adm/cmake/3rdparty_macro.cmake | 8 +++--- adm/cmake/ffmpeg.cmake | 4 +-- adm/cmake/freetype.cmake | 8 +++--- adm/cmake/qt.cmake | 4 +-- adm/cmake/tbb.cmake | 8 +++--- adm/cmake/tcl.cmake | 4 +-- adm/cmake/tk.cmake | 4 +-- adm/cmake/vtk.cmake | 16 +++++------ .../05_ImportExport/src/ImportExportApp.cpp | 27 ++++++++++--------- samples/mfc/standard/06_Ocaf/CMakeLists.txt | 2 +- .../mfc/standard/Common/OCC_2dChildFrame.h | 2 +- samples/mfc/standard/Common/OCC_2dDoc.h | 2 +- samples/mfc/standard/Common/OCC_2dView.h | 2 +- samples/mfc/standard/Common/OCC_3dBaseDoc.h | 2 +- .../mfc/standard/Common/OCC_3dChildFrame.h | 2 +- samples/mfc/standard/Common/OCC_3dDoc.h | 2 +- samples/mfc/standard/Common/OCC_3dView.h | 2 +- samples/mfc/standard/Common/OCC_App.cpp | 4 ++- samples/mfc/standard/Common/OCC_App.h | 6 +++-- .../mfc/standard/Common/OCC_BaseChildFrame.h | 2 +- samples/mfc/standard/Common/OCC_BaseDoc.h | 2 +- samples/mfc/standard/Common/OCC_BaseView.h | 2 +- .../mfc/standard/Common/OCC_StereoConfigDlg.h | 2 +- samples/mfc/standard/mfcsample/CMakeLists.txt | 16 ++++++++--- 25 files changed, 92 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index beee192894..3007cc69c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 /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}") diff --git a/adm/cmake/3rdparty_macro.cmake b/adm/cmake/3rdparty_macro.cmake index 7ac1d04246..4bc9a71f24 100644 --- a/adm/cmake/3rdparty_macro.cmake +++ b/adm/cmake/3rdparty_macro.cmake @@ -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() diff --git a/adm/cmake/ffmpeg.cmake b/adm/cmake/ffmpeg.cmake index 8c5bfb5c25..89c53769bd 100644 --- a/adm/cmake/ffmpeg.cmake +++ b/adm/cmake/ffmpeg.cmake @@ -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() diff --git a/adm/cmake/freetype.cmake b/adm/cmake/freetype.cmake index 8d4ebe7353..220e57a62a 100644 --- a/adm/cmake/freetype.cmake +++ b/adm/cmake/freetype.cmake @@ -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) diff --git a/adm/cmake/qt.cmake b/adm/cmake/qt.cmake index 0f76c94824..922177b8b6 100644 --- a/adm/cmake/qt.cmake +++ b/adm/cmake/qt.cmake @@ -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) diff --git a/adm/cmake/tbb.cmake b/adm/cmake/tbb.cmake index 52cff5319a..670fa4d338 100644 --- a/adm/cmake/tbb.cmake +++ b/adm/cmake/tbb.cmake @@ -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() diff --git a/adm/cmake/tcl.cmake b/adm/cmake/tcl.cmake index cde1015250..f9cb8938df 100644 --- a/adm/cmake/tcl.cmake +++ b/adm/cmake/tcl.cmake @@ -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() diff --git a/adm/cmake/tk.cmake b/adm/cmake/tk.cmake index b751099fdc..5e6d4299f3 100644 --- a/adm/cmake/tk.cmake +++ b/adm/cmake/tk.cmake @@ -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() diff --git a/adm/cmake/vtk.cmake b/adm/cmake/vtk.cmake index f9e268b59f..c5692fd60e 100644 --- a/adm/cmake/vtk.cmake +++ b/adm/cmake/vtk.cmake @@ -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() diff --git a/samples/mfc/standard/05_ImportExport/src/ImportExportApp.cpp b/samples/mfc/standard/05_ImportExport/src/ImportExportApp.cpp index 6e43e0aeca..733021c3b2 100755 --- a/samples/mfc/standard/05_ImportExport/src/ImportExportApp.cpp +++ b/samples/mfc/standard/05_ImportExport/src/ImportExportApp.cpp @@ -22,18 +22,6 @@ END_MESSAGE_MAP() CImportExportApp::CImportExportApp() : OCC_App() { - // Set the local system units - try - { - UnitsAPI::SetLocalSystem (UnitsAPI_MDTV); - } - catch (Standard_Failure) - { - AfxMessageBox (L"Fatal Error in units initialisation"); - } - - SampleName = "ImportExport"; //for about dialog - SetSamplePath (L"..\\..\\05_ImportExport"); } ///////////////////////////////////////////////////////////////////////////// @@ -46,7 +34,20 @@ CImportExportApp theApp; BOOL CImportExportApp::InitInstance() { - AfxEnableControlContainer(); + // Set the local system units + try + { + UnitsAPI::SetLocalSystem (UnitsAPI_MDTV); + } + catch (Standard_Failure) + { + AfxMessageBox (L"Fatal Error in units initialisation"); + } + + SampleName = "ImportExport"; //for about dialog + SetSamplePath (L"..\\..\\05_ImportExport"); + + AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size diff --git a/samples/mfc/standard/06_Ocaf/CMakeLists.txt b/samples/mfc/standard/06_Ocaf/CMakeLists.txt index 8186e50429..9584cc79f3 100644 --- a/samples/mfc/standard/06_Ocaf/CMakeLists.txt +++ b/samples/mfc/standard/06_Ocaf/CMakeLists.txt @@ -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) diff --git a/samples/mfc/standard/Common/OCC_2dChildFrame.h b/samples/mfc/standard/Common/OCC_2dChildFrame.h index a4075ef850..cec6bf57d5 100755 --- a/samples/mfc/standard/Common/OCC_2dChildFrame.h +++ b/samples/mfc/standard/Common/OCC_2dChildFrame.h @@ -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: diff --git a/samples/mfc/standard/Common/OCC_2dDoc.h b/samples/mfc/standard/Common/OCC_2dDoc.h index 7186c1ebc7..e868dbc986 100755 --- a/samples/mfc/standard/Common/OCC_2dDoc.h +++ b/samples/mfc/standard/Common/OCC_2dDoc.h @@ -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) diff --git a/samples/mfc/standard/Common/OCC_2dView.h b/samples/mfc/standard/Common/OCC_2dView.h index 5fe262073f..9c15e71a55 100755 --- a/samples/mfc/standard/Common/OCC_2dView.h +++ b/samples/mfc/standard/Common/OCC_2dView.h @@ -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) diff --git a/samples/mfc/standard/Common/OCC_3dBaseDoc.h b/samples/mfc/standard/Common/OCC_3dBaseDoc.h index eff59545b1..2495567dda 100755 --- a/samples/mfc/standard/Common/OCC_3dBaseDoc.h +++ b/samples/mfc/standard/Common/OCC_3dBaseDoc.h @@ -13,7 +13,7 @@ #include "DimensionDlg.h" #include -class AFX_EXT_CLASS OCC_3dBaseDoc : public OCC_BaseDoc +class Standard_EXPORT OCC_3dBaseDoc : public OCC_BaseDoc { public: diff --git a/samples/mfc/standard/Common/OCC_3dChildFrame.h b/samples/mfc/standard/Common/OCC_3dChildFrame.h index ecc5b1a3bf..7b024b1e30 100755 --- a/samples/mfc/standard/Common/OCC_3dChildFrame.h +++ b/samples/mfc/standard/Common/OCC_3dChildFrame.h @@ -12,7 +12,7 @@ #include "OCC_BaseChildFrame.h" #include -class AFX_EXT_CLASS OCC_3dChildFrame : public OCC_BaseChildFrame +class Standard_EXPORT OCC_3dChildFrame : public OCC_BaseChildFrame { DECLARE_DYNCREATE(OCC_3dChildFrame) public: diff --git a/samples/mfc/standard/Common/OCC_3dDoc.h b/samples/mfc/standard/Common/OCC_3dDoc.h index 2c29340afd..9df82db329 100755 --- a/samples/mfc/standard/Common/OCC_3dDoc.h +++ b/samples/mfc/standard/Common/OCC_3dDoc.h @@ -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: diff --git a/samples/mfc/standard/Common/OCC_3dView.h b/samples/mfc/standard/Common/OCC_3dView.h index e701a2b18f..469d8fe6ad 100755 --- a/samples/mfc/standard/Common/OCC_3dView.h +++ b/samples/mfc/standard/Common/OCC_3dView.h @@ -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: diff --git a/samples/mfc/standard/Common/OCC_App.cpp b/samples/mfc/standard/Common/OCC_App.cpp index 93b1353678..4809291f68 100644 --- a/samples/mfc/standard/Common/OCC_App.cpp +++ b/samples/mfc/standard/Common/OCC_App.cpp @@ -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) diff --git a/samples/mfc/standard/Common/OCC_App.h b/samples/mfc/standard/Common/OCC_App.h index c5a4155864..5e9447d949 100755 --- a/samples/mfc/standard/Common/OCC_App.h +++ b/samples/mfc/standard/Common/OCC_App.h @@ -13,14 +13,16 @@ #include #include -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; diff --git a/samples/mfc/standard/Common/OCC_BaseChildFrame.h b/samples/mfc/standard/Common/OCC_BaseChildFrame.h index 3fb7dee076..22b7405780 100755 --- a/samples/mfc/standard/Common/OCC_BaseChildFrame.h +++ b/samples/mfc/standard/Common/OCC_BaseChildFrame.h @@ -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: diff --git a/samples/mfc/standard/Common/OCC_BaseDoc.h b/samples/mfc/standard/Common/OCC_BaseDoc.h index e4897a471f..8b297df8eb 100755 --- a/samples/mfc/standard/Common/OCC_BaseDoc.h +++ b/samples/mfc/standard/Common/OCC_BaseDoc.h @@ -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: diff --git a/samples/mfc/standard/Common/OCC_BaseView.h b/samples/mfc/standard/Common/OCC_BaseView.h index 357e510eda..15630eea1e 100755 --- a/samples/mfc/standard/Common/OCC_BaseView.h +++ b/samples/mfc/standard/Common/OCC_BaseView.h @@ -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: diff --git a/samples/mfc/standard/Common/OCC_StereoConfigDlg.h b/samples/mfc/standard/Common/OCC_StereoConfigDlg.h index dd21ca0baf..84e04f7e89 100644 --- a/samples/mfc/standard/Common/OCC_StereoConfigDlg.h +++ b/samples/mfc/standard/Common/OCC_StereoConfigDlg.h @@ -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: diff --git a/samples/mfc/standard/mfcsample/CMakeLists.txt b/samples/mfc/standard/mfcsample/CMakeLists.txt index 767bf853a7..f4c35bf4b8 100644 --- a/samples/mfc/standard/mfcsample/CMakeLists.txt +++ b/samples/mfc/standard/mfcsample/CMakeLists.txt @@ -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})