这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,57 @@ else()
endif()

####################################################################
# optoins
# options
####################################################################
option(ENABLE_BUILD_TESTS "Build test project" OFF)

####################################################################
# configure project
# define project
####################################################################
project("Vst3SampleHost")
set(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")

####################################################################
# update commit id file
####################################################################
set(APP_COMMIT_ID_INC "${PROJECT_ROOT}/src/app/CommitID.inc")

execute_process(
COMMAND "git" "rev-parse" "HEAD"
OUTPUT_VARIABLE APP_COMMIT_ID
RESULT_VARIABLE RESULT_REV_PARSE
)

if(NOT (RESULT_REV_PARSE EQUAL 0))
message(FATAL_ERROR "failed to get current commit id: ${RESULT_REV_PARSE}")
endif()

string(STRIP ${APP_COMMIT_ID} APP_COMMIT_ID)

if(EXISTS "${APP_COMMIT_ID_INC}")
file(READ "${APP_COMMIT_ID_INC}" PREV_APP_COMMIT_ID)
message("PREV : ${PREV_APP_COMMIT_ID}")
string(REGEX MATCH "L\"[^\"]+\"" PREV_APP_COMMIT_ID "${PREV_APP_COMMIT_ID}")
if(NOT PREV_APP_COMMIT_ID)
message(FATAL_ERROR "failed to get previous commit id")
endif()
else()
unset(PREV_APP_COMMIT_ID)
endif()

if((DEFINED PREV_APP_COMMIT_ID) AND ("${PREV_APP_COMMIT_ID}" STREQUAL "${APP_COMMIT_ID}"))
# do nothing
# message("same commit id")
else()
message("write commit id to ${APP_COMMIT_ID_INC}")
file(WRITE "${APP_COMMIT_ID_INC}" "L\"${APP_COMMIT_ID}\"")
endif()

####################################################################
# configure project
####################################################################
project("Vst3SampleHost")
set(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")

set(CMAKE_CXX_STANDARD 17)

Expand All @@ -56,8 +98,6 @@ get_filename_component(WX_DIR "./ext/wxWidgets" ABSOLUTE)
function(ADD_VST3SAMPLEHOST_TARGET EXE_NAME)
cmake_parse_arguments(AVP "ENABLE_BUILD_TESTS" "" "" ${ARGN})

set(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")

set(TARGET_NAME "${EXE_NAME}")

if(NOT ${AVP_ENABLE_BUILD_TESTS})
Expand Down
11 changes: 11 additions & 0 deletions src/app/AppConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "./AppConfig.hpp"

NS_HWM_BEGIN

wchar_t const * const kAppName = L"Vst3SampleHost";
wchar_t const * const kAppVersion = L"0.0.0.1";
wchar_t const * const kAppCommitID =
#include "./CommitID.inc"
;

NS_HWM_END
10 changes: 10 additions & 0 deletions src/app/AppConfig.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

NS_HWM_BEGIN

extern wchar_t const * const kAppName;
extern wchar_t const * const kAppVersion;
extern wchar_t const * const kAppCommitID;

NS_HWM_END

13 changes: 13 additions & 0 deletions src/gui/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ class AboutDialog

dc.SetFont(font_);
dc.SetTextForeground(*wxWHITE);

auto font_size = font_.GetPixelSize();
auto padding = 62;
auto text_rect = wxRect{
wxPoint{ padding, img.GetHeight() / 2 },
wxSize { img.GetWidth() - padding * 2, font_size.GetHeight() }
};

auto const version_str =
String(L"Version: ") + kAppVersion +
L" (" + String(kAppCommitID).substr(0, 8) + L")";

dc.DrawLabel(version_str, text_rect, wxALIGN_CENTER_VERTICAL);
}

private:
Expand Down
3 changes: 1 addition & 2 deletions src/prefix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ using UInt16 = std::uint16_t;
using UInt32 = std::uint32_t;
using UInt64 = std::uint64_t;

constexpr wchar_t const *kAppName = L"Vst3SampleHost";

NS_HWM_END

#include "app/AppConfig.hpp"
#include "misc/DebuggerOutputStream.hpp"
#include "misc/StrCnv.hpp"