Compare commits

..

6 commits

Author SHA1 Message Date
f30e911208 Merge branch 'master' into conan
Some checks failed
Run UnitTests / build-and-run-tests (push) Failing after 1m23s
2024-07-13 22:43:09 +09:00
165702ac6d Version 1.2
All checks were successful
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 1s
Run UnitTests / build-and-run-tests (push) Successful in 33s
Build for Releases / ensure-release-exists (push) Successful in 0s
Build for Releases / assets-release-x86_64 (push) Successful in 1m11s
Conan configuration was changed, so bump version for it.
2024-07-13 22:42:53 +09:00
c3182cb127 Fix conanfile.py/CMakeLists.txt for C consumers
The new configuration should make C consumers link to "stdc++" by
default, which should fix building with static libs for C programs.
2024-07-13 22:41:16 +09:00
15d6bc8b84 Minor fix to info in release action/workflow
All checks were successful
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 0s
Run UnitTests / build-and-run-tests (push) Successful in 2m30s
2024-07-13 17:12:46 +09:00
98efbc1f81 Release versions of UDPC without libsodium
All checks were successful
Build for Releases / ensure-release-exists (push) Successful in 3s
Build for Releases / assets-release-x86_64 (push) Successful in 1m7s
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 0s
Run UnitTests / build-and-run-tests (push) Successful in 2m30s
2024-07-13 16:02:02 +09:00
c9d5e1136a Update release info in release action/workflow
All checks were successful
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 1s
Run UnitTests / build-and-run-tests (push) Successful in 2m31s
2024-07-13 15:29:41 +09:00
5 changed files with 97 additions and 6 deletions

View file

@ -23,7 +23,8 @@ jobs:
-d "{ -d "{
\"name\": \"UDPC version ${GITHUB_REF_NAME}\", \"name\": \"UDPC version ${GITHUB_REF_NAME}\",
\"tag_name\": \"${GITHUB_REF_NAME}\", \"tag_name\": \"${GITHUB_REF_NAME}\",
\"body\": \"Warning: Static libs require linking with C++ linker (and libsodium)! \"body\": \"Warning: Static libs require linking with C++ linker or linking with stdc++ (`-lstdc++`)!
Warning: Will need to link with libsodium!
SHA256SUMS\" SHA256SUMS\"
}" >&/dev/null }" >&/dev/null
@ -34,6 +35,8 @@ jobs:
env: env:
SHARED_LIB_ASSET_NAME: "udpc_${{ github.ref_name }}_shared.tar.zst" SHARED_LIB_ASSET_NAME: "udpc_${{ github.ref_name }}_shared.tar.zst"
STATIC_LIB_ASSET_NAME: "udpc_${{ github.ref_name }}_static.tar.zst" STATIC_LIB_ASSET_NAME: "udpc_${{ github.ref_name }}_static.tar.zst"
SHARED_NOLIBSODIUM_LIB_ASSET_NAME: "udpc_${{ github.ref_name }}_no_libsodium_shared.tar.zst"
STATIC_NOLIBSODIUM_LIB_ASSET_NAME: "udpc_${{ github.ref_name }}_no_libsodium_static.tar.zst"
steps: steps:
- name: Update and upgrade with apt - name: Update and upgrade with apt
run: apt-get --yes update && apt-get --yes upgrade run: apt-get --yes update && apt-get --yes upgrade
@ -51,6 +54,10 @@ jobs:
touch shared_lib_exists touch shared_lib_exists
elif [[ "$asset" == "$STATIC_LIB_ASSET_NAME" ]]; then elif [[ "$asset" == "$STATIC_LIB_ASSET_NAME" ]]; then
touch static_lib_exists touch static_lib_exists
elif [[ "$asset" == "$SHARED_NOLIBSODIUM_LIB_ASSET_NAME" ]]; then
touch shared_nolibsodium_lib_exists
elif [[ "$asset" == "$STATIC_NOLIBSODIUM_LIB_ASSET_NAME" ]]; then
touch static_nolibsodium_lib_exists
fi fi
done done
- name: Build shared if asset does not exist - name: Build shared if asset does not exist
@ -131,3 +138,81 @@ jobs:
-H 'Content-Type: multipart/form-data' \ -H 'Content-Type: multipart/form-data' \
-F "attachment=@staticOut/${STATIC_LIB_ASSET_NAME};type=application/zstd" >&/dev/null -F "attachment=@staticOut/${STATIC_LIB_ASSET_NAME};type=application/zstd" >&/dev/null
fi fi
- name: Build shared-no-libsodium if asset does not exist
run: |
if ! [[ -e shared_nolibsodium_lib_exists ]]; then
if ! [[ -d udpc_cloned ]]; then
git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/UDPConnection.git udpc_cloned
fi
pushd udpc_cloned >&/dev/null && git restore . && git checkout "${GITHUB_REF_NAME}" && popd >&/dev/null
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DCMAKE_INSTALL_PREFIX=/usr -DUDPC_DISABLE_LIBSODIUM=True -S udpc_cloned -B buildReleaseSharedNolibsodium
make -C buildReleaseSharedNolibsodium
make DESTDIR=$(pwd)/sharedNolibsodiumOut -C buildReleaseSharedNolibsodium install
pushd sharedNolibsodiumOut >&/dev/null
tar --sort=name -I'zstd --compress -T0 --ultra -20' -cf "$SHARED_NOLIBSODIUM_LIB_ASSET_NAME" usr
popd >&/dev/null
curl -X GET \
"https://git.seodisparate.com/api/v1/repos/stephenseo/UDPConnection/releases/tags/${GITHUB_REF_NAME}" \
-H 'accept: application/json' -o release_info_latest.json
curl --fail-with-body -X PATCH \
"https://git.seodisparate.com/api/v1/repos/stephenseo/UDPConnection/releases/$(jq .id < release_info_latest.json)" \
-H 'accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{
\"body\": \"$(jq .body < release_info_latest.json | sed -e 's/^"//' -e 's/"$//')
$(cd sharedNolibsodiumOut && sha256sum "$SHARED_NOLIBSODIUM_LIB_ASSET_NAME")\"
"} >&/dev/null
curl --fail-with-body -X POST \
"https://git.seodisparate.com/api/v1/repos/stephenseo/UDPConnection/releases/$(jq .id < release_info_latest.json)/assets" \
-H 'accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H 'Content-Type: multipart/form-data' \
-F "attachment=@sharedNolibsodiumOut/${SHARED_NOLIBSODIUM_LIB_ASSET_NAME};type=application/zstd" >&/dev/null
fi
- name: Build static-no-libsodium if asset does not exist
run: |
if ! [[ -e static_nolibsodium_lib_exists ]]; then
if ! [[ -d udpc_cloned ]]; then
git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/UDPConnection.git udpc_cloned
fi
pushd udpc_cloned >&/dev/null && git restore . && git checkout "${GITHUB_REF_NAME}" && popd >&/dev/null
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=Off -DCMAKE_INSTALL_PREFIX=/usr -DUDPC_DISABLE_LIBSODIUM=True -S udpc_cloned -B buildReleaseStaticNolibsodium
make -C buildReleaseStaticNolibsodium
make DESTDIR=$(pwd)/staticNolibsodiumOut -C buildReleaseStaticNolibsodium install
pushd staticNolibsodiumOut >&/dev/null
tar --sort=name -I'zstd --compress -T0 --ultra -20' -cf "$STATIC_NOLIBSODIUM_LIB_ASSET_NAME" usr
popd >&/dev/null
curl -X GET \
"https://git.seodisparate.com/api/v1/repos/stephenseo/UDPConnection/releases/tags/${GITHUB_REF_NAME}" \
-H 'accept: application/json' -o release_info_latest.json
curl --fail-with-body -X PATCH \
"https://git.seodisparate.com/api/v1/repos/stephenseo/UDPConnection/releases/$(jq .id < release_info_latest.json)" \
-H 'accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{
\"body\": \"$(jq .body < release_info_latest.json | sed -e 's/^"//' -e 's/"$//')
$(cd staticNolibsodiumOut && sha256sum "$STATIC_NOLIBSODIUM_LIB_ASSET_NAME")\"
"} >&/dev/null
curl --fail-with-body -X POST \
"https://git.seodisparate.com/api/v1/repos/stephenseo/UDPConnection/releases/$(jq .id < release_info_latest.json)/assets" \
-H 'accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H 'Content-Type: multipart/form-data' \
-F "attachment=@staticNolibsodiumOut/${STATIC_NOLIBSODIUM_LIB_ASSET_NAME};type=application/zstd" >&/dev/null
fi

View file

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.7) cmake_minimum_required(VERSION 3.7)
project(UDPC) project(UDPC)
set(UDPC_VERSION 1.1) set(UDPC_VERSION 1.2)
set(UDPC_SOVERSION 1) set(UDPC_SOVERSION 1)
set(UDPC_SOURCES set(UDPC_SOURCES
@ -42,6 +42,12 @@ find_package(libsodium REQUIRED)
target_compile_definitions(UDPC PUBLIC UDPC_LIBSODIUM_ENABLED) target_compile_definitions(UDPC PUBLIC UDPC_LIBSODIUM_ENABLED)
target_link_libraries(UDPC PUBLIC libsodium::libsodium) target_link_libraries(UDPC PUBLIC libsodium::libsodium)
# Enforce linking with libstdc++ even with C targets.
# Doesn't affect conan, so conanfile.py was also modified for this.
set_target_properties(UDPC PROPERTIES
INTERFACE_LINK_LIBRARIES "stdc++"
)
if(CMAKE_BUILD_TYPE MATCHES "Debug") if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(UDPC_UnitTest_SOURCES set(UDPC_UnitTest_SOURCES
src/CXX11_shared_spin_lock.cpp src/CXX11_shared_spin_lock.cpp

View file

@ -22,4 +22,4 @@ find_package(udpc CONFIG REQUIRED)
add_executable(UDPC_NetworkTest add_executable(UDPC_NetworkTest
${UDPC_NetworkTest_SOURCES} ${UDPC_NetworkTest_SOURCES}
) )
target_link_libraries(UDPC_NetworkTest udpc::udpc stdc++) target_link_libraries(UDPC_NetworkTest PUBLIC udpc::udpc)

View file

@ -1,5 +1,5 @@
[requires] [requires]
udpc/1.1 udpc/1.2
[generators] [generators]
CMakeDeps CMakeDeps

View file

@ -5,7 +5,7 @@ import os
class udpcRecipe(ConanFile): class udpcRecipe(ConanFile):
name = "udpc" name = "udpc"
version = "1.1" version = "1.2"
package_type = "library" package_type = "library"
# Optional metadata # Optional metadata
@ -54,4 +54,4 @@ class udpcRecipe(ConanFile):
def package_info(self): def package_info(self):
self.cpp_info.libs = ["UDPC"] self.cpp_info.libs = ["UDPC"]
self.cpp_info.system_libs = ["stdc++"]