Skip to content

Commit b6d73d2

Browse files
committed
[*Dockerfile] Fix images to work consistently ; [CMakeLists.txt] Disable tests by default ; [c89stringutils/tests/test_string_extras.h] Remove C++ comment
1 parent f9c7fae commit b6d73d2

File tree

7 files changed

+65
-56
lines changed

7 files changed

+65
-56
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ configure_file(
5656
add_subdirectory("${PROJECT_NAME}")
5757

5858
include(CTest)
59-
option(BUILD_TESTING "Build the tests" ON)
60-
option(C89STRINGUTILS_BUILD_TESTING "Build the tests" ON)
59+
option(BUILD_TESTING "Build the tests" OFF)
60+
option(C89STRINGUTILS_BUILD_TESTING "Build the tests" OFF)
6161
if (BUILD_TESTING AND C89STRINGUTILS_BUILD_TESTING)
6262
add_subdirectory("${PROJECT_NAME}/tests")
6363
endif (BUILD_TESTING AND C89STRINGUTILS_BUILD_TESTING)

Dockerfile

Lines changed: 0 additions & 12 deletions
This file was deleted.

Dockerfile.debian

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,33 @@ c89stringutils
88

99
C89 is missing some nice things. As is MSVC.
1010
This adds the string related functionality for:
11+
1112
- **Windows**
12-
- MSVC 2005
13-
- MSVC 2022 (should support all other versions also)
14-
- MinGW
15-
- Cygwin
16-
- Open Watcom 2.0 (including **DOS** target)
13+
- MSVC 2005
14+
- MSVC 2022 (should support all other versions also)
15+
- MinGW
16+
- Cygwin
17+
- Open Watcom 2.0 (including **DOS** target)
1718
- **SunOS**
1819
- **Linux**
1920
- ***BSD**
2021
- **macOS**
2122

22-
Everything is hidden behind `ifdef`s so if the compiler/OS supports the function, that function will be used instead of the one provided by this library.
23+
Everything is hidden behind `ifdef`s so if the compiler/OS supports the function, that function will be used instead of
24+
the one provided by this library.
2325

2426
### String functions implemented
2527

26-
| Function | Citation |
27-
----------------------------------------------------------------------------|------------------------------|
28-
| [`strcasestr`](https://www.freebsd.org/cgi/man.cgi?query=strcasestr) | From MUSL |
29-
| [`strncasecmp`](https://www.freebsd.org/cgi/man.cgi?query=strncasecmp) | Alias for MSVC's `_strnicmp` |
30-
| [`strcasecmp`](https://www.freebsd.org/cgi/man.cgi?query=strcasecmp) | Alias for MSVC's `_stricmp` |
31-
| [`snprintf`](https://www.freebsd.org/cgi/man.cgi?query=snprintf) | Mostly from WTF_StringExtras |
32-
| [`vsnprintf`](https://www.freebsd.org/cgi/man.cgi?query=vsnprintf) | Mostly from WTF_StringExtras |
33-
| [`strnstr`](https://www.freebsd.org/cgi/man.cgi?query=strnstr) | Mostly from WTF_StringExtras |
34-
| [`strerrorlen_s`](https://en.cppreference.com/w/c/string/byte/strerror) | From Safe C Library |
35-
| [`asprintf`](https://www.freebsd.org/cgi/man.cgi?query=asprintf) | From libressl-portable |
28+
| Function | Citation |
29+
|-------------------------------------------------------------------------|------------------------------|
30+
| [`strcasestr`](https://www.freebsd.org/cgi/man.cgi?query=strcasestr) | From MUSL |
31+
| [`strncasecmp`](https://www.freebsd.org/cgi/man.cgi?query=strncasecmp) | Alias for MSVC's `_strnicmp` |
32+
| [`strcasecmp`](https://www.freebsd.org/cgi/man.cgi?query=strcasecmp) | Alias for MSVC's `_stricmp` |
33+
| [`snprintf`](https://www.freebsd.org/cgi/man.cgi?query=snprintf) | Mostly from WTF_StringExtras |
34+
| [`vsnprintf`](https://www.freebsd.org/cgi/man.cgi?query=vsnprintf) | Mostly from WTF_StringExtras |
35+
| [`strnstr`](https://www.freebsd.org/cgi/man.cgi?query=strnstr) | Mostly from WTF_StringExtras |
36+
| [`strerrorlen_s`](https://en.cppreference.com/w/c/string/byte/strerror) | From Safe C Library |
37+
| [`asprintf`](https://www.freebsd.org/cgi/man.cgi?query=asprintf) | From libressl-portable |
3638

3739
Additionally `jasprintf`, a version of `asprintf` that concatenates on successive calls.
3840

@@ -43,22 +45,21 @@ Additionally `jasprintf`, a version of `asprintf` that concatenates on successiv
4345

4446
### Configure, build, and test
4547

46-
```bash
47-
mkdir build && cd build
48-
cmake ..
49-
cmake --build .
48+
```sh
49+
cmake -S . -B build
50+
cmake --build build
5051
ctest -C Debug
5152
```
5253

5354
### Script to automatically build
5455

5556
Build, test, and package for:
5657

57-
- Cygwin;
58-
- MinGW (32-bit and 64-bit);
59-
- MSVC 2005 (32-bit and 64-bit);
60-
- MSVC 2022 (32-bit and 64-bit);
61-
- OpenWatcom's DOS target (16-bit).
58+
- Cygwin;
59+
- MinGW (32-bit and 64-bit);
60+
- MSVC 2005 (32-bit and 64-bit);
61+
- MSVC 2022 (32-bit and 64-bit);
62+
- OpenWatcom's DOS target (16-bit).
6263

6364
…by running in Command Prompt: https://github.com/offscale/win-cmake-multi-build
6465

@@ -67,15 +68,18 @@ Build, test, and package for:
6768
#### Instructions for MSVC 2005
6869

6970
With cmake-3.11.4 specified, do:
71+
7072
```sh
7173
mkdir build_msvc2005 && cd build_msvc2005
7274
cmake-3.11.4-win64-x64\bin\cmake -DCMAKE_WARN_VS8=OFF -DCMAKE_BUILD_TYPE="Debug" -G "Visual Studio 8 2005" ..
7375
cmake-3.11.4-win64-x64\bin\cmake --build .
7476
cmake-3.11.4-win64-x64\bin\ctest -C Debug
7577
```
78+
7679
(the last two commands can be run by opening the solution in Visual Studio 2005)
7780

7881
Alternatively with newer versions of CMake (tested 3.26.3):
82+
7983
```sh
8084
mkdir build_msvc_nmake2005 && cd build_msvc_nmake2005
8185
cmake -DCMAKE_BUILD_TYPE="Debug" -G "NMake Makefiles" ..
@@ -86,13 +90,15 @@ ctest -C Debug
8690
#### Instructions for Open Watcom (DOS target)
8791

8892
With v2 from https://github.com/open-watcom/open-watcom-v2/releases installed:
93+
8994
```sh
9095
[path]\WATCOM\owsetenv.bat
9196
mkdir build_dos && cd build_dos
9297
cmake -G "Watcom WMake" -D CMAKE_SYSTEM_NAME "DOS" -D CMAKE_SYSTEM_PROCESSOR "I86" ..
9398
cmake --build .
9499
ctest -C Debug
95100
```
101+
96102
(that test phase might fail if you're running this on a non-DOS host)
97103

98104
---

alpine.Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM alpine
2+
3+
RUN apk add --no-cache gcc cmake make musl-dev linux-headers
4+
5+
COPY . /c89stringutils
6+
7+
WORKDIR /c89stringutils
8+
9+
RUN cmake -DCMAKE_BUILD_TYPE="Debug" \
10+
-DBUILD_TESTING=1 \
11+
-DC89STRINGUTILS_BUILD_TESTING=1 \
12+
-S . -B build && \
13+
cmake --build build
14+
15+
CMD cd build && ctest .

c89stringutils/tests/test_string_extras.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <greatest.h>
22

3-
// #define C89STRINGUTILS_IMPLEMENTATION
43
#include <c89stringutils_string_extras.h>
54

65
static const char *buffer = "hello world";

debian.Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM debian
2+
3+
RUN apt-get update -qq && \
4+
apt-get install -qy cmake gcc make pkg-config libc-dev && \
5+
rm -rf /var/lib/apt/lists/* /var/cache/apt
6+
7+
COPY . /c89stringutils
8+
9+
WORKDIR /c89stringutils
10+
11+
RUN cmake -DCMAKE_BUILD_TYPE="Debug" \
12+
-DBUILD_TESTING=1 \
13+
-DC89STRINGUTILS_BUILD_TESTING=1 \
14+
-S . -B build && \
15+
cmake --build build
16+
17+
CMD cd /c89stringutils/build && ctest .

0 commit comments

Comments
 (0)