Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c9883d36..f86e9fb7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -20,7 +20,7 @@ add_library(marian STATIC
common/config_validator.cpp
common/options.cpp
common/binary.cpp
- common/build_info.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/common/build_info.cpp
common/io.cpp
common/filesystem.cpp
common/file_stream.cpp
@@ -70,7 +70,7 @@ add_library(marian STATIC
layers/generic.cpp
layers/loss.cpp
layers/weight.cpp
- layers/lsh.cpp
+ layers/lsh.cpp
rnn/cells.cpp
rnn/attention.cpp
@@ -117,21 +117,22 @@ target_compile_options(marian PUBLIC ${ALL_WARNINGS})
# Git updates .git/logs/HEAD file whenever you pull or commit something.
# If Marian is checked out as a submodule in another repository,
-# there's no .git directory in ${CMAKE_SOURCE_DIR}. Instead .git is a
-# file that specifies the relative path from ${CMAKE_SOURCE_DIR} to
-# ./git/modules/<MARIAN_ROOT_DIR> in the root of the repository that
-# contains Marian as a submodule. We set MARIAN_GIT_DIR to the appropriate
-# path, depending on whether ${CMAKE_SOURCE_DIR}/.git is a directory or file.
-if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git) # not a submodule
- set(MARIAN_GIT_DIR ${CMAKE_SOURCE_DIR}/.git)
-else(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
- file(READ ${CMAKE_SOURCE_DIR}/.git MARIAN_GIT_DIR)
+# ${CMAKE_CURRENT_SOURCE_DIR}/../.git is not a directory but a file
+# that specifies the relative path from ${CMAKE_CURRENT_SOURCE_DIR}/..
+# to ./git/modules/<MARIAN_ROOT_DIR> in the root of the check_out of
+# the project that contains Marian as a submodule.
+#
+# We set MARIAN_GIT_DIR to the appropriate path, depending on whether
+# ${CMAKE_CURRENT_SOURCE_DIR}/../.git is a directory or file.
+set(MARIAN_GIT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../.git)
+if(NOT IS_DIRECTORY ${MARIAN_GIT_DIR}) # i.e., it's a submodule
+ file(READ ${MARIAN_GIT_DIR} MARIAN_GIT_DIR)
string(REGEX REPLACE "gitdir: (.*)\n" "\\1" MARIAN_GIT_DIR ${MARIAN_GIT_DIR})
- get_filename_component(MARIAN_GIT_DIR "${CMAKE_SOURCE_DIR}/${MARIAN_GIT_DIR}" ABSOLUTE)
-endif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
+ get_filename_component(MARIAN_GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${MARIAN_GIT_DIR}" ABSOLUTE)
+endif(NOT IS_DIRECTORY ${MARIAN_GIT_DIR})
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/common/git_revision.h
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND git log -1 --pretty=format:\#define\ GIT_REVISION\ \"\%h\ \%ai\" > ${CMAKE_CURRENT_SOURCE_DIR}/common/git_revision.h
DEPENDS ${MARIAN_GIT_DIR}/logs/HEAD
VERBATIM
@@ -220,7 +221,7 @@ if(COMPILE_SERVER)
add_executable(marian_server command/marian_server.cpp)
set_target_properties(marian_server PROPERTIES OUTPUT_NAME marian-server)
if(MSVC)
- # Disable warnings from the SimpleWebSocketServer library
+ # Disable warnings from the SimpleWebSocketServer library needed for compilation of marian-server
target_compile_options(marian_server PUBLIC ${ALL_WARNINGS} /wd4267 /wd4244 /wd4456 /wd4458)
else(MSVC)
# -Wno-suggest-override disables warnings from Boost 1.69+