CMakeLists.txt 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. cmake_minimum_required (VERSION 2.6)
  2. project(rainbow-lollipop C)
  3. list(APPEND CMAKE_MODULE_PATH
  4. ${CMAKE_SOURCE_DIR}/cmake/vala
  5. )
  6. include(ValaPrecompile)
  7. include(ValaVersion)
  8. find_package(Gettext REQUIRED)
  9. find_program(EXTRACT_EXECUTABLE xgettext)
  10. find_package(Vala REQUIRED)
  11. ensure_vala_version("0.26" MINIMUM)
  12. find_package(PkgConfig)
  13. pkg_check_modules(GLIB REQUIRED glib-2.0)
  14. add_definitions(${GLIB_CFLAGS} ${GLIB_CFLAGS_OTHER})
  15. link_libraries(${GLIB_LIBRARIES})
  16. link_directories(${GLIB_LIBRARY_DIRS})
  17. link_libraries(m)
  18. pkg_check_modules(GTK REQUIRED gtk+-3.0)
  19. add_definitions(${GTK_CFLAGS} ${GTK_CFLAGS_OTHER})
  20. link_libraries(${GTK_LIBRARIES})
  21. link_directories(${GTK_LIBRARY_DIRS})
  22. pkg_check_modules(CLUTTER REQUIRED clutter-1.0)
  23. add_definitions(${CLUTTER_CFLAGS} ${CLUTTER_CFLAGS_OTHER})
  24. link_libraries(${CLUTTER_LIBRARIES})
  25. link_directories(${CLUTTER_LIBRARY_DIRS})
  26. pkg_check_modules(CLUTTERGTK REQUIRED clutter-gtk-1.0)
  27. add_definitions(${CLUTTERGTK_CFLAGS} ${CLUTTERGTK_CFLAGS_OTHER})
  28. link_libraries(${CLUTTERGTK_LIBRARIES})
  29. link_directories(${CLUTTERGTK_LIBRARY_DIRS})
  30. pkg_check_modules(GEE gee-0.8)
  31. if (NOT GEE_FOUND)
  32. pkg_check_modules(GEE REQUIRED gee-1.0)
  33. SET(GEE10 TRUE)
  34. endif()
  35. add_definitions(${GEE_CFLAGS} ${GEE_CFLAGS_OTHER})
  36. link_libraries(${GEE_LIBRARIES})
  37. link_directories(${GEE_LIBRARY_DIRS})
  38. pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
  39. add_definitions(${WEBKIT_CFLAGS} ${WEBKIT_CFLAGS_OTHER})
  40. link_libraries(${WEBKIT_LIBRARIES})
  41. link_directories(${WEBKIT_LIBRARY_DIRS})
  42. pkg_check_modules(WEBKIT_EXT REQUIRED webkit2gtk-web-extension-4.0)
  43. add_definitions(${WEBKIT_EXT_CFLAGS} ${WEBKIT_EXT_CFLAGS_OTHER})
  44. link_libraries(${WEBKIT_EXT_LIBRARIES})
  45. link_directories(${WEBKIT_EXT_LIBRARY_DIRS})
  46. pkg_check_modules(SQLITE3 REQUIRED sqlite3)
  47. add_definitions(${SQLITE3_CFLAGS} ${SQLITE3_CFLAGS_OTHER})
  48. link_libraries(${SQLITE3_LIBRARIES})
  49. link_directories(${SQLITE3_LIBRARY_DIRS})
  50. pkg_check_modules(ZMQ REQUIRED libzmq>=3)
  51. add_definitions(${ZMQ_CFLAGS} ${ZMQ_CFLAGS_OTHER})
  52. link_libraries(${ZMQ_LIBRARIES})
  53. link_directories(${ZMQ_LIBRARY_DIRS})
  54. pkg_check_modules(HTTPSEVERYWHERE REQUIRED httpseverywhere)
  55. add_definitions(${HTTPSEVERYWHERE_CFLAGS} ${HTTPSEVERYWHERE_CFLAGS_OTHER})
  56. link_libraries(${HTTPSEVERYWHERE_LIBRARIES})
  57. link_directories(${HTTPSEVERYWHERE_LIBRARY_DIRS})
  58. if (GEE10)
  59. vala_precompile(VALA_BINARY_C
  60. "src/dummy.vala"
  61. "src/track.vala"
  62. "src/database.vala"
  63. "src/empty_track.vala"
  64. "src/alaia.vala"
  65. "src/history_track.vala"
  66. "src/tracklist.vala"
  67. "src/nodes.vala"
  68. "src/site_node.vala"
  69. "src/download_node.vala"
  70. "src/config.vala"
  71. "src/ipc.vala"
  72. "src/ipc_protocol.vala"
  73. "src/session_select.vala"
  74. "src/authentication_dialog.vala"
  75. "src/history.vala"
  76. "src/searchengine.vala"
  77. "src/search_widget.vala"
  78. "src/error_node.vala"
  79. "src/application_states.vala"
  80. "src/config_dialog.vala"
  81. "src/context_menu.vala"
  82. "src/input_handlers.vala"
  83. "src/loading_indicator.vala"
  84. "src/focus.vala"
  85. "src/trackwebview.vala"
  86. PACKAGES
  87. gtk+-3.0
  88. clutter-1.0
  89. clutter-gtk-1.0
  90. webkit2gtk-4.0
  91. gee-1.0
  92. libzmq
  93. sqlite3
  94. httpseverywhere
  95. OPTIONS
  96. --thread
  97. --vapidir=${CMAKE_SOURCE_DIR}/vapi_old
  98. --target-glib 2.32
  99. )
  100. else()
  101. vala_precompile(VALA_BINARY_C
  102. "src/dummy.vala"
  103. "src/track.vala"
  104. "src/database.vala"
  105. "src/empty_track.vala"
  106. "src/alaia.vala"
  107. "src/history_track.vala"
  108. "src/tracklist.vala"
  109. "src/nodes.vala"
  110. "src/site_node.vala"
  111. "src/download_node.vala"
  112. "src/config.vala"
  113. "src/ipc.vala"
  114. "src/ipc_protocol.vala"
  115. "src/session_select.vala"
  116. "src/authentication_dialog.vala"
  117. "src/history.vala"
  118. "src/searchengine.vala"
  119. "src/search_widget.vala"
  120. "src/error_node.vala"
  121. "src/application_states.vala"
  122. "src/config_dialog.vala"
  123. "src/context_menu.vala"
  124. "src/input_handlers.vala"
  125. "src/loading_indicator.vala"
  126. "src/focus.vala"
  127. "src/trackwebview.vala"
  128. PACKAGES
  129. gtk+-3.0
  130. clutter-1.0
  131. clutter-gtk-1.0
  132. webkit2gtk-4.0
  133. gee-0.8
  134. libzmq
  135. sqlite3
  136. httpseverywhere
  137. OPTIONS
  138. --thread
  139. --vapidir=${CMAKE_SOURCE_DIR}/vapi
  140. --target-glib 2.32
  141. )
  142. endif()
  143. if (GEE10)
  144. vala_precompile(VALA_EXTENSION_C
  145. "src/dummy2.vala"
  146. "src/alaia_extension.vala"
  147. "src/ipc_protocol.vala"
  148. PACKAGES
  149. webkit2gtk-web-extension-4.0
  150. libzmq
  151. gee-1.0
  152. OPTIONS
  153. --vapidir=${CMAKE_SOURCE_DIR}/vapi
  154. --target-glib 2.32
  155. )
  156. else()
  157. vala_precompile(VALA_EXTENSION_C
  158. "src/dummy2.vala"
  159. "src/alaia_extension.vala"
  160. "src/ipc_protocol.vala"
  161. PACKAGES
  162. webkit2gtk-web-extension-4.0
  163. libzmq
  164. gee-0.8
  165. OPTIONS
  166. --vapidir=${CMAKE_SOURCE_DIR}/vapi
  167. --target-glib 2.32
  168. )
  169. endif()
  170. # Security Stuff
  171. add_definitions(-fstack-protector-all -D_FORTIFY_SOURCE=2)
  172. # Supress C compilerwarnings
  173. #TODO: remove as soon as libgee-warning-messages are fixed
  174. # we can't do anything about them because we should not modify
  175. # the C-code that is generated by valac
  176. add_definitions(-w)
  177. # Multilanguage Stuff
  178. SET(POTFILE "${PROJECT_NAME}.pot")
  179. add_definitions(-DGETTEXT_PACKAGE="${PROJECT_NAME}")
  180. FILE(GLOB FILES_TO_TRANSLATE "src/*.vala")
  181. add_custom_target(pot ALL
  182. COMMAND
  183. ${EXTRACT_EXECUTABLE} --language=vala --keyword=_ --escape --sort-output --copyright-holder="Daniel 'grindhold' Brendle" --package-name="${PROJECT_NAME}" --package-version="0.0.1" --msgid-bugs-address="rainbow-lollipop-talk@lists.rainbow-lollipop.de" -o po/${POTFILE} ${FILES_TO_TRANSLATE}
  184. COMMAND
  185. sed -i 's/CHARSET/UTF-8/' po/${POTFILE}
  186. COMMENT
  187. "Extracting translation strings"
  188. )
  189. add_custom_target(pofiles ALL
  190. COMMAND
  191. ${GETTEXT_MSGMERGE_EXECUTABLE} --backup=off -U po/de.po po/${POTFILE}
  192. COMMAND
  193. ${GETTEXT_MSGMERGE_EXECUTABLE} --backup=off -U po/en.po po/${POTFILE}
  194. DEPENDS
  195. pot
  196. COMMENT
  197. "Creating PO-files out of ${POTFILE}"
  198. )
  199. SET(LOC_BUILDDIR "data/locale/")
  200. add_custom_target(mofiles ALL
  201. COMMAND
  202. mkdir -p ${LOC_BUILDDIR}de/LC_MESSAGES/
  203. COMMAND
  204. ${GETTEXT_MSGFMT_EXECUTABLE} -c -o ${LOC_BUILDDIR}/de/LC_MESSAGES/${PROJECT_NAME}.mo po/de.po
  205. COMMAND
  206. mkdir -p ${LOC_BUILDDIR}en/LC_MESSAGES/
  207. COMMAND
  208. ${GETTEXT_MSGFMT_EXECUTABLE} -c -o ${LOC_BUILDDIR}/en/LC_MESSAGES/${PROJECT_NAME}.mo po/en.po
  209. DEPENDS
  210. pofiles
  211. COMMENT
  212. "Creating MO-files"
  213. )
  214. # Maintargets
  215. add_library("alaiaextension" SHARED ${VALA_EXTENSION_C})
  216. add_executable(${PROJECT_NAME} ${VALA_BINARY_C})
  217. # Installing
  218. install(DIRECTORY "data/rainbow-lollipop" DESTINATION share)
  219. install(DIRECTORY "data/icons" DESTINATION share)
  220. install(DIRECTORY "data/applications" DESTINATION share)
  221. install(DIRECTORY "data/locale" DESTINATION share)
  222. install(TARGETS "alaiaextension" ${PROJECT_NAME}
  223. RUNTIME DESTINATION bin
  224. LIBRARY DESTINATION lib/${PROJECT_NAME}
  225. )