From kde-active Tue Jul 10 09:55:00 2012 From: Marco Martin Date: Tue, 10 Jul 2012 09:55:00 +0000 To: kde-active Subject: porting stuff to Nepomuk2 Message-Id: <201207101155.00753.notmart () gmail ! com> X-MARC-Message: https://marc.info/?l=kde-active&m=134191436631732 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_0v/+PS07kv2L6L+" --Boundary-00=_0v/+PS07kv2L6L+ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Yo all, I tried to port some stuff to Nepomuk2, namely kactivities and plasma-mobile porting kactivities went smooth, and is now in the branch mart/nepomuk2 of the kactivities repository. the only thing still to fix is that is exposing a Nepomuk::Resource in a method, so it will have to provide both that and a new one with a Nepomuk2::Resource for plasma-mobile (mart/nepomuk2 branch on the plasma-mobile git repo) is a bit more tricky: it needs nepomuk_add_ontology_classes that is still generating code with Nepomuk:: namespace. this will be a problem for a lot of code to port i guess I did a mart/rcgenNepomuk2 branch on the nepomuk-core repo. this builds that copy of rcgen with the name nepomuk2-rcgen and generates code with Nepomuk2:: namespace (a bit of generated code is disabled because it was using old functions from ResourceManager that are removed and were very slow) i tought at start to make the namespace command line dependent but the result vas an ugly bunch of spaghetti and the kdelibs copy would have to be modified (not good) it also needs an updated cmake file NepomukAddOntologyClasses (attached), which adds the NEPOMUK2 option and in that case uses nepomuk2-rcgen. all should be retrocompatible, Vishes: what's the best way to proceed now? Cheers, Marco Martin --Boundary-00=_0v/+PS07kv2L6L+ Content-Type: text/x-cmake; charset="UTF-8"; name="NepomukAddOntologyClasses.cmake" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="NepomukAddOntologyClasses.cmake" # # Use the Nepomuk resource class generator to generate convinient Resource subclasses # from ontologies. # # Usage: # NEPOMUK_ADD_ONTOLOGY_CLASSES( # [FAST] # [ONTOLOGIES] [ ...] # [CLASSES [ ...]] # [VISIBILITY ] # ) # # If FAST is specified the rcgen parameter --fast will be used which results in resource classes # not based on Nepomuk::Resource but on a custom class which does not perform any checks and simply # writes the data to Nepomuk (hence the name fast). # # The optional CLASSES parameter allows to specify the classes to be generated (RDF URIs) in # case one does not want all classes in the ontologies to be generated. # # The optional VISIBILITY parameter can only be used in non-fast mode and allows to set the gcc visibility # to make the generated classes usable in a publically exported API. The is used to create # the name of the export macro and the export include file. Thus, when using "VISIBILITY foobar" include # file "foobar_export.h" needs to define FOOBAR_EXPORT. # # Copyright (c) 2009 Sebastian Trueg # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # macro(NEPOMUK_ADD_ONTOLOGY_CLASSES _sources) # extract arguments set(_current_arg_type "onto") foreach(_arg ${ARGN}) if(${_arg} STREQUAL "ONTOLOGIES") set(_current_arg_type "onto") elseif(${_arg} STREQUAL "VISIBILITY") set(_current_arg_type "visib") elseif(${_arg} STREQUAL "CLASSES") set(_current_arg_type "class") elseif(${_arg} STREQUAL "FAST") set(_fastmode "--fast") elseif(${_arg} STREQUAL "NEPOMUK2") set(_nepomuk2 TRUE) else(${_arg} STREQUAL "ONTOLOGIES") if(${_current_arg_type} STREQUAL "onto") list(APPEND _ontologies ${_arg}) get_filename_component(_filename ${_arg} NAME) list(APPEND _ontofilenames ${_filename}) elseif(${_current_arg_type} STREQUAL "class") list(APPEND _classes "--class" "${_arg}") else(${_current_arg_type} STREQUAL "onto") set(_visibility "--visibility" "${_arg}") endif(${_current_arg_type} STREQUAL "onto") endif(${_arg} STREQUAL "ONTOLOGIES") endforeach(_arg) # find our helper program (first in the install dir, then everywhere) if (_nepomuk2) if(NOT WINCE) find_program(RCGEN nepomuk2-rcgen PATHS ${KDE4_BIN_INSTALL_DIR} ${BIN_INSTALL_DIR} NO_DEFAULT_PATH) find_program(RCGEN nepomuk2-rcgen) else(NOT WINCE) find_program(RCGEN nepomuk2-rcgen PATHS ${HOST_BINDIR} NO_DEFAULT_PATH) endif(NOT WINCE) else(_nepomuk2) if(NOT WINCE) find_program(RCGEN nepomuk-rcgen PATHS ${KDE4_BIN_INSTALL_DIR} ${BIN_INSTALL_DIR} NO_DEFAULT_PATH) find_program(RCGEN nepomuk-rcgen) else(NOT WINCE) find_program(RCGEN nepomuk-rcgen PATHS ${HOST_BINDIR} NO_DEFAULT_PATH) endif(NOT WINCE) endif(_nepomuk2) if(NOT RCGEN) message(SEND_ERROR "Failed to find the Nepomuk source generator" ) else(NOT RCGEN) file(TO_NATIVE_PATH ${RCGEN} RCGEN) # we generate the files in the current binary dir set(_targetdir ${CMAKE_CURRENT_BINARY_DIR}) # generate the list of source and header files execute_process( COMMAND ${RCGEN} ${_fastmode} --listheaders --prefix ${_targetdir}/ ${_classes} ${_visibility} ${_ontologies} OUTPUT_VARIABLE _out_headers RESULT_VARIABLE rcgen_result ) if(NOT ${rcgen_result} EQUAL 0) message(SEND_ERROR "Running ${RCGEN} to generate list of headers failed with error code ${rcgen_result}") endif(NOT ${rcgen_result} EQUAL 0) execute_process( COMMAND ${RCGEN} ${_fastmode} --listsources --prefix ${_targetdir}/ ${_classes} ${_visibility} ${_ontologies} OUTPUT_VARIABLE _out_sources RESULT_VARIABLE rcgen_result ) if(NOT ${rcgen_result} EQUAL 0) message(SEND_ERROR "Running ${RCGEN} to generate list of sources failed with error code ${rcgen_result}") endif(NOT ${rcgen_result} EQUAL 0) add_custom_command(OUTPUT ${_out_headers} ${_out_sources} COMMAND ${RCGEN} ${_fastmode} --writeall --target ${_targetdir}/ ${_classes} ${_visibility} ${_ontologies} DEPENDS ${_ontologies} COMMENT "Generating ontology source files from ${_ontofilenames}" ) # make sure the includes are found include_directories(${_targetdir}) # finally append the source files to the source list list(APPEND ${_sources} ${_out_sources}) endif(NOT RCGEN) # reset variable names used unset(_current_arg_type) unset(_arg) unset(_ontologies) unset(_ontofilenames) unset(_classes) unset(_visibility) unset(_fastmode) unset(_nepomuk2) unset(_targetdir) unset(_out_headers) unset(_out_sources) unset(rcgen_result) endmacro(NEPOMUK_ADD_ONTOLOGY_CLASSES) --Boundary-00=_0v/+PS07kv2L6L+ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Active mailing list Active@kde.org https://mail.kde.org/mailman/listinfo/active --Boundary-00=_0v/+PS07kv2L6L+--