Ralf Habacker schrieb:
David Faure schrieb:
On Thursday 03 April 2008, Ralf Habacker wrote:
David Faure schrieb:
On Wednesday 02 April 2008, Ralf Habacker wrote:
SVN commit 793038 by habacker:
kdeinit modules are not supported on win32
M +10 -6 client/CMakeLists.txt M +11 -5
src/CMakeLists.txt
--- trunk/KDE/kdebase/apps/konqueror/client/CMakeLists.txt
#793037:793038
@@ -10,13 +10,17 @@
kde4_add_app_icon(kfmclient_SRCS
"${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-file-manager.png")
-kde4_add_kdeinit_executable( kfmclient NOGUI ${kfmclient_SRCS})
+if (WIN32)
+ add_definitions(-Dkdemain=main)
+ kde4_add_executable(kfmclient ${kfmclient_SRCS})
+ target_link_libraries(kfmclient ${KDE4_KIO_LIBS} )
+else (WIN32)
+ kde4_add_kdeinit_executable( kfmclient NOGUI ${kfmclient_SRCS})
+ target_link_libraries(kdeinit_kfmclient ${KDE4_KIO_LIBS} )
+ install(TARGETS kdeinit_kfmclient DESTINATION
${INSTALL_TARGETS_DEFAULT_ARGS} )
+ target_link_libraries( kfmclient kdeinit_kfmclient )
+endif (WIN32)
Ouch. But we define kdeinit modules everywhere in the source code.
Maintaining CMakeLists.txt files
like this one is going to be horrible.
How about making kde4_add_kdeinit_executable do what's right for
Windows, i.e. creating a static lib
kdeinit_foo with -Dkdemain-main, and then the normal stuff from the
CMakeLists.txt will work:
target_link_libraries(kdeinit_kfmclient ${KDE4_KIO_LIBS} )
install(TARGETS kdeinit_kfmclient DESTINATION
${INSTALL_TARGETS_DEFAULT_ARGS} )
You are aware that you then install an obsolate static library ?
Ah, indeed.
target_link_libraries( kfmclient kdeinit_kfmclient )
(I think/hope that the dependencies of the static lib are used for
the binary)
would it not be possible to have something like the following
kde4_add_kdeinit_executable(kfmclient ... )
kde4_target_link_library(kfmclient ... )
kde4_install(TARGETS kfmclient ... )
which would make it possible to hide all the internal platform
depending stuff into those cmake macros.
I agree. But this is Alex's call really -> moving discussion to
kde-buildsystem.
After some private discussion with Alex and Christian I have prepared a
patch which adds the following platform independent cmake macros to
KDE4Macros.cmake
kde4_kdeinit_add_executable(target options sources)
kde4_kdeinit_link_libraries(target options libraries)
kde4_kdeinit_install(target options)
This api makes it possible to skip the kdeinit magic on windows without
any further patching of package CMakeLists.txt. (See appended testcase
for konquerors kfmclient)
The appended patch contains the win32 and non win32 implementations of
the above mentioned macros taken from the macro
kde_add_kdeinit_executable which will be obsolate now. I've tried hard
to make sure it will work on unix abe before by inspecting the macro
kde_add_kdeinit_executable.
Any problems with this patch ?
Ralf
Index: KDE4Macros.cmake
===================================================================
--- KDE4Macros.cmake (revision 793929)
+++ KDE4Macros.cmake (working copy)
@@ -747,6 +747,65 @@
endmacro (KDE4_ADD_KDEINIT_EXECUTABLE)
+# the following macros are intended for creating kdeinit modules using with a
+# platform independent interface
+# kdeinit modules are shared libraries loadable by the kdeinit loader
+# on win32 kdeinit modules are not supported and replaced by simple
executables
+#
+#kde4_kdeinit_add_executable(target options sources)
+#kde4_kdeinit_link_libraries(target options libraries)
+#kde4_kdeinit_install(target options)
+
+# th 'if' statement is made outside the macros to reduce the number of
conditionals
+# it could be extended to whole KDE4Macros.cmake to split it into three
+# areas - a platform independent, a win32, a unix and a mac os specific
section
+if (WIN32)
+ macro (kde4_kdeinit_add_executable _target_NAME)
+ add_definitions(-Dkdemain=main)
+ kde4_check_executable_params(_SRCS _nogui _uninst _test ${ARGN})
+ kde4_add_executable(${_target_NAME} "${_nogui}" "${_uninst}" ${_SRCS})
+ endmacro (kde4_kdeinit_add_executable)
+
+ macro (kde4_kdeinit_link_libraries _target_NAME)
+ target_link_libraries(${_target_NAME} ${ARGN})
+ endmacro (kde4_kdeinit_link_libraries)
+
+ macro (kde4_kdeinit_install)
+ install(TARGETS ${ARGV})
+ endmacro (kde4_kdeinit_install)
+else(WIN32)
+ macro (kde4_kdeinit_add_executable _target_NAME)
+ kde4_check_executable_params(_SRCS _nogui _uninst _test ${ARGN})
+
+ set (KDEINIT_LINK_TYPE SHARED)
+
+ kde4_handle_automoc(kdeinit_${_target_NAME} _SRCS)
+ if (KDE4_ENABLE_FINAL)
+
kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/kdeinit_${_target_NAME}_final_cpp.cpp
_separate_files ${_SRCS})
+ add_library(kdeinit_${_target_NAME} ${KDEINIT_LINK_TYPE}
${CMAKE_CURRENT_BINARY_DIR}/kdeinit_${_target_NAME}_final_cpp.cpp
${_separate_files})
+
+ else (KDE4_ENABLE_FINAL)
+ add_library(kdeinit_${_target_NAME} ${KDEINIT_LINK_TYPE} ${_SRCS})
+ endif (KDE4_ENABLE_FINAL)
+
+ kde4_handle_rpath_for_library(kdeinit_${_target_NAME})
+ set_target_properties(kdeinit_${_target_NAME} PROPERTIES OUTPUT_NAME
kdeinit4_${_target_NAME})
+
+ configure_file(${KDE4_MODULE_DIR}/kde4init_dummy.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
+ kde4_add_executable(${_target_NAME} "${_nogui}" "${_uninst}"
${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
+ endmacro (kde4_kdeinit_add_executable)
+
+ macro (kde4_kdeinit_link_libraries _target_NAME)
+ target_link_libraries(kdeinit_${_target_NAME} ${ARGN})
+ target_link_libraries(${_target_NAME} kdeinit_${_target_NAME})
+ endmacro (kde4_kdeinit_link_libraries)
+
+ macro (kde4_kdeinit_install _target_NAME)
+ install(TARGETS kdeinit_${_target_NAME}
${INSTALL_TARGETS_DEFAULT_ARGS} )
+ install(TARGETS ${_target_NAME} ${ARGN})
+ endmacro (kde4_kdeinit_install)
+endif (WIN32)
+
# add a unit test, which is executed when running make test
# it will be built with RPATH pointing to the build dir
# The targets are always created, but only built for the "all"
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 793509)
+++ CMakeLists.txt (working copy)
@@ -1,5 +1,4 @@
########### kfmclient ###############
-
set(kfmclient_SRCS kfmclient.cpp )
qt4_add_dbus_interface( kfmclient_SRCS ../src/org.kde.Konqueror.Main.xml
konq_main_interface )
@@ -9,20 +8,10 @@
add_definitions(-DQT_NO_CAST_ASCII)
kde4_add_app_icon(kfmclient_SRCS
"${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-file-manager.png")
+kde4_kdeinit_add_executable(kfmclient ${kfmclient_SRCS})
+kde4_kdeinit_link_libraries(kfmclient ${KDE4_KIO_LIBS})
+kde4_kdeinit_install(kfmclient DESTINATION ${BIN_INSTALL_DIR})
-if (WIN32)
- add_definitions(-Dkdemain=main)
- kde4_add_executable(kfmclient ${kfmclient_SRCS})
- target_link_libraries(kfmclient ${KDE4_KIO_LIBS} )
-else (WIN32)
- kde4_add_kdeinit_executable( kfmclient NOGUI ${kfmclient_SRCS})
- target_link_libraries(kdeinit_kfmclient ${KDE4_KIO_LIBS} )
- install(TARGETS kdeinit_kfmclient DESTINATION
${INSTALL_TARGETS_DEFAULT_ARGS} )
- target_link_libraries( kfmclient kdeinit_kfmclient )
-endif (WIN32)
-
-install(TARGETS kfmclient DESTINATION ${BIN_INSTALL_DIR})
-
########### install files ###############
if( NOT WIN32)
install( FILES kfmclient_3_2.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem