Skip to content

Commit

Permalink
Guard against builds with no .git folders by including generated vers…
Browse files Browse the repository at this point in the history
…ion header in index, falling back when git describe fails
  • Loading branch information
weefuzzy committed Jun 18, 2020
1 parent cfec281 commit 2bb97a7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ build
**/.DS_Store
/examples/out*.wav
.vs/
script/FluidVersion.hpp
20 changes: 20 additions & 0 deletions script/FluidVersion.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/)
Copyright 2017-2019 University of Huddersfield.
Licensed under the BSD-3 License.
See license.md file in the project root for full license information.
This project has received funding from the European Research Council (ERC)
under the European Union’s Horizon 2020 research and innovation programme
(grant agreement No 725899).
*/

#pragma once

namespace fluid{
namespace client{
inline const char* fluidVersion()
{
return "1.0.0-RC1";
}
}
}
6 changes: 4 additions & 2 deletions script/flucoma_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE result
OUTPUT_VARIABLE FLUID_VERSION_TAG
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(result)
message(FATAL_ERROR "Failed to get version string from Git")
message(VERBOSE "Failed to get version string from Git, falling back to indexed header")
else()
configure_file("${CMAKE_CURRENT_LIST_DIR}/FluidVersion.hpp.in" "${CMAKE_CURRENT_LIST_DIR}/FluidVersion.hpp" @ONLY)
endif()

configure_file("${CMAKE_CURRENT_LIST_DIR}/FluidVersion.hpp.in" "${CMAKE_CURRENT_LIST_DIR}/FluidVersion.hpp" @ONLY)
set(FLUID_VERSION_PATH ${CMAKE_CURRENT_LIST_DIR})

0 comments on commit 2bb97a7

Please sign in to comment.