Skip to content

Commit dba269f

Browse files
committed
Fix compile on linux
1 parent f6d0a36 commit dba269f

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set_source_files_properties(
1111
COMPILE_FLAGS "-w"
1212
)
1313

14-
file(GLOB XXHASH_SRC vendor/xxHash/*.c)
14+
file(GLOB XXHASH_SRC vendor/xxHash/xxhash.c)
1515
set_source_files_properties(
1616
${XXHASH_SRC}
1717
PROPERTIES
@@ -25,10 +25,15 @@ add_executable(fine ${XDELTA_SRC} ${XXHASH_SRC} ${FINE_SRC})
2525
add_compile_definitions(SIZEOF_SIZE_T=8 PICOJSON_USE_INT64)
2626
add_subdirectory(vendor/spdlog)
2727
target_compile_options(fine PRIVATE -Wall -Wextra -Wstrict-aliasing=0 -fno-rtti -O3)
28-
target_link_libraries(fine -municode -static spdlog::spdlog -s)
28+
if (WIN32)
29+
set(OS_LINK_FLAGS "-municode")
30+
else()
31+
set(OS_LINK_FLAGS)
32+
endif()
33+
target_link_libraries(fine ${OS_LINK_FLAGS} -static spdlog::spdlog -s)
2934
set_target_properties(fine
30-
PROPERTIES
31-
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target"
32-
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target"
33-
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target"
35+
PROPERTIES
36+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target"
37+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target"
38+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target"
3439
)

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ int wmain(int argc, const wchar_t* argv[]) {
111111
static void setupWorkingDirectory(const char* arg0) {
112112
spdlog::info("Init: setup working directory");
113113
auto dir = fs::weakly_canonical(fs::path(arg0)).parent_path();
114-
spdlog::info("Init: changing working directory to {}", dir);
114+
spdlog::info("Init: changing working directory to {}", dir.u8string());
115115
chdir(dir.c_str());
116116
}
117117

src/platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
#ifdef _WIN32
44
#include <Windows.h>
5+
#else
6+
#include <unistd.h>
57
#endif
68

79
#include <algorithm>
810
#include <cstdint>
11+
#include <cstring>
912
#include <filesystem>
1013
#include <fstream>
1114
#include <iostream>

src/streamio.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ void BufferStreamIO::writeFully(const u8* buf, i64 len) {
8787
if (position + len > dataLen) {
8888
bail("Buffer overflow in BufferStreamIO.writeFully");
8989
}
90-
memcpy(data + position, buf, len);
90+
std::memcpy(data + position, buf, len);
9191
position += len;
9292
}
9393

9494
void BufferStreamIO::readFully(u8* buf, i64 len) {
9595
if (position + len > dataLen) {
9696
bail("Buffer EOF in BufferStreamIO.readFully");
9797
}
98-
memcpy(buf, data + position, len);
98+
std::memcpy(buf, data + position, len);
9999
position += len;
100100
}

0 commit comments

Comments
 (0)