From 8de6b2283d48f6786c4683b4fe8aad68e5348f9f Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 29 Jul 2023 17:50:51 +0200 Subject: [PATCH] Fix build error when building from a tarball instead of a git clone --- CMakeLists.txt | 2 +- cmake/GitVersion.cmake | 9 +++++++-- common/CMakeLists.txt | 1 + server/main.cpp | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f7af377..1c13e189 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.20) -project(WiVRn VERSION 1.0.0 LANGUAGES C CXX) +project(WiVRn VERSION 0.7.1 LANGUAGES C CXX) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake index f4f340e4..7ddabfa9 100644 --- a/cmake/GitVersion.cmake +++ b/cmake/GitVersion.cmake @@ -1,5 +1,10 @@ -execute_process(COMMAND git describe --always OUTPUT_VARIABLE GIT_DESC) -string(STRIP ${GIT_DESC} GIT_DESC) +execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always OUTPUT_VARIABLE GIT_DESC ERROR_QUIET) + +if (GIT_DESC) + string(STRIP ${GIT_DESC} GIT_DESC) +else() + set(GIT_DESC v${CMAKE_PROJECT_VERSION}) +endif() configure_file(${INPUT_FILE} ${OUTPUT_FILE}) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 52fd9936..3b3e5810 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,6 +9,7 @@ else () -D GIT_EXECUTABLE=${GIT_EXECUTABLE} -D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in -D OUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/version.cpp + -D CMAKE_PROJECT_VERSION=${CMAKE_PROJECT_VERSION} -P ${CMAKE_SOURCE_DIR}/cmake/GitVersion.cmake ) endif() diff --git a/server/main.cpp b/server/main.cpp index 5ca78510..467a4218 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -22,6 +22,7 @@ #include #include "pidfd.h" +#include "version.h" #include "avahi_publisher.h" #include "hostname.h" @@ -106,7 +107,7 @@ int create_listen_socket() std::cerr << "Could not bind socket to path " << sock_file << ": " << strerror(errno) << ". Is the service running already?" << std::endl; if (errno == EADDRINUSE) { - std::cerr << "If wivrn is not running, delete " << sock_file << " before starting a new instance" << std::endl; + std::cerr << "If WiVRn is not running, delete " << sock_file << " before starting a new instance" << std::endl; } close(fd); throw std::system_error(errno, std::system_category()); @@ -185,6 +186,7 @@ void waitpid_verbose(pid_t pid, const std::string& name) int main(int argc, char * argv[]) { + std::cerr << "WiVRn " << git_version << " starting" << std::endl; create_listen_socket(); u_trace_marker_init();