mirror of
https://github.com/marian-nmt/marian.git
synced 2024-09-11 06:15:56 +03:00
renamed version.h* to project_version.h*; created new version.cpp that is the only place that includes version header(s)
This commit is contained in:
parent
a5cd4cfaa6
commit
ab8c3e9009
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
# Config files from CMake
|
||||
src/common/version.h
|
||||
src/common/project_version.h
|
||||
src/common/git_revision.h
|
||||
|
||||
*.vcxproj.user
|
||||
/vs/x64
|
||||
|
@ -224,10 +224,11 @@ if(COMPILE_EXAMPLES)
|
||||
add_definitions(-DCOMPILE_EXAMPLES=1)
|
||||
endif(COMPILE_EXAMPLES)
|
||||
|
||||
# Compile source files
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.h.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.h @ONLY)
|
||||
# Generate project_version.h to reflect our version number
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/common/project_version.h.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/common/projectI_version.h @ONLY)
|
||||
|
||||
# Compile source files
|
||||
include_directories(${marian_SOURCE_DIR}/src)
|
||||
add_subdirectory(src)
|
||||
|
||||
|
@ -6,6 +6,7 @@ include_directories(3rd_party/SQLiteCpp/include)
|
||||
include_directories(3rd_party/sentencepiece)
|
||||
|
||||
add_library(marian STATIC
|
||||
common/version.cpp
|
||||
common/utils.cpp
|
||||
common/logging.cpp
|
||||
common/cli_helper.cpp
|
||||
|
2
src/common/cli_wrapper.cpp
Normal file → Executable file
2
src/common/cli_wrapper.cpp
Normal file → Executable file
@ -120,7 +120,7 @@ void CLIWrapper::parse(int argc, char **argv) {
|
||||
|
||||
// handle --version flag
|
||||
if(optVersion_->count()) {
|
||||
std::cerr << PROJECT_VERSION_FULL << std::endl;
|
||||
std::cerr << projectVersion() << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -65,12 +65,12 @@ void Config::initialize(int argc, char** argv, cli::mode mode, bool validate) {
|
||||
if(has("version")) {
|
||||
auto version = get<std::string>("version");
|
||||
|
||||
if(mode == cli::mode::training && version != PROJECT_VERSION_FULL)
|
||||
if(mode == cli::mode::training && version != projectVersion())
|
||||
LOG(info,
|
||||
"[config] Loaded model has been created with Marian {}, "
|
||||
"will be overwritten with current version {} at saving",
|
||||
version,
|
||||
PROJECT_VERSION_FULL);
|
||||
projectVersion());
|
||||
else
|
||||
LOG(info,
|
||||
"[config] Loaded model has been created with Marian {}",
|
||||
@ -80,7 +80,7 @@ void Config::initialize(int argc, char** argv, cli::mode mode, bool validate) {
|
||||
else if(mode == cli::mode::training) {
|
||||
LOG(info,
|
||||
"[config] Model is being created with Marian {}",
|
||||
PROJECT_VERSION_FULL);
|
||||
projectVersion());
|
||||
}
|
||||
}
|
||||
|
||||
|
4
src/common/version.h.in → src/common/project_version.h.in
Normal file → Executable file
4
src/common/version.h.in → src/common/project_version.h.in
Normal file → Executable file
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* File version.h is generated using CMake. Do NOT modify it manually! Edit
|
||||
* version.h.in file instead.
|
||||
* File project-version.h is generated using CMake. Do NOT modify it manually! Edit
|
||||
* project-version.h.in file instead.
|
||||
*/
|
||||
|
||||
// e.g. v1.2.3-beta+1.abc123d
|
2
src/marian.h
Normal file → Executable file
2
src/marian.h
Normal file → Executable file
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#include "common/version.h"
|
||||
#include "common/config.h"
|
||||
#include "common/definitions.h"
|
||||
#include "common/logging.h"
|
||||
#include "common/options.h"
|
||||
#include "common/version.h"
|
||||
#include "common/io.h"
|
||||
|
||||
#include "data/batch_generator.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "encoder_decoder.h"
|
||||
#include "common/cli_helper.h"
|
||||
#include "common/version.h"
|
||||
|
||||
namespace marian {
|
||||
|
||||
@ -87,7 +88,7 @@ Config::YamlNode EncoderDecoder::getModelParameters() {
|
||||
if(options_->has("original-type"))
|
||||
modelParams["type"] = options_->getOptions()["original-type"];
|
||||
|
||||
modelParams["version"] = PROJECT_VERSION_FULL;
|
||||
modelParams["version"] = projectVersion();
|
||||
return modelParams;
|
||||
}
|
||||
|
||||
|
@ -131,6 +131,7 @@
|
||||
<ClCompile Include="..\src\common\logging.cpp" />
|
||||
<ClCompile Include="..\src\common\config.cpp" />
|
||||
<ClCompile Include="..\src\common\config_parser.cpp" />
|
||||
<ClCompile Include="..\src\common\version.cpp" />
|
||||
<ClCompile Include="..\src\data\alignment.cpp" />
|
||||
<ClCompile Include="..\src\data\default_vocab.cpp" />
|
||||
<ClCompile Include="..\src\data\sentencepiece_vocab.cpp" />
|
||||
@ -219,6 +220,7 @@
|
||||
<ClInclude Include="..\src\common\io_item.h" />
|
||||
<ClInclude Include="..\src\common\timer.h" />
|
||||
<ClInclude Include="..\src\common\types.h" />
|
||||
<ClInclude Include="..\src\common\version.h" />
|
||||
<ClInclude Include="..\src\layers\loss.h" />
|
||||
<ClInclude Include="..\src\layers\weight.h" />
|
||||
<ClInclude Include="..\src\marian.h" />
|
||||
@ -371,7 +373,7 @@
|
||||
<ClInclude Include="..\src\common\regex.h" />
|
||||
<ClInclude Include="..\src\common\shape.h" />
|
||||
<ClInclude Include="..\src\common\utils.h" />
|
||||
<ClInclude Include="..\src\common\version.h" />
|
||||
<ClInclude Include="..\src\common\project_version.h" />
|
||||
<ClInclude Include="..\src\data\alignment.h" />
|
||||
<ClInclude Include="..\src\data\batch.h" />
|
||||
<ClInclude Include="..\src\data\batch_generator.h" />
|
||||
|
@ -265,6 +265,9 @@
|
||||
<ClCompile Include="..\src\data\sentencepiece_vocab.cpp">
|
||||
<Filter>data</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\common\version.cpp">
|
||||
<Filter>common</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\marian.h" />
|
||||
@ -697,9 +700,6 @@
|
||||
<ClInclude Include="..\src\common\utils.h">
|
||||
<Filter>common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\common\version.h">
|
||||
<Filter>common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\data\alignment.h">
|
||||
<Filter>data</Filter>
|
||||
</ClInclude>
|
||||
@ -1087,6 +1087,12 @@
|
||||
<ClInclude Include="..\src\tensors\rand.h">
|
||||
<Filter>tensors</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\common\project_version.h">
|
||||
<Filter>common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\common\version.h">
|
||||
<Filter>common</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="3rd_party">
|
||||
|
Loading…
Reference in New Issue
Block a user