-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed/added dependence, updates for decoupling
- files removed know part of a separate repo dependency https://github.com/zelang-dev/c-raii
- Loading branch information
1 parent
5bdd08b
commit 18ba4c7
Showing
101 changed files
with
11,025 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ dkms.conf | |
build/ | ||
.frontmatter/ | ||
frontmatter.json | ||
coroutine-built/ | ||
built/ | ||
*.crt | ||
*.pem | ||
*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@echo off | ||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" ( | ||
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" | ||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ( | ||
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" | ||
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\BuildTools" ( | ||
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars32.bat" | ||
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community" ( | ||
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" | ||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" ( | ||
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars32.bat" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@echo off | ||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" ( | ||
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" | ||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ( | ||
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" | ||
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\BuildTools" ( | ||
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" | ||
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community" ( | ||
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" | ||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" ( | ||
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Windows & Linux & macOS | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Linux ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- target: amd64 | ||
flags: -m64 | ||
- target: x86 | ||
flags: -m32 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Prepare | ||
run: | | ||
sudo dpkg --add-architecture i386 | ||
sudo apt-get update -q -y | ||
sudo apt-get install -y gcc-multilib g++-multilib valgrind libc6-dbg libc6-dbg:i386 | ||
- name: Configure & build | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=${{ matrix.flags }} .. | ||
cmake --build . | ||
- name: Run test examples | ||
run: | | ||
cd build | ||
./test-defer | ||
./test-exceptions | ||
build-windows: | ||
name: Windows (${{ matrix.arch }}) | ||
runs-on: windows-2019 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [x64, Win32] | ||
steps: | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
with: | ||
arch: ${{ matrix.arch }} | ||
- uses: actions/checkout@v4 | ||
- name: Configure & build | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -D BUILD_TESTING=ON -A ${{ matrix.arch }} | ||
cmake --build . --config Debug | ||
- name: Run test examples | ||
shell: cmd | ||
run: | | ||
cd build\Debug | ||
.\test-defer.exe | ||
.\test-exceptions.exe | ||
build-macos: | ||
name: macOS | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup | ||
run: | | ||
brew install cmake | ||
- name: Configure & build | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON .. | ||
cmake --build . | ||
- name: Run test examples | ||
run: | | ||
cd build | ||
./test-defer | ||
./test-exceptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | ||
name: Deploy Jekyll with GitHub Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "docs/**" | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Build with Jekyll | ||
uses: actions/jekyll-build-pages@v1 | ||
with: | ||
source: ./docs | ||
destination: ./_site | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
.vscode/settings.json | ||
build/ | ||
built/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
cmake_minimum_required(VERSION 2.8...3.14) | ||
|
||
project(c-raii LANGUAGES C) | ||
|
||
set(C_STANDARD 89) | ||
|
||
include(CMakeDependentOption) | ||
include(GNUInstallDirs) | ||
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}") | ||
|
||
set(CMAKE_CONFIGURATION_TYPES=Debug;Release) | ||
set(BUILD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BUILD_DIR}) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/built") | ||
|
||
cmake_dependent_option(BUILD_TESTING | ||
"Build the unit tests when BUILD_TESTING is enabled and we are the root project" OFF | ||
"BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF) | ||
|
||
option(BUILD_SHARED_LIBS "Build the library as a shared (dynamically-linked) " OFF) | ||
|
||
file(GLOB raii_files | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/*.c | ||
) | ||
|
||
if(BUILD_SHARED_LIBS) | ||
add_library(raii SHARED ${raii_files}) | ||
else() | ||
add_library(raii STATIC ${raii_files}) | ||
endif() | ||
|
||
set_property(TARGET raii PROPERTY POSITION_INDEPENDENT_CODE True) | ||
|
||
target_include_directories(raii PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
) | ||
|
||
if(UNIX) | ||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -D NDEBUG") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fomit-frame-pointer -Wno-return-type") | ||
endif() | ||
|
||
if(WIN32) | ||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /D NDEBUG") | ||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) | ||
add_definitions("/wd4244 /wd4267 /wd4033 /wd4715") | ||
endif() | ||
|
||
find_package(Threads) | ||
target_link_libraries(raii PUBLIC ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
if (BUILD_TESTING) | ||
enable_testing() | ||
add_subdirectory(tests) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
set(_fmt TGZ) | ||
if(WIN32) | ||
set(_fmt ZIP) | ||
endif() | ||
|
||
set(CPACK_GENERATOR ${_fmt}) | ||
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) | ||
set(CPACK_DEB_COMPONENT_INSTALL ON) | ||
set(CPACK_RPM_COMPONENT_INSTALL ON) | ||
set(CPACK_NUGET_COMPONENT_INSTALL ON) | ||
set(CPACK_WIX_COMPONENT_INSTALL ON) | ||
set(CPACK_NSIS_MODIFY_PATH ON) | ||
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) | ||
set(CPACK_VERBATIM_VARIABLES YES) | ||
|
||
set(CPACK_PACKAGE_VENDOR "https://github.com/zelang-dev/c-raii") | ||
set(CPACK_PACKAGE_VERSION 0.0.0) | ||
include(CPack) | ||
|
||
set(CMAKE_INSTALL_CONFIG_NAME ${CMAKE_BUILD_TYPE}) | ||
install(TARGETS ${raii} DESTINATION lib) | ||
install(DIRECTORY include/ DESTINATION include) |
Oops, something went wrong.