From 72456c2679dfbe8ff0e079bb39f72e75a4b01ee7 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Sun, 28 Jun 2009 15:12:16 +0200 Subject: [PATCH] Add cmake infrastructure. --- .gitignore | 1 + CMakeLists.txt | 17 +++++++++++++++++ kaya | 6 +++--- lib/CMakeLists.txt | 5 +++++ lib/ext/CMakeLists.txt | 20 ++++++++++++++++++++ lib/kaya.desktop | 10 ++++++++++ lib/kaya.rb | 9 +++++---- main.rb | 4 ++++ 8 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 lib/CMakeLists.txt create mode 100644 lib/ext/CMakeLists.txt create mode 100644 lib/kaya.desktop create mode 100644 main.rb diff --git a/.gitignore b/.gitignore index 54e43cb..d83a9ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ .#* \#*# +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..25c8bb3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,17 @@ +project(kaya) +cmake_minimum_required(VERSION 2.6) + +find_package(KDE4 REQUIRED) +include(KDE4Defaults) +add_subdirectory(lib) + + +configure_file(main.rb main.rb) + +install(DIRECTORY lib DESTINATION ${DATA_INSTALL_DIR}/kaya + PATTERN "*rc" EXCLUDE + PATTERN "*.desktop" EXCLUDE) +install(FILES ${PROJECT_BINARY_DIR}/main.rb + DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + RENAME kaya) diff --git a/kaya b/kaya index 9c42e3f..42b74c7 100755 --- a/kaya +++ b/kaya @@ -1,4 +1,4 @@ -#!/bin/bash -RUBY=/usr/bin/ruby +#!/usr/bin/env ruby +require 'lib/kaya.rb' -$RUBY lib/kaya.rb $@ +start_kaya if __FILE__ == $0 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..2b0b1e9 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(ext) + +install(FILES kaya.notifyrc DESTINATION ${DATA_INSTALL_DIR}/kaya) +install(FILES kaya.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) +install(FILES kayaui.rc DESTINATION ${DATA_INSTALL_DIR}/kaya) diff --git a/lib/ext/CMakeLists.txt b/lib/ext/CMakeLists.txt new file mode 100644 index 0000000..a56eb71 --- /dev/null +++ b/lib/ext/CMakeLists.txt @@ -0,0 +1,20 @@ +find_package(Qt4 REQUIRED) +find_package(Ruby REQUIRED) + +add_definitions(${QT_DEFINITIONS}) +include_directories(${QT_INCLUDES}) + + +set(src extensions.cpp expblur.cpp) +qt4_wrap_cpp(src extensions.h) +add_library(extensions SHARED ${src}) +set_target_properties(extensions PROPERTIES PREFIX "") + + +message("lib: ${QT_QTGUI_LIBRARY}") +target_link_libraries(extensions ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) + +# install(TARGETS ksimple DESTINATION bin) + + + diff --git a/lib/kaya.desktop b/lib/kaya.desktop new file mode 100644 index 0000000..e3f767f --- /dev/null +++ b/lib/kaya.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Kaya +GenericName=Generic Board Game +Exec=kaya %i %m -caption "%c" +Icon=kaya +Type=Application +DocPath=kaya/kaya.html +Comment=A generic board game application. +Terminal=false diff --git a/lib/kaya.rb b/lib/kaya.rb index e1db3e8..9b3795f 100644 --- a/lib/kaya.rb +++ b/lib/kaya.rb @@ -1,11 +1,12 @@ +#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__)) require 'qtutils' require 'mainwindow' require 'plugins/loader' require 'games/all' -if $0 == __FILE__ - DEFAULT_GAME = :chess +def start_kaya + default_game = :chess app = KDE::Application.init( :version => '0.1', @@ -25,13 +26,13 @@ if $0 == __FILE__ name = args.arg(0) g = Game.get(name.to_sym) unless g - warn "No such game #{name}. Defaulting to #{DEFAULT_GAME}" + warn "No such game #{name}. Defaulting to #{default_game}" nil else g end end - game ||= Game.get(DEFAULT_GAME) + game ||= Game.get(default_game) plugin_loader = PluginLoader.new main = MainWindow.new(plugin_loader, game) diff --git a/main.rb b/main.rb new file mode 100644 index 0000000..c2c5ba1 --- /dev/null +++ b/main.rb @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require '${DATA_INSTALL_DIR}/kaya/lib/kaya.rb' + +start_kaya if __FILE__ == $0 -- 2.11.4.GIT