Skip to content

Commit

Permalink
Fix build on Windows (#138)
Browse files Browse the repository at this point in the history
1. use `#include "port/port.h"` instead of `#include "port/port_posix.h"`
2. added an "install" target for CMake to workaround rust-lang/cmake-rs#18
3. MSVC reported 2 warnings in Titan (and tons of warnings in RocksDB), and these are fixed.
  • Loading branch information
kennytm authored Jan 31, 2020
1 parent 4e2c6e0 commit 01f293d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release"))
rocksdb
testutillib
gtest)

foreach(test ${TESTS})
add_executable(titan_${test} src/${test}.cc $<TARGET_OBJECTS:testharness>)
target_link_libraries(titan_${test} ${TEST_LIBS})
add_test(titan_${test} titan_${test})
endforeach(test ${TESTS})
endforeach(test ${TESTS})
endif()

if (WITH_TITAN_TOOLS)
Expand Down Expand Up @@ -138,3 +138,16 @@ if (WITH_TITAN_TOOLS)
target_include_directories(titandb_bench PRIVATE ${gflags_INCLUDE_DIR})
target_link_libraries(titandb_bench ${TOOLS_LIBS})
endif()

# Installation - copy lib/ and include/

include(GNUInstallDirs)
install(DIRECTORY include/titan
COMPONENT devel
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
install(TARGETS titan
COMPONENT devel
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
2 changes: 1 addition & 1 deletion src/blob_file_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "blob_storage.h"
#include "db/log_reader.h"
#include "db/log_writer.h"
#include "port/port_posix.h"
#include "port/port.h"
#include "rocksdb/options.h"
#include "rocksdb/status.h"
#include "titan/options.h"
Expand Down
2 changes: 0 additions & 2 deletions src/blob_storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ void BlobStorage::GetObsoleteFiles(std::vector<std::string>* obsolete_files,
SequenceNumber oldest_sequence) {
MutexLock l(&mutex_);

uint32_t file_dropped = 0;
uint64_t file_dropped_size = 0;
for (auto it = obsolete_files_.begin(); it != obsolete_files_.end();) {
auto& file_number = it->first;
auto& obsolete_sequence = it->second;
Expand Down

0 comments on commit 01f293d

Please sign in to comment.