Skip to content

Commit 905c6de

Browse files
committed
[win32] use boost filesystem for gcc builds
Signed-off-by: r4sas <[email protected]>
1 parent d7c4d0f commit 905c6de

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

Makefile.linux

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ifeq ($(shell expr match $(CXX) 'clang'),5)
1515
NEEDED_CXXFLAGS += -std=c++17
1616
else ifeq ($(shell expr match ${CXXVER} "7"),1) # gcc 7
1717
NEEDED_CXXFLAGS += -std=c++17
18-
LDLIBS = -lboost_filesystem
18+
LDLIBS = -lboost_filesystem
1919
else ifeq ($(shell expr match ${CXXVER} "[8-9]"),1) # gcc 8 - 9
2020
NEEDED_CXXFLAGS += -std=c++17
2121
LDLIBS = -lstdc++fs

Makefile.mingw

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CXXFLAGS := $(CXX_DEBUG) -fPIC -msse
77
INCFLAGS := -I$(DAEMON_SRC_DIR) -IWin32
88
LDFLAGS := ${LD_DEBUG} -static -fPIC -msse
99

10-
NEEDED_CXXFLAGS += -std=c++17
10+
NEEDED_CXXFLAGS += -std=c++20
1111
DEFINES += -DWIN32_LEAN_AND_MEAN
1212

1313
# UPNP Support
@@ -16,7 +16,12 @@ ifeq ($(USE_UPNP),yes)
1616
LDLIBS = -lminiupnpc
1717
endif
1818

19+
ifeq ($(USE_WINXP_FLAGS), yes)
20+
DEFINES += -DWINVER=0x0501 -D_WIN32_WINNT=0x0501
21+
endif
22+
1923
LDLIBS += \
24+
$(MINGW_PREFIX)/lib/libboost_filesystem-mt.a \
2025
$(MINGW_PREFIX)/lib/libboost_program_options-mt.a \
2126
$(MINGW_PREFIX)/lib/libssl.a \
2227
$(MINGW_PREFIX)/lib/libcrypto.a \
@@ -37,10 +42,6 @@ ifeq ($(USE_WIN32_APP), yes)
3742
DAEMON_OBJS += $(patsubst %.rc,obj/%.o,$(DAEMON_RC))
3843
endif
3944

40-
ifeq ($(USE_WINXP_FLAGS), yes)
41-
DEFINES += -DWINVER=0x0501 -D_WIN32_WINNT=0x0501
42-
endif
43-
4445
ifeq ($(USE_AESNI),yes)
4546
NEEDED_CXXFLAGS += -maes
4647
LDFLAGS += -maes

Win32/Win32NetState.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2020, The PurpleI2P Project
2+
* Copyright (c) 2013-2024, The PurpleI2P Project
33
*
44
* This file is part of Purple i2pd project and licensed under BSD3
55
*

Win32/Win32NetState.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2020, The PurpleI2P Project
2+
* Copyright (c) 2013-2024, The PurpleI2P Project
33
*
44
* This file is part of Purple i2pd project and licensed under BSD3
55
*

libi2pd/FS.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ namespace fs {
261261
#else */ // TODO: wait until implemented
262262
const auto sctp = std::chrono::time_point_cast<std::chrono::system_clock::duration>(
263263
t - decltype(t)::clock::now() + std::chrono::system_clock::now());
264-
/*#endif */
265-
return std::chrono::system_clock::to_time_t(sctp);
266-
#else
264+
/*#endif */
265+
return std::chrono::system_clock::to_time_t(sctp);
266+
#else
267267
boost::system::error_code ec;
268268
auto t = boost::filesystem::last_write_time (path, ec);
269269
return ec ? 0 : t;
270-
#endif
270+
#endif
271271
}
272272

273273
bool Remove(const std::string & path) {

libi2pd/FS.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include <functional>
1717

1818
#ifndef STD_FILESYSTEM
19-
# if (!TARGET_OS_SIMULATOR && __has_include(<filesystem>)) // supports std::filesystem
19+
# if (_WIN32 && __GNUG__) // MinGW GCC somehow incorrectly converts paths
20+
# define STD_FILESYSTEM 0
21+
# elif (!TARGET_OS_SIMULATOR && __has_include(<filesystem>)) // supports std::filesystem
2022
# define STD_FILESYSTEM 1
2123
# else
2224
# define STD_FILESYSTEM 0

0 commit comments

Comments
 (0)