-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf3237c
commit 4cd8034
Showing
15 changed files
with
273 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Test Conan integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
build_type: [Debug, Release] | ||
linkage_is_dynamic: ["True", "False"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Install Conan | ||
id: conan | ||
uses: turtlebrowser/get-conan@main | ||
|
||
- name: Conan version | ||
run: echo "${{ steps.conan.outputs.version }}" | ||
|
||
- name: Conan profile detect | ||
working-directory: . | ||
run: | | ||
conan profile detect | ||
- name: Update Conan profile | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
$profilePath = "$env:USERPROFILE\.conan2\profiles\default" | ||
$content = Get-Content -Path $profilePath | ||
$content = $content -replace 'compiler.cppstd=14', 'compiler.cppstd=17' | ||
$content | Set-Content -Path $profilePath | ||
- name: Conan create | ||
working-directory: . | ||
run: | | ||
conan create . -tf="tests" -s build_type=${{ matrix.build_type }} -o shared=${{ matrix.linkage_is_dynamic }} --build=missing | ||
- name: Open a tmate debug session | ||
if: ${{ failure() }} | ||
uses: mxschmitt/action-tmate@v3 | ||
with: | ||
timeout-minutes: 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import check_min_cppstd, can_run | ||
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps | ||
from conan.tools.scm import Git | ||
|
||
class cpprealmRecipe(ConanFile): | ||
name = "cpprealm" | ||
version = "1.0" | ||
|
||
# Optional metadata | ||
license = "Apache-2.0" | ||
url = "https://github.com/realm/realm-cpp" | ||
description = "Realm is a mobile database that runs directly inside phones, tablets or wearables." | ||
|
||
# Binary configuration | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = {"shared": [True, False]} | ||
default_options = {"shared": False} | ||
|
||
def is_darwin(self): | ||
return self.settings.os == "Macos" or self.settings.os == "iOS" or self.settings.os == "watchOS" | ||
|
||
def validate(self): | ||
check_min_cppstd(self, "17") | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
if not self.is_darwin() and not self.settings.os == "Emscripten": | ||
self.requires("zlib/1.3") | ||
if not self.is_darwin(): | ||
self.requires("openssl/3.2.0") | ||
self.requires("libuv/1.48.0") | ||
if self.settings.os == "Linux": | ||
self.requires("libcurl/8.4.0") | ||
def source(self): | ||
git = Git(self) | ||
git.clone(url="https://github.com/realm/realm-cpp", target=".") | ||
git.folder = "." | ||
git.checkout(commit="507162c8036ff91b5726bdd4d7efbb9d3f5539bc") | ||
git.run("submodule update --init --recursive") | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def generate(self): | ||
deps = CMakeDeps(self) | ||
deps.generate() | ||
tc = CMakeToolchain(self) | ||
tc.variables["USES_CONAN"] = "ON" | ||
tc.variables["REALM_CPP_NO_TESTS"] = "ON" | ||
tc.variables["REALM_CORE_SUBMODULE_BUILD"] = "ON" | ||
tc.variables["REALM_USE_SYSTEM_OPENSSL"] = "ON" | ||
if self.settings.os == "Windows": | ||
self.cpp_info.cxxflags = ["/Zc:preprocessor /bigobj"] | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
def package_info(self): | ||
if self.settings.build_type == "Debug": | ||
self.cpp_info.libs = ["cpprealm-dbg", "realm-object-store-dbg", "realm-parser-dbg", "realm-sync-dbg", "realm-dbg"] | ||
else: | ||
self.cpp_info.libs = ["cpprealm", "realm-object-store", "realm-parser", "realm-sync", "realm"] | ||
if self.is_darwin(): | ||
self.cpp_info.frameworks = ["Foundation", "Security", "Compression", "z"] | ||
if self.settings.os == "Windows": | ||
self.cpp_info.system_libs = ["Version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.