Skip to content

Commit

Permalink
Fix MacOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrePTJ committed Mar 17, 2023
1 parent 6bc3a79 commit 241a4cc
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

8 changes: 7 additions & 1 deletion .idea/kemai.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ endif ()
# Setup other dependencies
find_package(spdlog REQUIRED)
find_package(magic_enum REQUIRED)
if (APPLE)
find_package(range-v3 REQUIRED)
endif()

# Write version to file to ease packaging
file(WRITE ${CMAKE_BINARY_DIR}/version.txt ${PROJECT_VERSION})
Expand Down
11 changes: 11 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from conan import ConanFile


class KemaiConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_find_package"
requires = ("spdlog/1.11.0", "magic_enum/0.8.2")

def requirements(self):
if self.settings.os == "Macos":
self.requires("range-v3/0.12.0")
6 changes: 0 additions & 6 deletions conanfile.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ elseif (APPLE)
set(KEMAI_ICNS "${CMAKE_SOURCE_DIR}/bundle/macos/kemai.icns")
set_source_files_properties(${KEMAI_ICNS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/bundle/macos/Info.plist)
target_link_libraries(${PROJECT_NAME} "-framework CoreGraphics")
target_link_libraries(${PROJECT_NAME} range-v3::meta "-framework CoreGraphics")
elseif (UNIX)
list(APPEND SRCS
monitor/linuxDesktopEventsMonitor.cpp)
Expand Down
12 changes: 10 additions & 2 deletions src/client/kimaiCache.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include "kimaiCache.h"

/*
* TODO: Removes when std::views is available on MacOS/clang
*/
#ifdef Q_OS_MACOS
#include <range/v3/all.hpp>
#else
#include <ranges>
namespace ranges = std;
#endif

#include <magic_enum.hpp>
#include <spdlog/spdlog.h>
Expand Down Expand Up @@ -69,7 +77,7 @@ Projects KimaiCache::projects(std::optional<int> customerId) const
{
if (customerId.has_value())
{
auto its = mProjects | std::views::filter([id = customerId.value()](auto const& project) { return project.customer.id == id; });
auto its = mProjects | ranges::views::filter([id = customerId.value()](auto const& project) { return project.customer.id == id; });
return {its.begin(), its.end()};
}
return mProjects;
Expand All @@ -79,7 +87,7 @@ Activities KimaiCache::activities(std::optional<int> projectId) const
{
if (projectId.has_value())
{
auto its = mActivities | std::views::filter([id = projectId.value()](auto const& activity) {
auto its = mActivities | ranges::views::filter([id = projectId.value()](auto const& activity) {
if (!activity.project.has_value())
{
return true;
Expand Down

0 comments on commit 241a4cc

Please sign in to comment.