Browse Source

Initial commit.

master
Kolan Sh 4 years ago
commit
a3bf0ee0e7

+ 6
- 0
CFlags.cmake View File

@@ -0,0 +1,6 @@
1
+SET (CMAKE_C_FLAGS_DEBUG "-ggdb3 -O0 -ftest-coverage -Wcoverage-mismatch ${CMAKE_C_FLAGS_DEBUG}")
2
+SET (CMAKE_C_FLAGS_RELEASE "-O2 ${CMAKE_C_FLAGS_RELEASE}")
3
+IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
4
+  SET (VALA_DEBUG "-g")
5
+ENDIF ()
6
+SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") # supress Gcc warnings

+ 61
- 0
CPackCommon.cmake View File

@@ -0,0 +1,61 @@
1
+INCLUDE (CPackDetectArch)
2
+
3
+## CPack configuration ##
4
+SET (CPACK_PACKAGE_CONTACT "${CONTACT}")
5
+SET (CPACK_PACKAGE_VENDOR "${CONTACT}")
6
+SET (CPACK_NSIS_MODIFY_PATH ON)
7
+SET (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
8
+INCLUDE (InstallRequiredSystemLibraries)
9
+SET (CPACK_RESOURCE_FILE_LICENSE
10
+     "${CMAKE_SOURCE_DIR}/COPYING")
11
+SET (CPACK_PACKAGE_DESCRIPTION_FILE
12
+    "${CMAKE_SOURCE_DIR}/README")
13
+INSTALL (FILES "${PROJECT_BINARY_DIR}/pkg-config/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc"
14
+	 DESTINATION lib/pkgconfig)
15
+#SET (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME}")
16
+#SET (CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME}")
17
+SET (CPACK_PACKAGE_VERSION_MAJOR "${MAJOR}")
18
+SET (CPACK_PACKAGE_VERSION_MINOR "${MINOR}")
19
+SET (CPACK_PACKAGE_VERSION_PATCH "${PATCH}")
20
+SET (CPACK_PACKAGE_VERSION "${MAJOR}.${MINOR}.${PATCH}")
21
+
22
+IF (UNIX)
23
+  SET (CPACK_GENERATOR "DEB;RPM;STGZ;TBZ2;TGZ;TZ;ZIP")
24
+  SET (CPACK_SOURCE_GENERATOR "DEB;RPM;STGZ;TBZ2;TGZ;TZ;ZIP")
25
+  SET (CPACK_PACKAGE_NAME "${PROJECT_LOWERCASE_NAME}")
26
+  SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
27
+  SET (CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
28
+
29
+  # Debian specific options
30
+  SET (CPACK_DEBIAN_PACKAGE_DEPENDS "${DEBIAN_DEPENDENCIES}")
31
+  SET (CPACK_DEBIAN_PACKAGE_SECTION "${DEBIAN_SECTION}")
32
+  # SET (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${ARCHITECTURE}")
33
+  # SET (CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
34
+  SET (CPACK_DEBIAN_PACKAGE_RECOMMENDS "")
35
+  SET (CPACK_DEBIAN_PACKAGE_SUGGESTS "")
36
+
37
+  # RPM specific options
38
+  # SET (CPACK_RPM_PACKAGE_ARCHITECTURE "${ARCHITECTURE}")
39
+  SET (CPACK_RPM_PACKAGE_LICENSE "${LICENSE}")
40
+  SET (CPACK_RPM_PACKAGE_GROUP "${REDHAT_SECTION}")
41
+  SET (CPACK_RPM_PACKAGE_REQUIRES "${REDHAT_DEPENDENCIES}")
42
+  SET (CPACK_RPM_PACKAGE_PROVIDES "${PROJECT_LOWERCASE_NAME}")
43
+
44
+  # http://public.kitware.com/Bug/view.php?id=12997
45
+  SET(CPACK_PACKAGE_FILE_NAME
46
+      "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${ARCHITECTURE}")
47
+
48
+ELSEIF (WIN32)
49
+  SET (CPACK_GENERATOR "NSIS")
50
+  SET (CPACK_SOURCE_GENERATOR "NSIS")
51
+  SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CMAKE_PROJECT_NAME}-${MAJOR}")
52
+  #SET (CPACK_NSIS_MENU_LINKS "${EWS_WEBSITE}" "Homepage for ${EWS_APP_NAME}")
53
+  #SET (CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\${EXE_TARGET_NAME}.exe)
54
+  #SET (CPACK_NSIS_URL_INFO_ABOUT "${EWS_WEBSITE}")
55
+  #SET (CPACK_NSIS_HELP_LINK "${EWS_WEBSITE}")
56
+  SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}-${MAJOR}")
57
+  SET (CPACK_UNINSTALL_NAME "${WIN32_UNINSTALL_NAME}-${MAJOR}") # <=10 symbols: https://redmine.backbone.ws/issues/83
58
+ENDIF ()
59
+
60
+INCLUDE (CPack)
61
+

+ 20
- 0
CPackDetectArch.cmake View File

@@ -0,0 +1,20 @@
1
+# Kernel of Operation System
2
+EXECUTE_PROCESS (COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE OSKERNEL)
3
+MESSAGE ("OSKERNEL = ${OSKERNEL}")
4
+STRING (TOLOWER "${OSKERNEL}" OSKERNEL)
5
+
6
+# CPU Architecture
7
+SET (CUSTOM_ARCHITECTURE "" CACHE STRING "Specify custom target architecutre")
8
+SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}")
9
+IF (ARCHITECTURE STREQUAL "")
10
+    # SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
11
+    # SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
12
+    EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
13
+
14
+    # Replacements
15
+    STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}")
16
+    STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}")
17
+    STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}")
18
+
19
+ENDIF ()
20
+MESSAGE ("ARCHITECTURE = ${ARCHITECTURE}")

+ 69
- 0
FindVala.cmake View File

@@ -0,0 +1,69 @@
1
+##
2
+# Find module for the Vala compiler (valac)
3
+#
4
+# This module determines wheter a Vala compiler is installed on the current
5
+# system and where its executable is.
6
+#
7
+# Call the module using "find_package(Vala) from within your CMakeLists.txt.
8
+#
9
+# The following variables will be set after an invocation:
10
+#
11
+#  VALA_FOUND       Whether the vala compiler has been found or not
12
+#  VALA_EXECUTABLE  Full path to the valac executable if it has been found
13
+#  VALA_VERSION     Version number of the available valac
14
+#  VALA_USE_FILE    Include this file to define the vala_precompile function
15
+##
16
+
17
+##
18
+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
19
+# Copyright 2010-2011 Daniel Pfeifer
20
+#
21
+# Redistribution and use in source and binary forms, with or without
22
+# modification, are permitted provided that the following conditions are met:
23
+#
24
+#    1. Redistributions of source code must retain the above copyright notice,
25
+#       this list of conditions and the following disclaimer.
26
+#
27
+#    2. Redistributions in binary form must reproduce the above copyright notice,
28
+#       this list of conditions and the following disclaimer in the documentation
29
+#       and/or other materials provided with the distribution.
30
+#
31
+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
32
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34
+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
+#
42
+# The views and conclusions contained in the software and documentation are those
43
+# of the authors and should not be interpreted as representing official policies,
44
+# either expressed or implied, of Jakob Westhoff
45
+##
46
+
47
+# Search for the valac executable in the usual system paths.
48
+find_program(VALA_EXECUTABLE valac)
49
+mark_as_advanced(VALA_EXECUTABLE)
50
+
51
+# Determine the valac version
52
+if(VALA_EXECUTABLE)
53
+    execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
54
+                    OUTPUT_VARIABLE VALA_VERSION
55
+                    OUTPUT_STRIP_TRAILING_WHITESPACE)
56
+    string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
57
+endif(VALA_EXECUTABLE)
58
+
59
+# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
60
+# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
61
+# VALA_EXECUTABLE is set)
62
+
63
+include(FindPackageHandleStandardArgs)
64
+find_package_handle_standard_args(Vala
65
+    REQUIRED_VARS VALA_EXECUTABLE
66
+    VERSION_VAR VALA_VERSION)
67
+
68
+set(VALA_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVala.cmake")
69
+

+ 31
- 0
MacroOptionalAddSubdirectory.cmake View File

@@ -0,0 +1,31 @@
1
+# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
2
+# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
3
+# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
4
+# this will have two effects
5
+# 1 - CMake will not complain if the directory doesn't exist
6
+#     This makes sense if you want to distribute just one of the subdirs
7
+#     in a source package, e.g. just one of the subdirs in kdeextragear.
8
+# 2 - If the directory exists, it will offer an option to skip the 
9
+#     subdirectory.
10
+#     This is useful if you want to compile only a subset of all
11
+#     directories.
12
+
13
+# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
14
+#
15
+# Redistribution and use is allowed according to the terms of the BSD license.
16
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17
+
18
+
19
+MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
20
+   GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
21
+   IF(EXISTS ${_fullPath})
22
+      IF(${ARGC} EQUAL 2)
23
+        OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1})
24
+      ELSE(${ARGC} EQUAL 2)
25
+        OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE)
26
+      ENDIF(${ARGC} EQUAL 2)
27
+      IF(BUILD_${_dir})
28
+         ADD_SUBDIRECTORY(${_dir})
29
+      ENDIF(BUILD_${_dir})
30
+   ENDIF(EXISTS ${_fullPath})
31
+ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)

+ 1
- 0
README View File

@@ -0,0 +1 @@
1
+Backbone's CMake scripts.

+ 180
- 0
UseVala.cmake View File

@@ -0,0 +1,180 @@
1
+##
2
+# Compile vala files to their c equivalents for further processing.
3
+#
4
+# The "vala_precompile" function takes care of calling the valac executable on
5
+# the given source to produce c files which can then be processed further using
6
+# default cmake functions.
7
+#
8
+# The first parameter provided is a variable, which will be filled with a list
9
+# of c files outputted by the vala compiler. This list can than be used in
10
+# conjuction with functions like "add_executable" or others to create the
11
+# neccessary compile rules with CMake.
12
+#
13
+# The following sections may be specified afterwards to provide certain options
14
+# to the vala compiler:
15
+#
16
+# SOURCES
17
+#   A list of .vala files to be compiled. Please take care to add every vala
18
+#   file belonging to the currently compiled project or library as Vala will
19
+#   otherwise not be able to resolve all dependencies.
20
+#
21
+# PACKAGES
22
+#   A list of vala packages/libraries to be used during the compile cycle. The
23
+#   package names are exactly the same, as they would be passed to the valac
24
+#   "--pkg=" option.
25
+#
26
+# OPTIONS
27
+#   A list of optional options to be passed to the valac executable. This can be
28
+#   used to pass "--thread" for example to enable multi-threading support.
29
+#
30
+# CUSTOM_VAPIS
31
+#   A list of custom vapi files to be included for compilation. This can be
32
+#   useful to include freshly created vala libraries without having to install
33
+#   them in the system.
34
+#
35
+# GENERATE_VAPI
36
+#   Pass all the needed flags to the compiler to create an internal vapi for
37
+#   the compiled library. The provided name will be used for this and a
38
+#   <provided_name>.vapi file will be created.
39
+#
40
+# GENERATE_HEADER
41
+#   Let the compiler generate a header file for the compiled code. There will
42
+#   be a header file as well as an internal header file being generated called
43
+#   <provided_name>.h and <provided_name>_internal.h
44
+#
45
+# The following call is a simple example to the vala_precompile macro showing
46
+# an example to every of the optional sections:
47
+#
48
+#   find_package(Vala "0.12" REQUIRED)
49
+#   inlcude(${VALA_USE_FILE})
50
+#
51
+#   vala_precompile(VALA_C
52
+#     SOURCES
53
+#       source1.vala
54
+#       source2.vala
55
+#       source3.vala
56
+#     PACKAGES
57
+#       gtk+-2.0
58
+#       gio-1.0
59
+#       posix
60
+#     DIRECTORY
61
+#       gen
62
+#     OPTIONS
63
+#       --thread
64
+#     CUSTOM_VAPIS
65
+#       some_vapi.vapi
66
+#     GENERATE_VAPI
67
+#       myvapi
68
+#     GENERATE_HEADER
69
+#       myheader
70
+#     )
71
+#
72
+# Most important is the variable VALA_C which will contain all the generated c
73
+# file names after the call.
74
+##
75
+
76
+##
77
+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
78
+# Copyright 2010-2011 Daniel Pfeifer
79
+#
80
+# Redistribution and use in source and binary forms, with or without
81
+# modification, are permitted provided that the following conditions are met:
82
+#
83
+#    1. Redistributions of source code must retain the above copyright notice,
84
+#       this list of conditions and the following disclaimer.
85
+#
86
+#    2. Redistributions in binary form must reproduce the above copyright notice,
87
+#       this list of conditions and the following disclaimer in the documentation
88
+#       and/or other materials provided with the distribution.
89
+#
90
+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
91
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
92
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
93
+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
94
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
95
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
96
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
97
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
98
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
99
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100
+#
101
+# The views and conclusions contained in the software and documentation are those
102
+# of the authors and should not be interpreted as representing official policies,
103
+# either expressed or implied, of Jakob Westhoff
104
+##
105
+
106
+include(CMakeParseArguments)
107
+
108
+function(vala_precompile output)
109
+    cmake_parse_arguments(ARGS "" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI"
110
+        "SOURCES;PACKAGES;OPTIONS;CUSTOM_VAPIS" ${ARGN})
111
+
112
+    if(ARGS_DIRECTORY)
113
+        set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
114
+    else(ARGS_DIRECTORY)
115
+        set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
116
+    endif(ARGS_DIRECTORY)
117
+    include_directories(${DIRECTORY})
118
+    set(vala_pkg_opts "")
119
+    foreach(pkg ${ARGS_PACKAGES})
120
+        list(APPEND vala_pkg_opts "--pkg=${pkg}")
121
+    endforeach(pkg ${ARGS_PACKAGES})
122
+    set(in_files "")
123
+    set(out_files "")
124
+    foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
125
+        list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
126
+        string(REPLACE ".vala" ".c" src ${src})
127
+        string(REPLACE ".gs" ".c" src ${src})
128
+        set(out_file "${DIRECTORY}/${src}")
129
+        list(APPEND out_files "${DIRECTORY}/${src}")
130
+    endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
131
+
132
+    set(custom_vapi_arguments "")
133
+    if(ARGS_CUSTOM_VAPIS)
134
+        foreach(vapi ${ARGS_CUSTOM_VAPIS})
135
+            if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
136
+                list(APPEND custom_vapi_arguments ${vapi})
137
+            else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
138
+                list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
139
+            endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
140
+        endforeach(vapi ${ARGS_CUSTOM_VAPIS})
141
+    endif(ARGS_CUSTOM_VAPIS)
142
+
143
+    set(vapi_arguments "")
144
+    if(ARGS_GENERATE_VAPI)
145
+        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
146
+        set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
147
+
148
+        # Header and internal header is needed to generate internal vapi
149
+        if (NOT ARGS_GENERATE_HEADER)
150
+            set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
151
+        endif(NOT ARGS_GENERATE_HEADER)
152
+    endif(ARGS_GENERATE_VAPI)
153
+
154
+    set(header_arguments "")
155
+    if(ARGS_GENERATE_HEADER)
156
+        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
157
+        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
158
+        list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
159
+        list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
160
+    endif(ARGS_GENERATE_HEADER)
161
+
162
+    add_custom_command(OUTPUT ${out_files}
163
+    COMMAND
164
+        ${VALA_EXECUTABLE}
165
+    ARGS
166
+        "-C"
167
+        ${header_arguments}
168
+        ${vapi_arguments}
169
+        "-b" ${CMAKE_CURRENT_SOURCE_DIR}
170
+        "-d" ${DIRECTORY}
171
+        ${vala_pkg_opts}
172
+        ${ARGS_OPTIONS}
173
+        ${in_files}
174
+        ${custom_vapi_arguments}
175
+    DEPENDS
176
+        ${in_files}
177
+        ${ARGS_CUSTOM_VAPIS}
178
+    )
179
+    set(${output} ${out_files} PARENT_SCOPE)
180
+endfunction(vala_precompile)

+ 18
- 0
ValaBinCommonRules.cmake View File

@@ -0,0 +1,18 @@
1
+INCLUDE (FindVala)
2
+INCLUDE (UseVala)
3
+INCLUDE (CFlags)
4
+FIND_PACKAGE (PkgConfig REQUIRED)
5
+
6
+SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
7
+
8
+VALA_PRECOMPILE (VALA_C ${BinSources}
9
+                 PACKAGES ${BinPackages}
10
+                 OPTIONS --thread ${VALA_DEBUG}
11
+                 CUSTOM_VAPIS ${BinCustomVapis}
12
+                 GENERATE_VAPI
13
+                 GENERATE_HEADER
14
+                )
15
+PKG_CHECK_MODULES (PKGS REQUIRED ${BinPackages})
16
+INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
17
+ADD_EXECUTABLE (${BinName} ${VALA_C} ${BinExtraSources})
18
+TARGET_LINK_LIBRARIES (${BinName} ${PKGS_LIBRARIES} ${BinLinkLibs})

+ 39
- 0
ValaLibCommonRules.cmake View File

@@ -0,0 +1,39 @@
1
+INCLUDE (FindVala)
2
+INCLUDE (UseVala)
3
+INCLUDE (CFlags)
4
+FIND_PACKAGE (PkgConfig REQUIRED)
5
+
6
+IF (WIN32)
7
+  SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
8
+ENDIF (WIN32)
9
+
10
+VALA_PRECOMPILE (VALA_C ${LibSources}
11
+                 PACKAGES ${LibPackages}
12
+                 OPTIONS --thread ${VALA_DEBUG} --vapi=${LibName}-${MAJOR}.vapi
13
+                 CUSTOM_VAPIS ${LibCustomVapis}
14
+                 GENERATE_VAPI
15
+                 GENERATE_HEADER ${LibName}-${MAJOR}
16
+                )
17
+PKG_CHECK_MODULES (PKGS REQUIRED ${LibPackages})
18
+INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
19
+ADD_LIBRARY (${LibName} SHARED ${VALA_C} ${LibExtraSources})
20
+TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})
21
+SET_TARGET_PROPERTIES (${LibName} PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH})
22
+SET_TARGET_PROPERTIES (${LibName} PROPERTIES SOVERSION ${MAJOR})
23
+IF (WIN32)
24
+  SET_TARGET_PROPERTIES (${LibName} PROPERTIES PREFIX "" IMPORT_PREFIX ""
25
+                         SUFFIX "-${MAJOR}.dll" IMPORT_SUFFIX "-${MAJOR}.a")
26
+ENDIF (WIN32)
27
+
28
+IF (LibInstall)
29
+  IF (UNIX)
30
+    INSTALL (TARGETS ${LibName} DESTINATION lib)
31
+  ELSEIF (WIN32)
32
+    INSTALL (TARGETS ${LibName}
33
+             RUNTIME DESTINATION bin
34
+             LIBRARY DESTINATION lib
35
+             ARCHIVE DESTINATION lib)
36
+  ENDIF (UNIX)
37
+  INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.h DESTINATION include)
38
+  INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.vapi DESTINATION share/vala/vapi)
39
+ENDIF (LibInstall)

+ 16
- 0
ValaPluginCommonRules.cmake View File

@@ -0,0 +1,16 @@
1
+INCLUDE (FindVala)
2
+INCLUDE (UseVala)
3
+INCLUDE (CFlags)
4
+FIND_PACKAGE (PkgConfig REQUIRED)
5
+
6
+VALA_PRECOMPILE (VALA_C ${PluginSources}
7
+                 PACKAGES ${PluginPackages}
8
+                 OPTIONS --thread ${VALA_DEBUG}
9
+                 CUSTOM_VAPIS ${PluginCustomVapis}
10
+                 GENERATE_VAPI
11
+                 GENERATE_HEADER
12
+                )
13
+PKG_CHECK_MODULES (PKGS REQUIRED ${PluginPackages})
14
+INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
15
+ADD_LIBRARY (${PluginName} SHARED ${VALA_C} ${PluginExtraSources})
16
+TARGET_LINK_LIBRARIES (${PluginName} ${PKGS_LIBRARIES} ${PluginLinkLibs})

Loading…
Cancel
Save