Squashed 'third_party/flatbuffers/' content from commit acc9990ab
Change-Id: I48550d40d78fea996ebe74e9723a5d1f910de491
git-subtree-dir: third_party/flatbuffers
git-subtree-split: acc9990abd2206491480291b0f85f925110102ea
diff --git a/conan/CMakeLists.txt b/conan/CMakeLists.txt
new file mode 100644
index 0000000..d32a013
--- /dev/null
+++ b/conan/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.8)
+
+message(STATUS "Conan FlatBuffers Wrapper")
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+if (WIN32 AND MSVC AND FLATBUFFERS_BUILD_SHAREDLIB)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+endif(WIN32 AND MSVC AND FLATBUFFERS_BUILD_SHAREDLIB)
+
+include(${CMAKE_SOURCE_DIR}/CMakeListsOriginal.txt)
diff --git a/conan/appveyor/build.py b/conan/appveyor/build.py
new file mode 100644
index 0000000..9bac46d
--- /dev/null
+++ b/conan/appveyor/build.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import os
+
+if os.getenv("APPVEYOR_REPO_TAG") != "true":
+ print("Skip build step. It's not TAG")
+else:
+ os.system("python conan/build.py")
diff --git a/conan/appveyor/install.py b/conan/appveyor/install.py
new file mode 100644
index 0000000..962c7da
--- /dev/null
+++ b/conan/appveyor/install.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import os
+
+if os.getenv("APPVEYOR_REPO_TAG") != "true":
+ print("Skip step. It's not TAG")
+else:
+ os.system("pip install conan conan-package-tools")
diff --git a/conan/build.py b/conan/build.py
new file mode 100644
index 0000000..5545631
--- /dev/null
+++ b/conan/build.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import os
+import re
+import subprocess
+from cpt.packager import ConanMultiPackager
+
+
+def set_appveyor_environment():
+ if os.getenv("APPVEYOR") is not None:
+ compiler_version = os.getenv("CMAKE_VS_VERSION").split(" ")[0].replace('"', '')
+ os.environ["CONAN_VISUAL_VERSIONS"] = compiler_version
+ os.environ["CONAN_STABLE_BRANCH_PATTERN"] = "master"
+ ci_platform = os.getenv("Platform").replace('"', '')
+ ci_platform = "x86" if ci_platform == "x86" else "x86_64"
+ os.environ["CONAN_ARCHS"] = ci_platform
+ os.environ["CONAN_BUILD_TYPES"] = os.getenv("Configuration").replace('"', '')
+
+
+def get_branch():
+ try:
+ for line in subprocess.check_output("git branch", shell=True).decode().splitlines():
+ line = line.strip()
+ if line.startswith("*") and " (HEAD detached" not in line:
+ return line.replace("*", "", 1).strip()
+ return ""
+ except Exception:
+ pass
+ return ""
+
+
+def get_version():
+ version = get_branch()
+ if os.getenv("TRAVIS", False):
+ version = os.getenv("TRAVIS_BRANCH")
+
+ if os.getenv("APPVEYOR", False):
+ version = os.getenv("APPVEYOR_REPO_BRANCH")
+ if os.getenv("APPVEYOR_REPO_TAG") == "true":
+ version = os.getenv("APPVEYOR_REPO_TAG_NAME")
+
+ match = re.search(r"v(\d+\.\d+\.\d+.*)", version)
+ if match:
+ return match.group(1)
+ return version
+
+
+def get_reference(username):
+ return "flatbuffers/{}@google/stable".format(get_version())
+
+
+if __name__ == "__main__":
+ login_username = os.getenv("CONAN_LOGIN_USERNAME", "aardappel")
+ username = os.getenv("CONAN_USERNAME", "google")
+ upload = os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/aardappel/flatbuffers")
+ stable_branch_pattern = os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+.*")
+ test_folder = os.getenv("CPT_TEST_FOLDER", os.path.join("conan", "test_package"))
+ upload_only_when_stable = os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True)
+ set_appveyor_environment()
+
+ builder = ConanMultiPackager(reference=get_reference(username),
+ username=username,
+ login_username=login_username,
+ upload=upload,
+ stable_branch_pattern=stable_branch_pattern,
+ upload_only_when_stable=upload_only_when_stable,
+ test_folder=test_folder)
+ builder.add_common_builds(pure_c=False)
+ builder.run()
diff --git a/conan/test_package/CMakeLists.txt b/conan/test_package/CMakeLists.txt
new file mode 100644
index 0000000..9c1c78c
--- /dev/null
+++ b/conan/test_package/CMakeLists.txt
@@ -0,0 +1,9 @@
+project(test_package CXX)
+cmake_minimum_required(VERSION 2.8.11)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
diff --git a/conan/test_package/conanfile.py b/conan/test_package/conanfile.py
new file mode 100644
index 0000000..735e31d
--- /dev/null
+++ b/conan/test_package/conanfile.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from conans import ConanFile, CMake
+import os
+
+
+class TestPackageConan(ConanFile):
+ settings = "os", "compiler", "build_type", "arch"
+ generators = "cmake"
+
+ def build(self):
+ cmake = CMake(self)
+ cmake.configure()
+ cmake.build()
+
+ def test(self):
+ bin_path = os.path.join("bin", "test_package")
+ self.run(bin_path, run_environment=True)
+ self.run("flatc --version", run_environment=True)
+ self.run("flathash fnv1_16 conan", run_environment=True)
diff --git a/conan/test_package/test_package.cpp b/conan/test_package/test_package.cpp
new file mode 100644
index 0000000..df7d577
--- /dev/null
+++ b/conan/test_package/test_package.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2018 Google Inc. All rights reserved.
+ *
+ * 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.
+ */
+
+#include <cstdlib>
+#include <iostream>
+#include "flatbuffers/util.h"
+
+// Test to validate Conan package generated
+
+int main(int /*argc*/, const char * /*argv*/ []) {
+
+ const std::string filename("conanbuildinfo.cmake");
+
+ if (flatbuffers::FileExists(filename.c_str())) {
+ std::cout << "File " << filename << " exists.\n";
+ } else {
+ std::cout << "File " << filename << " does not exist.\n";
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/conan/travis/build.sh b/conan/travis/build.sh
new file mode 100755
index 0000000..069ced2
--- /dev/null
+++ b/conan/travis/build.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "$(uname -s)" == 'Darwin' ]]; then
+ if which pyenv > /dev/null; then
+ eval "$(pyenv init -)"
+ fi
+ pyenv activate conan
+fi
+
+conan user
+python conan/build.py
diff --git a/conan/travis/install.sh b/conan/travis/install.sh
new file mode 100755
index 0000000..f4208d8
--- /dev/null
+++ b/conan/travis/install.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "$(uname -s)" == 'Darwin' ]]; then
+ brew update || brew update
+ brew outdated pyenv || brew upgrade pyenv
+ brew install pyenv-virtualenv
+ brew install cmake || true
+
+ if which pyenv > /dev/null; then
+ eval "$(pyenv init -)"
+ fi
+
+ pyenv install 2.7.10
+ pyenv virtualenv 2.7.10 conan
+ pyenv rehash
+ pyenv activate conan
+fi
+
+pip install -U conan_package_tools conan