avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcrea...@apache.org
Subject svn commit: r1129697 - in /avro/trunk/lang/c: CMakeLists.txt docs/CMakeLists.txt
Date Tue, 31 May 2011 14:28:18 GMT
Author: dcreager
Date: Tue May 31 14:28:18 2011
New Revision: 1129697

URL: http://svn.apache.org/viewvc?rev=1129697&view=rev
Log:
AVRO-470. Generate docs in CMake build scripts

The CMake build scripts now use asciidoc to generate the documentation,
just like the automake scripts do.  You need the asciidoc and
source-highlight packages installed; if they're not both available, then
we skip the documentation when building.

[via Daniel Lundin]

Added:
    avro/trunk/lang/c/docs/CMakeLists.txt
Modified:
    avro/trunk/lang/c/CMakeLists.txt

Modified: avro/trunk/lang/c/CMakeLists.txt
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/CMakeLists.txt?rev=1129697&r1=1129696&r2=1129697&view=diff
==============================================================================
--- avro/trunk/lang/c/CMakeLists.txt (original)
+++ avro/trunk/lang/c/CMakeLists.txt Tue May 31 14:28:18 2011
@@ -19,7 +19,28 @@
 cmake_minimum_required(VERSION 2.4)
 project(AvroC)
 enable_testing()
-file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../share/VERSION.txt" AVRO_VERSION)
+
+#-----------------------------------------------------------------------
+# Retrieve the current version number
+
+execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/version.sh project
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    RESULT_VARIABLE AVRO_VERSION_RESULT
+    OUTPUT_VARIABLE AVRO_VERSION
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+if(AVRO_VERSION_RESULT)
+    message(FATAL_ERROR "Cannot determine Avro version number")
+endif(AVRO_VERSION_RESULT)
+
+execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/version.sh libtool
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    RESULT_VARIABLE LIBAVRO_VERSION_RESULT
+    OUTPUT_VARIABLE LIBAVRO_VERSION
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+if(LIBAVRO_VERSION_RESULT)
+    message(FATAL_ERROR "Cannot determine libavro version number")
+endif(LIBAVRO_VERSION_RESULT)
+
 
 if(APPLE)
     set(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac
OS X" FORCE) 
@@ -35,6 +56,7 @@ include_directories(${AvroC_SOURCE_DIR}/
 add_subdirectory(src)
 add_subdirectory(examples)
 add_subdirectory(tests)
+add_subdirectory(docs)
 
 add_custom_target(pretty
     "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake_pretty.cmake")

Added: avro/trunk/lang/c/docs/CMakeLists.txt
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/docs/CMakeLists.txt?rev=1129697&view=auto
==============================================================================
--- avro/trunk/lang/c/docs/CMakeLists.txt (added)
+++ avro/trunk/lang/c/docs/CMakeLists.txt Tue May 31 14:28:18 2011
@@ -0,0 +1,51 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+set (AVRO_DOC_SRC
+    index.txt
+)
+
+# TODO(dln): Use FindAsciidoc script instead.
+message(STATUS "Searching for asciidoc...")
+find_program(ASCIIDOC_EXECUTABLE asciidoc)
+find_program(SOURCE_HIGHLIGHT_EXECUTABLE source-highlight)
+
+if (ASCIIDOC_EXECUTABLE AND SOURCE_HIGHLIGHT_EXECUTABLE)
+    foreach(_file ${AVRO_DOC_SRC})
+        get_filename_component(_file_we ${_file} NAME_WE)
+        set(_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
+        set(_html_out "${_file_we}.html")
+        add_custom_command(
+            OUTPUT "${_html_out}"
+            COMMAND ${ASCIIDOC_EXECUTABLE}
+                -a avro_version=${AVRO_VERSION}
+                -a libavro_version=${LIBAVRO_VERSION}
+                -a toc
+                --unsafe -n -o "${_html_out}" "${_file_path}"
+            DEPENDS "${_file_path}"
+            COMMENT "asciidoc ${_file}"
+            )
+        add_custom_target("${_file_we}_html" ALL echo -n
+            DEPENDS "${_file}" "${_html_out}"
+        )
+    endforeach(_file)
+else(ASCIIDOC_EXECUTABLE AND SOURCE_HIGHLIGHT_EXECUTABLE)
+    message(WARNING "asciidoc not found. HTML documentation will *NOT* be built.")
+endif(ASCIIDOC_EXECUTABLE AND SOURCE_HIGHLIGHT_EXECUTABLE)
+



Mime
View raw message