Combine Vala{Lib,Plugin}CommonRules.
This commit is contained in:
parent
c16c3e5d81
commit
e94a91ba7e
|
@ -3,16 +3,17 @@ INCLUDE (UseVala)
|
||||||
INCLUDE (CFlagsCommonRules)
|
INCLUDE (CFlagsCommonRules)
|
||||||
FIND_PACKAGE (PkgConfig REQUIRED)
|
FIND_PACKAGE (PkgConfig REQUIRED)
|
||||||
|
|
||||||
IF (WIN32)
|
IF (NOT LibNoApi)
|
||||||
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
|
SET (export_vaapi "--vapi=${LibName}-${MAJOR}.vapi")
|
||||||
ENDIF (WIN32)
|
SET (generate_header ${LibName}-${MAJOR})
|
||||||
|
ENDIF (NOT LibNoApi)
|
||||||
|
|
||||||
VALA_PRECOMPILE (VALA_C ${LibSources}
|
VALA_PRECOMPILE (VALA_C ${LibSources}
|
||||||
PACKAGES ${LibPackages}
|
PACKAGES ${LibPackages}
|
||||||
OPTIONS --thread ${LibValaOpts} ${VALA_DEBUG} --vapi=${LibName}-${MAJOR}.vapi
|
OPTIONS --thread ${LibValaOpts} ${VALA_DEBUG} ${export_vaapi}
|
||||||
CUSTOM_VAPIS ${LibCustomVapis}
|
CUSTOM_VAPIS ${LibCustomVapis}
|
||||||
GENERATE_VAPI
|
GENERATE_VAPI
|
||||||
GENERATE_HEADER ${LibName}-${MAJOR}
|
GENERATE_HEADER ${generate_header}
|
||||||
)
|
)
|
||||||
PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
|
PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
|
||||||
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
|
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
|
||||||
|
@ -21,23 +22,40 @@ ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
|
||||||
TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})
|
TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})
|
||||||
SET_TARGET_PROPERTIES (${LibName} PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH})
|
SET_TARGET_PROPERTIES (${LibName} PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH})
|
||||||
SET_TARGET_PROPERTIES (${LibName} PROPERTIES SOVERSION ${MAJOR})
|
SET_TARGET_PROPERTIES (${LibName} PROPERTIES SOVERSION ${MAJOR})
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
|
IF (NOT LibIsPlugin)
|
||||||
|
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
|
||||||
|
ENDIF (NOT LibIsPlugin)
|
||||||
SET_TARGET_PROPERTIES (${LibName} PROPERTIES PREFIX "" IMPORT_PREFIX ""
|
SET_TARGET_PROPERTIES (${LibName} PROPERTIES PREFIX "" IMPORT_PREFIX ""
|
||||||
SUFFIX "-${MAJOR}.dll" IMPORT_SUFFIX "-${MAJOR}.dll.a")
|
SUFFIX "-${MAJOR}.dll" IMPORT_SUFFIX "-${MAJOR}.dll.a")
|
||||||
ENDIF (WIN32)
|
ENDIF (WIN32)
|
||||||
|
|
||||||
|
SET (install_prefix "")
|
||||||
|
IF (LibIsPlugin)
|
||||||
|
SET (install_prefix "/${LibInstallPrefix}/${LibName}-${MAJOR}")
|
||||||
|
ENDIF (LibIsPlugin)
|
||||||
|
|
||||||
|
IF (UNIX)
|
||||||
|
SET (install_dest lib${install_prefix})
|
||||||
|
ELSEIF (WIN32)
|
||||||
|
SET (install_dest bin${install_prefix})
|
||||||
|
ENDIF (UNIX)
|
||||||
|
|
||||||
IF (LibInstall)
|
IF (LibInstall)
|
||||||
IF (UNIX)
|
IF (LibNoApi)
|
||||||
INSTALL (TARGETS ${LibName} DESTINATION lib)
|
INSTALL (TARGETS ${LibName} RUNTIME DESTINATION ${install_dest}
|
||||||
ELSEIF (WIN32)
|
LIBRARY DESTINATION ${install_dest})
|
||||||
INSTALL (TARGETS ${LibName}
|
ELSE (LibNoApi)
|
||||||
RUNTIME DESTINATION bin
|
INSTALL (TARGETS ${LibName} RUNTIME DESTINATION ${install_dest}
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION ${install_dest}
|
||||||
ARCHIVE DESTINATION lib)
|
ARCHIVE DESTINATION lib)
|
||||||
ENDIF (UNIX)
|
|
||||||
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.h DESTINATION include)
|
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.h DESTINATION include)
|
||||||
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.vapi DESTINATION share/vala/vapi)
|
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.vapi DESTINATION share/vala/vapi)
|
||||||
|
ENDIF (LibNoApi)
|
||||||
ENDIF (LibInstall)
|
ENDIF (LibInstall)
|
||||||
|
|
||||||
# Access to 'share' directory when debugging (Gettext, Glade, GSchema files, etc...)
|
# Access to 'share' directory when debugging (Gettext, Glade, GSchema files, etc...)
|
||||||
EXECUTE_PROCESS (COMMAND ln -sf ${CMAKE_BINARY_DIR}/share -t ${CMAKE_CURRENT_BINARY_DIR}/..)
|
IF (NOT LibIsPlugin)
|
||||||
|
EXECUTE_PROCESS (COMMAND ln -sf ${CMAKE_BINARY_DIR}/share -t ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||||
|
ENDIF (NOT LibIsPlugin)
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
INCLUDE (FindVala)
|
|
||||||
INCLUDE (UseVala)
|
|
||||||
INCLUDE (CFlagsCommonRules)
|
|
||||||
FIND_PACKAGE (PkgConfig REQUIRED)
|
|
||||||
|
|
||||||
VALA_PRECOMPILE (VALA_C ${PluginSources}
|
|
||||||
PACKAGES ${PluginPackages}
|
|
||||||
OPTIONS --thread ${PluginValaOpts} ${VALA_DEBUG}
|
|
||||||
CUSTOM_VAPIS ${PluginCustomVapis}
|
|
||||||
GENERATE_VAPI
|
|
||||||
GENERATE_HEADER
|
|
||||||
)
|
|
||||||
PKG_CHECK_MODULES (PKGS REQUIRED ${PluginPkgModules})
|
|
||||||
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
|
|
||||||
ADD_LIBRARY (${PluginName} SHARED ${VALA_C} ${PluginExtraSources})
|
|
||||||
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
|
|
||||||
TARGET_LINK_LIBRARIES (${PluginName} ${PKGS_LIBRARIES} ${PluginLinkLibs})
|
|
||||||
|
|
||||||
IF (PluginInstall)
|
|
||||||
IF (UNIX)
|
|
||||||
INSTALL (TARGETS ${PluginName} DESTINATION lib/${PluginInstallPrefix}/${PluginName})
|
|
||||||
ELSEIF (WIN32)
|
|
||||||
INSTALL (TARGETS ${PluginName} DESTINATION bin/${PluginInstallPrefix}/${PluginName})
|
|
||||||
ENDIF (UNIX)
|
|
||||||
ENDIF (PluginInstall)
|
|
Loading…
Reference in New Issue