[libgtkmusic] Build system migrated to CMake.



commit be6756c2a7c3a6e9476869efb2d42741522220ea
Author: Leandro Mattioli <leandro mattioli gmail com>
Date:   Wed Dec 28 23:51:48 2016 -0200

    Build system migrated to CMake.

 .gitignore                                         |    1 +
 CMakeLists.txt                                     |  214 +
 INSTALL                                            |  373 +-
 Makefile.am                                        |  144 -
 Makefile.in                                        | 1289 --
 aclocal.m4                                         | 1298 --
 build-aux/compile                                  |  143 -
 build-aux/config.guess                             | 1530 ---
 build-aux/config.sub                               | 1782 ---
 build-aux/depcomp                                  |  630 -
 build-aux/install-sh                               |  527 -
 build-aux/ltmain.sh                                | 9661 -------------
 build-aux/missing                                  |  376 -
 cmake/FindGObjectIntrospection.cmake               |   61 +
 cmake/FindGladeUI.cmake                            |   48 +
 cmake/FindVala.cmake                               |   70 +
 cmake/FindXMLLint.cmake                            |    9 +
 cmake/UseVala.cmake                                |  192 +
 config.h.in                                        |   65 -
 configure                                          |14215 --------------------
 configure.ac                                       |   83 -
 glade/glade-catalog.dtd                            |  103 -
 glade/gtkmusic-catalog.xml                         |    7 +-
 .../16x16/actions/widget-gtkmusic-guitar.png}      |  Bin 960 -> 960 bytes
 .../16x16/actions/widget-gtkmusic-piano.png}       |  Bin 315 -> 315 bytes
 .../22x22/actions/widget-gtkmusic-guitar.png}      |  Bin 1442 -> 1442 bytes
 .../22x22/actions/widget-gtkmusic-piano.png}       |  Bin 337 -> 337 bytes
 gtkmusic-0.2.pc.in                                 |   13 -
 gtkmusic.pc.in                                     |   13 +
 m4/libtool.m4                                      | 7851 -----------
 m4/ltoptions.m4                                    |  369 -
 m4/ltsugar.m4                                      |  123 -
 m4/ltversion.m4                                    |   23 -
 m4/lt~obsolete.m4                                  |   98 -
 src/MusicalNotes.vala                              |    2 +-
 35 files changed, 623 insertions(+), 40690 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index bafe9b7..54603c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+build
 autom4te.cache
 config.h
 config.log
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..c668d6a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,214 @@
+project(libgtkmusic)
+cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+
+# =============================================================================
+# Modules
+# =============================================================================
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+include(FeatureSummary)
+include(FindGit)
+include(FindGObjectIntrospection)
+include(FindVala)
+include(FindGladeUI)
+include(FindXMLLint)
+include(UseVala)
+
+# =============================================================================
+# Common Configurations and Values
+# =============================================================================
+
+set(AUTHOR_NAME "Leandro Resende Mattioli")
+set(AUTHOR_EMAIL "leandro mattioli gmail com")
+set(AUTHOR_CONTACT ${AUTHOR_NAME} <${AUTHOR_EMAIl}>)
+
+set(PROJECT_URL "https://wiki.gnome.org/Projects/libgtkmusic";)
+
+set(VERSION_MAJOR "0")
+set(VERSION_MINOR "4")
+set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR})
+
+include_directories(src)
+
+set(GIR_FILE GtkMusic-${VERSION_STRING}.gir)
+set(TYPELIB_FILE GtkMusic-${VERSION_STRING}.typelib)
+set(VAPI_FILE gtkmusic-${VERSION_STRING}.vapi)
+
+# =============================================================================
+# Dependencies
+# =============================================================================
+
+find_package(PkgConfig REQUIRED)
+find_package(Vala REQUIRED)
+pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+pkg_check_modules(GEE REQUIRED gee-0.8)
+
+# =============================================================================
+# Main Library, Header and Pkg-Config
+# =============================================================================
+
+vala_precompile(
+    VALA_C_LIBGTKMUSIC src/GuitarWidget.vala  
+                       src/MusicalNotes.vala
+                       src/PianoWidget.vala
+    PACKAGES gtk+-3.0
+             gee-0.8
+             posix
+
+    OPTIONS    -h gtkmusic-internals.h 
+               --internal-vapi gtkmusic-internals-${VERSION_STRING}.vapi 
+               --library gtkmusic-${VERSION_STRING} --gir ${GIR_FILE}
+
+    GENERATE_VAPI gtkmusic-${VERSION_STRING}
+    GENERATE_HEADER gtkmusic
+)
+
+configure_file(${CMAKE_SOURCE_DIR}/gtkmusic.pc.in 
+               ${CMAKE_BINARY_DIR}/gtkmusic.pc @ONLY)
+
+set(DEPS_LIBRARIES    ${GTK3_LIBRARIES} ${GEE_LIBRARIES})
+set(DEPS_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS} ${GEE_INCLUDE_DIRS})
+set(DEPS_CFLAGS_OTHER ${GTK3_CFLAGS_OTHER} ${GEE_CFLAGS_OTHER})
+
+add_library(gtkmusic SHARED ${VALA_C_LIBGTKMUSIC})
+set_target_properties(gtkmusic PROPERTIES SOVERSION ${VERSION_STRING})
+target_link_libraries(gtkmusic ${DEPS_LIBRARIES})
+target_include_directories(gtkmusic PUBLIC ${DEPS_INCLUDE_DIRS})
+target_compile_options(gtkmusic PUBLIC ${DEPS_CFLAGS_OTHER})
+
+add_library(gtkmusic_static STATIC ${VALA_C_LIBGTKMUSIC})
+target_link_libraries(gtkmusic_static ${DEPS_LIBRARIES})
+target_include_directories(gtkmusic_static PUBLIC ${DEPS_INCLUDE_DIRS})
+target_compile_options(gtkmusic_static PUBLIC ${DEPS_CFLAGS_OTHER})
+
+install(FILES ${CMAKE_BINARY_DIR}/gtkmusic.pc
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+install(TARGETS gtkmusic gtkmusic_static 
+        LIBRARY DESTINATION lib 
+                PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 
+                            GROUP_READ GROUP_EXECUTE
+                            WORLD_READ WORLD_EXECUTE
+        ARCHIVE DESTINATION lib/static)
+install(FILES ${CMAKE_BINARY_DIR}/gtkmusic.h
+        DESTINATION include/gtkmusic-${VERSION_STRING})
+
+
+# =============================================================================
+# GObject Introspection
+# =============================================================================
+
+option(CREATE_GIR "Whether to create GObject Introspection Files" 
+       ${INTROSPECTION_FOUND})
+
+if(CREATE_GIR)
+
+if(INTROSPECTION_FOUND)
+    add_custom_command(
+        TARGET gtkmusic
+        POST_BUILD
+        COMMAND ${INTROSPECTION_COMPILER} 
+                --shared-library=libgtkmusic-${VERSION_STRING} 
+                -o ${TYPELIB_FILE} ${GIR_FILE}
+        COMMENT "Creating GObject Introspection files"
+    )
+    
+    install(FILES ${CMAKE_BINARY_DIR}/${GIR_FILE} 
+            DESTINATION ${INTROSPECTION_GIRDIR})
+    install(FILES ${CMAKE_BINARY_DIR}/${TYPELIB_FILE} 
+            DESTINATION ${INTROSPECTION_TYPELIBDIR})
+    
+else(INTROSPECTION_FOUND)
+message(WARNING "\
+pkg-config cannot find gobject-introspection. \
+If you're running a Debian based distribution, please install packages \
+libgirepository1.0-dev and gobject-instrospection")
+endif(INTROSPECTION_FOUND)
+
+endif(CREATE_GIR)
+
+# =============================================================================
+# Glade Catalog
+# =============================================================================
+
+option(CREATE_GLADE_CATALOG "Whether to add widgets to Glade designer"
+       ${GLADEUI_FOUND})
+if(CREATE_GLADE_CATALOG)
+    install(FILES ${CMAKE_SOURCE_DIR}/glade/gtkmusic-catalog.xml 
+            DESTINATION ${GLADEUI_CATALOGDIR} )
+    install(DIRECTORY ${CMAKE_SOURCE_DIR}/glade/icons/ 
+            DESTINATION ${GLADEUI_PIXMAPDIR} )
+    if(XMLLINT_FOUND)
+    add_custom_target(validate_catalog
+                      COMMAND ${XMLLINT_EXECUTABLE} --dtdvalid 
+                      ${GLADEUI_CATALOGDIR}/glade-catalog.dtd 
+                      --noout ${CMAKE_SOURCE_DIR}/glade/gtkmusic-catalog.xml)
+    endif(XMLLINT_FOUND)
+endif(CREATE_GLADE_CATALOG)
+
+
+# =============================================================================
+# Test utilities
+# =============================================================================
+
+option(BUILD_TESTS "Whether to build test applications" YES)
+if(BUILD_TESTS)
+vala_precompile(VALA_C_GUITAR_TEST test/TestsGuitar.vala
+                PACKAGES           gtk+-3.0 gee-0.8 posix
+                CUSTOM_VAPIS       ${CMAKE_BINARY_DIR}/${VAPI_FILE})
+
+add_executable(tests_guitar ${VALA_C_GUITAR_TEST})
+target_link_libraries(tests_guitar gtkmusic)
+target_link_libraries(tests_guitar ${GTK3_LIBRARIES} ${GEE_LIBRARIES})
+target_include_directories(tests_guitar PUBLIC ${GTK3_INCLUDE_DIRS} ${GEE_INCLUDE_DIRS})
+target_compile_options(tests_guitar PUBLIC ${GTK3_CFLAGS_OTHER} ${GEE_CFLAGS_OTHER})
+
+
+vala_precompile(VALA_C_PIANO_TEST test/TestsPiano.vala
+                PACKAGES           gtk+-3.0 gee-0.8 posix
+                CUSTOM_VAPIS       ${CMAKE_BINARY_DIR}/${VAPI_FILE})
+
+add_executable(tests_piano ${VALA_C_PIANO_TEST})
+target_link_libraries(tests_piano gtkmusic)
+target_link_libraries(tests_piano ${GTK3_LIBRARIES} ${GEE_LIBRARIES})
+target_include_directories(tests_piano PUBLIC ${GTK3_INCLUDE_DIRS} ${GEE_INCLUDE_DIRS})
+target_compile_options(tests_piano PUBLIC ${GTK3_CFLAGS_OTHER} ${GEE_CFLAGS_OTHER})
+
+vala_precompile(VALA_C_NOTES_TEST test/TestsMusicalNotes.vala
+                PACKAGES           gtk+-3.0 gee-0.8 posix
+                CUSTOM_VAPIS       ${CMAKE_BINARY_DIR}/${VAPI_FILE})
+
+add_executable(tests_notes ${VALA_C_NOTES_TEST})
+target_link_libraries(tests_notes gtkmusic)
+target_link_libraries(tests_notes ${GTK3_LIBRARIES} ${GEE_LIBRARIES})
+target_include_directories(tests_notes PUBLIC ${GTK3_INCLUDE_DIRS} ${GEE_INCLUDE_DIRS})
+target_compile_options(tests_notes PUBLIC ${GTK3_CFLAGS_OTHER} ${GEE_CFLAGS_OTHER})
+
+endif(BUILD_TESTS)
+
+# =============================================================================
+# GIT Integration
+# =============================================================================
+
+if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
+exec_program(${GIT_EXECUTABLE} ARGS "rev-list HEAD --count" 
+             OUTPUT_VARIABLE GIT_COMMAND)
+string(STRIP ${GIT_COMMAND} GIT_REVISION)             
+endif(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
+
+# =============================================================================
+# Build Configuration Overview
+# =============================================================================
+
+FEATURE_SUMMARY(WHAT ALL) 
+
+message("")
+message("------------------------------------------------------------------")
+message("Features:")
+message("------------------------------------------------------------------")
+message("Main Library        ON (always)")
+message("GI Typelib          ${CREATE_GIR}")
+message("Glade Catalog       ${CREATE_GLADE_CATALOG}")
+message("Executables (Tests) ${BUILD_TESTS}")
+message("Documentation       OFF")
+message("------------------------------------------------------------------")
+message("")
diff --git a/INSTALL b/INSTALL
index 7d1c323..30106c3 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,365 +1,8 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-
-   Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.  This file is offered as-is,
-without warranty of any kind.
-
-Basic Installation
-==================
-
-   Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.  Some packages provide this
-`INSTALL' file but do not implement all of the features documented
-below.  The lack of an optional feature in a given package is not
-necessarily a bug.  More recommendations for GNU packages can be found
-in *note Makefile Conventions: (standards)Makefile Conventions.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
-   It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
-   The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
-
-   The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.
-
-     Running `configure' might take a while.  While running, it prints
-     some messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package, generally using the just-built uninstalled binaries.
-
-  4. Type `make install' to install the programs and any data files and
-     documentation.  When installing into a prefix owned by root, it is
-     recommended that the package be configured and built as a regular
-     user, and only the `make install' phase executed with root
-     privileges.
-
-  5. Optionally, type `make installcheck' to repeat any self-tests, but
-     this time using the binaries in their final installed location.
-     This target does not install anything.  Running this target as a
-     regular user, particularly if the prior `make install' required
-     root privileges, verifies that the installation completed
-     correctly.
-
-  6. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
-
-  7. Often, you can also type `make uninstall' to remove the installed
-     files again.  In practice, not all packages have tested that
-     uninstallation works correctly, even though it is required by the
-     GNU Coding Standards.
-
-  8. Some packages, particularly those that use Automake, provide `make
-     distcheck', which can by used by developers to test that all other
-     targets like `make install' and `make uninstall' work correctly.
-     This target is generally not run by end users.
-
-Compilers and Options
-=====================
-
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  Run `./configure --help'
-for details on some of the pertinent environment variables.
-
-   You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment.  Here
-is an example:
-
-     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
-
-   *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-   You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you can use GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.  This
-is known as a "VPATH" build.
-
-   With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory.  After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
-
-   On MacOS X 10.5 and later systems, you can create libraries and
-executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor.  Like
-this:
-
-     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-                 CPP="gcc -E" CXXCPP="g++ -E"
-
-   This is not guaranteed to produce working output in all cases, you
-may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
-
-Installation Names
-==================
-
-   By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
-absolute file name.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.  In general, the
-default for these options is expressed in terms of `${prefix}', so that
-specifying just `--prefix' will affect all of the other directory
-specifications that were not explicitly provided.
-
-   The most portable way to affect installation locations is to pass the
-correct locations to `configure'; however, many packages provide one or
-both of the following shortcuts of passing variable assignments to the
-`make install' command line to change installation locations without
-having to reconfigure or recompile.
-
-   The first method involves providing an override variable for each
-affected directory.  For example, `make install
-prefix=/alternate/directory' will choose an alternate location for all
-directory configuration variables that were expressed in terms of
-`${prefix}'.  Any directories that were specified during `configure',
-but not in terms of `${prefix}', must each be overridden at install
-time for the entire installation to be relocated.  The approach of
-makefile variable overrides for each directory variable is required by
-the GNU Coding Standards, and ideally causes no recompilation.
-However, some platforms have known limitations with the semantics of
-shared libraries that end up requiring recompilation when using this
-method, particularly noticeable in packages that use GNU Libtool.
-
-   The second method involves providing the `DESTDIR' variable.  For
-example, `make install DESTDIR=/alternate/directory' will prepend
-`/alternate/directory' before all installation names.  The approach of
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
-does not work on platforms that have drive letters.  On the other hand,
-it does better at avoiding recompilation issues, and works well even
-when some directory options were not specified in terms of `${prefix}'
-at `configure' time.
-
-Optional Features
-=================
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-   Some packages offer the ability to configure how verbose the
-execution of `make' will be.  For these packages, running `./configure
---enable-silent-rules' sets the default to minimal output, which can be
-overridden with `make V=1'; while running `./configure
---disable-silent-rules' sets the default to verbose, which can be
-overridden with `make V=0'.
-
-Particular systems
-==================
-
-   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
-CC is not installed, it is recommended to use the following options in
-order to use an ANSI C compiler:
-
-     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
-
-and if that doesn't work, install pre-built binaries of GCC for HP-UX.
-
-   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
-a workaround.  If GNU CC is not installed, it is therefore recommended
-to try
-
-     ./configure CC="cc"
-
-and if that doesn't work, try
-
-     ./configure CC="cc -nodtk"
-
-   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
-directory contains several dysfunctional programs; working variants of
-these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
-in your `PATH', put it _after_ `/usr/bin'.
-
-   On Haiku, software installed for all users goes in `/boot/common',
-not `/usr/local'.  It is recommended to use the following options:
-
-     ./configure --prefix=/boot/common
-
-Specifying the System Type
-==========================
-
-   There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on.  Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
-     CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
-     OS
-     KERNEL-OS
-
-   See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
-   If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
-produce code for.
-
-   If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-   Variables not defined in a site shell script can be set in the
-environment passed to `configure'.  However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost.  In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'.  For example:
-
-     ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug.  Until the bug is fixed you can use this workaround:
-
-     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-`configure' Invocation
-======================
-
-   `configure' recognizes the following options to control how it
-operates.
-
-`--help'
-`-h'
-     Print a summary of all of the options to `configure', and exit.
-
-`--help=short'
-`--help=recursive'
-     Print a summary of the options unique to this package's
-     `configure', and exit.  The `short' variant lists options used
-     only in the top level, while the `recursive' variant lists options
-     also present in any nested packages.
-
-`--version'
-`-V'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`--cache-file=FILE'
-     Enable the cache: use and save the results of the tests in FILE,
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
-     disable caching.
-
-`--config-cache'
-`-C'
-     Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`--prefix=DIR'
-     Use DIR as the installation prefix.  *note Installation Names::
-     for more details, including other options available for fine-tuning
-     the installation locations.
-
-`--no-create'
-`-n'
-     Run the configure checks, but stop before creating any output
-     files.
-
-`configure' also accepts some other, not widely useful, options.  Run
-`configure --help' for more details.
-
+Suggested installation method
+
+Assuming that cmake and all dependencies are installed, run:
+       mkdir build
+       cd build
+       cmake ..
+       make
+       sudo make install
diff --git a/cmake/FindGObjectIntrospection.cmake b/cmake/FindGObjectIntrospection.cmake
new file mode 100644
index 0000000..3c88318
--- /dev/null
+++ b/cmake/FindGObjectIntrospection.cmake
@@ -0,0 +1,61 @@
+# - Try to find gobject-introspection
+# Once done, this will define
+#
+#  INTROSPECTION_FOUND - system has gobject-introspection
+#  INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
+#  INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
+#  INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
+#  INTROSPECTION_GIRDIR
+#  INTROSPECTION_TYPELIBDIR
+#  INTROSPECTION_CFLAGS
+#  INTROSPECTION_LIBS
+#
+# Copyright (C) 2010, Pino Toscano, <pino kde org>
+# Copyright (C) 2014 Igalia S.L.
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname _extra_args)
+    execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} ${_extra_args} gobject-introspection-1.0
+        OUTPUT_VARIABLE _result
+        RESULT_VARIABLE _null
+    )
+
+    if (_null)
+    else ()
+        string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+        string(REGEX REPLACE " +$" ""  _result "${_result}")
+        separate_arguments(_result)
+        set(${_outvar} ${_result} CACHE INTERNAL "")
+    endif ()
+endmacro(_GIR_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+    if (PACKAGE_FIND_VERSION_COUNT GREATER 0)
+        set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
+    endif ()
+    pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
+    if (_pc_gir_FOUND)
+        set(INTROSPECTION_FOUND TRUE)
+        _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir" "")
+        set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
+        set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
+    endif ()
+endif ()
+
+mark_as_advanced(
+    INTROSPECTION_SCANNER
+    INTROSPECTION_COMPILER
+    INTROSPECTION_GENERATE
+    INTROSPECTION_GIRDIR
+    INTROSPECTION_TYPELIBDIR
+    INTROSPECTION_CFLAGS
+    INTROSPECTION_LIBS
+)
+
diff --git a/cmake/FindGladeUI.cmake b/cmake/FindGladeUI.cmake
new file mode 100644
index 0000000..cf1d9bc
--- /dev/null
+++ b/cmake/FindGladeUI.cmake
@@ -0,0 +1,48 @@
+# Module FindGladeUI - Try to find gladeui
+#
+# Output variables
+#  GLADEUI_FOUND - system has gladeui
+#  GLADEUI_CATALOGDIR
+#  GLADEUI_PIXMAPDIR
+#  GLADEUI_MODULEDIR
+#
+# Based on webkit's FindGObjectIntrospection.cmake
+# Copyright (C) 2010, Pino Toscano, <pino kde org>
+# Copyright (C) 2014 Igalia S.L.
+#
+# Copyright (C) 2016, Leandro Resende Mattioli, <leandro mattioli gmail com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+macro(_GET_PKGCONFIG_VAR _outvar _varname _pkg)
+    execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} 
+                --variable=${_varname} ${_extra_args} ${_pkg}
+        OUTPUT_VARIABLE _result
+        RESULT_VARIABLE _null
+    )
+    if (_null)
+    else ()
+        string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+        string(REGEX REPLACE " +$" ""  _result "${_result}")
+        separate_arguments(_result)
+        set(${_outvar} ${_result} CACHE INTERNAL "")
+    endif ()
+endmacro(_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+    pkg_check_modules(_pc_gladeui gladeui-2.0)
+    if (_pc_gladeui_FOUND)
+        set(GLADEUI_FOUND TRUE)
+        _get_pkgconfig_var(GLADEUI_CATALOGDIR "catalogdir" "gladeui-2.0")
+        _get_pkgconfig_var(GLADEUI_PIXMAPDIR "pixmapdir" "gladeui-2.0")
+        _get_pkgconfig_var(GLADEUI_MODULEDIR "moduledir" "gladeui-2.0")
+    endif ()
+endif ()
+
+mark_as_advanced(
+    GLADEUI_CATALOGDIR
+    GLADEUI_PIXMAPDIR
+    GLADEUI_MODULEDIR
+)
diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake
new file mode 100644
index 0000000..c8fcc51
--- /dev/null
+++ b/cmake/FindVala.cmake
@@ -0,0 +1,70 @@
+##
+# Find module for the Vala compiler (valac)
+#
+# This module determines wheter a Vala compiler is installed on the current
+# system and where its executable is.
+#
+# Call the module using "find_package(Vala) from within your CMakeLists.txt.
+#
+# The following variables will be set after an invocation:
+#
+#  VALA_FOUND       Whether the vala compiler has been found or not
+#  VALA_EXECUTABLE  Full path to the valac executable if it has been found
+#  VALA_VERSION     Version number of the available valac
+#  VALA_USE_FILE    Include this file to define the vala_precompile function
+##
+
+##
+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
+# Copyright 2010-2011 Daniel Pfeifer
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+#    1. Redistributions of source code must retain the above copyright notice,
+#       this list of conditions and the following disclaimer.
+# 
+#    2. Redistributions in binary form must reproduce the above copyright notice,
+#       this list of conditions and the following disclaimer in the documentation
+#       and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 
+# The views and conclusions contained in the software and documentation are those
+# of the authors and should not be interpreted as representing official policies,
+# either expressed or implied, of Jakob Westhoff
+##
+
+# Search for the valac executable in the usual system paths
+# Some distributions rename the valac to contain the major.minor in the binary name
+find_program(VALA_EXECUTABLE NAMES valac valac-0.20 valac-0.18 valac-0.16 valac-0.14 valac-0.12 valac-0.10)
+mark_as_advanced(VALA_EXECUTABLE)
+
+# Determine the valac version
+if(VALA_EXECUTABLE)
+    execute_process(COMMAND ${VALA_EXECUTABLE} "--version" 
+                    OUTPUT_VARIABLE VALA_VERSION
+                    OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
+endif(VALA_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
+# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
+# VALA_EXECUTABLE is set)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Vala
+    REQUIRED_VARS VALA_EXECUTABLE
+    VERSION_VAR VALA_VERSION)
+
+set(VALA_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVala.cmake")
+
diff --git a/cmake/FindXMLLint.cmake b/cmake/FindXMLLint.cmake
new file mode 100644
index 0000000..120f3ce
--- /dev/null
+++ b/cmake/FindXMLLint.cmake
@@ -0,0 +1,9 @@
+find_program(XMLLINT_EXECUTABLE xmllint DOC "XML validation tool")
+mark_as_advanced(XMLLINT_EXECUTABLE)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+    XMLLINT 
+    DEFAULT_MSG 
+    XMLLINT_EXECUTABLE
+)
diff --git a/cmake/UseVala.cmake b/cmake/UseVala.cmake
new file mode 100644
index 0000000..ead9652
--- /dev/null
+++ b/cmake/UseVala.cmake
@@ -0,0 +1,192 @@
+##
+# Compile vala files to their c equivalents for further processing. 
+#
+# The "vala_precompile" function takes care of calling the valac executable on
+# the given source to produce c files which can then be processed further using
+# default cmake functions.
+#
+# The first parameter provided is a variable, which will be filled with a list
+# of c files outputted by the vala compiler. This list can than be used in
+# conjuction with functions like "add_executable" or others to create the
+# neccessary compile rules with CMake.
+#
+# The following sections may be specified afterwards to provide certain options
+# to the vala compiler:
+#
+# SOURCES
+#   A list of .vala files to be compiled. Please take care to add every vala
+#   file belonging to the currently compiled project or library as Vala will
+#   otherwise not be able to resolve all dependencies.
+#
+# PACKAGES
+#   A list of vala packages/libraries to be used during the compile cycle. The
+#   package names are exactly the same, as they would be passed to the valac
+#   "--pkg=" option.
+#
+# OPTIONS
+#   A list of optional options to be passed to the valac executable. This can be
+#   used to pass "--thread" for example to enable multi-threading support.
+#
+# DEFINITIONS
+#   A list of symbols to be used for conditional compilation. They are the same
+#   as they would be passed using the valac "--define=" option.
+#
+# CUSTOM_VAPIS
+#   A list of custom vapi files to be included for compilation. This can be
+#   useful to include freshly created vala libraries without having to install
+#   them in the system.
+#
+# GENERATE_VAPI
+#   Pass all the needed flags to the compiler to create a vapi for
+#   the compiled library. The provided name will be used for this and a
+#   <provided_name>.vapi file will be created.
+#
+# GENERATE_HEADER
+#   Let the compiler generate a header file for the compiled code. There will
+#   be a header file as well as an internal header file being generated called
+#   <provided_name>.h and <provided_name>_internal.h
+#
+# The following call is a simple example to the vala_precompile macro showing
+# an example to every of the optional sections:
+#
+#   find_package(Vala "0.12" REQUIRED)
+#   include(${VALA_USE_FILE})
+#
+#   vala_precompile(VALA_C
+#     SOURCES
+#       source1.vala
+#       source2.vala
+#       source3.vala
+#     PACKAGES
+#       gtk+-2.0
+#       gio-1.0
+#       posix
+#     DIRECTORY
+#       gen
+#     OPTIONS
+#       --thread
+#     CUSTOM_VAPIS
+#       some_vapi.vapi
+#     GENERATE_VAPI
+#       myvapi
+#     GENERATE_HEADER
+#       myheader
+#     )
+#
+# Most important is the variable VALA_C which will contain all the generated c
+# file names after the call.
+##
+
+##
+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
+# Copyright 2010-2011 Daniel Pfeifer
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+#    1. Redistributions of source code must retain the above copyright notice,
+#       this list of conditions and the following disclaimer.
+# 
+#    2. Redistributions in binary form must reproduce the above copyright notice,
+#       this list of conditions and the following disclaimer in the documentation
+#       and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 
+# The views and conclusions contained in the software and documentation are those
+# of the authors and should not be interpreted as representing official policies,
+# either expressed or implied, of Jakob Westhoff
+##
+
+include(CMakeParseArguments)
+
+function(vala_precompile output)
+    cmake_parse_arguments(ARGS "" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI"
+        "SOURCES;PACKAGES;OPTIONS;DEFINITIONS;CUSTOM_VAPIS" ${ARGN})
+
+    if(ARGS_DIRECTORY)
+               get_filename_component(DIRECTORY ${ARGS_DIRECTORY} ABSOLUTE)
+    else(ARGS_DIRECTORY)
+        set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+    endif(ARGS_DIRECTORY)
+    include_directories(${DIRECTORY})
+
+    set(vala_pkg_opts "")
+    foreach(pkg ${ARGS_PACKAGES})
+        list(APPEND vala_pkg_opts "--pkg=${pkg}")
+    endforeach(pkg ${ARGS_PACKAGES})
+
+    set(vala_define_opts "")
+    foreach(def ${ARGS_DEFINTIONS})
+        list(APPEND vala_define_opts "--define=${def}")
+    endforeach(def ${ARGS_DEFINTIONS})
+
+    set(in_files "")
+    set(out_files "")
+    foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
+        list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
+        string(REPLACE ".vala" ".c" src ${src})
+        string(REPLACE ".gs" ".c" src ${src})
+        set(out_file "${DIRECTORY}/${src}")
+        list(APPEND out_files "${DIRECTORY}/${src}")
+    endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
+
+    set(custom_vapi_arguments "")
+    if(ARGS_CUSTOM_VAPIS)
+        foreach(vapi ${ARGS_CUSTOM_VAPIS})
+            if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
+                list(APPEND custom_vapi_arguments ${vapi})
+            else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
+                list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
+            endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
+        endforeach(vapi ${ARGS_CUSTOM_VAPIS})
+    endif(ARGS_CUSTOM_VAPIS)
+
+    set(vapi_arguments "")
+    if(ARGS_GENERATE_VAPI)
+        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
+        set(vapi_arguments "--vapi=${ARGS_GENERATE_VAPI}.vapi")
+
+        # Header and internal header is needed to generate internal vapi
+        if (NOT ARGS_GENERATE_HEADER)
+            set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
+        endif(NOT ARGS_GENERATE_HEADER)
+    endif(ARGS_GENERATE_VAPI)
+
+    set(header_arguments "")
+    if(ARGS_GENERATE_HEADER)
+        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
+        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
+        list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
+        list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
+    endif(ARGS_GENERATE_HEADER)
+
+    add_custom_command(OUTPUT ${out_files} 
+    COMMAND 
+        ${VALA_EXECUTABLE} 
+    ARGS 
+        "-C" 
+        ${header_arguments} 
+        ${vapi_arguments}
+        "-b" ${CMAKE_CURRENT_SOURCE_DIR} 
+        "-d" ${DIRECTORY} 
+        ${vala_pkg_opts} 
+        ${vala_define_opts}
+        ${ARGS_OPTIONS} 
+        ${in_files} 
+        ${custom_vapi_arguments}
+    DEPENDS 
+        ${in_files} 
+        ${ARGS_CUSTOM_VAPIS}
+    )
+    set(${output} ${out_files} PARENT_SCOPE)
+endfunction(vala_precompile)
diff --git a/glade/gtkmusic-catalog.xml b/glade/gtkmusic-catalog.xml
index dcde2bd..916b60a 100644
--- a/glade/gtkmusic-catalog.xml
+++ b/glade/gtkmusic-catalog.xml
@@ -1,9 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<glade-catalog name="gtkmusic" library="gtkmusic-0.2">
+<glade-catalog name="gtkmusic" library="gtkmusic">
 <glade-widget-classes>
 <glade-widget-class name="GtkMusicGuitar" generic-name="guitar" title="Guitar"
                     default-height="60" default-width="170">
     <post-create-function>gtk_music_guitar_new</post-create-function>
+        <packing-defaults>
+          <parent-class name="GtkDrawingArea">
+            <child-property id="expand" default="true"/>
+          </parent-class>
+        </packing-defaults>
 </glade-widget-class>
                     <!--parent="GtkDrawingArea" />-->
 <glade-widget-class name="GtkMusicPiano" generic-name="piano" title="Piano"
diff --git a/gtkmusic.pc.in b/gtkmusic.pc.in
new file mode 100644
index 0000000..5fe3aab
--- /dev/null
+++ b/gtkmusic.pc.in
@@ -0,0 +1,13 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@/bin
+libdir=@CMAKE_INSTALL_PREFIX@/lib
+includedir=@CMAKE_INSTALL_PREFIX@/include
+datarootdir=@CMAKE_INSTALL_PREFIX@/share
+datadir=${datarootdir}
+
+Name: libgtkmusic
+Description: Gtk musical widgets collection
+Version: @VERSION_STRING@
+Requires: glib-2.0 gobject-2.0 gtk+-3.0 gee-0.8
+Libs: -L${libdir} -lgtkmusic-@VERSION_STRING@
+Cflags: -I${includedir}/gtkmusic-@VERSION_STRING@
diff --git a/src/MusicalNotes.vala b/src/MusicalNotes.vala
index 4e08ba7..66eae3b 100644
--- a/src/MusicalNotes.vala
+++ b/src/MusicalNotes.vala
@@ -109,7 +109,7 @@ public class MusicalNotes {
     * @param note The note in scientific notation (with octave)
     * @return The associated MIDI code
     **/
-    public static ushort get_note_as_midi_code(string note) 
+    public static short get_note_as_midi_code(string note) 
            throws MusicalNoteError {
         //Number components
         short high = -1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]