From: rusirius <rus...@qc...> - 2011-05-25 16:28:40
|
Alexander, Thank you for this. I have tried to follow this step by step and I believe that I have followed everything accurately. Unfortunately I am getting an error during compilation: [ 66%] Building CXX object src/CMakeFiles/stellarium.dir/qrc_mainRes.cxx.o [ 67%] Building CXX object src/CMakeFiles/stellarium.dir/main.cpp.o make[2]: *** No rule to make target `plugins/GpsLocator/src/./libGpsLocator.a', needed by `src/stellarium'. Stop. make[1]: *** [src/CMakeFiles/stellarium.dir/all] Error 2 make: *** [all] Error 2 johnc@voyager:~/prog/gpslocator-plugin/builds/unix$ I'm not sure what I'm missing but here but I have create a GpsLocator directory under plugins and added my plugin code. Here are the modifications I have made to the various Stellarium files: ~stellarium/gpslocator-plugin/CMakeLists.txt: SET(USE_PLUGIN_GPSLOCATOR 1 CACHE BOOL "Define whether the Gps Locator plugin should be built.") ~stellarium/gpslocator-plugin/plugins/CMakeLists.txt: IF (USE_PLUGIN_GPSLOCATOR) ADD_SUBDIRECTORY( GpsLocator ) ENDIF() ~stellarium/gpslocator-plugin/src/CMakeLists.txt: IF (USE_PLUGIN_GPSLOCATOR) SET(STELLARIUM_STATIC_PLUGINS_LIBRARIES ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} "${CMAKE_BINARY_DIR}/plugins/GpsLocator/src/${CMAKE_CFG_INTDIR}/libGpsLocator.a") ADD_DEFINITIONS(-DUSE_STATIC_PLUGIN_GPSLOCATOR) ENDIF() ~stellarium/gpslocator-plugin/src/StelMainGraphicsView.cpp: #ifdef USE_STATIC_PLUGIN_GPSLOCATOR Q_IMPORT_PLUGIN(GpsLocator) #endif I also make one change to ~stellarium/gpslocator-plugin/plugins/GpsLocator/src/CMakeLists.txt in that I commented out some lines under INCLUDE_DIRECTORIES as I figured they are no longer required. Here is how the file looks: INCLUDE_DIRECTORIES( ${STELLARIUM_BUILD_DIR} ${STELLARIUM_SOURCE_DIR} ${STELLARIUM_SOURCE_DIR}/core ${STELLARIUM_SOURCE_DIR}/core/external ${STELLARIUM_SOURCE_DIR}/core/modules ${STELLARIUM_SOURCE_DIR}/gui ${STELLARIUM_SOURCE_DIR}/scripting ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/gui $ENV{CMAKE_INCLUDE_PATH} ) LINK_DIRECTORIES(${STELLARIUM_BUILD_DIR}/src) SET(GpsLocator_SRCS GpsLocator.hpp GpsLocator.cpp Gps.hpp Gps.cpp SerialPort.hpp SerialPort.cpp gui/GpsLocatorDialog.hpp gui/GpsLocatorDialog.cpp gui/StelDialogGPSL.hpp gui/StelDialogGPSL.cpp gui/GpsTerminal.hpp gui/GpsTerminal.cpp gui/GpsMapTool.hpp gui/GpsMapTool.cpp ) # Add here all the .ui files SET(GpsLocator_UIS gui/GpsLocatorDialog.ui gui/GpsTerminal.ui gui/GpsMapTool.ui ) QT4_WRAP_UI(GpsLocator_UIS_H ${GpsLocator_UIS}) # Compile the resource files SET(GpsLocator_RES ${CMAKE_SOURCE_DIR}/resources/gpsLocator.qrc) QT4_ADD_RESOURCES(GpsLocator_RES_CXX ${GpsLocator_RES}) # Add here all the files which require moc compilation # that is, all the headers with SIGNAL/SLOTS/PLUGIN_INTERFACE etc.. SET(GpsLocator_MOC_HDRS gui/StelDialogGPSL.hpp gui/GpsLocatorDialog.hpp gui/GpsTerminal.hpp gui/GpsMapTool.hpp GpsLocator.hpp Gps.hpp ) # After this call, GpsLocator_MOC_SRCS = moc_GpsLocator.cxx QT4_WRAP_CPP(GpsLocator_MOC_SRCS ${GpsLocator_MOC_HDRS}) SET(extLinkerOption ${QT_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES}) ############### For building the dynamic library ###################### IF(BUILD_DYNAMIC_LIB) ADD_LIBRARY(GpsLocator MODULE ${GpsLocator_SRCS} ${GpsLocator_MOC_SRCS} ${GpsLocator_RES_CXX} ${GpsLocator_UIS_H}) IF(APPLE) FIND_LIBRARY(OPENGL_LIBRARY OpenGL) MARK_AS_ADVANCED(OPENGL_LIBRARY) SET_TARGET_PROPERTIES(GpsLocator PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" SUFFIX ".dylib") ENDIF(APPLE) IF(WIN32) SET_TARGET_PROPERTIES(GpsLocator PROPERTIES LINK_FLAGS "-enable-runtime-pseudo-reloc -Wl,--allow-multiple-definition" ) SET(StelMain stelMain) ELSE(WIN32) SET(StelMain ) ENDIF(WIN32) TARGET_LINK_LIBRARIES(GpsLocator ${StelMain} ${extLinkerOption}) INSTALL(TARGETS GpsLocator DESTINATION "modules/${PACKAGE}") ENDIF(BUILD_DYNAMIC_LIB) ############### For building the static library ###################### IF(BUILD_STATIC_LIB) ADD_LIBRARY(GpsLocator-static STATIC ${GpsLocator_SRCS} ${GpsLocator_MOC_SRCS} ${GpsLocator_RES_CXX} ${GpsLocator_UIS_H}) SET_TARGET_PROPERTIES(GpsLocator-static PROPERTIES OUTPUT_NAME "GpsLocator") TARGET_LINK_LIBRARIES(GpsLocator-static ${StelMain} ${extLinkerOption}) SET_TARGET_PROPERTIES(GpsLocator-static PROPERTIES COMPILE_FLAGS "-fPIC -DQT_STATICPLUGIN") ENDIF(BUILD_STATIC_LIB) I'm not sure what else is required. On 25/05/2011 08:42, Alexander Wolf wrote: > 2011/5/24 Alexander Wolf<ale...@gm...>: >> This recommendations is nice for development plugins on linux, but >> don't cool for mac os x. Now I'm develop my plugin meteor shower - you >> can look my commits as example integrate plugins on source code of >> Stellarium. Or any other plugin. > O.K., I write some simple instructions for create a static plugin on > wiki - http://stellarium.org/wiki/index.php/Static_Plugin_Development > > |