-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ffmpeg/fix-android
- Loading branch information
Showing
35 changed files
with
213 additions
and
519 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
sources: | ||
"2.3.1": | ||
url: "https://github.com/erincatto/Box2D/archive/v2.3.1.zip" | ||
sha256: "8ddd947400c59bcf09774bd75787e6253098a0bd337f5c61dae38b91aea678cf" | ||
"2.4.2": | ||
url: "https://github.com/erincatto/box2d/archive/refs/tags/v2.4.2.tar.gz" | ||
sha256: "85b9b104d256c985e6e244b4227d447897fac429071cc114e5cc819dae848852" | ||
"2.4.1": | ||
url: "https://github.com/erincatto/box2d/archive/refs/tags/v2.4.1.tar.gz" | ||
sha256: "d6b4650ff897ee1ead27cf77a5933ea197cbeef6705638dd181adc2e816b23c2" | ||
"2.4.0": | ||
url: "https://github.com/erincatto/Box2D/archive/v2.4.0.zip" | ||
sha256: "6aebbc54c93e367c97e382a57ba12546731dcde51526964c2ab97dec2050f8b9" | ||
patches: | ||
"2.4.0": | ||
- patch_file: "patches/0001-install-and-allow-shared.patch" | ||
patch_description: "add install, allow shared build" | ||
patch_type: "conan" |
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 |
---|---|---|
@@ -1,68 +1,73 @@ | ||
import os | ||
from conan import ConanFile, tools | ||
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout | ||
from conan import ConanFile | ||
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir, copy | ||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
from conan.tools.scm import Version | ||
|
||
required_conan_version = ">=1.46.0" | ||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class Box2dConan(ConanFile): | ||
name = "box2d" | ||
license = "Zlib" | ||
description = "Box2D is a 2D physics engine for games" | ||
topics = ("physics", "engine", "game development") | ||
homepage = "http://box2d.org/" | ||
license = "Zlib" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = {"shared": [True, False], | ||
"fPIC": [True, False]} | ||
default_options = {"shared": False, "fPIC": True,} | ||
homepage = "http://box2d.org/" | ||
topics = ("physics-engine", "graphic", "2d", "collision") | ||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False] | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True | ||
} | ||
|
||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
try: | ||
del self.options.fPIC | ||
except Exception: | ||
pass | ||
self.options.rm_safe("fPIC") | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
try: | ||
del self.options.fPIC | ||
except Exception: | ||
pass | ||
self.options.rm_safe("fPIC") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="Box2D") | ||
cmake_layout(self, src_folder="src") | ||
|
||
def source(self): | ||
tools.files.get(self, | ||
**self.conan_data["sources"][self.version], | ||
strip_root=True) | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["BOX2D_BUILD_SHARED"] = self.options.shared | ||
tc.variables["BOX2D_BUILD_STATIC"] = not self.options.shared | ||
if self.settings.os == "Windows" and self.options.shared: | ||
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True | ||
tc.variables["BOX2D_BUILD_EXAMPLES"] = False | ||
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" | ||
tc.variables["BOX2D_BUILD_TESTBED"] = False | ||
tc.variables["BOX2D_BUILD_UNIT_TESTS"] = False | ||
tc.generate() | ||
|
||
def build(self): | ||
apply_conandata_patches(self) | ||
cmake = CMake(self) | ||
cmake.configure(build_script_folder="Box2D") | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
tools.files.copy(self, "License.txt", src=os.path.join(self.source_folder, "Box2D"), dst=os.path.join(self.package_folder,"licenses")) | ||
tools.files.copy(self, os.path.join("Box2D", "*.h"), src=os.path.join(self.source_folder, "Box2D"), dst=os.path.join(self.package_folder, "include")) | ||
tools.files.copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) | ||
tools.files.copy(self, "*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) | ||
tools.files.copy(self, "*.so*", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) | ||
tools.files.copy(self, "*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) | ||
tools.files.copy(self, "*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) | ||
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.install() | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
rm(self, "*.pdb", self.package_folder, recursive=True) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["Box2D"] | ||
if self.settings.os in ("FreeBSD", "Linux"): | ||
self.cpp_info.system_libs = ["m"] | ||
self.cpp_info.names["cmake_find_package"] = "box2d" | ||
self.cpp_info.names["cmake_find_package_multi"] = "box2d" | ||
self.cpp_info.libs = ["box2d"] | ||
if Version(self.version) >= "2.4.1" and self.options.shared: | ||
self.cpp_info.defines.append("B2_SHARED") | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("m") |
File renamed without changes.
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(test_package) | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(box2d) | ||
find_package(box2d REQUIRED CONFIG) | ||
|
||
add_executable(test_package test_package.cpp) | ||
target_link_libraries(test_package box2d::box2d) | ||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE box2d::box2d) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
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.