Mercurial > projects > qtd
changeset 4:0a29ce1ae854
CMake build script.
Small fixes in examples.
line wrap: on
line diff
--- a/CMakeLists.txt Wed May 13 17:34:40 2009 +0000 +++ b/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -1,26 +1,381 @@ +cmake_minimum_required(VERSION 2.6) PROJECT(qtd CXX C) -cmake_minimum_required(VERSION 2.6) FIND_PACKAGE(Qt4 REQUIRED) -# Using Tango - -#set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/cmaked) -#set(CMAKE_D_USE_TANGO True) include_directories(${QT_INCLUDES} include) -IF(CMAKE_HOST_WIN32) - INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cpp/qt_core/local.cmake) - INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cpp/qt_gui/local.cmake) - INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cpp/qt_opengl/local.cmake) -# INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cpp/qt_qtd/local.cmake) - ADD_LIBRARY(qtd_cpp SHARED ${QT_QTD_SRCS} ${QT_CORE_SRCS} ${QT_GUI_SRCS}) - TARGET_LINK_LIBRARIES( qtd_cpp ${QT_LIBRARIES} ) -ELSE(CMAKE_HOST_WIN32) - ADD_SUBDIRECTORY(cpp/qt_core bin) - ADD_SUBDIRECTORY(cpp/qt_gui bin) - ADD_SUBDIRECTORY(cpp/qt_opengl bin) - ADD_SUBDIRECTORY(cpp/qt_qtd bin) -ENDIF(CMAKE_HOST_WIN32) +option(BUILD_QT_OPENGL "Build QtOpenGL" "ON") +option(BUILD_EXAMPLES "Build examples" "ON") + +set(PACKAGES Core Gui) +if(BUILD_QT_OPENGL) + set(PACKAGES ${PACKAGES} OpenGL) +endif(BUILD_QT_OPENGL) + +set(packages_big ${PACKAGES}) +set(packages) +foreach(package ${packages_big}) + string(TOLOWER ${package} package) + set(packages ${packages} ${package}) +endforeach(package ${packages_big}) + +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY CMakeFiles) + +find_program(DC dmd ldc) +## Parsing D compiler version. +if (DC) + exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output) + string(REGEX MATCH "Digital Mars D Compiler v[0-9]\\.[0-9]+" dmd_version "${d_output}") + if (dmd_version) + set(D_IS_MARS true) + set(D_COMPILER_NAME "Digital Mars D Compiler") + string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}") + string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}") + else (dmd_version) + string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}") + if (is_ldc) + exec_program(${DC} ARGS "--version" OUTPUT_VARIABLE d_output) + string(REGEX MATCH "based on DMD v[0-9]\\.[0-9]+ and llvm [0-9]\\.[0-9]+" ldc_version "${d_output}") + set(D_IS_LLVM true) + if(ldc_version) + set(D_IS_LLVM true) + set(D_COMPILER_NAME "LLVM-based D Compiler") + string(REGEX REPLACE "based on DMD v([0-9])\\.[0-9]+ and llvm [0-9]\\.[0-9]+" "\\1" D_VERSION "${ldc_version}") + string(REGEX REPLACE "based on DMD v[0-9]\\.([0-9]+) and llvm [0-9]\\.[0-9]+" "\\1" D_FRONTEND "${ldc_version}") + else(ldc_version) + message(FATAL_ERROR "LDC compiler was found, but the version can not be processed") + endif(ldc_version) + else (is_ldc) + message(FATAL_ERROR "D compliler not founded") + endif(is_ldc) + endif(dmd_version) + message(STATUS "D compiler founded -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}") +else (DC) + message(FATAL_ERROR "D compliler not founded") +endif (DC) + +# Check D compiler version +if(D_VERSION EQUAL "1") + if (D_FRONTEND LESS "041") + message(STATUS "Minimum required version of D compiler is 1.041 (or compiler based on this version)") + endif(D_FRONTEND LESS "041") + set(D_TARGET d1-tango) +elseif(D_VERSION EQUAL "2") + set(D_TARGET ) ## TODO: hm... I don`t known this parameter for D2 ^( +endif(D_VERSION EQUAL "1") + +if(D_IS_MARS) + set(SEPARETLY_D_OBJECTS true) +elseif(D_IS_LLVM) + set(SEPARETLY_D_OBJECTS true) +endif(D_IS_MARS) + +# Debug and release flags. +if (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) + #set(CMAKE_BUILD_TYPE Debug) + #set( SUFFIXLIB "${SUFFIXLIB}-debug" ) + #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) + add_definitions(-DDEBUG) + set(D_FLAGS -g -gc -debug) +else (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) + #set(CMAKE_BUILD_TYPE Release) + add_definitions(-UNO_DEBUG) + set(D_FLAGS -O -release -inline) + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + set(D_FLAGS ${D_FLAGS} -L/subsystem:windows) + endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) +endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) +set(D_FLAGS ${D_FLAGS} -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR}) + +MACRO(MAKE_WINDOWS_PATH pathname) + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + # An extra \\ escape is necessary to get a \ through CMake's processing. + STRING(REPLACE "/" "\\" ${pathname} "${${pathname}}") + # Enclose with UNESCAPED quotes. This means we need to escape our + # quotes once here, i.e. with \" + SET(${pathname} \"${${pathname}}\") + endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) +ENDMACRO(MAKE_WINDOWS_PATH) + +if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + set(implib implib) + find_program(IMPLIB ${implib}) + if (NOT IMPLIB) + message(FATAL_ERROR "implib not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") + endif (NOT IMPLIB) + set(D_OBJECT_SUFFIX .obj) + if(D_IS_MARS) + set(D_LIB_SUFFIX .lib) + set(D_LIB_PREFIX ) + elseif(D_IS_LDC) + set(D_LIB_SUFFIX .a) + set(D_LIB_PREFIX lib) + endif(D_IS_MARS) + set(GEN_OPT ${GEN_OPT} --cpp_shared) + add_definitions(-DCPP_SHARED) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux) + set(D_LIB_SUFFIX .a) + set(D_LIB_PREFIX lib) + set(D_OBJECT_SUFFIX .o) +endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + +set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./) +set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET}) + +add_subdirectory(generator) + +macro(OBJ_PATH path) + unset(test) + string(REGEX MATCH "${CMAKE_CURRENT_BINARY_DIR}/.*" test "${${path}}") + if(NOT ${test} EQUAL "") + string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" first) + string(LENGTH "${${path}}" last) + math(EXPR first "${first} + 1") + math(EXPR len "${last} - ${first}") + string(SUBSTRING "${${path}}" ${first} ${len} ${path}) + else(NOT ${test} EQUAL "") + string(REGEX MATCH "${CMAKE_CURRENT_SOURCE_DIR}/.*" test "${${path}}") + if(NOT ${test} EQUAL "") + string(LENGTH "${CMAKE_CURRENT_SOURCE_DIR}" first) + string(LENGTH "${${path}}" last) + math(EXPR first "${first} + 1") + math(EXPR len "${last} - ${first}") + string(SUBSTRING "${${path}}" ${first} ${len} ${path}) + endif(NOT ${test} EQUAL "") + endif(NOT ${test} EQUAL "") +endmacro(OBJ_PATH) + +macro(compile_d_files target objects_list) + unset(${objects_list}) + set(tmp_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir) + file(MAKE_DIRECTORY ${tmp_dir}) + if(${SEPARETLY_D_OBJECTS}) + foreach (d_source ${ARGN}) + OBJ_PATH(d_source) + set(d_obj ${tmp_dir}/${d_source}${D_OBJECT_SUFFIX}) + set(${objects_list} ${${objects_list} ${d_obj}) + get_filename_component(path ${d_obj} PATH) + file(MAKE_DIRECTORY ${path}) + set(d_obj_out ${d_obj}) + OBJ_PATH(d_obj_out) + add_custom_command(OUTPUT "${d_obj}" + COMMAND "${DC}" + ARGS ${D_FLAGS} -c ${d_source} -of${d_obj} + COMMENT "Building ${d_obj_out}" + DEPENDS ${d_source} + ) + endforeach(d_source) + else(${SEPARETLY_D_OBJECTS}) + set(${objects_list} ${tmp_dir}/${target}${D_OBJECT_SUFFIX}) + set(d_obj_out ${${objects_list}}) + OBJ_PATH(d_obj_out) + set(parameters_list_file ${tmp_dir}/parameters) + SET (parameters ${D_FLAGS} -c ${ARGN} -of${${objects_list}}) + FILE (REMOVE ${parameters_list_file}) + FOREACH(arg ${parameters}) + FILE (APPEND ${parameters_list_file} "${arg}\n") + ENDFOREACH(arg) + add_custom_command(OUTPUT "${${objects_list}}" + COMMAND "${DC}" + ARGS @${parameters_list_file} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${ARGN} + COMMENT "" + ) + endif(${SEPARETLY_D_OBJECTS}) +endmacro(compile_d_files objects_list) + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +add_custom_target(allpackages ALL) + +link_directories(${CMAKE_BINARY_DIR}/CMakeFiles) -#ADD_SUBDIRECTORY(qt bin) +foreach(package ${packages}) + unset(d_objs) + unset(cpp_objs) + unset(d_sources) + unset(cpp_sources) + unset(lib_name) + unset(link_cpp) + unset(link_d) + unset(cpp_files) + unset(d_files) + unset(classes) + unset(d_generated_files) + + include (${CMAKE_SOURCE_DIR}/build/${package}.txt) + + set(${package}_link_example "${link_example}") + set(${link_example} "") + + set(CUR_TMP_PATH CMakeFiles/${package}.dir) + + set(classes ArrayOps ${classes}) + foreach(class ${classes}) + set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d) + set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp) + endforeach(class) + add_sources_for_generating(${cpp_sources}) + + foreach(d_source ${d_files}) + set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/${d_source}.d) + endforeach(d_source) + foreach(d_source ${d_generated_files}) + set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d) + endforeach(d_source) + foreach (cpp_source ${cpp_files}) + set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp) + endforeach(cpp_source) + + compile_d_files(${package}_dobjs objects ${d_sources}) + set(d_objs ${d_objs} ${objects}) + + set(lib_name ${D_LIB_PREFIX}qtd${package}${D_LIB_SUFFIX}) + + add_library(cpp_${package} SHARED ${cpp_sources}) + add_dependencies(cpp_${package} dgen) + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + set_property(TARGET cpp_${package} PROPERTY RUNTIME_OUTPUT_DIRECTORY lib) + set_property(TARGET cpp_${package} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles) + ADD_CUSTOM_COMMAND( + TARGET cpp_${package} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove + ${CMAKE_BINARY_DIR}/CMakeFiles/${CMAKE_IMPORT_LIBRARY_PREFIX}cpp${package}${CMAKE_IMPORT_LIBRARY_SUFFIX} + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/CMakeFiles/${CMAKE_IMPORT_LIBRARY_PREFIX}cpp_${package}.dll${CMAKE_IMPORT_LIBRARY_SUFFIX} + ${CMAKE_BINARY_DIR}/CMakeFiles/${CMAKE_IMPORT_LIBRARY_PREFIX}cpp${package}${CMAKE_IMPORT_LIBRARY_SUFFIX} + ) + target_link_libraries(cpp_${package} ${link_cpp} ) + set(cpp_lib ${CMAKE_BINARY_DIR}/lib/libcpp_${package}.dll) + set(cpp_lib_native ${cpp_lib}) + MAKE_WINDOWS_PATH(cpp_lib_native) + set(d_implib ${CMAKE_BINARY_DIR}/CMakeFiles/${package}.dir/cpp_${package}.lib) + set(d_implib_native ${d_implib}) + MAKE_WINDOWS_PATH(d_implib_native) + set(cpp_${package}_implib cpp${package}) + add_custom_command( + OUTPUT "${d_implib}" + COMMAND "${IMPLIB}" + ARGS /system /PAGESIZE:32 ${d_implib_native} ${cpp_lib_native} + DEPENDS "cpp_${package}" + COMMENT "Creating implib ${lib_name}" + ) + add_custom_command( + OUTPUT "${lib_name}" + COMMAND "${DC}" + ARGS -lib ${d_objs} ${d_implib} -oflib/${lib_name} + DEPENDS ${d_objs} ${d_implib} + COMMENT "Linking ${lib_name}" + ) + else(${CMAKE_SYSTEM_NAME} STREQUAL Linux) + set_property(TARGET cpp_${package} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles) + foreach(cpp_source ${cpp_sources}) + set(cpp_source ${cpp_source}) + OBJ_PATH(cpp_source) + set(cpp_objs ${cpp_objs} CMakeFiles/cpp_${package}.dir/${cpp_source}.o) + endforeach(cpp_source) + + add_custom_command( + OUTPUT "${lib_name}" + COMMAND "${CMAKE_AR}" + ARGS rcs lib/${lib_name} ${d_objs} ${cpp_objs} + DEPENDS ${d_objs} cpp_${package} + COMMENT "Linking ${lib_name}" + ) + endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + add_custom_target(${package} DEPENDS ${lib_name}) + foreach(depend ${depends}) + add_dependencies(cpp_${package} cpp_${depend}) + add_dependencies(${package} ${depend}) + endforeach(depend ${depends}) + add_dependencies(allpackages ${package}) + set(depends ${depends} ${package}) +endforeach(package) + +foreach(package_big ${packages_big}) + string(TOLOWER ${package_big} package) + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) + set(libs_path ${CMAKE_BINARY_DIR}/lib/qtd${package}.lib) + MAKE_WINDOWS_PATH(libs_path) + set(${package}_lib_param -L+${libs_path}) + foreach(link ${${package}_link_example}) + set(link ${CMAKE_SOURCE_DIR}/lib/${link}.lib) + MAKE_WINDOWS_PATH(link) + set(link -L+${link}) + set(${package}_lib_param ${${package}_lib_param} ${link}) + endforeach(link ${link_example}) + else (${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) + set(${package}_lib_param -L-lqtd${package} -L-lQt${package_big}) + foreach(link ${link_example}) + set(${package}_lib_param ${${package}_lib_param} ${link}) + endforeach(link ${link_example}) + endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) +endforeach(package_big ${packages_big}) + +macro(build_example name) + unset(is_sources) + unset(is_libs) + set(qtd_libs ${core_lib_param} ${gui_lib_param}) + foreach(param ${ARGN}) + if(is_libs) + string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" param_package "${param}") + if(${param_package} STREQUAL ${param}) + unset(is_libs) + set(is_sources 1) + else(${param_package} STREQUAL ${param}) + unset(is_founded) + foreach(package_big ${packages_big}) + string(TOLOWER ${package_big} package) + if(${param_package} STREQUAL ${package_big}) + set(qtd_libs ${qtd_libs} ${${package}_lib_param}) + set(is_founded 1) + break(package_big ${packages_big}) + endif(${param_package} STREQUAL ${package_big}) + endforeach(package_big ${packages_big}) + if(NOT is_founded) + message(STATUS "Module ${param_package} not founded for example ${name}") + return(build_example name) + endif(NOT is_founded) + endif(${param_package} STREQUAL ${param}) + endif(is_libs) + if(NOT is_libs) + if(NOT is_sources) + if(${param} STREQUAL PACKAGES) + set(is_libs 1) + set(qtd_libs) + else(${param} STREQUAL PACKAGES) + set(is_sources 1) + endif(${param} STREQUAL PACKAGES) + endif(NOT is_sources) + if(is_sources) + set(sources ${sources} ${param}) + endif(is_sources) + endif(NOT is_libs) + endforeach(param ${ARGN}) + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) + set(libs_path ) + else(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) + set(libs_path -L-L${CMAKE_BINARY_DIR}/lib) + endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) + compile_d_files(${name}_dobjs objects ${sources} ) + set(output ${CMAKE_CURRENT_BINARY_DIR}/${name}${CMAKE_EXECUTABLE_SUFFIX}) + set(output_native ${output}) + make_windows_path(output_native) + add_custom_command(OUTPUT "${output}" + COMMAND "${DC}" + ARGS ${D_FLAGS} ${libs_path} ${qtd_libs} ${objects} + -of${output_native} + DEPENDS ${objects} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Building example ${name}" + ) + add_custom_target(example_${name} ALL DEPENDS "${output}") + add_dependencies(example_${name} allpackages) +endmacro(build_example sources) + +if(BUILD_QT_OPENGL) + add_subdirectory(demos) + add_subdirectory(examples) +endif(BUILD_QT_OPENGL) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/core.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,52 @@ +## Qt Lib name. +set (lib_name QtCore) +## Libraries linked to the cpp part (is active only if CPP_SHARED == true). +set (link_cpp ${QT_QTCORE_LIBRARY}) +## Libraries linked to the d part (is active only if CPP_SHARED == true).. +set (link_d ) +## Module specific cpp files. +set (cpp_files qt_qtd/qtd_core qt_qtd/ArrayOpsPrimitive_shell + qt_core/QPoint_shell qt_core/QPointF_shell + qt_core/QSize_shell qt_core/QSizeF_shell + qt_core/QLine_shell qt_core/QLineF_shell + qt_core/QString_shell qt_core/QVariant_shell + qt_core/QModelIndex_shell) +## Module specific d files. +set (d_files QGlobal qtd/Str QtDObject Signal d1/Signal qtd/ArrayOpsPrimitive + core/QPoint core/QPointF + core/QSize core/QSizeF + core/QLine core/QLineF + core/QString core/QVariant + core/QModelIndex) +set (d_generated_files core/Qt) +## Classes. +set (classes + QChildEvent + QCoreApplication + QEvent + QEventLoop + QObject + QTimerEvent + QTranslator + QRect + QByteArray + QLocale + QDataStream + QMimeData + QIODevice + QRectF + QDateTime + QDate + QTime + QBitArray + QRegExp + QUrl + QAbstractItemModel + QAbstractFileEngine + QFile + QDir + QFileInfo + QTextStream + QTimer + ) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/gui.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,228 @@ + +## Qt Lib name. +set(lib_name QtGui) + +## Libraries linked to the cpp part (is active only if CPP_SHARED == true). +set(link_cpp ${cpp_core_implib} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) + +## Libraries linked to the d part (is active only if CPP_SHARED == true).. +set(link_d libqtdcore.a) + +## Module specific cpp files. +set(cpp_files) + +## Module specific d files. +set(d_files) + +## Classes. +set(classes + QPushButton + QFileIconProvider + QPaintDevice + QPicture + QPixmap + QImage + QBitmap + QStyle + QStyleOption + QDesktopWidget + QMenu + QAction + QDropEvent + QInputContext + QWidget + QApplication + QIcon + QIconEngine + QPalette + QSizePolicy + QRegion + QFontMetrics + QCursor + QFont + QClipboard + QSessionManager + QPainterPath + QPainterPath_Element + QPaintEvent + QTransform + QMatrix + QPainter + QDragLeaveEvent + QPolygon + QInputEvent + QDragEnterEvent + QKeyEvent + QHideEvent + QWheelEvent + QMoveEvent + QActionGroup + QActionEvent + QFocusEvent + QIconEngineV2 + QFontInfo + QStyleHintReturn + QColor + QDragMoveEvent + QStyleOptionMenuItem + QTabletEvent + QShowEvent + QResizeEvent + QBrush + QInputMethodEvent + QContextMenuEvent + QStyleOptionComplex + QMouseEvent + QHelpEvent + QTextFormat + QKeySequence + QCloseEvent + QGradient + QTextItem + QTextOption + QPolygonF + QPen + QTextCharFormat + QTextListFormat + QTextTableFormat + QTextLength + QTextFrameFormat + QTextTableCellFormat + QTextBlockFormat + QTextImageFormat + QFrame + QLabel + QAbstractButton + QMovie + QCheckBox + QRadioButton + QToolButton + QStyleOptionButton + QStyleOptionToolButton + QStyleOptionToolBar + QStyleOptionToolBox + QStyleOptionToolBoxV2 + QStyleOptionSlider + QStyleOptionViewItem + QStyleOptionHeader + QStyleOptionDockWidget + QStyleOptionTab + QButtonGroup + QLCDNumber + QAbstractSlider + QDial + QSlider + QScrollBar + QPaintEngine + QSpacerItem + QLayout + QLayoutItem + QPaintEngineState + QBoxLayout + QHBoxLayout + QVBoxLayout + QFormLayout + QGridLayout + QStackedLayout + QAbstractScrollArea + QAbstractItemDelegate + QAbstractItemView + QTreeView + QTableView + QListView + QHeaderView + QItemSelection + QItemSelectionModel + QItemSelectionRange + QDirModel + QSplitter + QSplitterHandle + QListWidget + QListWidgetItem + QMainWindow + QMenuBar + QToolBar + QMessageBox + QDockWidget + QDialog + QStatusBar + QTabWidget + QTabBar + QImageIOHandler + QImageReader + QTextFrame_iterator + QTextBlock_iterator + QPrinter + QTextLine + QTextEdit + QTextCursor + QTextFrame + QTextObject + QTextBlock + QTextDocument + QPrinterInfo + QTextList + QTextLayout + QTextBlockUserData + QTextDocumentFragment + QTextTable + QAbstractTextDocumentLayout + QTextBlockGroup + QTextObjectInterface + QTextInlineObject + QAbstractTextDocumentLayout_PaintContext + QTextLayout_FormatRange + QTextFragment + QTextTableCell + QPrintEngine + QStyleOptionTabWidgetFrame + QComboBox + QValidator + QCompleter + QLineEdit + QStyleOptionComboBox + QStyleOptionFrame + QFileDialog + QAbstractProxyModel + QGraphicsItem + QGraphicsItemGroup + QGraphicsWidget + QGraphicsLayout + QGraphicsScene + QGraphicsSimpleTextItem + QGraphicsRectItem + QGraphicsPolygonItem + QGraphicsPixmapItem + QGraphicsPathItem + QGraphicsLineItem + QGraphicsEllipseItem + QGraphicsLayoutItem + QAbstractGraphicsShapeItem + QGraphicsTextItem + QGraphicsProxyWidget + QGraphicsSceneEvent + QGraphicsSceneWheelEvent + QGraphicsSceneContextMenuEvent + QGraphicsSceneMouseEvent + QGraphicsSceneResizeEvent + QStyleOptionGraphicsItem + QGraphicsSceneMoveEvent + QGraphicsSceneHoverEvent + QGraphicsSceneDragDropEvent + QGraphicsSceneHelpEvent + QGraphicsView + QTableWidgetSelectionRange + QStandardItem + QUndoStack + QTreeWidgetItem + QTreeWidget + QTextEdit_ExtraSelection + QTableWidgetItem + QTableWidget + QTextOption_Tab + QMdiSubWindow + QInputMethodEvent_Attribute + QMdiArea + QUndoCommand + QStandardItemModel +)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/opengl.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,19 @@ +##QTD_OPENGL += opengl/QGL opengl/gl opengl/glu opengl/glfuncs opengl/gltypes + +## Qt Lib name. +set(lib_name QtOpenGL) + +set(link_cpp ${cpp_core_implib} ${cpp_gui_implib} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY}) + +set(link_d qtdcore) + +set(classes + QGLWidget + QGLContext + QGLFormat + QGLColormap + ) + +if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) + set(link_example opengl32 glu32) +endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/svg.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,9 @@ +set(lib_name QtSvg) + +set(link_cpp qtdcore_cpp ${qt_core_lib_name} ${qt_gui_lib_name}) +set(link_d qtdcore) + +set(classes + QSvgWidget + QSvgRenderer + ) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demos/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +add_subdirectory(interview) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demos/interview/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ + build_example(interview main.d model.d)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,5 @@ +add_subdirectory(itemviews) +add_subdirectory(mainwindows) +add_subdirectory(opengl) +add_subdirectory(tutorials) +add_subdirectory(widgets) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/itemviews/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ + add_subdirectory(dirview) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/itemviews/dirview/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(dirview main.d)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/mainwindows/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +add_subdirectory(dockwidgets) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/mainwindows/dockwidgets/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(dockwidgets main.d mainwindow.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/opengl/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +add_subdirectory(hellogl) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/opengl/hellogl/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,2 @@ +build_example(hellogl PACKAGES QtCore QtGui QtOpenGL + main.d window.d glwidget.d) \ No newline at end of file
--- a/examples/opengl/hellogl/glwidget.d Wed May 13 17:34:40 2009 +0000 +++ b/examples/opengl/hellogl/glwidget.d Wed May 13 19:01:55 2009 +0000 @@ -50,7 +50,7 @@ class GLWidget : QGLWidget { // Q_OBJECT - + public: this(QWidget parent = null) { @@ -59,17 +59,18 @@ xRot = 0; yRot = 0; zRot = 0; - + trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0); trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0); + } - + ~this() { makeCurrent(); glDeleteLists(object, 1); - } - + } + QSize minimumSizeHint() { return QSize(50, 50); @@ -91,7 +92,7 @@ updateGL(); } } - + void setYRotation(int angle) { normalizeAngle(&angle); @@ -101,7 +102,7 @@ updateGL(); } } - + void setZRotation(int angle) { normalizeAngle(&angle); @@ -111,11 +112,11 @@ updateGL(); } } - + mixin Signal!("xRotationChanged", int); mixin Signal!("yRotationChanged", int); mixin Signal!("zRotationChanged", int); - + protected: void initializeGL() @@ -142,7 +143,7 @@ { int side = qMin(width, height); glViewport((width - side) / 2, (height - side) / 2, side, side); - + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0); @@ -153,12 +154,12 @@ { lastPos = QPoint(event.pos.x, event.pos.y); } - + void mouseMoveEvent(QMouseEvent event) { int dx = event.x - lastPos.x; int dy = event.y - lastPos.y; - + if (event.buttons() & Qt.LeftButton) { setXRotation(xRot + 8 * dy); setYRotation(yRot + 8 * dx); @@ -173,9 +174,9 @@ { GLuint list = glGenLists(1); glNewList(list, GL_COMPILE); - + glBegin(GL_QUADS); - + GLdouble x1 = +0.06; GLdouble y1 = -0.14; GLdouble x2 = +0.14; @@ -184,10 +185,10 @@ GLdouble y3 = +0.00; GLdouble x4 = +0.30; GLdouble y4 = +0.22; - + quad(x1, y1, x2, y2, y2, x2, y1, x1); quad(x3, y3, x4, y4, y4, x4, y3, x3); - + extrude(x1, y1, x2, y2); extrude(x2, y2, y2, x2); extrude(y2, x2, y1, x1); @@ -195,61 +196,61 @@ extrude(x3, y3, x4, y4); extrude(x4, y4, y4, x4); extrude(y4, x4, y3, x3); - + const double Pi = 3.14159265358979323846; const int NumSectors = 200; - + for (int i = 0; i < NumSectors; ++i) { double angle1 = (i * 2 * Pi) / NumSectors; GLdouble x5 = 0.30 * sin(angle1); GLdouble y5 = 0.30 * cos(angle1); GLdouble x6 = 0.20 * sin(angle1); GLdouble y6 = 0.20 * cos(angle1); - + double angle2 = ((i + 1) * 2 * Pi) / NumSectors; GLdouble x7 = 0.20 * sin(angle2); GLdouble y7 = 0.20 * cos(angle2); GLdouble x8 = 0.30 * sin(angle2); GLdouble y8 = 0.30 * cos(angle2); - + quad(x5, y5, x6, y6, x7, y7, x8, y8); - + extrude(x6, y6, x7, y7); extrude(x8, y8, x5, y5); } - + glEnd(); glEndList(); return list; } - + void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2, GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4) { qglColor(trolltechGreen); - + glVertex3d(x1, y1, -0.05); glVertex3d(x2, y2, -0.05); glVertex3d(x3, y3, -0.05); glVertex3d(x4, y4, -0.05); - + glVertex3d(x4, y4, +0.05); glVertex3d(x3, y3, +0.05); glVertex3d(x2, y2, +0.05); glVertex3d(x1, y1, +0.05); } - + void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { qglColor(trolltechGreen.darker(rndint(250 + (100 * x1)))); - + glVertex3d(x1, y1, +0.05); glVertex3d(x2, y2, +0.05); glVertex3d(x2, y2, -0.05); glVertex3d(x1, y1, -0.05); } - + void normalizeAngle(int *angle) { while (*angle < 0) @@ -257,7 +258,7 @@ while (*angle > 360 * 16) *angle -= 360 * 16; } - + GLuint object; int xRot; int yRot;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +add_subdirectory(tutorial) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,6 @@ +add_subdirectory(t1) +add_subdirectory(t2) +add_subdirectory(t3) +add_subdirectory(t4) +add_subdirectory(t5) +add_subdirectory(t6) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/t1/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(t1 main.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/t2/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(t2 main.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/t3/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(t3 main.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/t4/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(t4 main.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/t5/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(t5 main.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/tutorials/tutorial/t6/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(t6 main.d) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/widgets/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,2 @@ +add_subdirectory(analogclock) +add_subdirectory(calculator) \ No newline at end of file
--- a/examples/widgets/analogclock/AnalogClock.d Wed May 13 17:34:40 2009 +0000 +++ b/examples/widgets/analogclock/AnalogClock.d Wed May 13 19:01:55 2009 +0000 @@ -64,16 +64,26 @@ void paintEvent(QPaintEvent event) { - static const QPoint[3] hourHand = [ +/* static const QPoint hourHand[3] = { QPoint(7, 8), QPoint(-7, 8), QPoint(0, -40) - ]; - static const QPoint[3] minuteHand = [ + }; + static const QPoint minuteHand[3] = { QPoint(7, 8), QPoint(-7, 8), QPoint(0, -70) - ]; + }; +*/ + scope hourHand = new QPolygon; + hourHand.append(QPoint(7, 8)); + hourHand.append(QPoint(-7, 8)); + hourHand.append(QPoint(0, -40)); + + scope minuteHand = new QPolygon; + minuteHand.append(QPoint(7, 8)); + minuteHand.append(QPoint(-7, 8)); + minuteHand.append(QPoint(0, -70)); scope hourColor = new QColor(127, 0, 127); scope minuteColor = new QColor(0, 127, 127, 191);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/widgets/analogclock/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(analogclock main.d AnalogClock.d)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/widgets/calculator/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,1 @@ +build_example(calculator main.d calculator.d button.d)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/generator/CMakeLists.txt Wed May 13 19:01:55 2009 +0000 @@ -0,0 +1,224 @@ +PROJECT(generator CXX C) +cmake_minimum_required(VERSION 2.6) +FIND_PACKAGE(Qt4 REQUIRED) + +## Sources +set(srcs + classlistgenerator.cpp + cppgenerator.cpp + cppheadergenerator.cpp + cppimplgenerator.cpp + docparser.cpp + generatorsetd.cpp + dgenerator.cpp + jumptable.cpp + metainfogenerator.cpp + metajavabuilder.cpp + qdocgenerator.cpp + uiconverter.cpp + containergenerator.cpp + + generator.cpp + main.cpp + reporthandler.cpp + typeparser.cpp + typesystem.cpp + asttoxml.cpp + fileout.cpp + generatorset.cpp + metajava.cpp + customtypes.cpp + abstractmetabuilder.cpp + abstractmetalang.cpp + prigenerator.cpp + + # rxx + parser/ast.cpp + parser/lexer.cpp + parser/list.cpp + parser/parser.cpp + parser/smallobject.cpp + parser/control.cpp + parser/visitor.cpp + parser/default_visitor.cpp + parser/dumptree.cpp + parser/tokens.cpp + parser/binder.cpp + parser/codemodel.cpp + parser/type_compiler.cpp + parser/name_compiler.cpp + parser/declarator_compiler.cpp + parser/class_compiler.cpp + parser/codemodel_finder.cpp + parser/compiler_utils.cpp + + ## rpp + parser/rpp/preprocessor.cpp +) +## Moc headers +set(moc_hdrs + classlistgenerator.h + cppgenerator.h + cppheadergenerator.h + cppimplgenerator.h + docparser.h + generatorsetd.h + dgenerator.h + jumptable.h + metainfogenerator.h + metajavabuilder.h + qdocgenerator.h + uiconverter.h + containergenerator.h + generator.h + main.h + reporthandler.h + typeparser.h + typesystem.h + asttoxml.h + fileout.h + generatorset.h + metajava.h + customtypes.h + abstractmetabuilder.h + abstractmetalang.h + prigenerator.h + + ## rxx + parser/ast.h + parser/lexer.h + parser/list.h + parser/parser.h + parser/rxx_allocator.h + parser/rpp-allocator.h + parser/smallobject.h + parser/tokens.h + parser/symbol.h + parser/control.h + parser/visitor.h + parser/default_visitor.h + parser/dumptree.h + parser/binder.h + parser/codemodel.h + parser/codemodel_pointer.h + parser/codemodel_fwd.h + parser/type_compiler.h + parser/name_compiler.h + parser/declarator_compiler.h + parser/class_compiler.h + parser/codemodel_finder.h + parser/compiler_utils.h + + # rpp + parser/rpp/pp-cctype.h + parser/rpp/pp-engine-bits.h + parser/rpp/pp-engine.h + parser/rpp/pp-environment.h + parser/rpp/pp-fwd.h + parser/rpp/pp-internal.h + parser/rpp/pp-iterator.h + parser/rpp/pp-macro-expander.h + parser/rpp/pp-macro.h + parser/rpp/pp-scanner.h + parser/rpp/pp-string.h + parser/rpp/pp-symbol.h + parser/rpp/pp.h + parser/rpp/preprocessor.h + +) + +## Resources. +set(res_files + generator.qrc +) + +#win32-msvc2005:{ +# QMAKE_CXXFLAGS += -wd4996 +# QMAKE_CFLAGS += -wd4996 +#} + +#win32-msvc.net { +# QMAKE_CXXFLAGS += /Zm500 +# QMAKE_CXXFLAGS -= -Zm200 +# QMAKE_CFLAGS -= -Zm200 +#} + +## Includes path. +set(inc_paths + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../common + ${CMAKE_CURRENT_SOURCE_DIR}/parser + ${CMAKE_CURRENT_SOURCE_DIR}/parser/include + ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp +) + +add_definitions(-DRXX_ALLOCATOR_INIT_0) + +## Build project +find_package (Qt4 REQUIRED) +set (QT_USE_QTMAIN true) +set (QT_USE_QTGUI false) +set (QT_USE_QTXML true) +include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) + +set(inc_paths + ${inc_paths} + ${QT_INCLUDES} +) +set(lib_paths + ${lib_paths} + ${QT_LIBRARY_DIR} +) +set(libs + ${QT_LIBRARIES} +) + +qt4_wrap_cpp(moc_srcs ${moc_hdrs}) +qt4_add_resources(res_wrapped_files ${res_files}) + +set (all_srcs + ${srcs} ${moc_srcs} + ${res_wrapped_files}) +include_directories(${inc_paths}) +add_executable(generator ${all_srcs} ) +target_link_libraries(generator ${libs}) + +foreach(package ${packages}) + set(gen_sources ${gen_sources} ${CMAKE_SOURCE_DIR}/generator/typesystem_${package}.xml) +endforeach(package ${packages}) + +MACRO(MAKE_WINDOWS_PATH pathname) + # An extra \\ escape is necessary to get a \ through CMake's processing. + STRING(REPLACE "/" "\\" ${pathname} "${${pathname}}") + # Enclose with UNESCAPED quotes. This means we need to escape our + # quotes once here, i.e. with \" + SET(${pathname} \"${${pathname}}\") +ENDMACRO(MAKE_WINDOWS_PATH) + +foreach(package ${packages}) + set(dgen_impl ${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.pri) + break(package ${packages}) +endforeach(package ${packages}) + +add_custom_command(OUTPUT ${dgen_impl} + COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} + COMMAND "generator" + ARGS ${GEN_OPT} --qt-include-directory=${QT_INCLUDE_DIR} --output-directory=../ + --source-directory=${CMAKE_SOURCE_DIR}/generator + qtjambi_masterinclude.h + build_opengl.txt + COMMENT "Generating binding..." + DEPENDS generator ${gen_sources} + ) +add_custom_target(dgen DEPENDS ${dgen_impl} COMMENT "") + +macro(add_sources_for_generating) + foreach(source ${ARGN}) + add_custom_command(OUTPUT "${source}" + COMMAND "" + ARGS "" + DEPENDS ${dgen_impl} + COMMENT "" + ) + endforeach(source ${allcppsources}) +endmacro(add_sources_for_generating) \ No newline at end of file
--- a/generator/main.cpp Wed May 13 17:34:40 2009 +0000 +++ b/generator/main.cpp Wed May 13 19:01:55 2009 +0000 @@ -75,6 +75,7 @@ QString typesystemFileName; QString pp_file = ".preprocessed.tmp"; QStringList rebuild_classes; + QString source_dir; QMap<QString, QString> args; @@ -150,7 +151,12 @@ } } + source_dir = args.value("source-directory"); fileName = args.value("arg-1"); + if (!source_dir.isEmpty()) + { + fileName = source_dir + "/" + fileName; + } typesystemFileName = args.value("arg-2"); if (args.contains("arg-3")) @@ -172,11 +178,10 @@ printf("Running the QtD Generator. Please wait while source files are being generated...\n"); - if (!TypeDatabase::instance()->parseFile(typesystemFileName)) + if (!TypeDatabase::instance()->parseFile(typesystemFileName, source_dir)) qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName)); - - if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"))) { + if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"), source_dir, args.value("qt-include-directory"))) { fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName)); return 1; } @@ -212,8 +217,11 @@ printf("General:\n"); printf( " --cpp-shared \n" + " --qt-include-directory \n" + " --qt-directory \n" + " --source-directory \n" " --debug-level=[sparse|medium|full] \n" - " --d-target=[d1-tango|d2-phobos] \n" + " --d-target=[d1-tango|d2-phobos] \n" " --dump-object-tree \n" " --help, -h or -? \n" " --no-suppress-warnings \n"
--- a/generator/main.h Wed May 13 17:34:40 2009 +0000 +++ b/generator/main.h Wed May 13 19:01:55 2009 +0000 @@ -49,7 +49,8 @@ struct Preprocess { - static bool preprocess(const QString &sourceFile, const QString &targetFile, const QString &commandLineIncludes = QString()) + static bool preprocess(const QString &sourceFile, const QString &targetFile, const QString &commandLineIncludes = QString(), + QString qtdir = QString(), QString qtdir_inc = QString()) { rpp::pp_environment env; rpp::pp preprocess(env); @@ -86,10 +87,12 @@ includes += commandLineIncludes.split(path_splitter); // Include Qt - QString qtdir_inc = getenv ("QTDIR_INC"); - QString qtdir = getenv ("QTDIR"); + if (qtdir.isEmpty()) + qtdir = getenv ("QTDIR"); + if (qtdir_inc.isEmpty()) + qtdir_inc = getenv ("QTDIR_INC"); if (qtdir.isEmpty() && qtdir_inc.isEmpty()) { - qWarning("QTDIR and(or) QTDIR_INC environment variables not set. This may cause problems with finding the necessary include files."); + qWarning("QTDIR and QTDIR_INC environment variables not set. This may cause problems with finding the necessary include files."); } else { if (qtdir_inc.isEmpty()) qtdir_inc = qtdir + "/include"; @@ -101,7 +104,6 @@ includes << qtdir_inc; } - foreach (QString include, includes) preprocess.push_include_path(QDir::convertSeparators(include).toStdString());
--- a/generator/typesystem.cpp Wed May 13 17:34:40 2009 +0000 +++ b/generator/typesystem.cpp Wed May 13 19:01:55 2009 +0000 @@ -138,8 +138,8 @@ class Handler : public QXmlDefaultHandler { public: - Handler(TypeDatabase *database, bool generate) - : m_database(database), m_generate(generate ? TypeEntry::GenerateAll : TypeEntry::GenerateForSubclass) + Handler(TypeDatabase *database, const QString &source_dir, bool generate) + : m_database(database), m_generate(generate ? TypeEntry::GenerateAll : TypeEntry::GenerateForSubclass), m_source_dir(source_dir) { m_current_enum = 0; current = 0; @@ -215,6 +215,8 @@ FieldModificationList m_field_mods; QHash<QString, StackElement::ElementType> tagNames; + + QString m_source_dir; }; bool Handler::error(const QXmlParseException &e) @@ -840,7 +842,7 @@ return false; } - if (!m_database->parseFile(name, convertBoolean(attributes["generate"], "generate", true))) { + if (!m_database->parseFile(name, m_source_dir, convertBoolean(attributes["generate"], "generate", true))) { m_error = QString("Failed to parse: '%1'").arg(name); return false; } @@ -1512,16 +1514,21 @@ addRemoveFunctionToTemplates(this); } -bool TypeDatabase::parseFile(const QString &filename, bool generate) +bool TypeDatabase::parseFile(const QString &filename, const QString &source_dir, bool generate) { - QFile file(filename); + QString name; + if (source_dir.isEmpty()) + name = filename; + else + name = source_dir + "/" + filename; + QFile file(name); Q_ASSERT(file.exists()); QXmlInputSource source(&file); int count = m_entries.size(); QXmlSimpleReader reader; - Handler handler(this, generate); + Handler handler(this, source_dir, generate); reader.setContentHandler(&handler); reader.setErrorHandler(&handler);
--- a/generator/typesystem.h Wed May 13 17:34:40 2009 +0000 +++ b/generator/typesystem.h Wed May 13 19:01:55 2009 +0000 @@ -1186,7 +1186,7 @@ static QString globalNamespaceClassName(const TypeEntry *te); QString filename() const { return "typesystem.txt"; } - bool parseFile(const QString &filename, bool generate = true); + bool parseFile(const QString &filename, const QString &work_dir, bool generate = true); private: uint m_suppressWarnings : 1;
--- a/generator/typesystem_core.xml Wed May 13 17:34:40 2009 +0000 +++ b/generator/typesystem_core.xml Wed May 13 19:01:55 2009 +0000 @@ -1924,7 +1924,7 @@ </object-type> <value-type name="QLine" wrap="struct"/> - <value-type name="QLineF" wrap="struct"> + <value-type name="QLineF" wrap="struct" > <inject-code> <import-file name="typesystem_core-java.java" quote-after-line="class QLineF___" quote-before-line="}// class"/> </inject-code>