Add wrappers for platform-specific headers and normalize include paths

Building the objectstore code now only requires adding the root `src` directory
to the include paths.
This commit is contained in:
Thomas Goyne 2016-01-25 10:25:28 -08:00
parent ad5db72767
commit a3dab7e4b1
13 changed files with 77 additions and 37 deletions

View File

@ -1,5 +1,3 @@
include_directories(impl)
set(SOURCES
index_set.cpp
list.cpp
@ -21,13 +19,14 @@ set(HEADERS
results.hpp
schema.hpp
shared_realm.hpp
impl/cached_realm.hpp
impl/cached_realm_base.hpp
impl/external_commit_helper.hpp
impl/transact_log_handler.hpp
parser/parser.hpp
parser/query_builder.hpp)
if(APPLE)
include_directories(impl/apple)
list(APPEND SOURCES
impl/apple/cached_realm.cpp
impl/apple/external_commit_helper.cpp)
@ -36,7 +35,6 @@ if(APPLE)
impl/apple/external_commit_helper.hpp)
find_library(CF_LIBRARY CoreFoundation)
else()
include_directories(impl/generic)
list(APPEND SOURCES
impl/generic/external_commit_helper.cpp)
list(APPEND HEADERS

View File

@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////
#include "cached_realm.hpp"
#include "impl/cached_realm.hpp"
#include "shared_realm.hpp"

View File

@ -16,10 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_CACHED_REALM_HPP
#define REALM_CACHED_REALM_HPP
#include "../cached_realm_base.hpp"
#include "impl/cached_realm_base.hpp"
#include <CoreFoundation/CFRunLoop.h>
@ -49,5 +46,3 @@ private:
} // namespace _impl
} // namespace realm
#endif // REALM_CACHED_REALM_HPP

View File

@ -16,9 +16,9 @@
//
////////////////////////////////////////////////////////////////////////////
#include "external_commit_helper.hpp"
#include "impl/external_commit_helper.hpp"
#include "realm_coordinator.hpp"
#include "impl/realm_coordinator.hpp"
#include <asl.h>
#include <assert.h>

View File

@ -16,9 +16,6 @@
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_EXTERNAL_COMMIT_HELPER_HPP
#define REALM_EXTERNAL_COMMIT_HELPER_HPP
#include <future>
namespace realm {
@ -77,5 +74,3 @@ private:
} // namespace _impl
} // namespace realm
#endif /* REALM_EXTERNAL_COMMIT_HELPER_HPP */

30
src/impl/cached_realm.hpp Normal file
View File

@ -0,0 +1,30 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_CACHED_REALM_HPP
#define REALM_CACHED_REALM_HPP
#include <realm/util/features.h>
#if REALM_PLATFORM_APPLE
#include "impl/apple/cached_realm.hpp"
#else
#include "impl/generic/cached_realm.hpp"
#endif
#endif // REALM_CACHED_REALM_HPP

View File

@ -0,0 +1,30 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_EXTERNAL_COMMIT_HELPER_HPP
#define REALM_EXTERNAL_COMMIT_HELPER_HPP
#include <realm/util/features.h>
#if REALM_PLATFORM_APPLE
#include "impl/apple/external_commit_helper.hpp"
#else
#include "impl/generic/external_commit_helper.hpp"
#endif
#endif // REALM_EXTERNAL_COMMIT_HELPER_HPP

View File

@ -16,10 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_CACHED_REALM_HPP
#define REALM_CACHED_REALM_HPP
#include "../cached_realm_base.hpp"
#include "impl/cached_realm_base.hpp"
namespace realm {
class Realm;
@ -37,4 +34,3 @@ public:
} // namespace _impl
} // namespace realm
#endif // REALM_CACHED_REALM_HPP

View File

@ -16,9 +16,9 @@
//
////////////////////////////////////////////////////////////////////////////
#include "external_commit_helper.hpp"
#include "impl/external_commit_helper.hpp"
#include "realm_coordinator.hpp"
#include "impl/realm_coordinator.hpp"
#include <realm/commit_log.hpp>
#include <realm/replication.hpp>

View File

@ -16,9 +16,6 @@
//
////////////////////////////////////////////////////////////////////////////
#ifndef REALM_EXTERNAL_COMMIT_HELPER_HPP
#define REALM_EXTERNAL_COMMIT_HELPER_HPP
#include <realm/group_shared.hpp>
#include <future>
@ -51,4 +48,3 @@ private:
} // namespace _impl
} // namespace realm
#endif /* REALM_EXTERNAL_COMMIT_HELPER_HPP */

View File

@ -16,10 +16,10 @@
//
////////////////////////////////////////////////////////////////////////////
#include "realm_coordinator.hpp"
#include "impl/realm_coordinator.hpp"
#include "cached_realm.hpp"
#include "external_commit_helper.hpp"
#include "impl/cached_realm.hpp"
#include "impl/external_commit_helper.hpp"
#include "object_store.hpp"
#include <unordered_map>

View File

@ -16,9 +16,9 @@
//
////////////////////////////////////////////////////////////////////////////
#include "transact_log_handler.hpp"
#include "impl/transact_log_handler.hpp"
#include "../binding_context.hpp"
#include "binding_context.hpp"
#include <realm/commit_log.hpp>
#include <realm/group_shared.hpp>

View File

@ -19,11 +19,11 @@
#include "shared_realm.hpp"
#include "binding_context.hpp"
#include "external_commit_helper.hpp"
#include "impl/external_commit_helper.hpp"
#include "impl/realm_coordinator.hpp"
#include "impl/transact_log_handler.hpp"
#include "object_store.hpp"
#include "realm_coordinator.hpp"
#include "schema.hpp"
#include "transact_log_handler.hpp"
#include <realm/commit_log.hpp>
#include <realm/group_shared.hpp>