Permalink
Browse files

make it possible to build gtk2 and gtk3 at the same time while keepin…

…g backward compatiblilty
  • Loading branch information...
yuyichao authored and kuromabo committed Jan 21, 2013
1 parent 699cc08 commit 78571e72cda2b00dbe6805432da7d8dcdbc03185
Showing with 167 additions and 143 deletions.
  1. +75 −25 CMakeLists.txt
  2. +13 −13 hotot-gir/CMakeLists.txt
  3. +10 −10 hotot/CMakeLists.txt
  4. +20 −35 misc/CMakeLists.txt
  5. +2 −2 misc/{hotot.desktop.in → hotot.desktop.in.in}
  6. +0 −1 po/CMakeLists.txt
  7. +1 −1 po/ca.po
  8. +2 −2 po/de_DE.po
  9. +3 −4 po/es_ES.po
  10. +3 −4 po/es_MX.po
  11. +3 −4 po/fr_FR.po
  12. +2 −2 po/gl.po
  13. +1 −1 po/hotot.pot
  14. +2 −3 po/it_IT.po
  15. +2 −2 po/ja.po
  16. +3 −4 po/pt_BR.po
  17. +3 −4 po/pt_PT.po
  18. +3 −4 po/tr_TR.po
  19. +2 −2 po/zh_CN.po
  20. +2 −2 po/zh_TW.po
  21. +13 −13 qt/CMakeLists.txt
  22. +2 −5 scripts/hotot.in
@@ -8,48 +8,98 @@ find_package(Gettext REQUIRED)
option(WITH_GTK "Enable GTK Version" On)
option(WITH_GIR "Use GIR as GTK Version" Off)

option(WITH_GTK2 "Enable GTK2 Version" Off)
option(WITH_GTK3 "Enable GTK3 Version" Off)

option(WITH_QT "Enable Qt Version" On)
option(WITH_KDE "Enable KDE4 integration for Qt" On)

option(WITH_CHROME "Enable Chrome Version" Off)

find_program(INTLTOOL_MERGE intltool-merge)

if(NOT INTLTOOL_MERGE)
message(FATAL_ERROR "intltool-merge required for i18n generation")
endif()

function(intltool_merge_translation infile outfile)
add_custom_command(
OUTPUT ${outfile}
COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${PROJECT_SOURCE_DIR}/po
${infile} ${outfile}
DEPENDS ${infile})
endfunction()

# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

##################### GTK Version ######################
if (WITH_GTK)
FIND_PACKAGE(PythonLibrary REQUIRED)

if (NOT PYTHONLIBRARY_FOUND)
message(FATAL_ERROR "GTK Wrapper for Hotot need python")
endif (NOT PYTHONLIBRARY_FOUND)
if(WITH_GTK OR WITH_GTK2 OR WITH_GTK3)
find_package(PythonLibrary REQUIRED)
if(NOT PYTHONLIBRARY_FOUND)
message(FATAL_ERROR "GTK Wrapper for Hotot need python")
endif()
include(PythonMacros)
# for backword compatibility, if none of GTK2 or GTK3 is manually set
# we will still use the old binary name instead of hotot-gtk{2,3}
if(WITH_GTK2 OR WITH_GTK3)
set(HOTOT_GTK_OLD_NAME Off)
else()
set(HOTOT_GTK_OLD_NAME On)
endif()

INCLUDE(PythonMacros)
if (WITH_GIR)
add_subdirectory(hotot-gir)
else (WITH_GIR)
add_subdirectory(hotot)
endif (WITH_GIR)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/hotot.in ${CMAKE_CURRENT_BINARY_DIR}/scripts/hotot @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/scripts/hotot DESTINATION bin )
endif (WITH_GTK)
function(hotot_gtk_build suffix HOTOT_GTK_NAME dir)
if(HOTOT_GTK_OLD_NAME)
set(HOTOT_BIN_NAME "hotot")
set(HOTOT_PY_NAME "hotot")
else()
set(HOTOT_BIN_NAME "hotot-${suffix}")
set(HOTOT_PY_NAME "hotot_${suffix}")
endif()
set(hotot_bin "${CMAKE_CURRENT_BINARY_DIR}/scripts/${HOTOT_BIN_NAME}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/hotot.in"
"${hotot_bin}" @ONLY)
install(PROGRAMS "${hotot_bin}" DESTINATION bin)
add_subdirectory("${dir}")
configure_file(misc/hotot.desktop.in.in
"misc/${HOTOT_BIN_NAME}.desktop.in")
intltool_merge_translation(
"${CMAKE_CURRENT_BINARY_DIR}/misc/${HOTOT_BIN_NAME}.desktop.in"
"${CMAKE_CURRENT_BINARY_DIR}/misc/${HOTOT_BIN_NAME}.desktop")
add_custom_target("desktopfile-${HOTOT_BIN_NAME}" ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/misc/${HOTOT_BIN_NAME}.desktop")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/misc/${HOTOT_BIN_NAME}.desktop"
DESTINATION share/applications/)
endfunction()

if(WITH_GIR)
set(WITH_GTK3 On)
else()
set(WITH_GTK2 On)
endif()
if(WITH_GTK2)
hotot_gtk_build(gtk2 Gtk2 hotot)
endif()
if(WITH_GTK3)
hotot_gtk_build(gtk3 Gtk3 hotot-gir)
endif()
endif()

##################### CHROME Version ######################
if (WITH_CHROME)
add_subdirectory(chrome)
endif (WITH_CHROME)
if(WITH_CHROME)
add_subdirectory(chrome)
endif()

##################### Qt Version ######################
if (WITH_QT)
add_subdirectory(qt)
endif (WITH_QT)
if(WITH_QT)
add_subdirectory(qt)
endif()

add_subdirectory(po)
add_subdirectory(misc)
@@ -1,15 +1,15 @@
set(hotot_gir_SRCS
__init__.py
agent.py
config.py
dbusservice.py
notification.py
hotot.py
i18n.py
inspector.py
utils.py
view.py
xhotkey.py
)
__init__.py
agent.py
config.py
dbusservice.py
notification.py
hotot.py
i18n.py
inspector.py
utils.py
view.py
xhotkey.py
)

python_install_module(hotot ${hotot_gir_SRCS})
python_install_module(${HOTOT_PY_NAME} ${hotot_gir_SRCS})
@@ -1,12 +1,12 @@
set(hotot_SRCS
__init__.py
agent.py
config.py
gtknotification.py
hotot.py
i18n.py
utils.py
view.py
)
__init__.py
agent.py
config.py
gtknotification.py
hotot.py
i18n.py
utils.py
view.py
)

python_install_module(hotot ${hotot_SRCS})
python_install_module(${HOTOT_PY_NAME} ${hotot_SRCS})
@@ -1,43 +1,28 @@
install(DIRECTORY "${PROJECT_SOURCE_DIR}/data/"
DESTINATION share/hotot
PATTERN .hg PATTERN *~ EXCLUDE)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/data/ DESTINATION share/hotot PATTERN .hg PATTERN *~ EXCLUDE)

install(FILES ${PROJECT_SOURCE_DIR}/data/image/ic24_hotot_mono_light.svg
DESTINATION share/icons/hicolor/scalable/status/ RENAME hotot_qt-inactive.svg)
install(FILES ${PROJECT_SOURCE_DIR}/data/image/ic24_hotot_mono_dark.svg
DESTINATION share/icons/hicolor/scalable/status/ RENAME hotot_qt-active.svg)
install(FILES "${PROJECT_SOURCE_DIR}/data/image/ic24_hotot_mono_light.svg"
DESTINATION share/icons/hicolor/scalable/status/
RENAME hotot_qt-inactive.svg)
install(FILES "${PROJECT_SOURCE_DIR}/data/image/ic24_hotot_mono_dark.svg"
DESTINATION share/icons/hicolor/scalable/status/
RENAME hotot_qt-active.svg)

set(ICON_SIZE 22x22 24x24 32x32 48x48 64x64 128x128)

foreach(size ${ICON_SIZE})
install(FILES ${PROJECT_SOURCE_DIR}/data/icons/${size}/apps/hotot.png
DESTINATION share/icons/hicolor/${size}/apps/)
endforeach(size ${ICON_SIZE})

find_program(INTLTOOL_MERGE intltool-merge)

if (NOT INTLTOOL_MERGE)
message(FATAL_ERROR "intltool-merge required for i18n generation")
endif (NOT INTLTOOL_MERGE)

MACRO(INTLTOOL_MERGE_TRANSLATION infile outfile)
ADD_CUSTOM_COMMAND(
OUTPUT ${outfile}
COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${PROJECT_SOURCE_DIR}/po ${infile} ${outfile}
DEPENDS ${infile}
)
ENDMACRO(INTLTOOL_MERGE_TRANSLATION)

INTLTOOL_MERGE_TRANSLATION(${CMAKE_CURRENT_SOURCE_DIR}/hotot.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/hotot.desktop)
INTLTOOL_MERGE_TRANSLATION(${CMAKE_CURRENT_SOURCE_DIR}/hotot-qt.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/hotot-qt.desktop)
install(FILES "${PROJECT_SOURCE_DIR}/data/icons/${size}/apps/hotot.png"
DESTINATION "share/icons/hicolor/${size}/apps/")
endforeach()

add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/hotot.desktop ${CMAKE_CURRENT_BINARY_DIR}/hotot-qt.desktop)
intltool_merge_translation(${CMAKE_CURRENT_SOURCE_DIR}/hotot-qt.desktop.in
${CMAKE_CURRENT_BINARY_DIR}/hotot-qt.desktop)

if (WITH_GTK)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hotot.desktop
DESTINATION share/applications/)
endif (WITH_GTK)
add_custom_target(desktopfile ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/hotot-qt.desktop)

if (WITH_QT)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hotot-qt.desktop
DESTINATION share/applications/)
endif (WITH_QT)
if(WITH_QT)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hotot-qt.desktop
DESTINATION share/applications/)
endif()
@@ -3,8 +3,8 @@ _Name=Hotot
_GenericName=Hotot Twitter Client
_X-GNOME-FullName=Hotot Twitter Client
Type=Application
_Comment=Lightweight Twitter client based on Gtk2 and WebKit
Exec=hotot
_Comment=Lightweight Twitter client based on Gtk and WebKit
Exec=@HOTOT_BIN_NAME@
Icon=hotot
Categories=GTK;GNOME;Network;
X-GNOME-Gettext-Domain=hotot
@@ -7,7 +7,6 @@ endif("${REL_SOURCE_ROOT}" STREQUAL "")
set(POT_FILE hotot.pot)

configure_file(POTFILES.in.in ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in)

find_program(INTLTOOL_EXTRACT intltool-extract)
find_program(INTLTOOL_UPDATE intltool-update)

@@ -119,7 +119,7 @@ msgid "Jimmy Xu"
msgstr "Jimmy Xu"

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr ""

#: ../..//misc/hotot-qt.desktop.in.h:2
@@ -125,8 +125,8 @@ msgid "Jimmy Xu"
msgstr "Jimmy Xu"

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Ein schlanker Twitter Client basierend auf Gtk2 und Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Ein schlanker Twitter Client basierend auf Gtk und Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
#, fuzzy
@@ -121,13 +121,12 @@ msgid "Jimmy Xu"
msgstr ""

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Cliente de Twitter basado en Gtk2 y Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Cliente de Twitter basado en Gtk y Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
#, fuzzy
msgid "Lightweight Twitter Client base on Qt and Webkit"
msgstr "Cliente de Twitter basado en Gtk2 y Webkit"
msgstr "Cliente de Twitter basado en Qt y Webkit"

#: /home/saber/Develop/Hotot/build/po/../..//qt/src/main.cpp:65
msgid "Lightweight, Flexible Microblogging"
@@ -123,13 +123,12 @@ msgid "Jimmy Xu"
msgstr ""

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Cliente Twitter liviano basado en Gtk2 y Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Cliente Twitter liviano basado en Gtk y Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
#, fuzzy
msgid "Lightweight Twitter Client base on Qt and Webkit"
msgstr "Cliente Twitter liviano basado en Gtk2 y Webkit"
msgstr "Cliente Twitter liviano basado en Qt y Webkit"

#: /home/saber/Develop/Hotot/build/po/../..//qt/src/main.cpp:65
msgid "Lightweight, Flexible Microblogging"
@@ -121,13 +121,12 @@ msgid "Jimmy Xu"
msgstr ""

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Un client léger pour twitter basé sur Gtk2 et Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Un client léger pour twitter basé sur Gtk et Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
#, fuzzy
msgid "Lightweight Twitter Client base on Qt and Webkit"
msgstr "Un client léger pour twitter basé sur Gtk2 et Webkit"
msgstr "Un client léger pour twitter basé sur Qt et Webkit"

#: /home/saber/Develop/Hotot/build/po/../..//qt/src/main.cpp:65
msgid "Lightweight, Flexible Microblogging"
@@ -117,8 +117,8 @@ msgid "Jimmy Xu"
msgstr "Jimmy Xu"

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Cliente lixeiro de Twitter baseado en Gtk2 e Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Cliente lixeiro de Twitter baseado en Gtk e Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
msgid "Lightweight Twitter Client base on Qt and Webkit"
@@ -184,7 +184,7 @@ msgid "Hotot Twitter Client"
msgstr ""

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr ""

#: ../..//misc/hotot-qt.desktop.in.h:1
@@ -122,11 +122,10 @@ msgid "Jimmy Xu"
msgstr "Jimmy Xu"

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Un agile Client per Twitter basato su Gtk2 e Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Un agile Client per Twitter basato su Gtk e Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
#, fuzzy
msgid "Lightweight Twitter Client base on Qt and Webkit"
msgstr "Un agile client per Twitter basato su Qt e Webkit"

@@ -117,8 +117,8 @@ msgid "Jimmy Xu"
msgstr "Jimmy Xu"

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Gtk2とWebkitベースの軽量なTwitterクライアント"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "GtkとWebkitベースの軽量なTwitterクライアント"

#: ../..//misc/hotot-qt.desktop.in.h:2
msgid "Lightweight Twitter Client base on Qt and Webkit"
@@ -124,13 +124,12 @@ msgid "Jimmy Xu"
msgstr ""

#: ../..//misc/hotot.desktop.in.h:3
msgid "Lightweight Twitter Client base on Gtk2 and Webkit"
msgstr "Cliente Twitter baseado em Gtk2 e Webkit"
msgid "Lightweight Twitter Client base on Gtk and Webkit"
msgstr "Cliente Twitter baseado em Gtk e Webkit"

#: ../..//misc/hotot-qt.desktop.in.h:2
#, fuzzy
msgid "Lightweight Twitter Client base on Qt and Webkit"
msgstr "Cliente Twitter baseado em Gtk2 e Webkit"
msgstr "Cliente Twitter baseado em Qt e Webkit"

#: /home/saber/Develop/Hotot/build/po/../..//qt/src/main.cpp:65
msgid "Lightweight, Flexible Microblogging"
Oops, something went wrong.

0 comments on commit 78571e7

Please sign in to comment.