diff options
author | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2018-12-11 00:32:22 +0300 |
---|---|---|
committer | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2018-12-11 00:32:22 +0300 |
commit | 8f604afb8877e9f0d3ba639216f76582580f6f6b (patch) | |
tree | 050aeafe5d9eb55b22ac5aeb3501b4e3242aa692 | |
parent | 44789014ef456ad792b1e48675b62325ece31bd2 (diff) |
make things compile under windows again
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/3rd_party/pathie-cpp/src/path.cpp | 2 | ||||
-rw-r--r-- | src/3rd_party/zlib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | src/models/transformer_factory.h | 4 | ||||
-rw-r--r-- | src/models/transformer_stub.cpp | 4 | ||||
-rw-r--r-- | src/tensors/cpu/device.cpp | 2 | ||||
-rw-r--r-- | vs/BuildRelease.bat | 2 | ||||
-rw-r--r-- | vs/CreateVSProjects.bat | 8 |
9 files changed, 22 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e2372667..fb4554cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,9 +70,12 @@ if(MSVC) set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /W4 /Zi /MP /GL /DNDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "/MTd /Od /Ob0 /RTC1 /Zi /D_DEBUG") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /LTCG:incremental /INCREMENTAL:NO") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /LTCG:incremental /INCREMENTAL:NO /NODEFAULTLIB:MSVCRT") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG:incremental") + + find_library(SHLWAPI Shlwapi.lib) + set(EXT_LIBS ${EXT_LIBS} SHLWAPI) else() set(DISABLE_GLOBALLY "-Wno-unused-result") diff --git a/src/3rd_party/pathie-cpp/src/path.cpp b/src/3rd_party/pathie-cpp/src/path.cpp index 99185085..2adcef20 100644 --- a/src/3rd_party/pathie-cpp/src/path.cpp +++ b/src/3rd_party/pathie-cpp/src/path.cpp @@ -51,6 +51,8 @@ #include <shlwapi.h> //#include <ntifs.h> // Currently not in msys2 +#define F_OK 0 + #elif defined(_PATHIE_UNIX) #include <unistd.h> #include <limits.h> diff --git a/src/3rd_party/zlib/CMakeLists.txt b/src/3rd_party/zlib/CMakeLists.txt index c9584424..a33b4810 100644 --- a/src/3rd_party/zlib/CMakeLists.txt +++ b/src/3rd_party/zlib/CMakeLists.txt @@ -4,4 +4,7 @@ file(GLOB ZLIB_INC *.h) # add sources of the wrapper as a "SQLiteCpp" static library add_library(zlib OBJECT ${ZLIB_SRC} ${ZLIB_INC}) -target_compile_options(zlib PUBLIC -Wno-implicit-function-declaration) + +if(NOT MSVC) + target_compile_options(zlib PUBLIC -Wno-implicit-function-declaration) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6daeb08f..03524117 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,6 +58,7 @@ add_library(marian STATIC models/model_factory.cpp models/encoder_decoder.cpp + models/transformer_stub.cpp rescorer/score_collector.cpp diff --git a/src/models/transformer_factory.h b/src/models/transformer_factory.h index dea53a90..aa31e4d1 100755 --- a/src/models/transformer_factory.h +++ b/src/models/transformer_factory.h @@ -12,7 +12,3 @@ namespace marian { Ptr<EncoderBase> NewEncoderTransformer(Ptr<Options> options); Ptr<DecoderBase> NewDecoderTransformer(Ptr<Options> options); } // namespace marian - -#ifndef _MSC_VER -#include "models/transformer.h" -#endif diff --git a/src/models/transformer_stub.cpp b/src/models/transformer_stub.cpp new file mode 100644 index 00000000..420b7781 --- /dev/null +++ b/src/models/transformer_stub.cpp @@ -0,0 +1,4 @@ +// TODO: This is a wrapper around transformer.h. We kept the .H name to minimize confusing git, until this is code-reviewed.
+// This is meant to speed-up builds, and to support Ctrl-F7 to rebuild.
+
+#include "models/transformer.h"
diff --git a/src/tensors/cpu/device.cpp b/src/tensors/cpu/device.cpp index b0fdae92..44c8110f 100644 --- a/src/tensors/cpu/device.cpp +++ b/src/tensors/cpu/device.cpp @@ -22,7 +22,7 @@ Device::~Device() { // Should generate a runtime error otherwise as we have a check in the AVX512 // functions which tests for alignment. #ifdef _WIN32 -#define MALLOC(size) _aligned_alloc(size, alignment_) +#define MALLOC(size) _aligned_malloc(size, alignment_) #elif __GNUC__ #define MALLOC(size) aligned_alloc(alignment_, size) #else diff --git a/vs/BuildRelease.bat b/vs/BuildRelease.bat index 8c3185e3..31215a15 100644 --- a/vs/BuildRelease.bat +++ b/vs/BuildRelease.bat @@ -17,6 +17,6 @@ if "%BUILD_ROOT%"=="" set BUILD_ROOT=%ROOT%build call CreateVSProjects.bat %BUILD_ROOT%
if errorlevel 1 exit /b 1
-cmake --build %BUILD_ROOT% --config Release
+cmake --build %BUILD_ROOT% --config Release
exit /b 0
\ No newline at end of file diff --git a/vs/CreateVSProjects.bat b/vs/CreateVSProjects.bat index ffc4aee8..bb87feb4 100644 --- a/vs/CreateVSProjects.bat +++ b/vs/CreateVSProjects.bat @@ -45,14 +45,16 @@ set CMAKE_OPT=%CMAKE_OPT% -G %GENERATOR_TARGET% set CMAKE_OPT=%CMAKE_OPT% -D CMAKE_POLICY_DEFAULT_CMP0074=NEW
:: ----- Disable some tool build -----
-set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_SERVER:BOOL=TRUE
+set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_SERVER:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_EXAMPLES:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_TESTS:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_CPU:BOOL=TRUE
-set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_CUDA:BOOL=TRUE
+set CMAKE_OPT=%CMAKE_OPT% -D COMPILE_CUDA:BOOL=TRUE
+set CMAKE_OPT=%CMAKE_OPT% -D USE_NCCL:BOOL=FALSE
+set CMAKE_OPT=%CMAKE_OPT% -D USE_SENTENCEPIECE:BOOL=FALSE
-set CMAKE_OPT=%CMAKE_OPT% -D USE_CUDNN:BOOL=TRUE
+set CMAKE_OPT=%CMAKE_OPT% -D USE_CUDNN:BOOL=FALSE
set CMAKE_OPT=%CMAKE_OPT% -D USE_MPI:BOOL=FALSE
echo.
|