From 10b2fe0f27b04fc854821452226bce44d046ff4e Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 14 Apr 2014 12:54:03 -0700 Subject: [PATCH] Implement packaging. --- .gitignore | 21 +++++++++++++-------- CMakeLists.txt | 23 +++++++++++++++++++++++ doc/CMakeLists.txt | 4 ++-- doc/{conf.py => conf.py.in} | 2 +- 4 files changed, 39 insertions(+), 11 deletions(-) rename doc/{conf.py => conf.py.in} (99%) diff --git a/.gitignore b/.gitignore index 4bf352d4..a6ef1d86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,16 @@ +/_CPack_Packages +/doc/conf.py +/doc/doxyxml +/doc/html +/Testing +/*.cmake +/format-test +/install_manifest.txt +/tinyformat_speed_test +*~ +*.a +*.zip +cmake_install.cmake CMakeCache.txt CMakeFiles -cmake_install.cmake Makefile -/CTestTestfile.cmake -/doc/doxyxml -/format_test -/html -/libformat.a -/Testing -*~ diff --git a/CMakeLists.txt b/CMakeLists.txt index f225d926..56c89494 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,3 +135,26 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/format-benchmark/tinyformat_test.cpp) WORKING_DIRECTORY tinyformat DEPENDS format) endif () + +if (EXISTS .gitignore) + # Get the list of ignored files from .gitignore. + file (STRINGS ".gitignore" lines) + LIST(REMOVE_ITEM lines /doc/html) + foreach (line ${lines}) + string(REPLACE "*" ".*" line "${line}") + set(ignored_files ${ignored_files} "${line}$" "${line}/") + endforeach () + set(ignored_files ${ignored_files} /.git /breathe /format-benchmark /gtest) + + set(CPACK_SOURCE_GENERATOR ZIP) + set(CPACK_SOURCE_IGNORE_FILES ${ignored_files}) + set(CPACK_PACKAGE_VERSION_MAJOR 0) + set(CPACK_PACKAGE_VERSION_MINOR 8) + set(CPACK_PACKAGE_VERSION_PATCH 0) + set(CPACK_SOURCE_PACKAGE_FILE_NAME + format-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-src) + set(CPACK_RESOURCE_FILE_README ${FORMAT_SOURCE_DIR}/README.rst) + include(CPack) +endif () + +configure_file(doc/conf.py.in doc/conf.py @ONLY) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 97b4b08f..f7e3d301 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,6 +1,6 @@ add_custom_command(OUTPUT html/index.html COMMAND doxygen - COMMAND rm -rf ../html - COMMAND sphinx-build -b html . ../html + COMMAND rm -rf html + COMMAND sphinx-build -b html . html DEPENDS conf.py index.rst) add_custom_target(doc DEPENDS html/index.html) diff --git a/doc/conf.py b/doc/conf.py.in similarity index 99% rename from doc/conf.py rename to doc/conf.py.in index a95df058..4e504650 100644 --- a/doc/conf.py +++ b/doc/conf.py.in @@ -54,7 +54,7 @@ copyright = u'1990-2012, Python Software Foundation' # built documents. # # The short X.Y version. -version = '0.8' +version = '@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@' # The full version, including alpha/beta/rc tags. release = version