My CMake modules, scripts, templates
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ValaLibCommonRules.cmake 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. INCLUDE (FindVala)
  2. INCLUDE (UseVala)
  3. INCLUDE (CFlagsCommonRules)
  4. FIND_PACKAGE (PkgConfig REQUIRED)
  5. IF (NOT LibNoApi)
  6. SET (export_vaapi "--vapi=${LibName}-${MAJOR}.vapi")
  7. SET (generate_header ${LibName}-${MAJOR})
  8. ENDIF (NOT LibNoApi)
  9. IF (WIN32)
  10. IF (NOT LibIsPlugin)
  11. SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
  12. ENDIF (NOT LibIsPlugin)
  13. ENDIF (WIN32)
  14. VALA_PRECOMPILE (VALA_C ${LibSources}
  15. PACKAGES ${LibPackages}
  16. OPTIONS ${LibValaOpts} ${VALA_DEBUG} ${export_vaapi}
  17. CUSTOM_VAPIS ${LibCustomVapis}
  18. GENERATE_VAPI
  19. GENERATE_HEADER ${generate_header}
  20. )
  21. IF (NOT "${LibPkgModules}" STREQUAL "")
  22. PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
  23. ENDIF ()
  24. INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
  25. ADD_LIBRARY (${LibName} SHARED ${VALA_C} ${LibExtraSources})
  26. ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
  27. TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})
  28. SET_TARGET_PROPERTIES (${LibName} PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH})
  29. SET_TARGET_PROPERTIES (${LibName} PROPERTIES SOVERSION ${MAJOR})
  30. IF (WIN32)
  31. SET_TARGET_PROPERTIES (${LibName} PROPERTIES PREFIX "" IMPORT_PREFIX ""
  32. SUFFIX "-${MAJOR}.dll" IMPORT_SUFFIX "-${MAJOR}.dll.a")
  33. ENDIF (WIN32)
  34. SET (install_prefix "")
  35. IF (LibIsPlugin)
  36. SET (install_prefix "/${LibInstallPrefix}")
  37. ENDIF (LibIsPlugin)
  38. SET (lib "lib")
  39. IF(UNIX)
  40. IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
  41. SET (lib "lib64")
  42. ENDIF()
  43. ENDIF(UNIX)
  44. IF (UNIX)
  45. SET (install_dest ${lib}${install_prefix})
  46. #INCLUDE (GNUInstallDirs)
  47. #SET (install_dest ${CMAKE_INSTALL_FULL_LIBDIR}${install_prefix})
  48. ELSEIF (WIN32)
  49. SET (install_dest bin${install_prefix})
  50. ENDIF (UNIX)
  51. IF (LibInstall)
  52. IF (LibNoApi)
  53. INSTALL (TARGETS ${LibName} RUNTIME DESTINATION ${install_dest}
  54. LIBRARY DESTINATION ${install_dest})
  55. ELSE (LibNoApi)
  56. INSTALL (TARGETS ${LibName} RUNTIME DESTINATION ${install_dest}
  57. LIBRARY DESTINATION ${install_dest}
  58. ARCHIVE DESTINATION ${lib})
  59. INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.h DESTINATION include)
  60. INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.vapi DESTINATION share/vala/vapi)
  61. ENDIF (LibNoApi)
  62. ENDIF (LibInstall)
  63. # Access to 'share' directory when debugging (Gettext, Glade, GSchema files, etc...)
  64. IF (NOT LibIsPlugin)
  65. EXECUTE_PROCESS (COMMAND ln -sf ${CMAKE_BINARY_DIR}/share -t ${CMAKE_CURRENT_BINARY_DIR}/..)
  66. ENDIF (NOT LibIsPlugin)