Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 85 additions & 17 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,17 +1,85 @@
*.c linguist-language=C
*.cmake linguist-vendored
*.cmd linguist-detectable=false
*.cpp linguist-language=C++
*.cxx linguist-language=C++
*.dsp linguist-detectable=false
*.dsw linguist-detectable=false
*.h linguist-language=C
*.hpp linguist-language=C++
*.html linguist-detectable=false
*.hxx linguist-language=C++
*.sh linguist-detectable=false
*.sln linguist-detectable=false
*.vcxproj linguist-detectable=false
*.vimrc linguist-detectable=false
CMakeLists.txt linguist-vendored
makefile linguist-detectable=false
# .gitattributes — C (GitHub-hosted)
#
# Sources: GitHub Docs (line endings), git-scm gitattributes (diff=cpp),
# gitattributes/gitattributes C++.gitattributes + Common.gitattributes,
# github-linguist overrides.

# Default: detect text, normalize to LF in the repository
* text=auto

# --- Source ---
*.c text diff=cpp
*.h text diff=cpp
*.inc text
*.inl text

# --- Build / config ---
*.am text
*.cmake text
*.m4 text
*.mak text
*.mk text
*akefile text
CMakeLists.txt text
configure text eol=lf
configure.ac text

# --- Scripts ---
*.bash text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
*.sh text eol=lf
*.zsh text eol=lf

# --- Docs / meta ---
*.adoc text
*.markdown text diff=markdown
*.md text diff=markdown
*.txt text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
LICENSE text
NEWS text
README text
TODO text
.gitattributes text
.gitignore text

# --- Serialisation ---
*.json text
*.toml text
*.xml text
*.yaml text
*.yml text

# --- Compiled / binary artefacts ---
*.a binary
*.dll binary
*.dylib binary
*.exe binary
*.gch binary
*.lib binary
*.o binary
*.obj binary
*.out binary
*.pch binary
*.so binary

# --- Archives / images (common) ---
*.gif binary
*.gz binary
*.ico binary
*.jpeg binary
*.jpg binary
*.png binary
*.tar binary
*.zip binary

# --- GitHub Linguist ---
# Object / build trees if committed (prefer .gitignore; mark if present)
**/build/** linguist-generated
**/cmake-build-*/** linguist-generated
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on:
push:
branches:
- master
- dev
- boilerplate
- idiomatic
- rc1
- rc2
- rc3
pull_request:

concurrency:
Expand Down
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"editor.tabSize": 4,
},
"[c]": {
"editor.defaultFormatter": "ms-vscode.cpptools",
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.rulers": [ 60, 64, 68, 72, 76 ],
"editor.tabSize": 4,
Expand All @@ -14,6 +16,8 @@
"editor.tabSize": 4,
},
"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools",
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.rulers": [ 60, 64, 68, 72, 76 ],
"editor.tabSize": 4,
Expand Down Expand Up @@ -49,7 +53,17 @@
"editor.insertSpaces": true,
"editor.tabSize": 2,
},
"C_Cpp.autocompleteAddParentheses": true,
"C_Cpp.clang_format_fallbackStyle": "none",
"C_Cpp.clang_format_style": "file",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.enhancedColorization": "enabled",
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.formatting": "clangFormat",
"C_Cpp.intelliSenseEngine": "default",
"cmake.configureOnOpen": false,
"debug.allowBreakpointsEverywhere": true,
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.renderWhitespace": "all",
Expand Down Expand Up @@ -128,6 +142,7 @@
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"print": "cpp",
"queue": "cpp",
"random": "cpp",
"ranges": "cpp",
Expand Down
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT

# adhere strictly to C and C++ standards plus extensions. These are actually
# useless since we do not compile anything; they merely state our intention.
set(CMAKE_C_STANDARD 17)
if(NOT CMAKE_C_STANDARD)

set(CMAKE_C_STANDARD 17)
endif()
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON) # GNU extensions and POSIX standard
set(CMAKE_CXX_STANDARD 17)
if(NOT CMAKE_CXX_STANDARD)

set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

Expand Down Expand Up @@ -181,11 +187,11 @@ include(GNUInstallDirs)
# ##########################################################
# tool

add_executable(${PROJECT_NAME}
add_executable(${PROJECT_NAME_LOWER}
main.c
)

target_compile_options(${PROJECT_NAME}
target_compile_options(${PROJECT_NAME_LOWER}
PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -pedantic
Expand All @@ -199,11 +205,11 @@ target_compile_options(${PROJECT_NAME}
>
)

target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME_LOWER}
$<$<STREQUAL:${STLSOFT_INCLUDE_DIR},>:STLSoft::STLSoft>
)

install(TARGETS ${PROJECT_NAME}
install(TARGETS ${PROJECT_NAME_LOWER}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand All @@ -227,7 +233,7 @@ endif(BUILD_TESTING)
# ##########################################################
# completion

message(NOTICE "Generating CMake build scripts for ${PROJECT_NAME} ${PROJECT_VERSION}, for C${CMAKE_C_STANDARD} C++${CMAKE_CXX_STANDARD}")
message(NOTICE "Generating CMake build scripts for ${PROJECT_NAME} ${PROJECT_VERSION}, for C${CMAKE_C_STANDARD} C++${CMAKE_CXX_STANDARD}, with build type ${CMAKE_BUILD_TYPE}")


# ############################## end of file ############################# #
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Windows CLI that writes messages to the debugger via **OutputDebugString**


![C](https://img.shields.io/badge/C-00599C?style=flat&logo=c&logoColor=white)
![Windows](https://img.shields.io/badge/OS-Windows-0078D6?style=flat&logo=windows&logoColor=white)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![GitHub release](https://img.shields.io/github/v/release/sistools/WriteDebugString.svg)](https://github.com/sistools/WriteDebugString/releases/latest)
[![Last Commit](https://img.shields.io/github/last-commit/sistools/WriteDebugString)](https://github.com/sistools/WriteDebugString/commits/master)
Expand Down Expand Up @@ -75,10 +76,17 @@ Defect reports, feature requests, and pull requests are welcome on [the **WriteD

### Related projects

Other (similar) projects include:

* [**ReadDebugString**](https://github.com/sistools/ReadDebugString)
* [**realpath**](https://github.com/sistools/realpath)
Other **sistools** projects include:

* [**chomp**](https://github.com/sistools/chomp);
* [**errni**](https://github.com/sistools/errni) (errno on all platforms, and also GetLastError codes on Windows);
* [**lnunique**](https://github.com/sistools/lnunique);
* [**lslocales**](https://github.com/sistools/lslocales);
* [**lstrip**](https://github.com/sistools/lstrip);
* [**mksock**](https://github.com/sistools/mksock) (Unix-only);
* [**ReadDebugString**](https://github.com/sistools/ReadDebugString) (Windows-only);
* [**realpath**](https://github.com/sistools/realpath) (Windows-only);
* [**rstrip**](https://github.com/sistools/rstrip);


### License
Expand Down
34 changes: 27 additions & 7 deletions build_cmake.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#! /bin/bash

ScriptPath=$0
Dir=$(cd $(dirname "$ScriptPath"); pwd)
Dir=$(cd "$(dirname "$ScriptPath")" && pwd)
Basename=$(basename "$ScriptPath")

CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build}
if [[ -n "$MSYSTEM" ]]; then

Expand All @@ -13,11 +14,31 @@ else
DefaultMakeCmd=make
fi
MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}}
ProjectNameFile="$Dir/.sis/project_name.txt"
ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile")

IgnoreRemainingFlagsAndOptions=0
Targets=()


# ##########################################################
# colours

if command -v tput > /dev/null; then

SisClr_Blue=${FG_BLUE:-$(tput setaf 4)}
SisClr_Red=${FG_RED:-$(tput setaf 1)}
SisClr_Bold=${FD_BOLD:-$(tput bold)}
SisClr_None=${FD_NONE:-$(tput sgr0)}
else

SisClr_Blue=
SisClr_Red=
SisClr_Bold=
SisClr_None=
fi


# ##########################################################
# functions

Expand Down Expand Up @@ -77,7 +98,7 @@ EOF
;;
*)

>&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage"
>&2 echo "$ScriptPath: ${SisClr_Red}${SisClr_Bold}unrecognised argument '$1'${SisClr_None}; use --help for usage"

exit 1
;;
Expand All @@ -92,7 +113,7 @@ done

if [ ! -d "$CMakeDir" ]; then

>&2 echo "$ScriptPath: CMake build directory '$CMakeDir' not found so nothing to do; use script 'prepare_cmake.sh' if you wish to prepare CMake artefacts"
>&2 echo "$ScriptPath: ${SisClr_Red}${SisClr_Bold}CMake build directory '$CMakeDir' not found${SisClr_None} so nothing to do; use script 'prepare_cmake.sh' if you wish to prepare CMake artefacts"

exit 1
else
Expand All @@ -101,7 +122,7 @@ else

if [ ! -f "$CMakeDir/Makefile" ]; then

>&2 echo "$ScriptPath: CMake build directory '$CMakeDir' does not contain expected file 'Makefile', so a clean cannot be performed. It is recommended that you remove all CMake artefacts using script 'remove_cmake_artefacts.sh' followed by regeneration via 'prepare_cmake.sh'"
>&2 echo "$ScriptPath: ${SisClr_Red}${SisClr_Bold}CMake build directory '$CMakeDir' does not contain expected file 'Makefile'${SisClr_None}, so a clean cannot be performed. It is recommended that you remove all CMake artefacts using script 'remove_cmake_artefacts.sh' followed by regeneration via 'prepare_cmake.sh'"

cd ->/dev/null

Expand All @@ -110,10 +131,10 @@ else

if [ -z "$Targets" ]; then

echo "Executing build (via command \`$MakeCmd\`)"
echo "Executing build of ${SisClr_Blue}${SisClr_Bold}${ProjectName}${SisClr_None} (via command \`${SisClr_Blue}${SisClr_Bold}$MakeCmd${SisClr_None}\`)"
else

echo "Executing build (via command \`$MakeCmd\`) with specific target(s) $(join_by , "${Targets[@]}")"
echo "Executing build of ${SisClr_Blue}${SisClr_Bold}${ProjectName}${SisClr_None} (via command \`${SisClr_Blue}${SisClr_Bold}$MakeCmd${SisClr_None}\`) with specific target(s) $(join_by , "${Targets[@]}")"
fi

$MakeCmd ${Targets[*]}
Expand All @@ -127,4 +148,3 @@ fi


# ############################## end of file ############################# #

Loading
Loading