Skip to content

Commit

Permalink
Merge pull request #81 from garymm/garymm/build-macos
Browse files Browse the repository at this point in the history
fix build on MacOS
  • Loading branch information
AI-WAIFU committed Dec 2, 2023
2 parents 56fe18d + a27c053 commit f8edec5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL

set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_HEADLESS TRUE CACHE BOOL "Build in headless mode")

if(APPLE AND BUILD_HEADLESS)
message(FATAL_ERROR "Headless mode is not supported on MacOS yet. It should be possible, PRs welcome.")
endif()


set(BUILD_SERVER FALSE CACHE BOOL "Build server")
set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
Expand Down
12 changes: 6 additions & 6 deletions cmake/Modules/FindZmqpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ message(${CMAKE_SOURCE_DIR})
if(ENABLE_SYSTEM_ZMQPP)
find_library(ZMQPP_LIBRARY NAMES zmqpp)
find_path(ZMQPP_INCLUDE_DIR NAMES zmqpp.hpp PATH_SUFFIXES zmqpp)

if(ZMQPP_LIBRARY AND ZMQPP_INCLUDE_DIR)
message (STATUS "Using ZMQPP provided by system.")
set(USE_SYSTEM_GMP TRUE)
set(USE_SYSTEM_ZMQPP TRUE)
else()
message (STATUS "Detecting ZMQPP from system failed.")
endif()
Expand All @@ -20,17 +20,17 @@ endif()

if(NOT USE_SYSTEM_ZMQPP)
message(STATUS "Using ZMQPP submodule")
find_path(ZMQPP_INCLUDE_DIR NAMES zmqpp/zmqpp.hpp
find_path(ZMQPP_INCLUDE_DIR NAMES zmqpp/zmqpp.hpp
PATHS
${CMAKE_SOURCE_DIR}/lib/zmqpp/src/
PATH_SUFFIXES zmqpp)

find_library(ZMQPP_LIBRARY NAMES zmqpp
PATHS ${CMAKE_SOURCE_DIR}/lib/zmqpp/build/max-g++)
find_library(ZMQPP_LIBRARY NAMES zmqpp
PATHS ${CMAKE_SOURCE_DIR}/lib/zmqpp/build)

message(${ZMQPP_INCLUDE_DIR})
message(${ZMQPP_LIBRARY})

if(ZMQPP_LIBRARY AND ZMQPP_INCLUDE_DIR)
message(STATUS "Using ZMQPP provided by the submodule.")
else()
Expand Down
12 changes: 6 additions & 6 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,10 +919,10 @@ void Client::ReceiveAll()
}
/*
// Get current time
auto now = std::chrono::high_resolution_clock::now();
auto now = std::chrono::sytem_clock::now();
// Convert to a time_t object
auto now_c = std::chrono::high_resolution_clock::to_time_t(now);
auto now_c = std::chrono::system_clock::to_time_t(now);
// Convert to local time
std::tm* now_tm = std::localtime(&now_c);
Expand Down Expand Up @@ -1935,10 +1935,10 @@ std::string Client::getInfo() {
std::string info(lua_tolstring(L, lua_gettop(L), &str_len));

// Get current time
auto now = std::chrono::high_resolution_clock::now();
auto now = std::chrono::system_clock::now();

// Convert to a time_t object
auto now_c = std::chrono::high_resolution_clock::to_time_t(now);
auto now_c = std::chrono::system_clock::to_time_t(now);

// Convert to local time
std::tm* now_tm = std::localtime(&now_c);
Expand Down Expand Up @@ -1979,10 +1979,10 @@ float Client::getReward() {
reward = (float)lua_tonumber(L, lua_gettop(L));

// Get current time
auto now = std::chrono::high_resolution_clock::now();
auto now = std::chrono::system_clock::now();

// Convert to a time_t object
auto now_c = std::chrono::high_resolution_clock::to_time_t(now);
auto now_c = std::chrono::system_clock::to_time_t(now);

// Convert to local time
std::tm* now_tm = std::localtime(&now_c);
Expand Down
2 changes: 2 additions & 0 deletions util/minetester/build_zmqpp.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
cd lib/zmqpp
mkdir build
cmake .. -G "Unix Makefiles"
make

0 comments on commit f8edec5

Please sign in to comment.