From 88ef66333439c68264e7065b715252e8c970a116 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Tue, 3 Jul 2018 12:54:17 +0200 Subject: [PATCH] Add CMakeLists.txt to generate source distribution file --- .gitignore | 1 + CMakeLists.txt | 19 +++++++++++++++++++ doc/doxygen/lwip.Doxyfile.cmake.in | 2 +- src/Filelists.cmake | 4 +++- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index cb0ed534..9dda3408 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ /test/fuzz/output /test/fuzz/lwip_fuzz /test/fuzz/.depend +/build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..2f1eaf08 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.7) + +project(lwIP) + +set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +include(src/Filelists.cmake) + +# Package generation +set(CPACK_SOURCE_GENERATOR "ZIP") +set(CPACK_SOURCE_PACKAGE_DESCRIPTION_SUMMARY "lwIP lightweight IP stack") +set(CPACK_PACKAGE_VERSION_MAJOR "${LWIP_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${LWIP_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${LWIP_VERSION_REVISION}") +set(CPACK_SOURCE_IGNORE_FILES "/build/;${CPACK_SOURCE_IGNORE_FILES};.git") +include(CPack) + +# Target for package generation +add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) +add_dependencies(dist lwipdocs) diff --git a/doc/doxygen/lwip.Doxyfile.cmake.in b/doc/doxygen/lwip.Doxyfile.cmake.in index 659decb7..063c2887 100644 --- a/doc/doxygen/lwip.Doxyfile.cmake.in +++ b/doc/doxygen/lwip.Doxyfile.cmake.in @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = output +OUTPUT_DIRECTORY = "${DOXYGEN_OUTPUT_DIR}" # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and diff --git a/src/Filelists.cmake b/src/Filelists.cmake index 19f2648b..98de8fbe 100644 --- a/src/Filelists.cmake +++ b/src/Filelists.cmake @@ -236,6 +236,8 @@ set(lwipallapps_SRCS configure_file(${LWIP_DIR}/src/include/lwip/init.h.cmake.in ${LWIP_DIR}/src/include/lwip/init.h) # Documentation +set(DOXYGEN_DIR ${LWIP_DIR}/doc/doxygen) +set(DOXYGEN_OUTPUT_DIR output) set(DOXYGEN_IN ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile.cmake.in) set(DOXYGEN_OUT ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile) configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT}) @@ -246,7 +248,7 @@ if (DOXYGEN_FOUND) # note the option ALL which allows to build the docs together with the application add_custom_target(lwipdocs EXCLUDE_FROM_ALL COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY ${LWIP_DIR}/doc/doxygen + WORKING_DIRECTORY ${DOXYGEN_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) else (DOXYGEN_FOUND)