-
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 mikktspace 20200325 #2899
Merged
conan-center-bot
merged 5 commits into
conan-io:master
from
FrozenStormInteractive:new/mikktspace/20200325
Sep 18, 2020
Merged
Add mikktspace 20200325 #2899
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0e66d01
Add mikktspace 20200325
intelligide d037ab1
mikktspace: Fix recipe
intelligide 9bd8a58
mikktspace: Link m
intelligide cca6cfc
Apply suggestions from code review
intelligide bde27f1
Apply suggestions from code review
intelligide 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,22 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(mikktspace) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
if(WIN32 AND BUILD_SHARED_LIBS) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
endif() | ||
|
||
add_library(mikktspace ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/mikktspace.c) | ||
target_include_directories(mikktspace PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) | ||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") | ||
target_link_libraries(mikktspace PRIVATE m) | ||
endif() | ||
|
||
install(TARGETS mikktspace | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/mikktspace.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
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.20200325": | ||
url: "https://github.com/mmikk/MikkTSpace/archive/3e895b49d05ea07e4c2133156cfa94369e19e409.tar.gz" | ||
sha256: "aeba65ddee85a679133d510d71d00b108f603752f90b15b9ecf7777033f6e351" |
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,75 @@ | ||
import os | ||
import glob | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class MikkTSpaceConan(ConanFile): | ||
name = "mikktspace" | ||
description = " A common standard for tangent space used in baking tools to produce normal maps." | ||
homepage = "https://github.com/mmikk/MikkTSpace" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
license = "Zlib" | ||
topics = ("conan", "tangent", "space", "normal") | ||
|
||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"fPIC": [True, False], | ||
"shared": [True, False], | ||
} | ||
default_options = { | ||
"fPIC": True, | ||
"shared": False | ||
} | ||
|
||
generators = "cmake" | ||
exports_sources = ['CMakeLists.txt'] | ||
|
||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
extracted_dir = glob.glob('MikkTSpace-*/')[0] | ||
os.rename(extracted_dir, self._source_subfolder) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
del self.settings.compiler.cppstd | ||
del self.settings.compiler.libcxx | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.configure() | ||
return self._cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
@property | ||
def _extracted_license(self): | ||
content_lines = open(os.path.join(self.source_folder, self._source_subfolder, "mikktspace.h")).readlines() | ||
license_content = [] | ||
for i in range(4, 21): | ||
license_content.append(content_lines[i][4:-1]) | ||
return "\n".join(license_content) | ||
|
||
def package(self): | ||
tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._extracted_license) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["mikktspace"] | ||
if self.settings.os == "Linux": | ||
self.cpp_info.system_libs = ["m"] |
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) | ||
|
||
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}) | ||
|
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,16 @@ | ||
import os | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake_find_package", "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
self.run(os.path.join("bin", "test_package"), 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,26 @@ | ||
#include <assert.h> | ||
#include <stdbool.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <string.h> | ||
|
||
#include <mikktspace.h> | ||
|
||
static int GetNumFaces(const SMikkTSpaceContext *pContext) | ||
{ | ||
return 0; | ||
} | ||
|
||
int main() | ||
{ | ||
SMikkTSpaceInterface sInterface = {NULL}; | ||
sInterface.m_getNumFaces = GetNumFaces; | ||
|
||
SMikkTSpaceContext sContext = {NULL}; | ||
sContext.m_pInterface = &sInterface; | ||
|
||
genTangSpaceDefault(&sContext); | ||
|
||
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.20200325": | ||
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.
What if the file changes?
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.
It's an unmaintained project. I don't think this will change in the future.