Hi,

the syntax of the moc executable has changed between 5.1.1 and 5.2.0
versions of qt (see below). The difference is that the <file> argument has
become mandatory after the -f option.

Hence, moc will complain when osg throws in a -f without anything after it.
Hence I propose removing the -f on Qt5 builds. I have tested building
without -f on both qt520 and qt511, and that works well.

The attached src/osgQt/CMakeLists.txt that can be patched into 3.2 safely.
For the trunk, I would consider dropping the check on the version, and
simply remove the option on qt5. I have tested that on qt5.1.1, and that
worked fine. Question is however if it works on qt5.0. Probably it does, so
the question is simplicity of CMakeList.txt vs safety.

Best regards,


Kristofer Tingdahl






dgb8:localizations dgb$ /Users/Shared/appman/mac/qt/inst511_release/bin/moc
--help
moc: Invalid argument
Usage: moc [options] <header-file>
  -o<file>           write output to file rather than stdout
  -I<dir>            add dir to the include path for header files
  -E                 preprocess only; do not generate meta object code
  -D<macro>[=<def>]  define macro, with optional definition
  -U<macro>          undefine macro
  -i                 do not generate an #include statement
  -p<path>           path prefix for included file
  -f[<file>]         force #include, optional file name (overwrite default)
  -b<file>           prepend #include <file> (preserve default include)
  -nn                do not display notes
  -nw                do not display warnings
  @<file>            read additional options from file
  -v                 display version of moc
dgb8:localizations dgb$

and dgb8:localizations dgb$
/Users/Shared/appman/mac/qt/inst520_release/bin/moc --help
Usage: /Users/Shared/appman/mac/qt/inst520_release/bin/moc [options]
[header-file] [@option-file]
Qt Meta Object Compiler version 67 (Qt 5.2.0)

Options:
  -h, --help               Displays this help.
  -v, --version            Displays version information.
  -o <file>                Write output to file rather than stdout.
  -I <dir>                 Add dir to the include path for header files.
  -F <framework>           Add Mac framework to the include path for header
fil
                           es.
  -E                       Preprocess only; do not generate meta object
code.
  -D <macro[=def]>         Define macro, with optional definition.
  -U <macro>               Undefine macro.
  -M <key=value>           Add key/value pair to plugin meta data
  -i                       Do not generate an #include statement.
  -p <path>                Path prefix for included file.
  -f <file>                Force #include [optional <file>] (overwrite
default)
                           .
  -b <file>                Prepend #include <file> (preserve default
include).
  -n <which>               Do not display notes (-nn) or warnings (-nw).
Compat
                           ibility option.
  --no-notes               Do not display notes.
  --no-warnings            Do not display warnings (implies --no-notes).
  --ignore-option-clashes  Ignore all options that conflict with compilers,
lik
                           e -pthread conflicting with moc's -p option.

Arguments:
  [header-file]            Header file to read from, otherwise stdin.
  [@option-file]           Read additional options from option-file.
dgb8:localizations dgb$



-- 
Kristofer Tingdahl, Ph. D.
CEO
dGB Earth Sciences
IF(DYNAMIC_OPENSCENEGRAPH)
    ADD_DEFINITIONS(-DOSGQT_LIBRARY)
ELSE()
    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF()

SET(LIB_NAME osgQt)
SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})

SET(SOURCES_H
    ${HEADER_PATH}/QGraphicsViewAdapter
)

IF ( Qt5Widgets_FOUND )
    if (Qt5Widgets_VERSION VERSION_LESS 5.2.0)
        message( LESS THAN 520 )
        QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
    else()
        message( MORE THAN 520 )
        QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} )
    endif()
ELSE()
    QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
ENDIF()

SET(TARGET_H
    ${HEADER_PATH}/Export
    ${HEADER_PATH}/GraphicsWindowQt
    ${HEADER_PATH}/QFontImplementation
    ${HEADER_PATH}/QGraphicsViewAdapter
    ${HEADER_PATH}/QWidgetImage
    ${HEADER_PATH}/QWebViewImage
)


# FIXME: For OS X, need flag for Framework or dylib
SET(TARGET_SRC
    GraphicsWindowQt.cpp
    QFontImplementation.cpp
    QGraphicsViewAdapter.cpp
    QWidgetImage.cpp
    ${SOURCES_H_MOC}
    ${OPENSCENEGRAPH_VERSIONINFO_RC}
)

SET(TARGET_LIBRARIES
    osgWidget
    osgDB
    osgUtil
    osg
    OpenThreads
)

IF(CMAKE_COMPILER_IS_GNUCXX)
    # Remove -pedantic flag as it barfs on Qt headers
   STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()

# FIXME: This should work but something with the LINK_WITH_VARIABLES macro is 
not working
#SET(TARGET_LIBRARIES_VARS
#    QT_QTCORE_LIBRARY 
#    QT_QTGUI_LIBRARY
#    QT_QTOPENGL_LIBRARY
#)

IF( QT4_FOUND )
    INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} 
${QT_QTGUI_INCLUDE_DIR}
             ${QT_QTOPENGL_INCLUDE_DIR} )
    SET(TARGET_LIBRARIES
    ${TARGET_LIBRARIES}
    ${QT_QTCORE_LIBRARY} 
    ${QT_QTGUI_LIBRARY}
    ${QT_QTOPENGL_LIBRARY}
)

ENDIF( QT4_FOUND )

SETUP_LIBRARY(${LIB_NAME})

IF ( Qt5Widgets_FOUND )
    qt5_use_modules( ${LIB_NAME} Widgets OpenGL )
ENDIF ( Qt5Widgets_FOUND )
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to