mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-03-29 22:20:24 +00:00
Merge pull request #38 from ReenigneArcher/add-version-argument
Add version argument
This commit is contained in:
commit
cbbd813c5a
13
.github/workflows/create_package.yml
vendored
13
.github/workflows/create_package.yml
vendored
@ -100,6 +100,19 @@ jobs:
|
||||
run: |
|
||||
cd appimage_temp
|
||||
wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage && chmod +x appimagelint-x86_64.AppImage && ./appimagelint-x86_64.AppImage ./sunshine/sunshine.AppImage
|
||||
- name: Check Version
|
||||
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
|
||||
# base_ref for pull request check, ref for push
|
||||
run: |
|
||||
cd ./appimage_temp/sunshine
|
||||
version=$(./sunshine.AppImage --version | grep -o -E 'v[0-9]+\.[0-9]+\.[0-9]+')
|
||||
echo "sunshine_version=${version}" >> $GITHUB_ENV
|
||||
- name: Compare Versions
|
||||
if: ${{ ( github.ref == 'refs/heads/master' || github.base_ref == 'master') && ( env.sunshine_version != needs.check_changelog.outputs.next_version ) }}
|
||||
run: |
|
||||
echo AppImage version: "$sunshine_version"
|
||||
echo Changelog version: "${{ needs.check_changelog.outputs.next_version }}"
|
||||
exit 1
|
||||
- name: Upload Artifacts
|
||||
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(Sunshine)
|
||||
project(Sunshine VERSION 0.11.1)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
@ -258,6 +258,9 @@ else()
|
||||
configure_file(sunshine.service.in sunshine.service @ONLY)
|
||||
endif()
|
||||
|
||||
configure_file(version.h.in version.h @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(SUNSHINE_TARGET_FILES
|
||||
third-party/moonlight-common-c/reedsolomon/rs.c
|
||||
third-party/moonlight-common-c/reedsolomon/rs.h
|
||||
@ -367,7 +370,10 @@ list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_DEFAULT_DIR="${SUNSHINE_DEFAULT_DIR}")
|
||||
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
||||
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES})
|
||||
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
|
||||
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17)
|
||||
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
)
|
||||
|
||||
if(NOT DEFINED CMAKE_CUDA_STANDARD)
|
||||
set(CMAKE_CUDA_STANDARD 17)
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "thread_pool.h"
|
||||
#include "upnp.h"
|
||||
#include "video.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "platform/common.h"
|
||||
extern "C" {
|
||||
@ -63,6 +64,7 @@ void print_help(const char *name) {
|
||||
<< std::endl
|
||||
<< " --help | print help"sv << std::endl
|
||||
<< " --creds username password | set user credentials for the Web manager" << std::endl
|
||||
<< " --version | print the version of sunshine" << std::endl
|
||||
<< std::endl
|
||||
<< " flags"sv << std::endl
|
||||
<< " -0 | Read PIN from stdin"sv << std::endl
|
||||
@ -80,6 +82,13 @@ int entry(const char *name, int argc, char *argv[]) {
|
||||
}
|
||||
} // namespace help
|
||||
|
||||
namespace version {
|
||||
int entry(const char *name, int argc, char *argv[]) {
|
||||
std::cout << PROJECT_NAME << " version: v" << PROJECT_VER << std::endl;
|
||||
return 0;
|
||||
}
|
||||
} // namespace version
|
||||
|
||||
void log_flush() {
|
||||
sink->flush();
|
||||
}
|
||||
@ -111,7 +120,8 @@ int entry(const char *name, int argc, char *argv[]) {
|
||||
|
||||
std::map<std::string_view, std::function<int(const char *name, int argc, char **argv)>> cmd_to_func {
|
||||
{ "creds"sv, gen_creds::entry },
|
||||
{ "help"sv, help::entry }
|
||||
{ "help"sv, help::entry },
|
||||
{ "version"sv, version::entry }
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
10
version.h.in
Normal file
10
version.h.in
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef INCLUDE_GUARD
|
||||
#define INCLUDE_GUARD
|
||||
|
||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||
#define PROJECT_VER "@PROJECT_VERSION@"
|
||||
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
|
||||
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
|
||||
#define PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"
|
||||
|
||||
#endif // INCLUDE_GUARD
|
Loading…
x
Reference in New Issue
Block a user