Skip to content

Commit

Permalink
Update liblcd:
Browse files Browse the repository at this point in the history
- fix run on Lunux;
- add runs tests;
  • Loading branch information
rozhuk-im committed Apr 25, 2024
1 parent 5bdf950 commit 1d10bd7
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 9 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/build-macos-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ jobs:
with:
submodules: 'recursive'

- name: Install libraries
run: |
checkPkgAndInstall()
{
while [ $# -ne 0 ]
do
rm -f '/usr/local/bin/2to3'
if brew ls --versions $1 ; then
brew upgrade $1
else
brew install $1
fi
shift
done
}
checkPkgAndInstall cunit
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
Expand All @@ -42,17 +59,17 @@ jobs:
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_TESTS=1

- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
run: cmake --build . --config $BUILD_TYPE -j 16

- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE
run: ctest -C $BUILD_TYPE -j 16 --output-on-failure
11 changes: 8 additions & 3 deletions .github/workflows/build-ubuntu-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
with:
submodules: 'recursive'

- name: Install libraries
run: |
sudo apt-get update
sudo apt-get install cmake libcunit1 libcunit1-doc libcunit1-dev
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
Expand All @@ -42,17 +47,17 @@ jobs:
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_TESTS=1

- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
run: cmake --build . --config $BUILD_TYPE -j 16

- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE
run: ctest -C $BUILD_TYPE -j 16 --output-on-failure
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

############################# INITIAL SECTION ##########################
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.20)

project(ssdpd C)

Expand All @@ -21,7 +21,13 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")

############################# OPTIONS SECTION ##########################

option(INSTALL_PHP_MEDIA_SERVER "Install PHP UPnP/DLNA Media server [default: ON]" OFF)
option(INSTALL_PHP_MEDIA_SERVER "Install PHP UPnP/DLNA Media server [default: OFF]" OFF)
option(ENABLE_TESTS "Enable tests [default: OFF]" OFF)
if (ENABLE_TESTS)
# Enable testing functionality.
enable_testing()
set(ENABLE_LIBLCB_TESTS TRUE)
endif()

# Now CMAKE_INSTALL_PREFIX is a base prefix for everything.
if (NOT CONFDIR)
Expand Down Expand Up @@ -241,6 +247,10 @@ add_definitions(-DSOCKET_XML_CONFIG)
include(src/liblcb/CMakeLists.txt)
add_subdirectory(src)

if (ENABLE_TESTS)
#add_subdirectory(tests)
endif()

############################ TARGETS SECTION ###########################

add_custom_target(dist ${CMAKE_CURRENT_SOURCE_DIR}/dist.sh
Expand Down
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ UPnP/DLNA PHP server requires
2. PHP with fpm, fileinfo, soap, xml.


## Run tests
```
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=1 ..
cmake --build . --config Release -j 16
ctest -C Release --output-on-failure -j 16
```

## Usage
```
ssdpd [-d] [-v] [-c file]
Expand Down

0 comments on commit 1d10bd7

Please sign in to comment.