diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86740add..b639e001 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,29 +29,14 @@ env: BUILD_TYPE: Release -# jobs: -# build_check: -# strategy: -# # do not stop on 1st fail -# fail-fast: false -# matrix: -# # GitHub runner macos build is broken: https://github.com/actions/runner-images/issues/577 -# # Could not symlink bin/2to3-3.11 Target /usr/local/bin/2to3-3.11 already exists. -# # Could not symlink bin/2to3 Target /usr/local/bin/2to3 already exists. -# # hack fix: https://github.com/actions/setup-python/issues/577#issuecomment-1365231822 -# os: [ubuntu-22.04, macos-12, windows-2022] -# -# runs-on: ${{ matrix.os }} -# -# -# steps: - - jobs: - # --- Linux (Ubuntu) steps --- +# ---------------------------- +# --- Linux (Ubuntu) steps --- +# ---------------------------- +# linux-x86_64: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: # --- Clone the latest commit --- @@ -74,7 +59,7 @@ jobs: run: | mkdir build sudo apt update - #sudo apt -y upgrade + # sudo apt -y upgrade sudo apt install g++ make cmake fakeroot rpm qttools5-dev libfftw3-dev binutils-dev \ libusb-1.0-0-dev libqt5opengl5-dev mesa-common-dev libgl1-mesa-dev libgles2-mesa-dev @@ -106,9 +91,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # --- macOS steps --- +# ------------------- +# --- macOS steps --- +# ------------------- +# macos-x86_64: - runs-on: macos-latest + runs-on: macos-12 steps: # --- Clone the latest commit --- @@ -189,7 +177,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # --- Windows steps --- +# --------------------------- +# --- Windows MINGW steps --- +# --------------------------- +# windows-mingw_w64: runs-on: windows-2022 steps: @@ -256,7 +247,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # --- Windows MSVC steps --- +# -------------------------- +# --- Windows MSVC steps --- +# -------------------------- +# windows-msvc_x64: runs-on: windows-2022 steps: @@ -282,7 +276,6 @@ jobs: - name: Setup Windows MSVC Build run: - copy CMakeListsMSVC.txt CMakeLists.txt & md build & call "%VCINSTALLDIR%/Auxiliary/Build/vcvars64.bat" & cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH=%Qt5_DIR% -DCMAKE_BUILD_TYPE=Release -Bbuild diff --git a/CMakeLists.txt b/CMakeLists.txt index 53052942..320920da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,28 +11,41 @@ if (GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") ) # get the git version execute_process( - COMMAND ${GIT_EXECUTABLE} describe --tags --dirty + COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) - # unstable release? - string(FIND ${VERSION} "unstable" REGULAR) - if( ${REGULAR} ) # not unstable - set( PACKAGE_VERSION ${VERSION} ) # x.y.z - else() # unstable - # add commit hash to version + # devdrop or release? + string(FIND ${VERSION} "devdrop-0-g" DEVDROP_POS) + string(FIND ${VERSION} "-0-g" ZERO_POS) + if( ${DEVDROP_POS} EQUAL 0 ) # "devdrop-x.y.z-p-gxxxxxxx(-dirty)" + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --long --dirty + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + set( VERSION "devdrop-${VERSION}" ) + elseif( ${ZERO_POS} GREATER 0 ) # x.y.z(-dirty) + # message(STATUS "TAG") + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --dirty + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else() # "x.y.z-p-gxxxxxxx(-dirty)" execute_process( COMMAND ${GIT_EXECUTABLE} describe --long --dirty WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) - set( PACKAGE_VERSION "${VERSION}-unstable" ) # "x.y.z-p-gxxxxxxx-unstable" endif() + set( PACKAGE_VERSION ${VERSION} ) endif() -message(STATUS "VERSION: ${VERSION}") message(STATUS "PACKAGE_VERSION: ${PACKAGE_VERSION}") set(OpenGL_GL_PREFERENCE GLVND) @@ -49,7 +62,13 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/") INCLUDE_DIRECTORIES(".") -add_compile_options(-Wall -Wextra -pedantic) +if(MSVC) + # NOMINMAX to avoid clash with std::min or std::max due to silly macros min and max + add_compile_options(/W4 /D_CRT_SECURE_NO_WARNINGS /DNOMINMAX) +else() + add_compile_options(-Wall -Wextra -pedantic) +endif() + # Silence nasty warnings "parameter passing for argument of type ... changed in GCC 7.1" if(CMAKE_COMPILER_IS_GNUCXX)