Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: add Makefile helpers and exclude retest from all target #726

Merged
merged 4 commits into from
Mar 3, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

- name: cmake
run: |
cmake -B build && cmake --build build
cmake -B build && cmake --build build -t retest

- name: retest
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ jobs:
cmake --version
ninja --version
cmake -S . -B build -G "${{ matrix.config.generators }}" -DCMAKE_C_FLAGS="/WX" -DCMAKE_BUILD_TYPE=${{ matrix.config.build }}
cmake --build build --parallel
cmake --build build --parallel -t retest
build\test\retest.exe -r -v
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: make
run: |
cmake -B build -DCMAKE_C_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage"
cmake --build build -j
cmake --build build -j -t retest

- name: retest
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: cmake
run: |
cmake -B build -DHAVE_THREADS= && cmake --build build -j
cmake -B build -DHAVE_THREADS= && cmake --build build -j -t retest

- name: retest
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: make
run: |
cmake -B build && cmake --build build -j
cmake -B build && cmake --build build -j -t retest

- name: retest
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build*
/dist
test.d
test.o
*stamp
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libre.pc
# Test
#

add_subdirectory(test)
add_subdirectory(test EXCLUDE_FROM_ALL)
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.PHONY: build
build:
[ -d build ] || cmake -B build
cmake --build build --parallel

.PHONY: ninja
ninja:
[ -d build ] || cmake -B build -G Ninja
make build

.PHONY: dist
dist: build
cmake --install build --prefix dist

.PHONY: test
test: build
cmake --build build --parallel -t retest
build/test/retest -rv

.PHONY: clean
clean:
@rm -Rf build dist CMakeCache.txt CMakeFiles


###############################################################################
#
# Documentation section
#
DOX_DIR=../re-dox

$(DOX_DIR):
@mkdir $@

$(DOX_DIR)/Doxyfile: mk/Doxyfile Makefile
@cp $< $@
@perl -pi -e 's/PROJECT_NUMBER\s*=.*/PROJECT_NUMBER = $(VERSION)/' \
$(DOX_DIR)/Doxyfile

.PHONY:
dox: $(DOX_DIR) $(DOX_DIR)/Doxyfile
@doxygen $(DOX_DIR)/Doxyfile 2>&1 | grep -v DEBUG_ ; true
echo "Doxygen docs in $(DOX_DIR)"
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ libre is a Generic library for real-time communications with async IO support.

## Building

libre is using GNU makefiles. Make and OpenSSL development headers must be
libre is using CMake. CMake and OpenSSL development headers must be
installed before building.


Expand All @@ -45,6 +45,13 @@ $ sudo cmake --install build
$ sudo ldconfig
```

### Build/run tests

```
cmake -B build && cmake --build build -t retest -j
build/test/retest -rv
```

On some distributions, /usr/local/lib may not be included in ld.so.conf.
You can check with `grep "/usr/local/lib" /etc/ld.so.conf.d/*.conf`
and add if necessary:
Expand Down