Skip to content

Commit

Permalink
Windows build fix: #32
Browse files Browse the repository at this point in the history
  • Loading branch information
artiom committed Dec 9, 2024
1 parent 8004ca0 commit 611ec15
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,7 @@ gmon.out
# QtCreator

CMakeLists.txt.user

# MSVS.

/.vs
4 changes: 2 additions & 2 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"CurrentProjectSetting": "Windows x64 Debug (windows-default)"
}
"CurrentProjectSetting": "Windows x64 Debug (windows-ninja)"
}
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ add_third_party("gh:p-ranav/[email protected]"
"CSV2_TEST OFF"
"CSV2_SAMPLES OFF")

if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^x86.*")
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86.*)|(X86.*)|(amd64)|(AMD64)")
add_third_party("gh:intel/pcm"
GIT_TAG 2f9b0c2
OPTIONS
Expand All @@ -323,7 +323,7 @@ add_third_party("gh:zeromq/[email protected]"
OPTIONS
"CPPZMQ_BUILD_TESTS OFF")

add_third_party("gh:Tencent/rapidjson#7c73dd7"
add_third_party("gh:Tencent/rapidjson#ebd87cb"
OPTIONS
"RAPIDJSON_BUILD_DOC OFF"
"RAPIDJSON_BUILD_ASAN OFF"
Expand Down
2 changes: 1 addition & 1 deletion knp/base-framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ knp_add_library("${PROJECT_NAME}-core"
${${PROJECT_NAME}_headers}
ALIAS KNP::BaseFramework::Core
LINK_PRIVATE
spdlog::spdlog_header_only Boost::headers Boost::filesystem HighFive ${HDF5_LIB} csv2 # RapidJSON
spdlog::spdlog_header_only Boost::headers Boost::filesystem HighFive ${HDF5_LIB} csv2
# Hack to build with CLang.
${ADD_LIBS}
LINK_PUBLIC
Expand Down
8 changes: 4 additions & 4 deletions knp/base-framework/impl/storage/native/data_storage_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bool is_json_has_magic(const rapidjson::Document &doc) // cppcheck-suppress con
bool has_magic = false;
for (auto group_iter = attributes.Begin(); group_iter != attributes.End(); ++group_iter)
{
const auto &group = group_iter->GetObject();
const auto &group = *group_iter;
if (group.HasMember("name") && group["name"].GetString() == magic)
{
if (group.HasMember("value") && group["value"].GetInt() != MAGIC_NUMBER) break;
Expand All @@ -163,7 +163,7 @@ bool is_correct_version(const rapidjson::Document &doc) // cppcheck-suppress co

for (auto group_iter = attributes.Begin(); group_iter != attributes.End(); ++group_iter)
{
const auto &group = group_iter->GetObject();
const auto &group = *group_iter;

if (!group.HasMember("name") || group["name"].GetString() != version_str) continue;
if (!group.HasMember("value") || !group["value"].IsArray()) return false;
Expand Down Expand Up @@ -191,7 +191,7 @@ auto read_nodes(const rapidjson::Document::Object &spikes_group)
// Reading node IDs.
if (!spikes_group.HasMember("node_ids") || !spikes_group["node_ids"].IsObject())
throw std::runtime_error("No \"node_ids\" array in \"spikes\" group.");
const auto &nodes_ids = spikes_group["node_ids"].GetObject();
const auto &nodes_ids = spikes_group["node_ids"];

if (!nodes_ids.HasMember("value") || !nodes_ids["value"].IsArray())
throw std::runtime_error("Missing node data in JSON data file.");
Expand Down Expand Up @@ -253,7 +253,7 @@ KNP_DECLSPEC std::vector<core::messaging::SpikeMessage> load_messages_from_json(

if (!doc.HasMember("spikes") || !doc["spikes"].IsObject())
throw std::runtime_error("Unable to find \"spikes\" group in data file.");
const auto &spikes_group = doc["spikes"].GetObject();
const auto &spikes_group = doc["spikes"].GetObj();

auto nodes = read_nodes(spikes_group);
auto timestamps = read_timestamps(spikes_group);
Expand Down
2 changes: 1 addition & 1 deletion knp/devices-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include(knp-functions)

set(${PROJECT_NAME}_PUBLIC_INCLUDE_DIR "knp/devices")

if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86.*")
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86.*)|(X86.*)|(amd64)|(AMD64)")
set(${PROJECT_NAME}_CPU_SOURCE impl/x86_cpu.cpp impl/x86_cpu_power.cpp impl/x86_cpu_power.h)
set(${PROJECT_NAME}_ADD_LINK_LIBRARIES PCM_STATIC)
else()
Expand Down

0 comments on commit 611ec15

Please sign in to comment.