Skip to content

Commit

Permalink
[#2] Moved INI parser to initools submodule
Browse files Browse the repository at this point in the history
Signed-off-by: Clovis Durand <cd.clovel19@gmail.com>
  • Loading branch information
Clovel committed Mar 4, 2020
1 parent 0cc168a commit e67cc64
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 1,116 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "generator/deps/initools"]
path = generator/deps/initools
url = https://github.com/Clovel/initools.git
36 changes: 18 additions & 18 deletions generator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_PROJECT_BRIEF "OSCO Object Disctionary generator")

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/dest CACHE PATH "" FORCE)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/dest CACHE PATH "" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

# Allow CTest
Expand All @@ -68,17 +68,14 @@ option(ENABLE_DOCS "Build API documentation" ${DOXYGEN_FOUND})
# pkg-config dependencies
#------------------------------------------------------------------------------

set(ENV{PKG_CONFIG_PATH} "ENV{PKG_CONFIG_PATH}:${PKG_CONFIG_PATH}")
message(STATUS "Pkgconfig extra path are: $ENV{PKG_CONFIG_PATH}")

#------------------------------------------------------------------------------
# Project version
#------------------------------------------------------------------------------

# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Expand Down Expand Up @@ -113,12 +110,12 @@ find_package(PkgConfig REQUIRED)
if(PKG_CONFIG_FOUND)
# Produce a pkg-config file
configure_file (
${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc.in
${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc.in
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc
@ONLY
)
install (
FILES ${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc
DESTINATION lib/pkgconfig
)
endif(PKG_CONFIG_FOUND)
Expand All @@ -127,8 +124,11 @@ endif(PKG_CONFIG_FOUND)
# Project configuration
#------------------------------------------------------------------------------

include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_SOURCE_DIR}/inc)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}/deps/initools/inc
)

#------------------------------------------------------------------------------
# Sub-directories
Expand Down Expand Up @@ -160,17 +160,17 @@ endif (ENABLE_DOCS)
#------------------------------------------------------------------------------

set(COVERITY_FILES
" ${CMAKE_SOURCE_DIR}/build-coverity/output/summary.txt"
" ${CMAKE_CURRENT_SOURCE_DIR}/build-coverity/output/summary.txt"
)

add_custom_command(OUTPUT ${COVERITY_FILES}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR} mkdir -p build-coverity
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR} cov-configure --gcc
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR} cov-build --dir build-coverity make -j $(nproc)
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR} cov-analyze --dir build-coverity --all --aggressiveness-level low --misra-config MISRA_c2012_MM.config
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR} cov-commit-defects --dir build-coverity --host coverity3.freescale.net --user committer --password CoverityGuest --stream lib${PROJECT_NAME}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} mkdir -p build-coverity
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} cov-configure --gcc
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} cov-build --dir build-coverity make -j $(nproc)
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} cov-analyze --dir build-coverity --all --aggressiveness-level low --misra-config MISRA_c2012_MM.config
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} cov-commit-defects --dir build-coverity --host coverity3.freescale.net --user committer --password CoverityGuest --stream lib${PROJECT_NAME}
COMMAND ${CMAKE_COMMAND} -E touch ${COVERITY_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "run coverity"
)
add_custom_target(coverity DEPENDS ${COVERITY_FILES})
add_custom_target(${CMAKE_PROJECT_NAME}-coverity DEPENDS ${COVERITY_FILES})
3 changes: 3 additions & 0 deletions generator/deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
# Copyright (C) 2020 Clovis Durand
#
# -----------------------------------------------------------------------------

# Sub-directories -----------------------------------------
add_subdirectory(initools)
1 change: 1 addition & 0 deletions generator/deps/initools
Submodule initools added at 10fa27
2 changes: 1 addition & 1 deletion generator/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(DOXYGEN_FOUND)
message("Doxygen build started")

# note the option ALL which allows to build the docs together with the application
add_custom_target(doc_doxygen ALL
add_custom_target(${CMAKE_PROJECT_NAME}-doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs
COMMENT "Generating API documentation with Doxygen"
Expand Down
18 changes: 12 additions & 6 deletions generator/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

# Header files --------------------------------------------
file(GLOB PUBLIC_HEADERS
${CMAKE_SOURCE_DIR}/inc/*.h
${CMAKE_SOURCE_DIR}/inc/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../inc/*.h
${CMAKE_CURRENT_SOURCE_DIR}/../inc/*.hpp
)

file(GLOB_RECURSE MODULE_HEADERS
${CMAKE_SOURCE_DIR}/src/*.h
${CMAKE_SOURCE_DIR}/src/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
)

set(HEADERS
Expand All @@ -21,8 +21,8 @@ set(HEADERS

# Source files --------------------------------------------
file(GLOB SOURCES
${CMAKE_SOURCE_DIR}/src/*.c
${CMAKE_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.c
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
)

message("MAIN SOURCES : ${SOURCES}")
Expand All @@ -33,6 +33,12 @@ message("MAIN SOURCES : ${SOURCES}")
add_executable(${CMAKE_PROJECT_NAME}
${SOURCES}
)
add_dependencies(${CMAKE_PROJECT_NAME}
initools
)
target_link_libraries(${CMAKE_PROJECT_NAME}
initools
)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
PUBLIC_HEADER "${PUBLIC_HEADERS}"
)
Expand Down
Loading

0 comments on commit e67cc64

Please sign in to comment.