Commits

Anonymous committed f2db102

p2_mp4h builds now! Don't know how correctly, though. But it builds.
Made a lot of changes to get it to this state. Partly thanks to am2cmake:

http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ .

  • Participants
  • Parent commits 4c20171
  • Branches conversion-to-cmake

Comments (0)

Files changed (7)

File src/wml_backend/p2_mp4h/CMakeLists.txt

 # see - http://www.cmake.org/Wiki/CMake_FAQ#Is_there_an_option_to_produce_more_.27verbose.27_compiling.3F
 SET(CMAKE_VERBOSE_MAKEFILE ON)
 
-include(CheckIncludeFile)
-include(CheckIncludeFiles)
-include(CheckFunctionExists)
-
+include("${CMAKE_CURRENT_SOURCE_DIR}/Common.cmake")
 SUBDIRS (
+    lib
     src
 )
 
 
 CHECK_FUNCTION_EXISTS(tmpfile HAVE_TMPFILE)
 CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
+CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
+CHECK_FUNCTION_EXISTS(strerror HAVE_VPRINTF)
 
 SET (VERSION ${PACKAGE_VERSION})
 SET (PACKAGE_NAME ${PACKAGE})

File src/wml_backend/p2_mp4h/Common.cmake

+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+include(CheckFunctionExists)
+
+# Taken from http://www.cmake.org/pipermail/cmake/2007-March/013060.html
+MACRO(REPLACE_FUNCTIONS sources)
+  FOREACH(name ${ARGN})
+    STRING(TOUPPER have_${name} SYMBOL_NAME)
+    CHECK_FUNCTION_EXISTS(${name} ${SYMBOL_NAME})
+    IF(NOT ${SYMBOL_NAME})
+      SET(${sources} ${${sources}} ${name}.c)
+    ENDIF(NOT ${SYMBOL_NAME})
+  ENDFOREACH(name)
+ENDMACRO(REPLACE_FUNCTIONS)
+

File src/wml_backend/p2_mp4h/config.h.cmake

 #undef HAVE_STRDUP
 
 /* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
+#cmakedefine HAVE_STRERROR 1
 
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 #undef HAVE_UNSIGNED_LONG_LONG
 
 /* Define to 1 if you have the `vprintf' function. */
-#undef HAVE_VPRINTF
+#cmakedefine HAVE_VPRINTF
 
 /* Define to 1 if you have the `xmalloc' function. */
 #undef HAVE_XMALLOC

File src/wml_backend/p2_mp4h/lib/CMakeLists.txt

+SET(CMAKE_VERBOSE_MAKEFILE ON)
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
+########### next target ###############
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/../Common.cmake")
+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/..)
+REPLACE_FUNCTIONS(LIB_SOURCES strtol obstack xmalloc xstrdup)
+SET(mp4h_STAT_SRCS
+   error.c
+   ${LIB_SOURCES}
+   )
+
+ADD_LIBRARY(mp4h_lib STATIC ${mp4h_STAT_SRCS})
+
+
+########### install files ###############
+
+
+
+
+#original Makefile.am contents follow:
+
+#
+#INCLUDES = @INTLINCL@
+#
+#noinst_LIBRARIES  = libmp4h.a
+#
+#libmp4h_a_SOURCES = error.c
+#libmp4h_a_LIBADD  = @LIBOBJS@
+#noinst_HEADERS    = error.h getopt.h obstack.h
+#

File src/wml_backend/p2_mp4h/lib/error.c

 
 #include <stdio.h>
 
-#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
+#if defined(HAVE_VPRINTF) || defined(HAVE_DOPRNT) || defined(_LIBC)
 # ifdef HAVE_STDARG_H
 #  include <stdarg.h>
 #  define VA_START(args, lastarg) va_start(args, lastarg)
 
 #ifdef VA_START
   VA_START (args, message);
-# if HAVE_VPRINTF || _LIBC
+# if defined(HAVE_VPRINTF) || defined(_LIBC)
   vfprintf (stderr, message, args);
 # else
   _doprnt (message, args, stderr);
 
 #ifdef VA_START
   VA_START (args, message);
-# if HAVE_VPRINTF || _LIBC
+# if defined(HAVE_VPRINTF) || defined(_LIBC)
   vfprintf (stderr, message, args);
 # else
   _doprnt (message, args, stderr);

File src/wml_backend/p2_mp4h/lib/xmalloc.c

    The caller may set it to some other value.  */
 int xmalloc_exit_failure = EXIT_FAILURE;
 
-#if defined(HAVE_STDARG_H) && (HAVE_VPRINTF || HAVE_DOPRNT)
+#if defined(HAVE_STDARG_H) && (defined(HAVE_VPRINTF) || defined(HAVE_DOPRNT))
 void error (int, int, const char *, ...);
 #else
 void error ();

File src/wml_backend/p2_mp4h/src/CMakeLists.txt

-# see - http://www.cmake.org/Wiki/CMake_FAQ#Is_there_an_option_to_produce_more_.27verbose.27_compiling.3F
 SET(CMAKE_VERBOSE_MAKEFILE ON)
 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
-INCLUDE_DIRECTORIES( ".." )
-ADD_EXECUTABLE (mp4h 
-    builtin.c debug.c devel.c freeze.c input.c
-    macro.c mp4h.c output.c path.c symtab.c
-    )
+
+# TODO - replace ".." by the fully qualified path.
+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../pcre ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../lib ${CMAKE_CURRENT_SOURCE_DIR})
+
+
+########### next target ###############
+
+SET(mp4h_SRCS
+   builtin.c
+   debug.c
+   devel.c
+   freeze.c
+   input.c
+   macro.c
+   mp4h.c
+   output.c
+   path.c
+   symtab.c
+   )
+
+ADD_EXECUTABLE(mp4h ${mp4h_SRCS})
+
+TARGET_LINK_LIBRARIES(mp4h m mp4h_lib pcre )
+
+INSTALL( TARGETS mp4h DESTINATION bin)