+++ /dev/null
-project("roojspacker" C CXX)
-
-cmake_minimum_required(VERSION 3.2)
-
-
-set(PROJECT_WEB "https://www.roojs.com/")
-# Where to report bugs; usually either an e-mail address or an issue
-# tracker URL.
-set(PROJECT_BUGS "https://www.roojs.com/mtrack/")
-# Gettext package name
-#set(GETTEXT_PACKAGE ${PROJECT_NAME})
-
-# Library version
-#
-# This should be incremented with every release. See semver.org.
-set (ROOJSPACKER_VERSION_MAJOR 1)
-set (ROOJSPACKER_VERSION_MINOR 4)
-set (ROOJSPACKER_VERSION_REVISION 0)
-
-# API version.
-#
-# This will go in the pkg-config and shared library names. Should
-# only be changed if the API breaks backwards compatibility.
-set (ROOJSPACKER_VERSION_API "1.4")
-set (ROOJSPACKER_SOVERSION_CURRENT ${ROOJSPACKER_VERSION_MAJOR})
-set (ROOJSPACKER_SOVERSION_REVISION ${ROOJSPACKER_VERSION_MINOR})
-set (ROOJSPACKER_SOVERSION_AGE ${ROOJSPACKER_VERSION_REVISION})
-
-
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
-
-
-find_package(GLib "2.38" REQUIRED)
-find_package(Vala "0.36.0" REQUIRED)
-
-
-
-find_package(PkgConfig)
-pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
-pkg_check_modules(GIO REQUIRED gio-2.0)
-pkg_check_modules(GEE REQUIRED gee-0.8)
-pkg_check_modules(GTHREAD REQUIRED gthread-2.0)
-# this was optional??
-pkg_check_modules(JSON REQUIRED json-glib-1.0)
-
-
-set(ROOJSPACKER_VALA_PACKAGES
- glib-2.0
- gobject-2.0
- gee-0.8
- posix
- gio-2.0
- json-glib-1.0
-)
-
-
-
-set(CFLAGS
- ${GOBJECT_CFLAGS} ${GOBJECT_CFLAGS_OTHER}
- ${GIO_CFLAGS} ${GIO_CFLAGS_OTHER}
- ${GTHREAD_CFLAGS} ${GTHREAD_CFLAGS_OTHER}
- ${GEE_CFLAGS} ${GEE_CFLAGS_OTHER}
- ${JSON_CFLAGS} ${JSON_CFLAGS_OTHER}
-)
-add_definitions(${CFLAGS})
-
-
-
-if(CMAKE_BUILD_TYPE STREQUAL "")
- set(CMAKE_BUILD_TYPE "Debug")
-endif(CMAKE_BUILD_TYPE STREQUAL "")
-
-list(APPEND VALA_COMPILER_FLAGS
- "--target-glib=2.38"
- "-g"
- "--thread"
- "--vapidir=${CMAKE_SOURCE_DIR}/vapi"
-)
-list(APPEND VALA_COMPILER_FLAGs_DEBUG "--debug")
-# "-X -shared"
-#"-X -lm"
-
-
-
-include(AddCompilerFlags)
-
-global_add_compiler_flags(-Wno-incompatible-pointer-types)
-
-
-set(LIBS
- ${GOBJECT_LIBRARIES}
- ${GIO_LIBRARIES}
- ${GEE_LIBRARIES}
- ${GTHREAD_LIBRARIES}
- ${JSON_LIBRARIES}
-)
-link_libraries(${LIBS})
-
-
-set(LIB_PATHS
- ${GOBJECT_LIBRARY_DIRS}
- ${GIO_LIBRARY_DIRS}
- ${GEE_LIBRARY_DIRS}
- ${GTHREAD_LIBRARY_DIRS}
- ${JSON_LIBRARY_DIRS}
-)
-link_directories(${LIB_PATHS})
-
-set (LIBRARY_PATH "src")
-set(ROOJSPACKER_LIBRARY_NAME ${PROJECT_NAME}-${ROOJSPACKER_VERSION_API})
-set(ROOJSPACKER_PKG_NAME ${PROJECT_NAME}-${ROOJSPACKER_VERSION_API})
-
-# Name of the GObject Introspection repository for the library.
-set(ROOJSPACKER_GIR_NAME "MyProject-${ROOJSPACKER_VERSION_API}")
-
-set (LIBRARY_PATH "roojspacker")
-
-add_subdirectory(roojspacker)
-add_subdirectory(bin)
+++ /dev/null
-#!/bin/sh
-
-# Calling this script is basically the same as calling the configure
-# script directly, except that if your project uses submodules calling
-# this script will automatically initialize them.
-
-if [ -e $(dirname "$0")/.gitmodules ]; then
- (cd "$(dirname "$0")" && git submodule update --init --recursive)
-fi
-
-$(dirname $0)/configure "$@"
\ No newline at end of file
+++ /dev/null
-#
-#
-# Main target
-set(ROOJSPACKER_MAIN_VALA_SOURCES
- main.vala)
-
-
-set(ROOJS_VALA_CUSTOM_VAPIS
- ${CMAKE_BINARY_DIR}/${LIBRARY_PATH}/${ROOJSPACKER_PKG_NAME}.vapi)
-
-set(ROOJSPACKER_VALA_PACKAGES
- glib-2.0
- gobject-2.0
- gee-0.8
- posix
- gio-2.0
- json-glib-1.0
-)
-
-
-# Compile Vala sources to C
-vala_precompile_target(
- "${PROJECT_NAME}-valabin"
- ROOJSPACKER_MAIN_C_SOURCES
- ${ROOJS_VALA_CUSTOM_VAPIS}
- ${ROOJSPACKER_MAIN_VALA_SOURCES}
- PACKAGES ${ROOJSPACKER_VALA_PACKAGES}
- DEPENDS "${ROOJSPACKER_LIBRARY_NAME}-vala")
-
-# Tell CMake to create an executable named "my-project"
-add_executable(${PROJECT_NAME}
- ${ROOJSPACKER_MAIN_C_SOURCES})
-
-# Make sure the Vala sources are compiled to C before attempting to
-# build the executable.
-add_dependencies("${PROJECT_NAME}" "${PROJECT_NAME}-valabin")
-
-# We need to add the directory where the C header for our library is
-# installed, otherwise we'll get an error from the C compiler.
-set_target_properties(${PROJECT_NAME} PROPERTIES
- INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/roojspacker)
-
-# Any libraries that your tests need to link to should go here.
-# Usually this will just be your library.
-target_link_libraries(${PROJECT_NAME}
- ${ROOJSPACKER_LIBRARY_NAME})
-
-# Install the executable.
-install (TARGETS ${PROJECT_NAME}
- RUNTIME DESTINATION bin # On Windows, the DLL goes in the same place as the executables
- LIBRARY DESTINATION lib # This is where shared libraries (*.so on Linux, *.dynlib on OS X)
- ARCHIVE DESTINATION lib) # Finally, this is where static libraries (*.a) go
-
-
-# Generate a .gitignore
-file(WRITE ".gitignore" "# Automatically generated by CMake, do not modify.\n")
-foreach(file
- ".gitignore"
- "roojspacker${CMAKE_EXECUTABLE_SUFFIX}")
- file(APPEND ".gitignore" "/${file}\n")
-endforeach(file)
-foreach(file ${ROOJSPACKER_MAIN_SOURCES})
- string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" file ${file})
- file(APPEND ".gitignore" "/${file}\n")
-endforeach(file)
+++ /dev/null
-# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-# This module provides a convenient way to add C/C++ compiler flags if
-# the compiler supports them.
-
-include (CheckCCompilerFlag)
-include (CheckCXXCompilerFlag)
-
-# Depending on the settings, some compilers will accept unknown flags.
-# We try to disable this behavior by also passing these flags when we
-# check if a flag is supported.
-set (ADD_COMPILER_FLAGS_PREPEND "")
-
-if ("GNU" STREQUAL "${CMAKE_C_COMPILER_ID}")
- set (ADD_COMPILER_FLAGS_PREPEND "-Wall -Wextra -Werror")
-elseif ("Clang" STREQUAL "${CMAKE_C_COMPILER_ID}")
- set (ADD_COMPILER_FLAGS_PREPEND "-Werror=unknown-warning-option")
-endif ()
-
-##
-# Set a variable to different flags, depending on which compiler is in
-# use.
-#
-# Example:
-# set_compiler_flags(VARIABLE varname MSVC /wd666 INTEL /wd1729)
-#
-# This will set varname to /wd666 if the compiler is MSVC, and /wd1729
-# if it is Intel.
-#
-# Possible compilers:
-# - GCC: GNU C Compiler
-# - GCCISH: A compiler that (tries to) be GCC-compatible on the CLI
-# (i.e., anything but MSVC).
-# - CLANG: clang
-# - MSVC: Microsoft Visual C++ compiler
-# - INTEL: Intel C Compiler
-#
-# Note: the compiler is determined based on the value of the
-# CMAKE_C_COMPILER_ID variable, not CMAKE_CXX_COMPILER_ID.
-##
-function (set_compiler_specific_flags)
- set (oneValueArgs VARIABLE)
- set (multiValueArgs GCC GCCISH INTEL CLANG MSVC)
- cmake_parse_arguments(COMPILER_SPECIFIC_FLAGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- set (compiler_flags)
-
- if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
- list (APPEND compiler_flags ${COMPILER_SPECIFIC_FLAGS_GCC})
- elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
- list (APPEND compiler_flags ${COMPILER_SPECIFIC_FLAGS_CLANG})
- elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
- list (APPEND compiler_flags ${COMPILER_SPECIFIC_FLAGS_INTEL})
- elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
- list (APPEND compiler_flags ${COMPILER_SPECIFIC_FLAGS_MSVC})
- endif()
-
- if (NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
- list (APPEND compiler_flags ${COMPILER_SPECIFIC_FLAGS_GCCISH})
- endif ()
-
- set (${COMPILER_SPECIFIC_FLAGS_VARIABLE} "${compiler_flags}" PARENT_SCOPE)
-endfunction ()
-
-function (source_file_add_compiler_flags_unchecked file)
- set (flags ${ARGV})
- list (REMOVE_AT flags 0)
- get_source_file_property (sources ${file} SOURCES)
-
- foreach (flag ${flags})
- get_source_file_property (existing ${file} COMPILE_FLAGS)
- if ("${existing}" STREQUAL "NOTFOUND")
- set_source_files_properties (${file}
- PROPERTIES COMPILE_FLAGS "${flag}")
- else ()
- set_source_files_properties (${file}
- PROPERTIES COMPILE_FLAGS "${existing} ${flag}")
- endif ()
- endforeach (flag)
-endfunction ()
-
-function (source_file_add_compiler_flags file)
- set (flags ${ARGV})
- list (REMOVE_AT flags 0)
- get_source_file_property (sources ${file} SOURCES)
-
- foreach (flag ${flags})
- if ("GNU" STREQUAL "${CMAKE_C_COMPILER_ID}")
- # Because https://gcc.gnu.org/wiki/FAQ#wnowarning
- string (REGEX REPLACE "\\-Wno\\-(.+)" "-W\\1" flag_to_test "${flag}")
- else ()
- set (flag_to_test ${flag})
- endif ()
-
- if ("${file}" MATCHES "\\.c$")
- string (REGEX REPLACE "[^a-zA-Z0-9]+" "_" test_name "CFLAG_${flag_to_test}")
- CHECK_C_COMPILER_FLAG ("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${test_name})
- elseif ("${file}" MATCHES "\\.(cpp|cc|cxx)$")
- string (REGEX REPLACE "[^a-zA-Z0-9]+" "_" test_name "CXXFLAG_${flag_to_test}")
- CHECK_CXX_COMPILER_FLAG ("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${test_name})
- endif ()
-
- if (${test_name})
- source_file_add_compiler_flags_unchecked (${file} ${flag})
- endif ()
-
- unset (test_name)
- unset (flag_to_test)
- endforeach (flag)
-
- unset (flags)
-endfunction ()
-
-function (target_add_compiler_flags target)
- set (flags ${ARGV})
- list (REMOVE_AT flags 0)
- get_target_property (sources ${target} SOURCES)
-
- foreach (source ${sources})
- source_file_add_compiler_flags (${source} ${flags})
- endforeach (source)
-
- unset (flags)
- unset (sources)
-endfunction (target_add_compiler_flags)
-
-# global_add_compiler_flags (flag1 [flag2 [flag3 ...]]):
-#
-# This just adds the requested compiler flags to
-# CMAKE_C/CXX_FLAGS variable if they work with the compiler.
-function (global_add_compiler_flags)
- set (flags ${ARGV})
-
- foreach (flag ${flags})
- if ("GNU" STREQUAL "${CMAKE_C_COMPILER_ID}")
- # Because https://gcc.gnu.org/wiki/FAQ#wnowarning
- string (REGEX REPLACE "\\-Wno\\-(.+)" "-W\\1" flag_to_test "${flag}")
- else ()
- set (flag_to_test "${flag}")
- endif ()
-
- string (REGEX REPLACE "[^a-zA-Z0-9]+" "_" c_test_name "CFLAG_${flag_to_test}")
- CHECK_C_COMPILER_FLAG ("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${c_test_name})
- if (${c_test_name})
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
- endif ()
- unset (c_test_name)
-
- string (REGEX REPLACE "[^a-zA-Z0-9]+" "_" cxx_test_name "CFLAG_${flag_to_test}")
- CHECK_CXX_COMPILER_FLAG ("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${cxx_test_name})
- if (${cxx_test_name})
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
- endif ()
- unset (cxx_test_name)
-
- unset (flag_to_test)
- endforeach (flag)
-
- unset (flags)
-
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE)
-endfunction (global_add_compiler_flags)
\ No newline at end of file
+++ /dev/null
-# FindGLib.cmake
-# <https://github.com/nemequ/gnome-cmake>
-#
-# CMake support for GLib/GObject/GIO.
-#
-# License:
-#
-# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation
-# files (the "Software"), to deal in the Software without
-# restriction, including without limitation the rights to use, copy,
-# modify, merge, publish, distribute, sublicense, and/or sell copies
-# of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-find_package(PkgConfig)
-
-if(PKG_CONFIG_FOUND)
- pkg_search_module(GLIB_PKG glib-2.0)
- pkg_search_module(GOBJECT_PKG gobject-2.0)
- pkg_search_module(GIO_PKG gio-2.0)
-endif()
-
-find_library(GLIB glib-2.0 HINTS ${GLIB_PKG_LIBRARY_DIRS})
-find_library(GOBJECT gobject-2.0 HINTS ${GOBJECT_PKG_LIBRARY_DIRS})
-find_library(GIO gio-2.0 HINTS ${GIO_PKG_LIBRARY_DIRS})
-
-if(GLIB)
- add_library(glib-2.0 SHARED IMPORTED)
- set_property(TARGET glib-2.0 PROPERTY IMPORTED_LOCATION "${GLIB}")
-
- find_path(GLIB_INCLUDE_DIRS "glib.h"
- HINTS ${GLIB_PKG_INCLUDE_DIRS}
- PATH_SUFFIXES "glib-2.0")
-
- get_filename_component(GLIB_LIBDIR "${GLIB}" DIRECTORY)
- find_path(GLIB_CONFIG_INCLUDE_DIR "glibconfig.h"
- HINTS
- ${GLIB_LIBDIR}
- ${GLIB_PKG_INCLUDE_DIRS}
- PATHS
- "${CMAKE_LIBRARY_PATH}"
- PATH_SUFFIXES
- "glib-2.0/include"
- "glib-2.0")
- unset(GLIB_LIBDIR)
-
- if(NOT GLIB_CONFIG_INCLUDE_DIR)
- unset(GLIB_INCLUDE_DIRS)
- else()
- file(STRINGS "${GLIB_CONFIG_INCLUDE_DIR}/glibconfig.h" GLIB_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)")
- string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLIB_MAJOR_VERSION "${GLIB_MAJOR_VERSION}")
- file(STRINGS "${GLIB_CONFIG_INCLUDE_DIR}/glibconfig.h" GLIB_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)")
- string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLIB_MINOR_VERSION "${GLIB_MINOR_VERSION}")
- file(STRINGS "${GLIB_CONFIG_INCLUDE_DIR}/glibconfig.h" GLIB_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)")
- string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLIB_MICRO_VERSION "${GLIB_MICRO_VERSION}")
- set(GLIB_VERSION "${GLIB_MAJOR_VERSION}.${GLIB_MINOR_VERSION}.${GLIB_MICRO_VERSION}")
- unset(GLIB_MAJOR_VERSION)
- unset(GLIB_MINOR_VERSION)
- unset(GLIB_MICRO_VERSION)
-
- list(APPEND GLIB_INCLUDE_DIRS ${GLIB_CONFIG_INCLUDE_DIR})
- endif()
-endif()
-
-if(GOBJECT)
- add_library(gobject-2.0 SHARED IMPORTED)
- set_property(TARGET gobject-2.0 PROPERTY IMPORTED_LOCATION "${GOBJECT}")
-
- find_path(GOBJECT_INCLUDE_DIRS "glib-object.h"
- HINTS ${GOBJECT_PKG_INCLUDE_DIRS}
- PATH_SUFFIXES "glib-2.0")
- if(GOBJECT_INCLUDE_DIRS)
- list(APPEND GOBJECT_INCLUDE_DIRS ${GLIB_INCLUDE_DIRS})
- list(REMOVE_DUPLICATES GOBJECT_INCLUDE_DIRS)
- endif()
-endif()
-
-if(GIO)
- add_library(gio-2.0 SHARED IMPORTED)
- set_property(TARGET gio-2.0 PROPERTY IMPORTED_LOCATION "${GIO}")
-
- find_path(GIO_INCLUDE_DIRS "gio/gio.h"
- HINTS ${GIO_PKG_INCLUDE_DIRS}
- PATH_SUFFIXES "glib-2.0")
- if(GIO_INCLUDE_DIRS)
- list(APPEND GIO_INCLUDE_DIRS ${GOBJECT_INCLUDE_DIRS})
- list(REMOVE_DUPLICATES GIO_INCLUDE_DIRS)
- endif()
-endif()
-
-find_program(GLIB_GENMARSHAL glib-genmarshal)
-if(GLIB_GENMARSHAL)
- add_executable(glib-genmarshal IMPORTED)
- set_property(TARGET glib-genmarshal PROPERTY IMPORTED_LOCATION "${GLIB_GENMARSHAL}")
-endif()
-
-find_program(GLIB_MKENUMS glib-mkenums)
-if(GLIB_MKENUMS)
- add_executable(glib-mkenums IMPORTED)
- set_property(TARGET glib-mkenums PROPERTY IMPORTED_LOCATION "${GLIB_MKENUMS}")
-endif()
-
-find_program(GLIB_COMPILE_SCHEMAS glib-compile-schemas)
-if(GLIB_COMPILE_SCHEMAS)
- add_executable(glib-compile-schemas IMPORTED)
- set_property(TARGET glib-compile-schemas PROPERTY IMPORTED_LOCATION "${GLIB_COMPILE_SCHEMAS}")
-endif()
-
-# glib_install_schemas(
-# [DESTINATION directory]
-# schemas…)
-#
-# Validate and install the listed schemas.
-function(glib_install_schemas)
- set (options)
- set (oneValueArgs DESTINATION)
- set (multiValueArgs)
- cmake_parse_arguments(GSCHEMA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- foreach(schema ${GSCHEMA_UNPARSED_ARGUMENTS})
- get_filename_component(schema_name "${schema}" NAME)
- string(REGEX REPLACE "^(.+)\.gschema.xml$" "\\1" schema_name "${schema_name}")
- set(schema_output "${CMAKE_CURRENT_BINARY_DIR}/${schema_name}.gschema.xml.valid")
-
- add_custom_command(
- OUTPUT "${schema_output}"
- COMMAND glib-compile-schemas
- --strict
- --dry-run
- --schema-file="${schema}"
- COMMAND "${CMAKE_COMMAND}" ARGS -E touch "${schema_output}"
- DEPENDS "${schema}"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- COMMENT "Validating ${schema}")
-
- add_custom_target("gsettings-schema-${schema_name}" ALL
- DEPENDS "${schema_output}")
-
- if(CMAKE_INSTALL_FULL_DATADIR)
- set(SCHEMADIR "${CMAKE_INSTALL_FULL_DATADIR}/glib-2.0/schemas")
- else()
- set(SCHEMADIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas")
- endif()
- install(FILES "${schema}"
- DESTINATION "${SCHEMADIR}")
- install(CODE "execute_process(COMMAND \"${GLIB_COMPILE_SCHEMAS}\" \"${SCHEMADIR}\")")
- endforeach()
-endfunction()
-
-find_program(GLIB_COMPILE_RESOURCES glib-compile-resources)
-if(GLIB_COMPILE_RESOURCES)
- add_executable(glib-compile-resources IMPORTED)
- set_property(TARGET glib-compile-resources PROPERTY IMPORTED_LOCATION "${GLIB_COMPILE_RESOURCES}")
-endif()
-
-function(glib_compile_resources SPEC_FILE)
- set (options INTERNAL)
- set (oneValueArgs TARGET SOURCE_DIR HEADER SOURCE C_NAME)
- set (multiValueArgs)
- cmake_parse_arguments(GLIB_COMPILE_RESOURCES "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- if(NOT GLIB_COMPILE_RESOURCES_SOURCE_DIR)
- set(GLIB_COMPILE_RESOURCES_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
- endif()
-
- set(FLAGS)
-
- if(GLIB_COMPILE_RESOURCES_INTERNAL)
- list(APPEND FLAGS "--internal")
- endif()
-
- if(GLIB_COMPILE_RESOURCES_C_NAME)
- list(APPEND FLAGS "--c-name" "${GLIB_COMPILE_RESOURCES_C_NAME}")
- endif()
-
- get_filename_component(SPEC_FILE "${SPEC_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-
- execute_process(
- COMMAND glib-compile-resources
- --generate-dependencies
- --sourcedir "${GLIB_COMPILE_RESOURCES_SOURCE_DIR}"
- "${SPEC_FILE}"
- OUTPUT_VARIABLE deps
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- if(GLIB_COMPILE_RESOURCES_HEADER)
- get_filename_component(GLIB_COMPILE_RESOURCES_HEADER "${GLIB_COMPILE_RESOURCES_HEADER}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-
- add_custom_command(
- OUTPUT "${GLIB_COMPILE_RESOURCES_HEADER}"
- COMMAND glib-compile-resources
- --sourcedir "${GLIB_COMPILE_RESOURCES_SOURCE_DIR}"
- --generate-header
- --target "${GLIB_COMPILE_RESOURCES_HEADER}"
- ${FLAGS}
- "${SPEC_FILE}"
- DEPENDS "${SPEC_FILE}" ${deps}
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
- endif()
-
- if(GLIB_COMPILE_RESOURCES_SOURCE)
- get_filename_component(GLIB_COMPILE_RESOURCES_SOURCE "${GLIB_COMPILE_RESOURCES_SOURCE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-
- add_custom_command(
- OUTPUT "${GLIB_COMPILE_RESOURCES_SOURCE}"
- COMMAND glib-compile-resources
- --sourcedir "${GLIB_COMPILE_RESOURCES_SOURCE_DIR}"
- --generate-source
- --target "${GLIB_COMPILE_RESOURCES_SOURCE}"
- ${FLAGS}
- "${SPEC_FILE}"
- DEPENDS "${SPEC_FILE}" ${deps}
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
- endif()
-endfunction()
-
-find_program(GDBUS_CODEGEN gdbus-codegen)
-if(GDBUS_CODEGEN)
- add_executable(gdbus-codegen IMPORTED)
- set_property(TARGET gdbus-codegen PROPERTY IMPORTED_LOCATION "${GDBUS_CODEGEN}")
-endif()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(GLib
- REQUIRED_VARS
- GLIB_INCLUDE_DIRS
- GOBJECT_INCLUDE_DIRS
- GIO_INCLUDE_DIRS
- GLIB_MKENUMS
- GLIB_GENMARSHAL
- GLIB_COMPILE_SCHEMAS
- GLIB_COMPILE_RESOURCES
- GDBUS_CODEGEN
- VERSION_VAR
- GLIB_VERSION)
\ No newline at end of file
+++ /dev/null
-# FindGObjectIntrospection.cmake
-# © 2016 Evan Nemerson <evan@nemerson.com>
-
-find_program(GI_COMPILER_EXECUTABLE g-ir-compiler)
-find_program(GI_SCANNER_EXECUTABLE g-ir-scanner)
-
-if(CMAKE_INSTALL_FULL_DATADIR)
- set(GI_REPOSITORY_DIR "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
-else()
- set(GI_REPOSITORY_DIR "${CMAKE_INSTALL_PREFIX}/share/gir-1.0")
-endif()
-
-if(CMAKE_INSTALL_FULL_LIBDIR)
- set(GI_TYPELIB_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0")
-else()
- set(GI_TYPELIB_DIR "${CMAKE_INSTALL_LIBDIR}/girepository-1.0")
-endif()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(GObjectIntrospection
- REQUIRED_VARS
- GI_COMPILER_EXECUTABLE
- GI_SCANNER_EXECUTABLE)
-
-function(gobject_introspection_compile TYPELIB)
- set (options DEBUG VERBOSE)
- set (oneValueArgs MODULE SHARED_LIBRARY)
- set (multiValueArgs FLAGS INCLUDE_DIRS)
- cmake_parse_arguments(GI_COMPILER "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- get_filename_component(TYPELIB "${TYPELIB}" ABSOLUTE
- BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-
- if(GI_COMPILER_DEBUG)
- list(APPEND GI_COMPILER_FLAGS "--debug")
- endif()
-
- if(GI_COMPILER_VERBOSE)
- list(APPEND GI_COMPILER_FLAGS "--verbose")
- endif()
-
- if(GI_SHARED_LIBRARY)
- list(APPEND GI_COMPILER_FLAGS "--shared-library" "${GI_SHARED_LIBRARY}")
- endif()
-
- foreach(include_dir ${GI_COMPILER_INCLUDE_DIRS})
- list(APPEND GI_COMPILER_FLAGS "--includedir" "${include_dir}")
- endforeach()
-
- add_custom_command(
- OUTPUT "${TYPELIB}"
- COMMAND "${GI_COMPILER_EXECUTABLE}"
- ARGS
- "-o" "${TYPELIB}"
- ${GI_COMPILER_FLAGS}
- ${GI_COMPILER_UNPARSED_ARGUMENTS}
- DEPENDS
- ${GI_COMPILER_UNPARSED_ARGUMENTS})
-endfunction()
\ No newline at end of file
+++ /dev/null
-# FindVala.cmake
-# <https://github.com/nemequ/gnome-cmake>
-#
-# This file contains functions which can be used to integrate Vala
-# compilation with CMake. It is intended as a replacement for Jakob
-# Westhoff's FindVala.cmake and UseVala.cmake. It uses fast-vapis for
-# faster parallel compilation, and per-target directories for
-# generated sources to allow reusing source files across, even with
-# different options.
-#
-# License:
-#
-# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation
-# files (the "Software"), to deal in the Software without
-# restriction, including without limitation the rights to use, copy,
-# modify, merge, publish, distribute, sublicense, and/or sell copies
-# of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-set(VALAC_NAMES valac)
-
-set(_FIND_VALA_CURRENT_VERSION 98)
-while(_FIND_VALA_CURRENT_VERSION GREATER 0)
- list(APPEND VALAC_NAME "valac-1.${_FIND_VALA_CURRENT_VERSION}")
- math(EXPR _FIND_VALA_CURRENT_VERSION "${_FIND_VALA_CURRENT_VERSION} - 2")
-endwhile()
-set(_FIND_VALA_CURRENT_VERSION 98)
-while(_FIND_VALA_CURRENT_VERSION GREATER 0)
- list(APPEND VALAC_NAME "valac-1.${_FIND_VALA_CURRENT_VERSION}")
- math(EXPR _FIND_VALA_CURRENT_VERSION "${_FIND_VALA_CURRENT_VERSION} - 2")
-endwhile()
-unset(_FIND_VALA_CURRENT_VERSION)
-
-find_program(VALA_EXECUTABLE
- NAMES ${VALAC_NAMES})
-mark_as_advanced(VALA_EXECUTABLE)
-
-unset(VALAC_NAMES)
-
-if(VALA_EXECUTABLE)
- # Determine valac version
- execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
- OUTPUT_VARIABLE VALA_VERSION)
- string(REGEX REPLACE "^.*Vala ([0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9]+(\\-[0-9a-f]+)?)?).*$" "\\1" VALA_VERSION "${VALA_VERSION}")
-
- add_executable(valac IMPORTED)
- set_property(TARGET valac PROPERTY IMPORTED_LOCATION "${VALA_EXECUTABLE}")
-endif(VALA_EXECUTABLE)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Vala
- REQUIRED_VARS VALA_EXECUTABLE
- VERSION_VAR VALA_VERSION)
-
-function(_vala_mkdir_for_file file)
- get_filename_component(dir "${file}" DIRECTORY)
- file(MAKE_DIRECTORY "${dir}")
-endfunction()
-
-macro(_vala_parse_source_file_path source)
- set (options)
- set (oneValueArgs SOURCE TYPE OUTPUT_PATH OUTPUT_DIR GENERATED_SOURCE FAST_VAPI)
- set (multiValueArgs)
- cmake_parse_arguments(VALAPATH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- if(VALAPATH_SOURCE)
- get_filename_component("${VALAPATH_SOURCE}" "${source}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
- endif()
-
- if(VALAPATH_TYPE)
- string(REGEX MATCH "[^\\.]+$" "${VALAPATH_TYPE}" "${source}")
- string(TOLOWER "${${VALAPATH_TYPE}}" "${VALAPATH_TYPE}")
- endif()
-
- if(VALAPATH_OUTPUT_PATH OR VALAPATH_GENERATED_SOURCE OR VALAPATH_OUTPUT_DIR OR VALAPATH_FAST_VAPI)
- get_filename_component(srcfile "${source}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-
- string(LENGTH "${CMAKE_BINARY_DIR}" dirlen)
- string(SUBSTRING "${srcfile}" 0 ${dirlen} tmp)
- if("${CMAKE_BINARY_DIR}" STREQUAL "${tmp}")
- string(SUBSTRING "${srcfile}" ${dirlen} -1 tmp)
- set(outpath "build${tmp}")
- else()
- string(LENGTH "${CMAKE_SOURCE_DIR}" dirlen)
- string(SUBSTRING "${srcfile}" 0 ${dirlen} tmp)
- if("${CMAKE_SOURCE_DIR}" STREQUAL "${tmp}")
- string(SUBSTRING "${srcfile}" ${dirlen} -1 tmp)
- set(outpath "source${tmp}")
- else ()
- # TODO: this probably doesn't work correctly on Windows…
- set(outpath "root${tmp}")
- endif()
- endif()
-
- unset(tmp)
- unset(dirlen)
- unset(srcfile)
- endif()
-
- if(VALAPATH_OUTPUT_PATH)
- set("${VALAPATH_OUTPUT_PATH}" "${outpath}")
- endif()
-
- if(VALAPATH_GENERATED_SOURCE)
- string(REGEX REPLACE "\\.(vala|gs)$" ".c" "${VALAPATH_GENERATED_SOURCE}" "${outpath}")
- endif()
-
- if(VALAPATH_FAST_VAPI)
- string(REGEX REPLACE "\\.(vala|gs)$" ".vapi" "${VALAPATH_FAST_VAPI}" "${outpath}")
- endif()
-
- if(VALAPATH_OUTPUT_DIR)
- get_filename_component("${VALAPATH_OUTPUT_DIR}" "${outpath}" DIRECTORY)
- endif()
-
- unset(outpath)
-endmacro()
-
-# vala_precompile_target(
-# TARGET
-# GENERATED_SOURCES
-# SOURCES…
-# [VAPI vapi-name.vapi]
-# [GIR name-version.gir]
-# [HEADER name.h]
-# [FLAGS …]
-# [PACKAGES …]
-# [DEPENDS …])
-#
-# This function will use valac to generate C code.
-#
-# This function uses fast VAPIs to help improve parallelization and
-# incremental build times. The problem with this is that CMake
-# doesn't allow file-level dependencies across directories; if you're
-# generating code in one directory (for example, a library) and would
-# like to use it in another directory and are building in parallel,
-# the build can fail. To prevent this, this function will create a
-# ${TARGET}-vala top-level target (which *is* usable from other
-# directories).
-#
-# Options:
-#
-# TARGET
-# Target to create; it's generally best to make this similar to
-# your executable or library target name (e.g., for a "foo"
-# executable, "foo-vala" might be a good name), but not
-# technically required.
-# GENERATED_SOURCES
-# Variable in which to store the list of generated sources (which
-# you should pass to add_executable or add_library).
-# SOURCES
-# Vala sources to generate C from. You should include *.vala,
-# *.gs, and uninstalled *.vapi files here; you may also include
-# C/C++ sources (they will simply be passed directly through to
-# the GENERATED_SOURCES variable).
-# VAPI name.vapi
-# If you would like to have valac generate a VAPI (basically, if
-# you are generating a library not an executable), pass the file
-# name here.
-# GIR name-version.gir
-# If you would like to have valac generate a GIR, pass the file
-# name here.
-# HEADER name.h
-# If you would like to have valac generate a C header, pass the
-# file name here.
-# FLAGS …
-# List of flags you wish to pass to valac. They will be added to
-# the flags in VALA_COMPILER_FLAGS and VALA_COMPILER_FLAGS_DEBUG
-# (for Debug builds) or VALA_COMPILER_FLAGS_RELEASE (for Release
-# builds).
-# PACKAGES
-# List of dependencies to pass to valac.
-# DEPENDS
-# Any additional dependencies you would like.
-macro(vala_precompile_target TARGET GENERATED_SOURCES)
- set (options)
- set (oneValueArgs VAPI GIR HEADER)
- set (multiValueArgs FLAGS PACKAGES DEPENDS)
- cmake_parse_arguments(VALAC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- set(VALA_SOURCES)
- set(VALA_VAPIS)
- set(VALA_OUTPUT_SOURCES)
-
- if(VALAC_VAPI)
- list(APPEND non_source_out_files "${VALAC_VAPI}")
- list(APPEND non_source_valac_args "--vapi" "${VALAC_VAPI}")
- endif()
-
- if(VALAC_GIR)
- list(APPEND non_source_out_files "${VALAC_GIR}")
- list(APPEND non_source_valac_args
- "--gir" "${VALAC_GIR}"
- "--library" "${TARGET}"
- "--shared-library" "${CMAKE_SHARED_LIBRARY_PREFIX}${TARGET}${CMAKE_SHARED_LIBRARY_SUFFIX}")
- endif()
-
- if(VALAC_HEADER)
- list(APPEND non_source_out_files "${VALAC_HEADER}")
- list(APPEND non_source_valac_args --header "${VALAC_HEADER}")
- endif()
-
- # Split up the input files into three lists; one containing vala and
- # genie sources, one containing VAPIs, and one containing C files
- # (which may seem a bit silly, but it does open up the possibility
- # of declaring your source file list once instead of having separate
- # lists for Vala and C).
- foreach(source ${VALAC_UNPARSED_ARGUMENTS})
- _vala_parse_source_file_path("${source}"
- SOURCE source_full
- TYPE type)
-
- if("vala" STREQUAL "${type}" OR "gs" STREQUAL "${type}")
- list(APPEND VALA_SOURCES "${source_full}")
- elseif("vapi" STREQUAL "${type}")
- list(APPEND VALA_VAPIS "${source_full}")
- elseif(
- "c" STREQUAL "${type}" OR
- "h" STREQUAL "${type}" OR
- "cpp" STREQUAL "${type}" OR
- "cxx" STREQUAL "${type}" OR
- "hpp" STREQUAL "${type}")
- list(APPEND VALA_OUTPUT_SOURCES "${source_full}")
- endif()
-
- unset(type)
- unset(source_full)
- endforeach()
-
- # Set the common flags to pass to every valac invocation.
- set(VALAFLAGS ${VALAC_FLAGS} ${VALA_VAPIS})
- foreach(pkg ${VALAC_PACKAGES})
- list(APPEND VALAFLAGS "--pkg" "${pkg}")
- endforeach()
- list(APPEND VALAFLAGS ${VALA_COMPILER_FLAGS})
- if (CMAKE_BUILD_TYPE MATCHES "Debug")
- list(APPEND VALAFLAGS ${VALA_COMPILER_FLAGS_DEBUG})
- elseif(CMAKE_BUILD_TYPE MATCHES "Release")
- list(APPEND VALAFLAGS ${VALA_COMPILER_FLAGS_RELEASE})
- endif()
-
- # Where to put the output
- set(TARGET_DIR "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}")
-
- set(FAST_VAPI_STAMPS)
-
- # Create fast VAPI targets for each vala source
- foreach(source ${VALA_SOURCES})
- _vala_parse_source_file_path("${source}"
- FAST_VAPI fast_vapi_path)
-
- # We need somewhere to put the output…
- _vala_mkdir_for_file("${TARGET_DIR}/${fast_vapi_path}")
-
- # Create the target
- add_custom_command(
- OUTPUT "${TARGET_DIR}/${fast_vapi_path}.stamp"
- BYPRODUCTS "${TARGET_DIR}/${fast_vapi_path}"
- DEPENDS
- "${source}"
- ${VALA_VAPIS}
- ${VALAC_DEPENDS}
- COMMAND "${VALA_EXECUTABLE}"
- ARGS
- "${source}"
- --fast-vapi "${TARGET_DIR}/${fast_vapi_path}"
- ${VALAFLAGS}
- COMMAND "${CMAKE_COMMAND}" ARGS -E touch "${TARGET_DIR}/${fast_vapi_path}.stamp"
- COMMENT "Generating fast VAPI ${TARGET_DIR}/${fast_vapi_path}")
-
- list(APPEND FAST_VAPI_STAMPS "${TARGET_DIR}/${fast_vapi_path}.stamp")
-
- unset(fast_vapi_path)
- endforeach()
-
- # Create a ${TARGET_DIR}-fast-vapis target which depens on all the fast
- # vapi stamps. We can use this as a dependency to make sure all
- # fast-vapis are up to date.
- add_custom_command(
- OUTPUT "${TARGET_DIR}/fast-vapis.stamp"
- COMMAND "${CMAKE_COMMAND}" ARGS -E touch "${TARGET_DIR}/fast-vapis.stamp"
- DEPENDS
- ${FAST_VAPI_STAMPS}
- ${VALAC_DEPENDS}
- COMMENT "Generating fast VAPIs for ${TARGET}")
-
- add_custom_target("${TARGET}-fast-vapis"
- DEPENDS "${TARGET_DIR}/fast-vapis.stamp")
-
- set(VALA_GENERATED_SOURCE_STAMPS)
-
- # Add targets to generate C sources
- foreach(source ${VALA_SOURCES})
- _vala_parse_source_file_path("${source}"
- OUTPUT_PATH output_path
- OUTPUT_DIR output_dir
- GENERATED_SOURCE generated_source)
-
- set(use_fast_vapi_flags)
- foreach(src ${VALA_SOURCES})
- if(NOT "${src}" STREQUAL "${source}")
- _vala_parse_source_file_path("${src}"
- FAST_VAPI src_fast_vapi_path)
-
- list(APPEND use_fast_vapi_flags --use-fast-vapi "${TARGET_DIR}/${src_fast_vapi_path}")
-
- unset(src_fast_vapi_path)
- endif()
- endforeach()
-
- add_custom_command(
- OUTPUT "${TARGET_DIR}/${generated_source}.stamp"
- BYPRODUCTS "${TARGET_DIR}/${generated_source}"
- COMMAND "${VALA_EXECUTABLE}"
- ARGS
- -d "${TARGET_DIR}/${output_dir}"
- -C
- "${source}"
- ${VALAFLAGS}
- ${use_fast_vapi_flags}
- COMMAND "${CMAKE_COMMAND}" ARGS -E touch "${TARGET_DIR}/${generated_source}.stamp"
- DEPENDS
- "${TARGET}-fast-vapis"
- "${source}"
- ${VALA_VAPIS}
- COMMENT "Generating ${TARGET_DIR}/${generated_source}")
- unset(use_fast_vapi_flags)
-
- list(APPEND VALA_OUTPUT_SOURCES "${TARGET_DIR}/${generated_source}")
- list(APPEND VALA_GENERATED_SOURCE_STAMPS "${TARGET_DIR}/${generated_source}.stamp")
-
- unset(fast_vapi_path)
- unset(output_dir)
- unset(generated_source)
- endforeach()
-
- add_custom_command(
- OUTPUT "${TARGET_DIR}/stamp"
- COMMAND "${CMAKE_COMMAND}" ARGS -E touch "${TARGET_DIR}/stamp"
- DEPENDS ${VALA_GENERATED_SOURCE_STAMPS}
- COMMENT "Generating sources from Vala for ${TARGET}")
-
- set("${GENERATED_SOURCES}" ${VALA_OUTPUT_SOURCES})
-
- if(non_source_out_files)
- set(use_fast_vapi_flags)
- foreach(source ${VALA_SOURCES})
- _vala_parse_source_file_path("${source}"
- FAST_VAPI fast_vapi_path)
-
- list(APPEND use_fast_vapi_flags --use-fast-vapi "${TARGET_DIR}/${fast_vapi_path}")
-
- unset(fast_vapi_path)
- endforeach()
-
- add_custom_command(OUTPUT ${non_source_out_files}
- COMMAND ${VALA_EXECUTABLE}
- ARGS
- -C
- ${non_source_valac_args}
- ${VALAFLAGS}
- ${use_fast_vapi_flags}
- DEPENDS
- "${TARGET}-fast-vapis"
- ${VALA_VAPIS})
- unset(use_fast_vapi_flags)
- endif()
-
- # CMake doesn't allow file-level dependencies across directories, so
- # we provide a target we can depend on from other directories.
- add_custom_target("${TARGET}"
- DEPENDS
- "${TARGET_DIR}/stamp"
- ${non_source_out_files}
- ${VALAC_DEPENDS}
- ${VALA_GENERATED_SOURCE_STAMPS})
-
- unset(non_source_out_files)
- unset(non_source_valac_args)
-
- unset(VALA_GENERATED_SOURCE_STAMPS)
- unset(FAST_VAPI_STAMPS)
- unset(TARGET_DIR)
- unset(VALAFLAGS)
- unset(VALA_SOURCES)
- unset(VALA_VAPIS)
- unset(VALA_OUTPUT_SOURCES)
-endmacro()
\ No newline at end of file
+++ /dev/null
-# CMake Valadoc support
-# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-find_program(VALADOC_EXECUTABLE
- NAMES valadoc
- DOC "Valadoc")
-
-if(VALADOC_EXECUTABLE)
- execute_process(COMMAND ${VALADOC_EXECUTABLE} "--version" OUTPUT_VARIABLE VALADOC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(SUBSTRING "${VALADOC_VERSION}" 8 -1 VALADOC_VERSION)
-endif()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Valadoc
- FOUND_VAR VALADOC_FOUND
- REQUIRED_VARS VALADOC_EXECUTABLE
- VERSION_VAR VALADOC_VERSION)
-
-# valadoc_generate(OUTPUT_DIR
-# PACKAGE_NAME name
-# [PACKAGE_VERSION version]
-# [FLAGS flags…]
-# [PACKAGES packages…]
-# [DOCLET doclet]
-# [ALL])
-#
-# PACKAGE_NAME name
-# VAPI name to generate documentation for.
-# PACKAGE_VERSION version
-# Version number of the package.
-# FLAGS …
-# List of flags you wish to pass to valadoc.
-# PACKAGES
-# List of dependencies to pass to valac.
-# DOCLET doclet-name
-# Name of the doclet to use (default: html)
-function(valadoc_generate OUTPUT_DIR)
- set (options)
- set (oneValueArgs DOCLET PACKAGE_NAME PACKAGE_VERSION)
- set (multiValueArgs SOURCES PACKAGES FLAGS DEFINITIONS CUSTOM_VAPIS)
- cmake_parse_arguments(VALADOC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- unset (options)
- unset (oneValueArgs)
- unset (multiValueArgs)
-
- if("${VALADOC_DOCLET}" STREQUAL "")
- list(APPEND VALADOC_FLAGS "--doclet=html")
- else()
- list(APPEND VALADOC_FLAGS "--doclet=${VALADOC_DOCLET}")
- endif()
-
- if(NOT "${VALADOC_PACKAGE_NAME}" STREQUAL "")
- list(APPEND VALADOC_FLAGS "--package-name=${VALADOC_PACKAGE_NAME}")
- endif()
-
- if(NOT "${VALADOC_PACKAGE_VERSION}" STREQUAL "")
- list(APPEND VALADOC_FLAGS "--package-version=${VALADOC_PACKAGE_VERSION}")
- endif()
-
- foreach(pkg ${VALADOC_PACKAGES})
- list(APPEND VALADOC_FLAGS "--pkg=${pkg}")
- endforeach(pkg)
-
- add_custom_command(
- OUTPUT "${OUTPUT_DIR}"
- COMMAND "${VALADOC_EXECUTABLE}"
- ARGS
- --force
- -o "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DIR}"
- ${VALADOC_FLAGS}
- ${VALADOC_SOURCES}
- DEPENDS
- ${VALADOC_SOURCES}
- COMMENT "Generating documentation with Valadoc"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
-endfunction()
\ No newline at end of file
case TokenName.RIGHT_BRACE: return TokenName.LEFT_BRACE;
default:
throw new LangError.ArgumentError("invalid matching character : %s", name.to_string());
-
- return null;
+
};
//return this.matchingNames.get(name);
public bool isKeyword(string word) {
try {
- var x = this.keyword(word);
+ this.keyword(word);
return true;
} catch (LangError e) {
return false;