From 20b514bd470fad1f499931a3193e2e8955187433 Mon Sep 17 00:00:00 2001 From: Rashad M Date: Sun, 21 Jun 2015 19:12:11 +0200 Subject: tinyxml: use cmake to simply shared and static build --- src/tinyxml-1-cmakelists.patch | 22 ++++++++++++++++++++++ src/tinyxml-test.cpp | 24 ------------------------ src/tinyxml.mk | 24 +++++++----------------- 3 files changed, 29 insertions(+), 41 deletions(-) create mode 100644 src/tinyxml-1-cmakelists.patch delete mode 100644 src/tinyxml-test.cpp diff --git a/src/tinyxml-1-cmakelists.patch b/src/tinyxml-1-cmakelists.patch new file mode 100644 index 0000000..bcaf0d8 --- /dev/null +++ b/src/tinyxml-1-cmakelists.patch @@ -0,0 +1,22 @@ +diff -burN tinyxml.orig/CMakeLists.txt tinyxml/CMakeLists.txt +--- tinyxml.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 ++++ tinyxml/CMakeLists.txt 2015-06-21 19:03:09.878168410 +0200 +@@ -0,0 +1,18 @@ ++cmake_minimum_required(VERSION 2.8) ++ ++file(GLOB SRCS "${CMAKE_SOURCE_DIR}/tiny*.cpp" ) ++ ++include_directories(${CMAKE_SOURCE_DIR}) ++add_definitions(-DTIXML_USE_STL) ++ ++add_library(tinyxml ${SRCS}) ++ ++install(TARGETS tinyxml ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ ++file(GLOB HEADERS "${CMAKE_SOURCE_DIR}/*.h") ++install(FILES ${HEADERS} ++ DESTINATION include ++) diff --git a/src/tinyxml-test.cpp b/src/tinyxml-test.cpp deleted file mode 100644 index 519c51b..0000000 --- a/src/tinyxml-test.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is part of MXE. - * See index.html for further information. - */ - -#include -#include - -int main(int argc, char *argv[]) -{ - if (argc != 2) { - std::cerr << "Usage: tinyxml-test " << std::endl; - return 1; - } - std::string fpn = argv[1]; - - TiXmlDocument doc(fpn); - if (!doc.LoadFile()) { - std::cerr << "failed to load " << fpn << std::endl; - return 1; - } - - return 0; -} diff --git a/src/tinyxml.mk b/src/tinyxml.mk index 842a660..81f58e1 100644 --- a/src/tinyxml.mk +++ b/src/tinyxml.mk @@ -17,25 +17,15 @@ define $(PKG)_UPDATE endef define $(PKG)_BUILD - cd '$(1)' && $(TARGET)-g++ -c -O3 -Wall -Wno-unknown-pragmas -Wno-format -D TIXML_USE_STL tiny*.cpp - $(if $(BUILD_STATIC), - $(TARGET)-ar cr libtinyxml.a *.o - $(TARGET)-ranlib '$(1)/libtinyxml.a' -, -cd '$(1)' && $(TARGET)-g++ -shared -Wl,-soname,libtinyxml.so -o libtinyxml.so *.o -) - - $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib' - $(if $(BUILD_STATIC), - $(INSTALL) -m644 '$(1)'/*.a '$(PREFIX)/$(TARGET)/lib/' -, - $(INSTALL) -m644 '$(1)'/*.so '$(PREFIX)/$(TARGET)/lib/' -) - $(INSTALL) -d '$(PREFIX)/$(TARGET)/include' - $(INSTALL) -m644 '$(1)'/*.h '$(PREFIX)/$(TARGET)/include/' + mkdir '$(1).build' + cd '$(1).build' && cmake \ + -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \ + -DBUILD_SHARED_LIBS=$(if $(BUILD_STATIC),FALSE,TRUE) \ + '$(1)' + $(MAKE) -C '$(1).build' install '$(TARGET)-g++' \ - -W -Wall -D TIXML_USE_STL -ansi -pedantic \ + -Wall -DTIXML_USE_STL -ansi -pedantic \ '$(1)/xmltest.cpp' -o '$(PREFIX)/$(TARGET)/bin/test-tinyxml.exe' \ -ltinyxml endef -- cgit v0.12