Changeset 121 in pacpusframework for branches/2.0-beta1/cmake
- Timestamp:
- Jul 19, 2013, 12:42:35 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/cmake/PacpusUtilities.cmake
r120 r121 13 13 ## Qt macro compatibility Qt4 / Qt5 14 14 ## ======================================== 15 #function(qt_wrap_mocMOC_SRCS FILES_TO_MOC)16 17 #if(QT4_FOUNDED)18 # qt4_wrap_cpp(TEMP_VAR${FILES_TO_MOC})19 20 #elseif(Qt5Core_FOUND)21 # qt5_wrap_cpp(${MOC_SRCS} ${FILES_TO_MOC} PARENT_SCOPE)22 23 #else()24 # message(WARNING "QT uifound, can't wrap moc File")25 #endif()26 27 # #set(${MOC_SRCS} ${TEMP_VAR} PARENT_SCOPE)28 29 #endfunction(qt_wrap_moc)15 function(qt_wrap_cpp OUT_MOC_SRCS FILES_TO_MOC) 16 17 if(QT4_FOUNDED) 18 qt4_wrap_cpp(MOC_SRCS ${FILES_TO_MOC}) 19 20 elseif(Qt5Core_FOUND) 21 qt5_wrap_cpp(MOC_SRCS ${FILES_TO_MOC}) 22 23 else() 24 message(WARNING "QT not found, can't wrap moc File") 25 endif() 26 27 set(${OUT_MOC_SRCS} ${MOC_SRCS} PARENT_SCOPE) 28 29 endfunction(qt_wrap_cpp) 30 30 31 31 ## ======================================== 32 32 ## Qt macro compatibility Qt4 / Qt5 33 33 ## ======================================== 34 #function(qt_wrap_ui UI_SRCS UI_FILES) 35 # if(QT4_FOUND) 36 # qt4_wrap_ui( TEMP_VAR ${UI_FILES}) 37 38 # elseif(Qt5Core_FOUND) 39 # qt5_wrap_ui( TEMP_VAR ${UI_FILES}) 40 41 # else() 42 # message(WARNING "QT ui found, can't wrap ui File") 43 # endif() 44 45 # set(${UI_SRCS} ${TEMP_VAR} PARENT_SCOPE) 46 #endfunction() 34 function(qt_wrap_ui OUT_UI_SRCS UI_FILES) 35 if(QT4_FOUND) 36 qt4_wrap_ui( UI_SRCS ${UI_FILES}) 37 38 elseif(Qt5Core_FOUND) 39 qt5_wrap_ui( UI_SRCS ${UI_FILES}) 40 41 else() 42 message(WARNING "QT not found, can't wrap ui File") 43 endif() 44 45 set(${OUT_UI_SRCS} ${UI_SRCS} PARENT_SCOPE) 46 47 endfunction() 47 48 48 49 # ======================================== … … 53 54 if(QT4_FOUND) 54 55 pacpus_plugin_qt4(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 56 #message("Create QT4 Plugin") 55 57 56 58 elseif(Qt5Core_FOUND) … … 61 63 endif() 62 64 65 set(${OUT_CPP} ${PLUGIN_CPP} PARENT_SCOPE) 66 set(${OUT_H} ${PLUGIN_H} PARENT_SCOPE) 63 67 64 68 endfunction(PACPUS_PLUGIN) … … 162 166 " Q_OBJECT\n" 163 167 " //Qt5 Plugins Macro\n" 164 " Q_PLUGIN_METADATA(IID \"papus. pacpuscityvip." ${PLUGIN_NAME} "\" FILE \"" ${PLUGIN_NAME} ".json\")\n"168 " Q_PLUGIN_METADATA(IID \"papus." ${PLUGIN_NAME} "\" FILE \"" ${PLUGIN_NAME} ".json\")\n" 165 169 " Q_INTERFACES(PacpusPluginInterface)\n" 166 170 "\n" … … 366 370 SET(${result} ${dirlist}) 367 371 ENDMACRO() 372 373 374 # ======================================== 375 # Create export header for plugins 376 # ======================================== 377 function(CREATE_EXPORT OUT_H PLUGIN_NAME) 378 379 set(${OUT_H} "export_${PLUGIN_NAME}.h" PARENT_SCOPE) 380 381 string(TOUPPER ${PLUGIN_NAME} PLUGIN_NAME_UPPER) 382 383 # create the header file 384 file(WRITE "export_${PLUGIN_NAME}.h" 385 "// Autogenerated file by PacpusUtilities.cmake\n" 386 "// DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE\n" 387 "\n" 388 389 "#ifndef __EXPORT_${PLUGIN_NAME_UPPER}__H__\n" 390 "#define __EXPORT_${PLUGIN_NAME_UPPER}_H__\n" 391 "\n" 392 "// Export macro for use DLL for Windows only\n" 393 "#ifdef WIN32\n" 394 "# ifdef ${PLUGIN_NAME_UPPER}_EXPORT\n" 395 "// make DLL\n" 396 "# define ${PLUGIN_NAME_UPPER}_API __declspec(dllexport)\n" 397 "# else\n" 398 "// use DLL\n" 399 "# define ${PLUGIN_NAME_UPPER}_API __declspec(dllimport)\n" 400 "# endif\n" 401 "#else\n" 402 "// On other platforms, simply ignore this\n" 403 "# define ${PLUGIN_NAME_UPPER}_API\n" 404 "//#endif\n" 405 406 "#endif // __EXPORT_${PLUGIN_NAME_UPPER}_H__\n" 407 ) 408 endfunction(CREATE_EXPORT)
Note:
See TracChangeset
for help on using the changeset viewer.