diff --git a/.github/workflows/debs.yml b/.github/workflows/debs.yml index ff34a204..cbeef8b9 100644 --- a/.github/workflows/debs.yml +++ b/.github/workflows/debs.yml @@ -2,6 +2,7 @@ name: Debian packages on: workflow_dispatch: + workflow_call: pull_request: push: branches: @@ -11,6 +12,8 @@ jobs: get_version: name: Get version info runs-on: ubuntu-22.04 + permissions: + contents: read defaults: run: shell: bash @@ -32,6 +35,8 @@ jobs: build_debs: name: ${{ matrix.name }} runs-on: ubuntu-22.04 + permissions: + contents: read needs: [get_version] strategy: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e09f39b4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Release + +on: + workflow_dispatch: + push: + # release on tag push + tags: + - '*' + +permissions: + contents: write + +jobs: + build_debs: + name: Build deb packages + permissions: + contents: read + uses: ./.github/workflows/debs.yml + + create_release: + name: Create Release + needs: [build_wheels, build_docs] + runs-on: ubuntu-22.04 + + steps: + - name: Get version + id: get_version + run: | + echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + echo ${{ env.VERSION }} + + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + # download all artifacts to project dir + - uses: actions/download-artifact@v5 + with: + path: packages + pattern: libtins* + merge-multiple: true + + - name: check artifacts + run: | + ls -l packages + + - name: Generate changes file + uses: sarnold/gitchangelog-action@915234f151ceffb7a8c4f76de77e4ae321087b8f # v1.1.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN}} + + - name: Create release + id: create_release + uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1 + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.VERSION }} + name: Release ${{ env.VERSION }} + body_path: CHANGES.md + draft: false + prerelease: false + files: | + packages/*.tar.gz + packages/*.deb diff --git a/CMakeLists.txt b/CMakeLists.txt index f2b6d0ed..80ba21e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) OPTION(LIBTINS_BUILD_EXAMPLES "Build examples" ON) OPTION(LIBTINS_BUILD_TESTS "Build tests" ON) + # Compile in release mode by default IF(NOT CMAKE_BUILD_TYPE) MESSAGE(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") @@ -28,6 +29,10 @@ project( LANGUAGES CXX ) +if(DEFINED ENV{VERBOSE}) + set(CMAKE_VERBOSE_MAKEFILE ON) +endif() + # Check the thread library info early as setting compiler flags seems to # interfere with the detection and causes CMAKE_THREAD_LIBS_INIT to not # include -lpthread when it should. @@ -76,9 +81,10 @@ SET(TINS_VERSION_MINOR 6) SET(TINS_VERSION_PATCH 0) SET(LIBTINS_VERSION "${TINS_VERSION_MAJOR}.${TINS_VERSION_MINOR}") -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) +set(CMAKE_CXX_EXTENSIONS OFF) +MESSAGE(STATUS "Using C++ STD version '${CMAKE_CXX_STANDARD}'") if(CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(CLANG_DEFAULT_CXX_STDLIB libc++) diff --git a/cmake/Modules/CheckCXXFeatures.cmake b/cmake/Modules/CheckCXXFeatures.cmake index 369b5222..8eb79475 100644 --- a/cmake/Modules/CheckCXXFeatures.cmake +++ b/cmake/Modules/CheckCXXFeatures.cmake @@ -52,20 +52,6 @@ endif () #cmake_minimum_required(VERSION 2.8.3) -# -### Check for needed compiler flags -# -include(CheckCXXCompilerFlag) -check_cxx_compiler_flag("-std=c++11" _HAS_CXX11_FLAG) -if (NOT _HAS_CXX11_FLAG) - check_cxx_compiler_flag("-std=c++0x" _HAS_CXX0X_FLAG) -endif () - -if (_HAS_CXX11_FLAG) - set(CXX11_COMPILER_FLAGS "-std=c++11") -elseif (_HAS_CXX0X_FLAG) - set(CXX11_COMPILER_FLAGS "-std=c++0x") -endif () function(cxx11_check_feature FEATURE_NAME RESULT_VAR) if (NOT DEFINED ${RESULT_VAR}) diff --git a/tox.ini b/tox.ini index a853e196..347a9ed2 100644 --- a/tox.ini +++ b/tox.ini @@ -10,9 +10,8 @@ install_command = pip install {opts} {packages} [testenv:tools] setenv = - CFLAGS = -march=native -O2 -g -DNDEBUG - CXXFLAGS = {env:CFLAGS:-march=native -O2 -g -DNDEBUG} - LDFLAGS = {env:CFLAGS:-march=native -O2 -g -DNDEBUG} -Wl,-O1 -Wl,--as-needed + CC = {env:CC:gcc} + CXX = {env:CXX:g++} PREFIX = {env:PREFIX:{envdir}} passenv = @@ -28,6 +27,7 @@ passenv = HOME USERNAME USER + VERBOSE CI XDG_* GITHUB*