Skip to content

Commit

Permalink
Added automatic 'VERSION' file writer
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjhood committed Mar 15, 2024
1 parent 05cea3b commit 2ed6ad0
Show file tree
Hide file tree
Showing 9 changed files with 755 additions and 207 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!package.json
node_modules
!/.vscode/c_cpp_properties.json
!**/develop-logo-pluginval.png

# Windows Temp Cache Files
[Tt]humbs.db
Expand Down
35 changes: 17 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ cmake_minimum_required (VERSION 3.22...3.28 FATAL_ERROR)

list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/share/cmake/Modules")

project (STONEYDSP_BIQUADS VERSION 1.2.0
include(GetGitRevListCount)
get_git_rev_list_count()

project (STONEYDSP_BIQUADS VERSION 1.2.0.${_git_rev_list_count}
DESCRIPTION "Simple two-pole equalizer with variable oversampling."
HOMEPAGE_URL "https://github.com/nathanjhood/Biquads"
LANGUAGES C;CXX
)

include(StoneyDSPBiquadsWriteVersionFile)
stoneydsp_biquads_write_version_file()
unset(_git_rev_list_count)

message (STATUS "Configuring StoneyDSP Biquads v${STONEYDSP_BIQUADS_VERSION}...")

set_property(GLOBAL PROPERTY USE_FOLDERS YES)
Expand Down Expand Up @@ -150,14 +157,6 @@ target_link_libraries (Biquads
Helpers
]=============================================================================]#
juce_generate_juce_header (Biquads)
# if (STONEYDSP_BIQUADS_IS_TOP_LEVEL)
# execute_process (
# COMMAND "${CMAKE_COMMAND}"
# "--build ${STONEYDSP_BIQUADS_BINARY_DIR}"
# "--config ${CMAKE_BUILD_TYPE}"
# "--target juce_vst3_helper"
# )
# endif ()

#[=============================================================================[
CTest configuration
Expand Down Expand Up @@ -194,15 +193,15 @@ configure_package_config_file(
install(FILES
"${STONEYDSP_BIQUADS_BINARY_DIR}/StoneyDSPBiquadsConfigVersion.cmake"
"${STONEYDSP_BIQUADS_BINARY_DIR}/StoneyDSPBiquadsConfig.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/CMakeRC.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/FindCMakeRC.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/Findfmt.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/GetGitRef.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/JoinPaths.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/StoneyDSPCPackIgnoreList.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/StoneyDSPModuleSupport.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/WriteVersionFile.cmake"
# "${STONEYDSP_CMAKE_UTILS_DIR}/WriteVersionHeader.cmake"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/share/cmake/Modules/GetGitRevListCount.cmake"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/share/cmake/Modules/StoneyDSPBiquadsCPackIgnoreList.cmake"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/share/cmake/Modules/JoinPaths.cmake"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/share/cmake/Modules/WriteVersionFile.cmake"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/share/cmake/Modules/WriteVersionHeader.cmake"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/share/StoneyDSP/Biquads/copyright"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/VERSION"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/LICENSE"
"${STONEYDSP_BIQUADS_SOURCE_DIR}/README.md"
DESTINATION "${STONEYDSP_BIQUADS_INSTALL_DESTINATION}"
)

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

<hr>

<b>Verified by [Pluginval](https://www.tracktion.com/develop/pluginval)</b>

![pluginval](https://stoneydsp.com/resources/projects/biquads/develop-logo-pluginval.png)

<hr>

<b>Created with the [StoneyDSP C++ library for JUCE](https://www.tracktion.com/develop/pluginval)</b>

[![StoneyDSP](https://raw.githubusercontent.com/StoneyDSP/StoneyDSP/production/extras/Icons/images/w_icon__384x256.png)](https://www.stoneydsp.com)

<hr>
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.0.136
674 changes: 674 additions & 0 deletions share/StoneyDSP/Biquads/copyright

Large diffs are not rendered by default.

86 changes: 0 additions & 86 deletions share/cmake/Modules/GetGitRef.cmake

This file was deleted.

38 changes: 38 additions & 0 deletions share/cmake/Modules/GetGitRevListCount.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#[=============================================================================[
Fetches 'git rev-list --count --first-parent HEAD' for use in CMake projects.
Copyright (c) 2024 - Nathan J. Hood

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
]=============================================================================]#
macro(get_git_rev_list_count)
set(_git_rev_list_count 0)
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count --first-parent HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE test_result
OUTPUT_VARIABLE _git_rev_list_count
)
if(test_result EQUAL 0)
# If our VCS found a revision number, pass it to cache
string(STRIP "${_git_rev_list_count}" _git_rev_list_count)
set(_git_rev_list_count ${_git_rev_list_count})
message(DEBUG "get_git_rev_list_count ${git_rev_list_count}")
endif()
else()
message(WARNING "Git not found. Version cannot be determined.")
endif()
endmacro()
87 changes: 0 additions & 87 deletions share/cmake/Modules/GetSourceInfo.cmake

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@
.
]=============================================================================]#

include (GetGitRef)
include(GetGitRevListCount)

if (NOT DEFINED STONEYDSP_GIT_COMMIT_REF)
stoneydsp_get_git_ref ()
endif ()
if (NOT DEFINED STONEYDSP_BIQUADS_VERSION_TWEAK_NUMBER)
get_git_rev_list_count()
endif()

#[=============================================================================[
Provides:

STONEYDSP_VERSION_FILE
STONEYDSP_BIQUADS_VERSION_FILE

]=============================================================================]#
macro (stoneydsp_write_version_file)
set(_stoneydsp_tweak "")
set(_stoneydsp_tweak ${STONEYDSP_GIT_COMMIT_REF})
if(DEFINED StoneyDSP_VERSION_TWEAK AND (NOT StoneyDSP_VERSION_TWEAK STREQUAL ""))
set(_stoneydsp_tweak ${StoneyDSP_VERSION_TWEAK})
macro (stoneydsp_biquads_write_version_file)
set(_stoneydsp_biquads_version_tweak "")
set(_stoneydsp_biquads_version_tweak ${_git_rev_list_count})
if(DEFINED STONEYDSP_BIQUADS_VERSION_TWEAK AND (NOT STONEYDSP_BIQUADS_VERSION_TWEAK STREQUAL ""))
set(_stoneydsp_biquads_version_tweak ${STONEYDSP_BIQUADS_VERSION_TWEAK})
endif()
set(STONEYDSP_VERSION_FILE "${StoneyDSP_SOURCE_DIR}/VERSION")
file(WRITE "${STONEYDSP_VERSION_FILE}.tmp" "${StoneyDSP_VERSION_MAJOR}.${StoneyDSP_VERSION_MINOR}.${StoneyDSP_VERSION_PATCH}.${_stoneydsp_tweak}\n")
set(STONEYDSP_BIQUADS_VERSION_FILE "${STONEYDSP_BIQUADS_SOURCE_DIR}/VERSION")
file(WRITE "${STONEYDSP_BIQUADS_VERSION_FILE}.tmp" "${STONEYDSP_BIQUADS_VERSION_MAJOR}.${STONEYDSP_BIQUADS_VERSION_MINOR}.${STONEYDSP_BIQUADS_VERSION_PATCH}.${_stoneydsp_biquads_version_tweak}\n")

#Copy the file only if it has changed.
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${STONEYDSP_VERSION_FILE}.tmp" "${STONEYDSP_VERSION_FILE}")
file(REMOVE "${STONEYDSP_VERSION_FILE}.tmp")
set(STONEYDSP_VERSION_FILE "${STONEYDSP_VERSION_FILE}" CACHE INTERNAL "StoneyDSP current version file." FORCE)
unset(_stoneydsp_tweak)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${STONEYDSP_BIQUADS_VERSION_FILE}.tmp" "${STONEYDSP_BIQUADS_VERSION_FILE}")
file(REMOVE "${STONEYDSP_BIQUADS_VERSION_FILE}.tmp")
set(STONEYDSP_BIQUADS_VERSION_FILE "${STONEYDSP_BIQUADS_VERSION_FILE}" CACHE INTERNAL "StoneyDSP Biquads current version file." FORCE)
unset(_stoneydsp_biquads_version_tweak)
endmacro ()

0 comments on commit 2ed6ad0

Please sign in to comment.