From e08640e979f472af054503037f517e701f33802a Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 24 Oct 2015 19:17:17 +0300 Subject: [PATCH] Config added. --- CMakeLists.txt | 2 +- cmake/backbone | 2 +- config/CMakeLists.txt | 2 ++ config/Config.vapi | 6 ++++++ config/config.h.in | 3 +++ src/CMakeLists.txt | 4 +++- src/GtkBuilderTest.vala | 2 +- ui/CMakeLists.txt | 2 +- ui/glade/CMakeLists.txt | 1 + 9 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 config/CMakeLists.txt create mode 100644 config/Config.vapi create mode 100644 config/config.h.in create mode 100644 ui/glade/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1639ee7..25cdf6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ SET (PATCH 0) LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone) -#ADD_SUBDIRECTORY (config) +ADD_SUBDIRECTORY (config) ADD_SUBDIRECTORY (src) ADD_SUBDIRECTORY (pkg-config) ADD_SUBDIRECTORY (po) diff --git a/cmake/backbone b/cmake/backbone index 972b5e5..4b74a70 160000 --- a/cmake/backbone +++ b/cmake/backbone @@ -1 +1 @@ -Subproject commit 972b5e5d882bb590fb5eee248c92cdc13ff19c5f +Subproject commit 4b74a70c2806e160ac2ae1cfe8a960cee8d490d4 diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt new file mode 100644 index 0000000..f5319ad --- /dev/null +++ b/config/CMakeLists.txt @@ -0,0 +1,2 @@ +CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/config.h") diff --git a/config/Config.vapi b/config/Config.vapi new file mode 100644 index 0000000..24a890f --- /dev/null +++ b/config/Config.vapi @@ -0,0 +1,6 @@ +[CCode (cheader_filename = "config.h")] +namespace Config { + static const int VERSION_MAJOR; + static const int VERSION_MINOR; + static const int VERSION_PATCH; +} diff --git a/config/config.h.in b/config/config.h.in new file mode 100644 index 0000000..3c66f33 --- /dev/null +++ b/config/config.h.in @@ -0,0 +1,3 @@ +#define CONFIG_VERSION_MAJOR @MAJOR@ +#define CONFIG_VERSION_MINOR @MINOR@ +#define CONFIG_VERSION_PATCH @PATCH@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20c4a99..66cc3b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,9 @@ -SET (BinName gtkbuilder-test) +SET (BinName gtkbuilder-test-${MAJOR}) FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala) SET (BinPackages gtk+-3.0) SET (BinPkgModules gtk+-3.0) +SET (BinCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi) +INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config") SET (BinInstall ON) IF (WIN32) SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols") diff --git a/src/GtkBuilderTest.vala b/src/GtkBuilderTest.vala index 6994dde..af4d910 100644 --- a/src/GtkBuilderTest.vala +++ b/src/GtkBuilderTest.vala @@ -23,7 +23,7 @@ int main (string[] args) { // Custom location: File exec_file = File.new_for_path (Environment.find_program_in_path (args[0])); string settings_dir = Path.build_path (Path.DIR_SEPARATOR_S, - exec_file.get_parent().get_parent().get_path(), "share/gtkbuilder-test/ui"); + exec_file.get_parent().get_parent().get_path(), "share/gtkbuilder-test-"+Config.VERSION_MAJOR.to_string()+"/ui"); // l18n location: string localedir = Path.build_path (Path.DIR_SEPARATOR_S, exec_file.get_parent().get_parent().get_path(), "share/locale"); diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 6efbf20..fc14716 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1 +1 @@ -INSTALL (FILES glade/gtkbuilder-test.glade DESTINATION "share/gtkbuilder-test/ui") +ADD_SUBDIRECTORY (glade) diff --git a/ui/glade/CMakeLists.txt b/ui/glade/CMakeLists.txt new file mode 100644 index 0000000..e2ccc3b --- /dev/null +++ b/ui/glade/CMakeLists.txt @@ -0,0 +1 @@ +INSTALL (FILES gtkbuilder-test.glade DESTINATION "share/gtkbuilder-test-${MAJOR}/ui")