Skip to content

Commit

Permalink
Replace munit with unity for testing C, and doctest for testing the h…
Browse files Browse the repository at this point in the history
…ost (#22)

* Initial 0.5 bump
* Unity Placeholder Tests
* Adding doctest to the host project
* New clang-format conslidated between C and C++code
* Adding linux to PR builds
  • Loading branch information
samkusin authored Nov 10, 2022
1 parent e046912 commit 34e97a5
Show file tree
Hide file tree
Showing 35 changed files with 12,375 additions and 5,501 deletions.
9 changes: 9 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
BasedOnStyle: LLVM
UseTab: Never
---
Language: Cpp
IndentWidth: 4
TabWidth: 4
ColumnLimit: 100
AlignConsecutiveMacros: true
2 changes: 2 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: CMake
on:
push:
branches: [ "main" ]
pull_request:
branches: [ 'main' ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down
36 changes: 0 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,6 @@ cmake_minimum_required(VERSION 3.15)

project(clemens_65816 LANGUAGES C)

function(project_create_assets_target ARG_TARGET_NAME)
set(_TARGET_RUNTIME_OUTPUT_DIRECTORY
"${PROJECT_RUNTIME_OUTPUT_DIRECTORY}/${ARG_TARGET_NAME}")
set_target_properties(${ARG_TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${_TARGET_RUNTIME_OUTPUT_DIRECTORY})

file( TO_NATIVE_PATH "${CMAKE_CURRENT_LIST_DIR}/data"
_APP_DATA_DIR )

if( CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Linux" )
set( _EXT_COPY_COMMAND "rsync" )
set( _EXT_COPY_ARGS "-a" )
file( TO_NATIVE_PATH ${_TARGET_RUNTIME_OUTPUT_DIRECTORY}
_APP_DATA_DIR_TARGET )
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
set( _EXT_COPY_COMMAND "xcopy" )
set( _EXT_COPY_ARGS /s /e /y /i )
file( TO_NATIVE_PATH "${_TARGET_RUNTIME_OUTPUT_DIRECTORY}"
_APP_DATA_DIR_TARGET )
else()
message( FATAL_ERROR "${CMAKE_SYSTEM_NAME} Platform unsupported" )
endif()

add_custom_target(app_assets_${ARG_TARGET_NAME}
COMMAND ${_EXT_COPY_COMMAND} ${_EXT_COPY_ARGS}
${_APP_DATA_DIR}
${_APP_DATA_DIR_TARGET}
)
add_dependencies(app_assets_${ARG_TARGET_NAME} ${ARG_TARGET_NAME})
endfunction()

set(PROJECT_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}-run")

set(EMULATOR_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/clem_adb.c"
"${CMAKE_CURRENT_SOURCE_DIR}/clem_audio.c"
Expand Down Expand Up @@ -89,14 +56,11 @@ enable_testing()
add_subdirectory(tests)
endif()


add_executable(clemens_65816_emulator
"${CMAKE_CURRENT_SOURCE_DIR}/app.c")

target_link_libraries(clemens_65816_emulator PRIVATE clemens_65816)

project_create_assets_target(clemens_65816_emulator)

add_executable(clemens_mpack_format
"${CMAKE_CURRENT_SOURCE_DIR}/external/mpack.c"
"${CMAKE_CURRENT_SOURCE_DIR}/clem_mpack_format.c")
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ External libraries referenced below are used by the `host` project (the debuggin
### Clemens Emulator Library

* [mpack](https://github.com/ludocode/mpack) : A single source file MessagePack implementation written in C in the `external` folder used for serialization of a machine
* [unity](https://github.com/ThrowTheSwitch/Unity) : A C testing framework

### Host

Expand All @@ -203,6 +204,7 @@ External libraries referenced below are used by the `host` project (the debuggin
* [Dear ImGui](https://github.com/ocornut/imgui) A well-known IMGUI C++ library
* [Sokol](https://github.com/floooh/sokol) A cross-platform minimal rendering backend
* [fmt](https://github.com/fmtlib/fmt) A minimal std::format implementation
* [doctest](https://github.com/doctest/doctest) A minimal C++ single-header testing framework


## License
Expand Down
Loading

0 comments on commit 34e97a5

Please sign in to comment.