Add an initial pass at a CMake-based build system.
It currently creates a dynamic library, and builds on OS X only.
This commit is contained in:
parent
dd2c87c3b7
commit
9cf26ed2cb
|
@ -0,0 +1,12 @@
|
||||||
|
# CMake
|
||||||
|
.ninja_deps
|
||||||
|
.ninja_log
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
Makefile
|
||||||
|
build.ninja
|
||||||
|
cmake_install.cmake
|
||||||
|
rules.ninja
|
||||||
|
|
||||||
|
# Build products
|
||||||
|
librealm-object-store.dylib
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "external/pegtl"]
|
||||||
|
path = external/pegtl
|
||||||
|
url = https://github.com/ColinH/PEGTL
|
|
@ -0,0 +1,10 @@
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS off)
|
||||||
|
set(CMAKE_BUILD_TYPE CACHE STRING Debug)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
|
||||||
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${CMAKE_GENERATOR} STREQUAL "Ninja")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
|
||||||
|
endif()
|
|
@ -0,0 +1,28 @@
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
function(download_realm_core realm_core_version)
|
||||||
|
set(core_url "https://static.realm.io/downloads/core/realm-core-${realm_core_version}.tar.bz2")
|
||||||
|
set(core_directory "${CMAKE_CURRENT_SOURCE_DIR}${CMAKE_FILES_DIRECTORY}/core-${realm_core_version}")
|
||||||
|
|
||||||
|
set(core_library_debug ${core_directory}/librealm-dbg.a)
|
||||||
|
set(core_library_release ${core_directory}/librealm.a)
|
||||||
|
|
||||||
|
ExternalProject_Add(realm-core
|
||||||
|
URL ${core_url}
|
||||||
|
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}${CMAKE_FILES_DIRECTORY}/realm-core
|
||||||
|
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}${CMAKE_FILES_DIRECTORY}
|
||||||
|
SOURCE_DIR ${core_directory}
|
||||||
|
BUILD_BYPRODUCTS ${core_library_debug} ${core_library_release}
|
||||||
|
USES_TERMINAL_DOWNLOAD 1
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND "")
|
||||||
|
|
||||||
|
add_library(realm STATIC IMPORTED)
|
||||||
|
add_dependencies(realm realm-core)
|
||||||
|
set_property(TARGET realm PROPERTY IMPORTED_LOCATION_DEBUG ${core_library_debug})
|
||||||
|
set_property(TARGET realm PROPERTY IMPORTED_LOCATION_RELEASE ${core_library_release})
|
||||||
|
set_property(TARGET realm PROPERTY IMPORTED_LOCATION ${core_library_release})
|
||||||
|
|
||||||
|
set(REALM_CORE_INCLUDE_DIR ${core_directory}/include PARENT_SCOPE)
|
||||||
|
endfunction()
|
|
@ -0,0 +1,32 @@
|
||||||
|
project(realm-object-store)
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.0)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
|
||||||
|
|
||||||
|
include(CompilerFlags)
|
||||||
|
|
||||||
|
include(RealmCore)
|
||||||
|
download_realm_core(0.95.5)
|
||||||
|
|
||||||
|
include_directories(${REALM_CORE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} impl external/pegtl)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
index_set.cpp
|
||||||
|
list.cpp
|
||||||
|
object_schema.cpp
|
||||||
|
object_store.cpp
|
||||||
|
results.cpp
|
||||||
|
schema.cpp
|
||||||
|
shared_realm.cpp
|
||||||
|
impl/transact_log_handler.cpp
|
||||||
|
parser/parser.cpp
|
||||||
|
parser/query_builder.cpp)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
include_directories(impl/apple)
|
||||||
|
list(APPEND SOURCES impl/apple/external_commit_helper.cpp)
|
||||||
|
find_library(CF_LIBRARY CoreFoundation)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(realm-object-store SHARED ${SOURCES})
|
||||||
|
target_link_libraries(realm-object-store realm ${CF_LIBRARY})
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 49a5b0a49e154b362ef9cf1e756dd8673ddd4efe
|
Loading…
Reference in New Issue