From 272743bd5a66c7165f31a904a128bda4d0906af3 Mon Sep 17 00:00:00 2001 From: dwk Date: Tue, 10 Jun 2008 22:05:50 -0600 Subject: [PATCH] Created basic CMake files. xuni can now be built with autotools or with CMake. CMake is much faster, though at the moment it only supports libexpat and has no dist target. (Which is pretty much the same as the autotools system.) CMake also has other advantages: for example, it doesn't create libwidget.a and so on. Note that src/test/test.so was renamed to src/test/libtest.so due to the way that CMake creates shared objects. (Perhaps autotools would be able to automatically create this file now.) --- CMakeLists.txt | 5 +++++ gui/data/game.xml | 4 ++-- gui/data/menu.xml | 2 +- gui/data/options.xml | 6 +++--- src/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++++++ src/resource/CMakeLists.txt | 0 src/resource/libexpat.h | 8 ++++++++ src/resource/resource.h | 12 ++++++------ src/widget/CMakeLists.txt | 0 9 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/resource/CMakeLists.txt create mode 100644 src/widget/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..404eb6a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(xuni) + +SET(VERSION 0.3.0) + +ADD_SUBDIRECTORY(src) \ No newline at end of file diff --git a/gui/data/game.xml b/gui/data/game.xml index 3644b6a..15b7a2d 100644 --- a/gui/data/game.xml +++ b/gui/data/game.xml @@ -6,7 +6,7 @@ 100 0 - + game_init game_start game_event @@ -95,7 +95,7 @@ 100 0 - + game_start game_event game_click diff --git a/gui/data/menu.xml b/gui/data/menu.xml index 8db81f7..3c28252 100644 --- a/gui/data/menu.xml +++ b/gui/data/menu.xml @@ -7,7 +7,7 @@ 0 0 - + menu_init menu_start menu_event diff --git a/gui/data/options.xml b/gui/data/options.xml index c44a7f2..8900d21 100644 --- a/gui/data/options.xml +++ b/gui/data/options.xml @@ -6,7 +6,7 @@ 100 0 - + options_init options_start options_event @@ -66,7 +66,7 @@ 100 0 - + options_start options_event options_click @@ -141,7 +141,7 @@ 100 0 - + options_start options_event options_click diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..73ccd9b --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,41 @@ +INCLUDE_DIRECTORIES(/usr/include/SDL . widget) +LINK_DIRECTORIES(.) + +# The xuni library + +SET(LIBRARY_SOURCES + error.c graphics.c gui.c loadso.c loop.c memory.c utility.c xuni.c + resource/calc.c resource/libexpat.c resource/libmxml.c resource/resource.c + resource/xmlwrite.c widget/box.c widget/button.c widget/checkbox.c + widget/combobox.c widget/dump.c widget/font.c widget/image.c + widget/image_tile.c widget/label.c widget/listbox.c widget/panel.c + widget/scrollbar.c widget/textarea.c widget/textbox.c widget/theme.c + widget/widgets.c +) + +ADD_LIBRARY(xuni STATIC ${LIBRARY_SOURCES}) + +# The main xuni test program + +SET(TEST_SOURCES + test/main.c +) + +ADD_EXECUTABLE(../test ${TEST_SOURCES}) +TARGET_LINK_LIBRARIES(../test expat SDL SDL_gfx SDL_image SDL_ttf xuni) + +# The xuni resource editor + +SET(EDITOR_SOURCES + editor/editor.c +) + +ADD_EXECUTABLE(../editor ${EDITOR_SOURCES}) +TARGET_LINK_LIBRARIES(../editor expat SDL SDL_gfx SDL_image SDL_ttf xuni) + +# Subdirectories + +ADD_SUBDIRECTORY(editor) +ADD_SUBDIRECTORY(resource) +ADD_SUBDIRECTORY(test) +ADD_SUBDIRECTORY(widget) diff --git a/src/resource/CMakeLists.txt b/src/resource/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/resource/libexpat.h b/src/resource/libexpat.h index 304212a..2be23ab 100644 --- a/src/resource/libexpat.h +++ b/src/resource/libexpat.h @@ -11,6 +11,14 @@ extern "C" { #endif +#if !1 +struct resource_libexpat_data_t { + struct { + char *before, *after; + } ws; +}; +#endif + #ifdef RESOURCE_LIBRARY_EXPAT void parse_resource_file(struct resource_data_t *resource, diff --git a/src/resource/resource.h b/src/resource/resource.h index 3617908..d113625 100644 --- a/src/resource/resource.h +++ b/src/resource/resource.h @@ -8,8 +8,6 @@ #include /* for BUFSIZ */ #include -#include "../config.h" - #ifdef __cplusplus extern "C" { #endif @@ -102,6 +100,12 @@ const char *lookup_resource_va(struct resource_t *resource, void free_resource_data(struct resource_data_t *data); void free_resource_list(struct resource_list_t *list); +#ifdef __cplusplus +} +#endif + +#include "../config.h" + #ifdef HAVE_LIBEXPAT #define RESOURCE_LIBRARY_EXPAT #include "libexpat.h" @@ -113,8 +117,4 @@ void free_resource_list(struct resource_list_t *list); #error "No resource parsing library specified" #endif -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/widget/CMakeLists.txt b/src/widget/CMakeLists.txt new file mode 100644 index 0000000..e69de29 -- 2.11.4.GIT