Skip to content

Commit

Permalink
Added documentation deploy to github action and modified cmake to allow
Browse files Browse the repository at this point in the history
for just making documentation
  • Loading branch information
alxhoff committed Apr 28, 2023
1 parent ed1b92e commit bfec2b1
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 104 deletions.
51 changes: 38 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
push:
branches:
- master
- pong
- clean
- udp_demo
- ci
# - pong
# - clean
# - udp_demo
# - ci

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand All @@ -35,14 +35,28 @@ jobs:
run: cd build && make
doxygen:
name: Doxygen Build
permissions:
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Generate Doxygen Documentation
uses: mattnotmitt/doxygen-action@v1
with:
working-directory: docs
# - name: Generate Doxygen Documentation
# uses: mattnotmitt/doxygen-action@v1
# with:
# working-directory: docs
- name: Install Doxygen Dependencies
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz fonts-freefont-ttf

- name: Generate docs
shell: bash
run: mkdir -p build && cd build && cmake -DDOCS=on .. && make docs

- name: Print warnings
run: |
if [[ -s "doxygen_warnings.txt" ]]; then
Expand All @@ -52,12 +66,23 @@ jobs:
cat doxygen_warnings.txt
exit -1
fi
- name: Deploy Documentation
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'master' }}
# - name: Change permissons
# run: sudo bash -c "$(sudo chmod -R 777 docs)"

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/docs/html
# path: ${{runner.workspace}}/docs/docs/html
path: docs/docs/html

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

git_check:
name: Run Git Check
runs-on: ubuntu-latest
Expand Down
179 changes: 91 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,95 +5,28 @@ cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(CMAKE_CONFIG_DIR ${PROJECT_SOURCE_DIR}/config)

if("${TOOLCHAIN}" STREQUAL "docker" OR "${TOOLCHAIN}" STREQUAL "vm")
include(${CMAKE_MODULE_PATH}/init_remote_projects.cmake)
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON )
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

add_compile_options("-Wall" "-O0")

option(TRACE_FUNCTIONS "Trace function calls using instrument-functions")

find_package(Threads)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
find_package(SDL2_gfx REQUIRED)
include_directories(${SDL2_GFX_INCLUDE_DIRS})
find_package(SDL2_image REQUIRED)
include_directories(${SDL2_IMAGE_INCLUDE_DIRS})
find_package(SDL2_mixer REQUIRED)
include_directories(${SDL2_MIXER_INCLUDE_DIRS})
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_TTF_INCLUDE_DIRS})

find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
# git submodule update --remote
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --remote
--merge)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
# git submodule update --remote
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --remote
--merge)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()

SET(PROJECT_INCLUDES
${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/include
${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/portable/GCC/Posix
${PROJECT_SOURCE_DIR}/lib/Gfx/include
${PROJECT_SOURCE_DIR}/lib/AsyncIO/include
${PROJECT_SOURCE_DIR}/lib/StateMachine/include
${PROJECT_SOURCE_DIR}/lib/tracer/include
${PROJECT_SOURCE_DIR}/lib/LL
${PROJECT_SOURCE_DIR}/include
)

include_directories(${PROJECT_INCLUDES})

file(GLOB FREERTOS_SOURCES
"${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/*.c"
"${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/portable/GCC/Posix/*.c"
"${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/portable/MemMang/heap_3.c")
file(GLOB GFX_SOURCES "${PROJECT_SOURCE_DIR}/lib/Gfx/*.c")
file(GLOB STATE_MACHINE_SOURCES "${PROJECT_SOURCE_DIR}/lib/StateMachine/*.c")
file(GLOB ASYNC_SOURCES "${PROJECT_SOURCE_DIR}/lib/AsyncIO/*.c")
file(GLOB SIMULATOR_SOURCES "${PROJECT_SOURCE_DIR}/src/*.c")

SET(PROJECT_SOURCES
${SIMULATOR_SOURCES} ${FREERTOS_SOURCES} ${GFX_SOURCES} ${STATE_MACHINE_SOURCES} ${ASYNC_SOURCES}
)

set(PROJECT_LIBRARIES
${SDL2_LIBRARIES}
${SDL2_GFX_LIBRARIES}
${SDL2_IMAGE_LIBRARIES}
${SDL2_MIXER_LIBRARIES}
${SDL2_TTF_LIBRARIES}
m
${CMAKE_THREAD_LIBS_INIT}
rt
)

include(${CMAKE_MODULE_PATH}/tests.cmake)

add_executable(${CMAKE_PROJECT_NAME} ${PROJECT_SOURCES})

if(TRACE_FUNCTIONS)
add_definitions(-DTRACE_FUNCTIONS)
SET(GCC_COVERAGE_COMPILE_FLAGS "-finstrument-functions")
target_compile_options(FreeRTOS_Emulator PUBLIC ${GCC_COVERAGE_COMPILE_FLAGS})
endif(TRACE_FUNCTIONS)

target_link_libraries(${CMAKE_PROJECT_NAME} ${PROJECT_LIBRARIES})

if("${TOOLCHAIN}" STREQUAL "docker" OR "${TOOLCHAIN}" STREQUAL "vm")
include(${CMAKE_MODULE_PATH}/init_remote_projects.cmake)
else()

if(DOCS)
find_package(Doxygen REQUIRED)
Expand All @@ -105,7 +38,77 @@ else()
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
endif()
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON )
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

add_compile_options("-Wall" "-O0")

option(TRACE_FUNCTIONS "Trace function calls using instrument-functions")

find_package(Threads)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
find_package(SDL2_gfx REQUIRED)
include_directories(${SDL2_GFX_INCLUDE_DIRS})
find_package(SDL2_image REQUIRED)
include_directories(${SDL2_IMAGE_INCLUDE_DIRS})
find_package(SDL2_mixer REQUIRED)
include_directories(${SDL2_MIXER_INCLUDE_DIRS})
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_TTF_INCLUDE_DIRS})

SET(PROJECT_INCLUDES
${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/include
${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/portable/GCC/Posix
${PROJECT_SOURCE_DIR}/lib/Gfx/include
${PROJECT_SOURCE_DIR}/lib/AsyncIO/include
${PROJECT_SOURCE_DIR}/lib/StateMachine/include
${PROJECT_SOURCE_DIR}/lib/tracer/include
${PROJECT_SOURCE_DIR}/lib/LL
${PROJECT_SOURCE_DIR}/include
)

include_directories(${PROJECT_INCLUDES})

file(GLOB FREERTOS_SOURCES
"${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/*.c"
"${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/portable/GCC/Posix/*.c"
"${PROJECT_SOURCE_DIR}/lib/FreeRTOS_Kernel/portable/MemMang/heap_3.c")
file(GLOB GFX_SOURCES "${PROJECT_SOURCE_DIR}/lib/Gfx/*.c")
file(GLOB STATE_MACHINE_SOURCES "${PROJECT_SOURCE_DIR}/lib/StateMachine/*.c")
file(GLOB ASYNC_SOURCES "${PROJECT_SOURCE_DIR}/lib/AsyncIO/*.c")
file(GLOB SIMULATOR_SOURCES "${PROJECT_SOURCE_DIR}/src/*.c")

SET(PROJECT_SOURCES
${SIMULATOR_SOURCES} ${FREERTOS_SOURCES} ${GFX_SOURCES} ${STATE_MACHINE_SOURCES} ${ASYNC_SOURCES}
)

set(PROJECT_LIBRARIES
${SDL2_LIBRARIES}
${SDL2_GFX_LIBRARIES}
${SDL2_IMAGE_LIBRARIES}
${SDL2_MIXER_LIBRARIES}
${SDL2_TTF_LIBRARIES}
m
${CMAKE_THREAD_LIBS_INIT}
rt
)

include(${CMAKE_MODULE_PATH}/tests.cmake)

add_executable(${CMAKE_PROJECT_NAME} ${PROJECT_SOURCES})

if(TRACE_FUNCTIONS)
add_definitions(-DTRACE_FUNCTIONS)
SET(GCC_COVERAGE_COMPILE_FLAGS "-finstrument-functions")
target_compile_options(FreeRTOS_Emulator PUBLIC ${GCC_COVERAGE_COMPILE_FLAGS})
endif(TRACE_FUNCTIONS)

target_link_libraries(${CMAKE_PROJECT_NAME} ${PROJECT_LIBRARIES})

include(${CMAKE_MODULE_PATH}/init_local_projects.cmake)
endif()

include(${CMAKE_MODULE_PATH}/init_local_projects.cmake)
endif()
8 changes: 5 additions & 3 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ PROJECT_NUMBER = 1.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "A POSIX wrapped to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler."
PROJECT_BRIEF = "A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler."

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
Expand Down Expand Up @@ -866,8 +866,10 @@ WARN_LOGFILE = doxygen_warnings.txt

INPUT = ../lib/Gfx \
../lib/AsyncIO \
../lib/LL \
../lib/StateMachine \
../include
../include \
../src

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -1712,7 +1714,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.

GENERATE_LATEX = YES
GENERATE_LATEX = NO

# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
Expand Down

0 comments on commit bfec2b1

Please sign in to comment.