Merge pull request #875 from jpcima/git-build-id
Generalized Git build ID, and version display in Puredata
This commit is contained in:
commit
528ca22a7a
6 changed files with 31 additions and 13 deletions
|
|
@ -74,9 +74,7 @@ add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL
|
|||
src/editor/layout/about.hpp
|
||||
src/editor/utility/vstgui_after.h
|
||||
src/editor/utility/vstgui_before.h
|
||||
src/editor/GitBuildId.h
|
||||
${UI_FILES}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/git-build-id/GitBuildId.c")
|
||||
${UI_FILES})
|
||||
add_library(sfizz::editor ALIAS sfizz_editor)
|
||||
target_include_directories(sfizz_editor PUBLIC "src")
|
||||
target_link_libraries(sfizz_editor PUBLIC sfizz::messaging sfizz::plugins-common)
|
||||
|
|
@ -138,11 +136,5 @@ if(NOT CMAKE_CROSSCOMPILING)
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
# git build identifier
|
||||
add_custom_target(sfizz_editor_git_build_id
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-DSOURCE_DIR=${PROJECT_SOURCE_DIR}"
|
||||
"-DOUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/git-build-id/GitBuildId.c"
|
||||
"-P" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/GitBuildID.cmake"
|
||||
BYPRODUCTS "git-build-id/GitBuildId.c")
|
||||
add_dependencies(sfizz_editor sfizz_editor_git_build_id)
|
||||
# Git build identifier
|
||||
target_link_libraries(sfizz_editor PRIVATE sfizz-git-build-id)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ function(copy_puredata_resources TARGET SOURCE_DIR DESTINATION_DIR)
|
|||
endfunction()
|
||||
|
||||
add_pd_external(sfizz_puredata "sfizz_puredata.c")
|
||||
target_compile_definitions(sfizz_puredata PRIVATE "SFIZZ_NUM_CCS=${SFIZZ_NUM_CCS}")
|
||||
target_compile_definitions(sfizz_puredata PRIVATE
|
||||
"SFIZZ_NUM_CCS=${SFIZZ_NUM_CCS}"
|
||||
"SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"")
|
||||
target_link_libraries(sfizz_puredata PRIVATE sfizz::sfizz)
|
||||
|
||||
set_target_properties(sfizz_puredata PROPERTIES
|
||||
|
|
@ -36,6 +38,9 @@ if(MINGW)
|
|||
PROPERTY LINK_FLAGS " -static")
|
||||
endif()
|
||||
|
||||
# Git build identifier
|
||||
target_link_libraries(sfizz_puredata PRIVATE sfizz-git-build-id)
|
||||
|
||||
# Copy resources
|
||||
copy_puredata_resources(sfizz_puredata
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// license. You should have receive a LICENSE.md file along with the code.
|
||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
||||
|
||||
#include "GitBuildId.h"
|
||||
#include <m_pd.h>
|
||||
#include <sfizz.h>
|
||||
#include <string.h>
|
||||
|
|
@ -292,7 +293,10 @@ __attribute__((visibility("default")))
|
|||
#endif
|
||||
void sfizz_setup()
|
||||
{
|
||||
post("sfizz external for Puredata");
|
||||
if (GitBuildId[0])
|
||||
post("sfizz external for Puredata, version '%s.%s'", SFIZZ_VERSION, GitBuildId);
|
||||
else
|
||||
post("sfizz external for Puredata, version '%s'", SFIZZ_VERSION);
|
||||
|
||||
cls_sfizz_tilde = class_new(
|
||||
gensym("sfizz~"),
|
||||
|
|
|
|||
|
|
@ -351,6 +351,19 @@ endif()
|
|||
# Generic library alias
|
||||
add_library(sfizz::sfizz ALIAS sfizz_static)
|
||||
|
||||
# Git build identifier
|
||||
add_custom_target(sfizz-generate-git-build-id
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-DSOURCE_DIR=${PROJECT_SOURCE_DIR}"
|
||||
"-DOUTPUT_FILE=${PROJECT_BINARY_DIR}/git-build-id/GitBuildId.c"
|
||||
"-P" "${PROJECT_SOURCE_DIR}/cmake/GitBuildID.cmake"
|
||||
BYPRODUCTS "${PROJECT_BINARY_DIR}/git-build-id/GitBuildId.c")
|
||||
add_library(sfizz-git-build-id STATIC EXCLUDE_FROM_ALL
|
||||
"sfizz/git-build-id/GitBuildId.h"
|
||||
"${PROJECT_BINARY_DIR}/git-build-id/GitBuildId.c")
|
||||
target_include_directories(sfizz-git-build-id PUBLIC "sfizz/git-build-id")
|
||||
add_dependencies(sfizz-git-build-id sfizz-generate-git-build-id)
|
||||
|
||||
# Preserve generated files (Faust)
|
||||
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM TRUE)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Short identifier of the current head commit.
|
||||
|
|
@ -14,4 +16,6 @@ extern "C" {
|
|||
*/
|
||||
extern const char* GitBuildId;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
Loading…
Add table
Reference in a new issue