Skip to content

Commit

Permalink
Added support of CMake and CPack
Browse files Browse the repository at this point in the history
Moved `clpp` dir into `include` dir.
Fixed the paths in the Doxyfile.
  • Loading branch information
KOLANICH committed Nov 10, 2021
1 parent 9dbae24 commit 82d3716
Show file tree
Hide file tree
Showing 24 changed files with 99 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[submodule "cmake/thirdParty/Boilerplate"]
path = cmake/thirdParty/Boilerplate
url = https://github.com/KOLANICH-libs/Boilerplate.cmake
branch = master
shallow = true

[submodule "cmake/thirdParty/DoxygenUtils"]
path = cmake/thirdParty/DoxygenUtils
url = https://github.com/KOLANICH-libs/DoxygenUtils.cmake
branch = master
shallow = true
82 changes: 82 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
cmake_minimum_required(VERSION 3.7.2)

set(CMAKE_USE_RELATIVE_PATHS TRUE)
project("clpp")
set("PROJECT_DESCRIPTION" "")
set("PROJECT_HOMEPAGE_URL" "https://github.com/makerbot/clp-parser") # also https://sourceforge.net/project/clp-parser

set(CPACK_PACKAGE_VENDOR "Denis Shevchenko")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

set(OUR_CMAKE_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(OUR_CMAKE_3PARTY_MODULES_DIR "${OUR_CMAKE_MODULES_DIR}/thirdParty")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OUR_CMAKE_MODULES_DIR}" "${OUR_CMAKE_3PARTY_MODULES_DIR}" "${OUR_CMAKE_3PARTY_MODULES_DIR}/Boilerplate" "${OUR_CMAKE_3PARTY_MODULES_DIR}/DoxygenUtils")


include(Boilerplate)
include(DoxygenUtils)

set(BOOST_COMPS "filesystem;regex")

find_package(Boost COMPONENTS ${BOOST_COMPS} REQUIRED)

set(BCS_LINK "")
foreach(bc ${BOOST_COMPS})
set(BCS_LINK "${BCS_LINK};Boost::${bc}")
endforeach()

set(Include_dir "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(Examples_Dir "${CMAKE_CURRENT_SOURCE_DIR}/example")

buildAndPackageLib("${PROJECT_NAME}"
DO_NOT_PASSTHROUGH
TYPE INTERFACE
COMPONENT "lib"
DESCRIPTION "${PROJECT_DESCRIPTION}"
PUBLIC_INCLUDES ${Include_dir}
PUBLIC_LIBS ${BCS_LINK}
)

option(WITH_EXAMPLES "Build examples" OFF)
if(WITH_EXAMPLES)
file(GLOB_RECURSE EXAMPLES "${Examples_Dir}/*.cpp")
foreach(example ${EXAMPLES})
get_filename_component(exampleName "${example}" NAME_WE)
add_executable("${exampleName}" "${example}")
harden("${exampleName}")
add_sanitizers("${exampleName}")
target_include_directories("${exampleName}" PRIVATE "${Include_dir}")
target_link_libraries("${exampleName}" "${PROJECT_NAME}")
endforeach()
endif()

option(WITH_DOCS "Build docs" ON)
if(WITH_DOCS)
find_package(Doxygen REQUIRED dot)

load_doxyfile("${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile")
set(DOXYGEN_PROJECT_BRIEF "${CPACK_PACKAGE_DESCRIPTION}")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${CPACK_RESOURCE_FILE_README}")

set("DOXYGEN_GENERATE_HTML" YES)
set("DOXYGEN_GENERATE_MAN" YES)

set(DOXYGEN_EXAMPLE_PATH "${Examples_Dir}")
set(DOXYGEN_STRIP_FROM_PATH "${Include_dir}/clpp")
set(DOXYGEN_STRIP_FROM_INC_PATH "${Include_dir}/clpp")


file(GLOB_RECURSE HEADERS "${Include_dir}/*.h" "${Include_dir}/*.hxx" "${Include_dir}/*.hpp")
doxygen_add_docs(docs
"${HEADERS}"
ALL
USE_STAMP_FILE
)
endif()

#pass_through_cpack_vars()

include(CPack)
1 change: 1 addition & 0 deletions cmake/thirdParty/Boilerplate
Submodule Boilerplate added at e96387
1 change: 1 addition & 0 deletions cmake/thirdParty/DoxygenUtils
Submodule DoxygenUtils added at ad6b4d
8 changes: 4 additions & 4 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "C++ command line parameters parser"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = /home/denis/Profession/groundworks/cmd_line_params_parser/clp_parser/doc/
OUTPUT_DIRECTORY = ./doc/
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
Expand All @@ -25,7 +25,7 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = /home/denis/
STRIP_FROM_PATH = ./include/
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
Expand Down Expand Up @@ -93,7 +93,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = /home/denis/Profession/groundworks/cmd_line_params_parser/clp_parser/clpp/
INPUT = ./include/
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cpp \
Expand Down Expand Up @@ -136,7 +136,7 @@ HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET = /home/denis/Profession/groundworks/cmd_line_params_parser/clp_parser/doc/own.css
HTML_STYLESHEET = ./doc/own.css
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 82d3716

Please sign in to comment.