Get version number from CMakeLists

This commit is contained in:
ReenigneArcher 2022-04-28 18:06:55 -04:00
commit ef9abf2f15
4 changed files with 29 additions and 39 deletions

View file

@ -1,21 +0,0 @@
name: Close Added/Fixed Issues
on:
release:
types: [published]
jobs:
close_issues:
name: Check Issues / PRs
runs-on: ubuntu-latest
steps:
- name: Close Issues (added/fixed)
uses: actions/stale@v3
with:
only-issues-labels: 'added,fixed'
close-issue-message: >
This is now available in the latest release.
close-issue-label: 'released'
days-before-issue-stale: 0
days-before-issue-close: 0
ignore-updates: true

View file

@ -10,20 +10,24 @@ build:
os: ubuntu-20.04 os: ubuntu-20.04
tools: tools:
python: "3.9" python: "3.9"
apt_packages:
- cmake
- ffmpeg
- libboost-filesystem-dev
- libboost-log-dev
- libboost-thread-dev
jobs:
pre_build:
- cmake .
# Include the submodules, required for cmake ## apt packages required packages to run cmake on sunshine, note that additional packages are required
submodules: # apt_packages:
include: all # - cmake
recursive: true # - ffmpeg
# - libboost-filesystem-dev
# - libboost-log-dev
# - libboost-thread-dev
## run cmake
# jobs:
# pre_build:
# - cmake .
## Include the submodules, required for cmake
#submodules:
# include: all
# recursive: true
# Build documentation in the docs/ directory with Sphinx # Build documentation in the docs/ directory with Sphinx
sphinx: sphinx:

View file

@ -319,7 +319,6 @@ else()
endif() endif()
configure_file(version.h.in version.h @ONLY) configure_file(version.h.in version.h @ONLY)
configure_file(docs/source/conf.py.in "${CMAKE_CURRENT_SOURCE_DIR}/docs/source/conf.py" @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(SUNSHINE_TARGET_FILES set(SUNSHINE_TARGET_FILES

View file

@ -6,6 +6,8 @@
# standard imports # standard imports
from datetime import datetime from datetime import datetime
import os
import re
# -- Path setup -------------------------------------------------------------- # -- Path setup --------------------------------------------------------------
@ -13,8 +15,6 @@ from datetime import datetime
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
import os
# import sys
script_dir = os.path.dirname(os.path.abspath(__file__)) # the directory of this file script_dir = os.path.dirname(os.path.abspath(__file__)) # the directory of this file
source_dir = os.path.dirname(script_dir) # the source folder directory source_dir = os.path.dirname(script_dir) # the source folder directory
@ -26,8 +26,16 @@ copyright = f'{datetime.now ().year}, {project}'
author = 'ReenigneArcher' author = 'ReenigneArcher'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
version = '@PROJECT_VERSION@' with open(os.path.join(root_dir, 'CMakeLists.txt'), 'r') as f:
version = re.search(r"project\(Sunshine VERSION ((\d+)\.(\d+)\.(\d+))\)", str(f.read())).group(1)
"""
To use cmake method for obtaining version instead of regex,
1. Within CMakeLists.txt add the following line without backticks:
``configure_file(docs/source/conf.py.in "${CMAKE_CURRENT_SOURCE_DIR}/docs/source/conf.py" @ONLY)``
2. Rename this file to ``conf.py.in``
3. Uncomment the next line
"""
# version = '@PROJECT_VERSION@' # use this for cmake configure_file method
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------