Skip to content

Commit

Permalink
Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
Wei-Sheng Chin authored and ycjuan committed Jun 2, 2017
1 parent 740103e commit 9e4a1da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
13 changes: 8 additions & 5 deletions Makefile.win
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
CXX = cl.exe
CFLAGS = /nologo /O2 /EHsc /D "_CRT_SECURE_NO_DEPRECATE" /D "USEOMP" /openmp
CFLAGS = /nologo /O2 /EHsc /D "_CRT_SECURE_NO_DEPRECATE" /D "USEOMP" /D "USESSE" /openmp

TARGET = windows

all: $(TARGET) $(TARGET)\ffm-train.exe $(TARGET)\ffm-predict.exe

$(TARGET)\ffm-predict.exe: ffm.h ffm-predict.cpp ffm.obj
$(CXX) $(CFLAGS) ffm-predict.cpp ffm.obj -Fe$(TARGET)\ffm-predict.exe
$(TARGET)\ffm-predict.exe: ffm.h ffm-predict.cpp ffm.obj timer.obj
$(CXX) $(CFLAGS) ffm-predict.cpp ffm.obj timer.obj -Fe$(TARGET)\ffm-predict.exe

$(TARGET)\ffm-train.exe: ffm.h ffm-train.cpp ffm.obj
$(CXX) $(CFLAGS) ffm-train.cpp ffm.obj -Fe$(TARGET)\ffm-train.exe
$(TARGET)\ffm-train.exe: ffm.h ffm-train.cpp ffm.obj timer.obj
$(CXX) $(CFLAGS) ffm-train.cpp ffm.obj timer.obj -Fe$(TARGET)\ffm-train.exe

ffm.obj: ffm.cpp ffm.h
$(CXX) $(CFLAGS) -c ffm.cpp

timer.obj: timer.cpp timer.h
$(CXX) $(CFLAGS) -c timer.cpp

.PHONY: $(TARGET)
$(TARGET):
-mkdir $(TARGET)
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Building Windows Binaries

The Windows part is maintained by different maintainer, so it may not always support the latest version.

The latest version it supports is: v1.14
The latest version it supports is: v1.21

To build them via command-line tools of Visual C++, use the following steps:

Expand Down
10 changes: 7 additions & 3 deletions ffm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ uint64_t hashfile(string txt_path, bool one_block=false)

ffm_long end = (ffm_long) f.tellg();
f.seekg(0, ios::beg);
assert(f.tellg() == 0);
assert(static_cast<int>(f.tellg()) == 0);

uint64_t magic = 90359;
for(ffm_long pos = 0; pos < end; ) {
Expand Down Expand Up @@ -499,10 +499,14 @@ bool check_same_txt_bin(string txt_path, string bin_path) {

ffm_model::~ffm_model() {
if(W != nullptr) {
#ifdef _WIN32
_aligned_free(W);
#ifndef USESSE
free(W);
#else
#ifdef _WIN32
_aligned_free(W);
#else
free(W);
#endif
#endif
W = nullptr;
}
Expand Down

0 comments on commit 9e4a1da

Please sign in to comment.