Skip to content

Commit

Permalink
add:for gdal lib (#53)
Browse files Browse the repository at this point in the history
* add:for gdal lib

Signed-off-by: tasty-gumi <[email protected]>

* remove .gitignore dev sh

Signed-off-by: tasty-gumi <[email protected]>

---------

Signed-off-by: tasty-gumi <[email protected]>
  • Loading branch information
tasty-gumi authored Nov 4, 2024
1 parent e8b9d7e commit 39735d6
Show file tree
Hide file tree
Showing 64 changed files with 2,742 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.docker/
**/build
**/build-release
**/build-aux
velox/all/source_subfolder
14 changes: 12 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def system(command):
system("conan export marisa/all marisa/0.2.6@")
system("conan export meson/all meson/1.2.2@")
system("conan export ninja/all ninja/1.11.1@")
system("conan export nlohmann_json/all nlohmann_json/3.11.2@")
system("conan export nlohmann_json/all nlohmann_json/3.11.3@")
system("conan export onetbb/all onetbb/2021.7.0@")
system("conan export onetbb/all onetbb/2021.9.0@")
system("conan export opentelemetry-proto/all opentelemetry-proto/0.19.0@")
Expand All @@ -80,7 +80,17 @@ def system(command):
system("conan export xz_utils/all xz_utils/5.4.0@")
system("conan export yaml-cpp/all yaml-cpp/0.7.0@")
system("conan export zlib/all zlib/1.2.13@")
system("conan export zstd/all zstd/1.5.4@")
system("conan export zstd/all zstd/1.5.5@")
system("conan export b2/portable b2/5.2.1@")
system("conan export cmake/binary cmake/3.30.0@")
system("conan export openssl/3.x.x openssl/3.1.2@")

system("conan export rocksdb/all rocksdb/6.29.5@milvus/dev")
#gdal related
system("conan export json-c/all json-c/0.17@")
system("conan export sqlite3/all sqlite3/3.44.2@")
system("conan export proj/all proj/9.3.1@")
system("conan export libtiff/all libtiff/4.6.0@")
system("conan export libgeotiff/all libgeotiff/1.7.1@")
system("conan export geos/all geos/3.12.0@")
system("conan export gdal/all gdal/3.5.3@")
16 changes: 8 additions & 8 deletions gdal/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class GdalConan(ConanFile):
}
default_options = {
"shared": True,
"fPIC": False,
"fPIC": True,
"tools": False,
"with_armadillo": False,
"with_arrow": True,
Expand All @@ -103,23 +103,23 @@ class GdalConan(ConanFile):
"with_curl": True,
"with_dds": False,
"with_ecw": False,
"with_expat": True,
"with_expat": False,
"with_exr": False,
"with_freexl": False,
"with_geos": True,
"with_gif": True,
"with_gif": False,
"with_gta": False,
"with_hdf4": False,
"with_hdf5": False,
"with_heif": False,
"with_jpeg": "libjpeg",
"with_jpeg": False,
"with_jxl": False,
"with_kea": False,
"with_lerc": False,
"with_libaec": False,
"with_libarchive": False,
"with_libcsf": False,
"with_libdeflate": True,
"with_libdeflate": False,
"with_libiconv": True,
"with_libkml": False,
"with_libtiff": "deprecated",
Expand All @@ -137,14 +137,14 @@ class GdalConan(ConanFile):
"with_pcre2": False,
# "with_pdfium": False,
"with_pg": False,
"with_png": True,
"with_png": False,
"with_podofo": False,
"with_poppler": False,
"with_proj": "deprecated",
"with_publicdecompwt": False,
"with_qhull": True,
"with_qhull": False,
"with_rasterlite2": False,
"with_shapelib": True,
"with_shapelib": False,
"with_spatialite": False,
"with_sqlite3": False,
"with_tiledb": False,
Expand Down
4 changes: 4 additions & 0 deletions geos/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"3.12.0":
url: "https://github.com/libgeos/geos/releases/download/3.12.0/geos-3.12.0.tar.bz2"
sha256: "d96db96011259178a35555a0f6d6e75a739e52a495a6b2aa5efb3d75390fbc39"
156 changes: 156 additions & 0 deletions geos/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd, stdcpp_library
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rmdir, replace_in_file
from conan.tools.scm import Version
import os

required_conan_version = ">=1.54.0"


class GeosConan(ConanFile):
name = "geos"
description = "GEOS is a C++ library for performing operations on two-dimensional vector geometries."
license = "LGPL-2.1"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://libgeos.org/"
topics = ("osgeo", "geometry", "topology", "geospatial")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"inline": [True, False],
"utils": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"inline": True,
"utils": True,
}

@property
def _min_cppstd(self):
return "14" if Version(self.version) >= "3.12.0" else "11"

@property
def _compilers_minimum_version(self):
return {
"14": {
"gcc": "6",
"clang": "5",
"apple-clang": "10",
"Visual Studio": "15",
"msvc": "191",
},
}.get(self._min_cppstd, {})

@property
def _has_inline_option(self):
return Version(self.version) < "3.11.0"

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if not self._has_inline_option:
del self.options.inline

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
if Version(self.version) < "3.11.0":
# these 2 options are declared before project() in geos < 3.11.0
tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.cache_variables["BUILD_BENCHMARKS"] = False
else:
tc.variables["BUILD_BENCHMARKS"] = False
tc.cache_variables["CMAKE_BUILD_TYPE"] = str(self.settings.build_type)
if self._has_inline_option:
tc.variables["DISABLE_GEOS_INLINE"] = not self.options.inline
tc.variables["BUILD_TESTING"] = False
tc.variables["BUILD_DOCUMENTATION"] = False
tc.variables["BUILD_ASTYLE"] = False
tc.variables["BUILD_GEOSOP"] = self.options.utils
tc.generate()

def _patch_sources(self):
# Avoid setting CMAKE_BUILD_TYPE default when multi-config generators are used.
# https://github.com/libgeos/geos/pull/945
if Version(self.version) <= "3.12.1":
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})", "")

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
copy(self, "geos.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "geos")
# Avoid to create unwanted geos::geos target
# (geos_c component overrides this global target and it's fine since it depends on all other components)
self.cpp_info.set_property("cmake_target_name", "GEOS::geos_c")
self.cpp_info.set_property("pkg_config_name", "geos")

self.cpp_info.filenames["cmake_find_package"] = "geos"
self.cpp_info.filenames["cmake_find_package_multi"] = "geos"
self.cpp_info.names["cmake_find_package"] = "GEOS"
self.cpp_info.names["cmake_find_package_multi"] = "GEOS"

# GEOS::geos_cxx_flags
self.cpp_info.components["geos_cxx_flags"].set_property("cmake_target_name", "GEOS::geos_cxx_flags")
self.cpp_info.components["geos_cxx_flags"].defines.append("USE_UNSTABLE_GEOS_CPP_API")
if self.options.get_safe("inline"):
self.cpp_info.components["geos_cxx_flags"].defines.append("GEOS_INLINE")
if self.settings.os == "Windows":
self.cpp_info.components["geos_cxx_flags"].defines.append("TTMATH_NOASM")

# GEOS::geos
self.cpp_info.components["geos_cpp"].set_property("cmake_target_name", "GEOS::geos")
self.cpp_info.components["geos_cpp"].names["cmake_find_package"] = "geos"
self.cpp_info.components["geos_cpp"].names["cmake_find_package_multi"] = "geos"
self.cpp_info.components["geos_cpp"].libs = ["geos"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["geos_cpp"].system_libs.append("m")
if not self.options.shared:
libcxx = stdcpp_library(self)
if libcxx:
self.cpp_info.components["geos_cpp"].system_libs.append(libcxx)
self.cpp_info.components["geos_cpp"].requires = ["geos_cxx_flags"]

# GEOS::geos_c
self.cpp_info.components["geos_c"].set_property("cmake_target_name", "GEOS::geos_c")
self.cpp_info.components["geos_c"].libs = ["geos_c"]
self.cpp_info.components["geos_c"].requires = ["geos_cpp"]

if self.options.utils:
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
7 changes: 7 additions & 0 deletions geos/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C)

find_package(geos CONFIG REQUIRED geos_c)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE GEOS::geos_c)
26 changes: 26 additions & 0 deletions geos/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
37 changes: 37 additions & 0 deletions geos/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <geos_c.h>

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

void notice(const char *fmt, ...) {
va_list ap;

fprintf(stdout, "NOTICE: ");

va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
va_end(ap);
fprintf(stdout, "\n");
}

void log_and_exit(const char *fmt, ...) {
va_list ap;

fprintf(stdout, "ERROR: ");

va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
va_end(ap);
fprintf(stdout, "\n");
exit(1);
}

int main() {
initGEOS(notice, log_and_exit);
printf("GEOS version %s\n", GEOSversion());

finishGEOS();

return EXIT_SUCCESS;
}
8 changes: 8 additions & 0 deletions geos/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)
17 changes: 17 additions & 0 deletions geos/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
4 changes: 4 additions & 0 deletions geos/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
versions:
"3.12.0":
folder: all

4 changes: 4 additions & 0 deletions json-c/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.17":
url: "https://github.com/json-c/json-c/archive/json-c-0.17-20230812.tar.gz"
sha256: "024d302a3aadcbf9f78735320a6d5aedf8b77876c8ac8bbb95081ca55054c7eb"
Loading

0 comments on commit 39735d6

Please sign in to comment.