Below is the changes made to the included files. The examples CMakeList.txt file was not included but the code change needed for osgviewerMFC inclusion is listed below.
CMakeList.txt:
This is a little different than other example cmakelist.txt files in that I could not use the setup_example macro. I had to go in and extract out the important parts of the macro and inline them in the CMakeList.txt file so that I could add the WIN32 declaration into the ADD_EXECUTABLE() statement. In the future the setup_example macro might be modified to support osgviewerMFC but this is special case so you might not want to muddy the water for one example.
MFC_OSG.h:
This file had some small changes:
From: #include <osgViewer/GraphicsWindowWin32>
To: #include <osgViewer/api/win32/GraphicsWindowWin32>
Also added two new function declarations
Void PreFrameUpdate(void);
Void PostFrameUpdate(void);
MFC_OSG.cpp:
This file changed only in that I am explicitly showing the viewer run loop and added the two new functions in the MFC_OSG.h file.
"
34 lines
1.2 KiB
CMake
34 lines
1.2 KiB
CMake
SET(TARGET_SRC MFC_OSG_MDI.cpp MFC_OSG_MDI.rc MFC_OSG_MDIDoc.cpp MFC_OSG_MDIView.cpp stdafx.cpp MFC_OSG.cpp MainFrm.cpp ChildFrm.cpp)
|
|
SET(TARGET_H MFC_OSG_MDI.h MFC_OSG_MDIDoc.h MFC_OSG_MDIView.h stdafx.h MFC_OSG.h MainFrm.h ChildFrm.h Resource.h)
|
|
|
|
ADD_DEFINITIONS(-D_AFXDLL)
|
|
SET(CMAKE_MFC_FLAG 2)
|
|
|
|
#### end var setup ###
|
|
#SETUP_EXAMPLE(osgviewerMFC)
|
|
|
|
#
|
|
#Extracted from SETUP_EXAMPLES
|
|
#
|
|
SET(TARGET_NAME osgviewerMFC)
|
|
|
|
#
|
|
#Extracted from SETUP_EXE
|
|
#
|
|
IF(NOT TARGET_TARGETNAME)
|
|
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
|
|
ENDIF(NOT TARGET_TARGETNAME)
|
|
IF(NOT TARGET_LABEL)
|
|
SET(TARGET_LABEL "${TARGET_DEFAULT_LABEL_PREFIX} ${TARGET_NAME}")
|
|
ENDIF(NOT TARGET_LABEL)
|
|
|
|
# This is the important line because it adds WIN32 which tells CMake that this is an MFC/Windows appliation
|
|
# and not a console application
|
|
ADD_EXECUTABLE(${TARGET_TARGETNAME} WIN32 ${TARGET_SRC} ${TARGET_H})
|
|
|
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
|
|
|
|
SETUP_LINK_LIBRARIES()
|