[gnome-latex: 34/205] CMake
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 34/205] CMake
- Date: Fri, 14 Dec 2018 10:49:44 +0000 (UTC)
commit ba9ab954275b747ff16feec49294a1d285503867
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Fri Aug 28 23:52:41 2009 +0200
CMake
CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++++++
src/CMakeLists.txt | 7 +++++++
src/Makefile | 18 ------------------
src/callbacks.c | 1 +
src/config.h.cmake | 11 +++++++++++
src/main.c | 3 ++-
src/main.h | 7 -------
7 files changed, 58 insertions(+), 26 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..45a8190
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,37 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+PROJECT(latexila)
+
+# version
+SET(latexila_MAJOR 0)
+SET(latexila_MINOR 0)
+SET(latexila_PATCH 1)
+SET(latexila_VERSION ${latexila_MAJOR}.${latexila_MINOR}.${latexila_PATCH})
+
+MESSAGE(STATUS "*** Building LaTeXila ${latexila_VERSION} ***")
+
+IF(NOT DATA_DIR)
+ SET(DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/latexila" CACHE PATH "The directory where the data is")
+ENDIF(NOT DATA_DIR)
+
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(GTK2 REQUIRED gtk+-2.0 gtksourceview-2.0)
+
+INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS} ${latexila_BINARY_DIR}/src)
+
+SET(CMAKE_C_FLAGS "-Wall -std=c99 -DGTK_DISABLE_DEPRECATED=1")
+
+CONFIGURE_FILE(${latexila_SOURCE_DIR}/src/config.h.cmake ${latexila_BINARY_DIR}/src/config.h)
+
+ADD_SUBDIRECTORY(src)
+
+# packages
+SET(CPACK_GENERATOR "TGZ")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${latexila_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${latexila_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${latexila_PATCH})
+SET(CPACK_SOURCE_GENERATOR "TGZ")
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME latexila-${latexila_VERSION})
+SET(CPACK_SOURCE_IGNORE_FILES "~$" ".gz$")
+
+INCLUDE(CPack)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..5a01c88
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,7 @@
+SET(latexila_src main.c main.h callbacks.c callbacks.h print.c print.h)
+ADD_EXECUTABLE(latexila ${latexila_src})
+TARGET_LINK_LIBRARIES(latexila ${GTK2_LIBRARIES})
+
+INSTALL(TARGETS latexila DESTINATION "bin")
+INSTALL(FILES ui.xml DESTINATION "share/latexila")
+INSTALL(DIRECTORY icons/ DESTINATION "share/latexila/icons")
diff --git a/src/callbacks.c b/src/callbacks.c
index ff13c66..9d9dd63 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -12,6 +12,7 @@
#include <gtksourceview/gtksourceiter.h>
#include "main.h"
+#include "config.h"
#include "callbacks.h"
#include "print.h"
diff --git a/src/config.h.cmake b/src/config.h.cmake
new file mode 100644
index 0000000..88ab7fb
--- /dev/null
+++ b/src/config.h.cmake
@@ -0,0 +1,11 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#define PROGRAM_NAME "LaTeXila"
+#define PROGRAM_VERSION "${latexila_VERSION}"
+
+#define DATA_DIR "${DATA_DIR}"
+
+#define FONT "Monospace"
+
+#endif /* CONFIG_H */
diff --git a/src/main.c b/src/main.c
index 87b41a2..8babfe7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,6 +8,7 @@
#include <gtksourceview/gtksourcelanguagemanager.h>
#include "main.h"
+#include "config.h"
#include "callbacks.h"
#include "print.h"
@@ -191,7 +192,7 @@ main (int argc, char *argv[])
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
// load the xml file
- char *xml_file = "ui.xml";
+ gchar *xml_file = DATA_DIR "/ui.xml";
GError *error = NULL;
gtk_ui_manager_add_ui_from_file (ui_manager, xml_file, &error);
if (error)
diff --git a/src/main.h b/src/main.h
index 062c6c0..2684b6c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -3,13 +3,6 @@
#define _(STRING) gettext(STRING)
-#define PROGRAM_NAME "LaTeXila"
-#define PROGRAM_VERSION "0.0.1"
-
-#define DATA_DIR "/home/seb/dev/latexila/src"
-
-#define FONT "Monospace"
-
// each document opened is represented by a document_t structure
typedef struct
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]