Skip to content

Commit

Permalink
add step to compile all headers
Browse files Browse the repository at this point in the history
  • Loading branch information
benedekkupper committed Nov 16, 2023
1 parent d617bdf commit 6de20da
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Initialize Git submodules
run: git submodule update --init --recursive

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Expand Down
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.14)

project(hid-rp LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

include(GNUInstallDirs)

find_package(Python 3 REQUIRED)
Expand Down Expand Up @@ -29,3 +33,20 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${INCLUDES}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

# generate a source file and build it to verify syntax
file(GLOB_RECURSE HEADER_FILES "${INCLUDES}/*.hpp")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/compilation_test.cpp" "")
foreach(HEADER_FILE ${HEADER_FILES})
file(RELATIVE_PATH FILE_RELATIVE_PATH
${INCLUDES} ${HEADER_FILE}
)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/compilation_test.cpp"
"#include \"${FILE_RELATIVE_PATH}\"\n"
)
endforeach()
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/compilation_test.cpp"
"\nint main() { return 0; }\n"
)
add_executable(${PROJECT_NAME}-verify ${CMAKE_CURRENT_BINARY_DIR}/compilation_test.cpp)
target_link_libraries(${PROJECT_NAME}-verify ${PROJECT_NAME})
2 changes: 1 addition & 1 deletion hid-rp/hid/rdf/descriptor_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define __HID_RDF_DESCRIPTOR_VIEW_HPP_

#include <iterator>

#include <span>
#include "hid/rdf/item.hpp"

namespace hid::rdf
Expand Down
1 change: 0 additions & 1 deletion hid-rp/hid/rdf/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#ifndef __HID_RDF_PARSER_HPP_
#define __HID_RDF_PARSER_HPP_

#include <span>
#include "hid/usage.hpp"
#include "hid/rdf/descriptor_view.hpp"

Expand Down

0 comments on commit 6de20da

Please sign in to comment.