-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add astc-codec/20190617 #2548
Merged
danimtb
merged 4 commits into
conan-io:master
from
FrozenStormInteractive:new/astc-codec/20190617
Aug 28, 2020
Merged
Add astc-codec/20190617 #2548
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(cmake_wrapper) | ||
|
||
include("conanbuildinfo.cmake") | ||
conan_basic_setup() | ||
|
||
add_subdirectory(source_subfolder) |
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,4 @@ | ||
sources: | ||
"cci.20190617": | ||
url: "https://github.com/google/astc-codec/archive/9757befb64db6662aad45de09ca87cd6f599ac02.tar.gz" | ||
sha256: "19034fed68401a612655b026e713c351df8caa768f55ce29a0f628378e988eac" |
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,73 @@ | ||
import os | ||
import glob | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class AstcCodecConan(ConanFile): | ||
name = "astc-codec" | ||
description = " A software ASTC decoder implementation which supports the ASTC LDR profile" | ||
homepage = "https://github.com/google/astc-codec" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
license = "Apache-2.0" | ||
topics = ("conan", "astc", "codec") | ||
settings = "os", "compiler", "arch", "build_type" | ||
options = { | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"fPIC": True, | ||
} | ||
exports_sources = "CMakeLists.txt" | ||
generators = "cmake" | ||
|
||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
intelligide marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def configure(self): | ||
if self.settings.compiler.cppstd: | ||
tools.check_min_cppstd(self, "11") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
extracted_dir = glob.glob("astc-codec-*")[0] | ||
os.rename(extracted_dir, self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.definitions["OPTION_ASTC_TESTS"] = False | ||
self._cmake.configure(build_folder=self._build_subfolder) | ||
return self._cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("LICENSE", src=self._source_subfolder, dst="licenses") | ||
self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) | ||
self.copy("*.lib", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False) | ||
self.copy("*.dll", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False) | ||
self.copy("*.exe", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False) | ||
intelligide marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.copy("*.so*", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False, symlinks=True) | ||
self.copy("*.dylib", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False) | ||
self.copy("*.a", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = tools.collect_libs(self) | ||
|
||
bindir = os.path.join(self.package_folder, "bin") | ||
self.output.info("Appending PATH environment variable: {}".format(bindir)) | ||
self.env_info.PATH.append(bindir) |
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,9 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) | ||
set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) |
Binary file not shown.
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,18 @@ | ||
from conans import ConanFile, CMake, tools | ||
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): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
bees = os.path.join(self.source_folder, "atlas_small_4x4.astc") | ||
self.run("{} {} 256 256".format(bin_path, bees), run_environment=True) |
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,30 @@ | ||
#include <iostream> | ||
#include <vector> | ||
#include <cstdint> | ||
#include <fstream> | ||
#include <string> | ||
|
||
#include <astc-codec/astc-codec.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
if (argc < 4) { | ||
std::cerr << "Need at least three argument\n"; | ||
} | ||
std::ifstream stream(argv[1], std::ios::in | std::ios::binary); | ||
std::vector<uint8_t> astc_data((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>()); | ||
|
||
const size_t width = std::stoi(argv[2]); | ||
const size_t height = std::stoi(argv[3]); | ||
|
||
std::vector<uint8_t> result; | ||
result.resize(width * height * 4); | ||
|
||
bool success = astc_codec::ASTCDecompressToRGBA( | ||
astc_data.data(), astc_data.size(), width, height, astc_codec::FootprintType::k4x4, | ||
result.data(), result.size(), /* stride */ width * 4); | ||
|
||
stream.close(); | ||
|
||
return 0; | ||
} |
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,3 @@ | ||
versions: | ||
"cci.20190617": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there is no shared option? I see no restriction: https://github.com/google/astc-codec/blob/master/src/decoder/CMakeLists.txt#L17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library doesn't export symbols. And
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
introduces some linking errors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I didn't find any reference about this error, but I can reproduce it, so I've opened an issue to the author: google/astc-codec#14