3 Commits

Author SHA1 Message Date
f964ef7b60 fix stuff 2025-07-31 20:50:39 +02:00
dd05449f36 Remove man page generation without version 2025-07-31 20:37:05 +02:00
3ff626134e Allow build without git 2025-07-31 20:28:18 +02:00
6 changed files with 26 additions and 33 deletions

3
.gitmodules vendored
View File

@@ -4,6 +4,3 @@
[submodule "linklist-lib"]
path = linklist-lib
url = https://git.shimatta.de/mhu/linklist-lib.git
[submodule "test/catch2"]
path = test/catch2
url = https://git.shimatta.de/3rd-party/catch2.git

View File

@@ -28,12 +28,23 @@ pkg_check_modules(ELF REQUIRED libelf)
find_package(Doxygen)
find_package(LibXml2 REQUIRED)
add_subdirectory(man)
aux_source_directory("src" CFILES)
set(GEN_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/include/generated")
if (DEFINED NO_VERSION_INFO)
add_custom_target(
version-header
COMMAND
mkdir -p ${GEN_HEADER_PATH} && bash "${CMAKE_CURRENT_SOURCE_DIR}/gen_version_header.sh" "${GEN_HEADER_PATH}/version.h" "dummy"
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating version header dummy"
)
set (NO_VERSION_INFO true)
message("${BoldMagenta}No Version Information will be built${ColorReset}")
else(DEFINED NO_VERSION_INFO)
add_custom_target(
version-header
COMMAND
@@ -42,6 +53,8 @@ add_custom_target(
${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating version header"
)
add_subdirectory(man)
endif(DEFINED NO_VERSION_INFO)
add_custom_target(schema-header DEPENDS "${GEN_HEADER_PATH}/schema-blob.h")
add_custom_command(
@@ -66,9 +79,10 @@ target_link_directories(${PROJECT_NAME} PRIVATE ${ELF_LIBRARY_DIRS} ${LIBXML2_LI
target_include_directories(${PROJECT_NAME} PRIVATE ${ELF_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/include")
target_include_directories(${PROJECT_NAME} PRIVATE "include")
add_dependencies(${PROJECT_NAME} version-header schema-header)
add_dependencies(${PROJECT_NAME} schema-header)
add_dependencies(${PROJECT_NAME} version-header)
if (DOXYGEN_FOUND)
if (DOXYGEN_FOUND AND (NOT (DEFINED NO_VERSION_INFO)))
set(DOXYFILE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in")
set(DOXYFILE_DEST "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
configure_file(${DOXYFILE_SRC} ${DOXYFILE_DEST} @ONLY)
@@ -87,9 +101,7 @@ if (DOXYGEN_FOUND)
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
else (DOXYGEN_FOUND)
else (DOXYGEN_FOUND AND (NOT (DEFINED NO_VERSION_INFO)))
message("${BoldMagenta}Doxygen needs to be installed to generate the doxygen documentation${ColorReset}")
message("${BoldMagenta}doxygen target will not be available${ColorReset}")
endif (DOXYGEN_FOUND)
add_subdirectory(test)
endif (DOXYGEN_FOUND AND (NOT (DEFINED NO_VERSION_INFO)))

View File

@@ -1,9 +0,0 @@
#!/bin/bash
function _patchelfcrc() {
echo "Cursor index: $COMP_CWORD"
echo "line as array: $COMP_WORDS"
echo "line as string: $COMP_LINE"
}
complete -F _patchelfcrc patchelfcrc

View File

@@ -4,7 +4,12 @@ if [[ -z $1 ]]; then
exit -1;
fi
ver=`git describe --tags --always --dirty`
if [[ "$2" == "dummy" ]]; then
ver="v0.0.0-undefined"
else
ver=`git describe --tags --always --dirty`
fi
echo "#ifndef _VERSION_GENERATED_H_" > $1
echo "#define _VERSION_GENERATED_H_" >> $1
echo "#define GIT_VERSION_STRING \"$ver\"" >> $1

View File

@@ -1,11 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(patchelfcrc-test LANGUAGES CXX C)
add_subdirectory(catch2 EXCLUDE_FROM_ALL)
add_custom_target(test "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}" "-r compact" "-s" DEPENDS ${PROJECT_NAME})
aux_source_directory("src" TEST_SOURCES)
set(DUT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../src/crc.c)
add_executable(${PROJECT_NAME} EXCLUDE_FROM_ALL ${TEST_SOURCES} ${DUT_SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2WithMain)

Submodule test/catch2 deleted from 0631b607ee