text: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  from conans import ConanFile, CMake, tools
  import os
  
  
  class LibnameConan(ConanFile):
      name = "assimp"
      version = "4.1.0"
      description = "Open Asset Import Library. Loads 40+ 3D file formats into one unified and clean data structure."
      url = "https://github.com/Nulifier/conan-assimp"
      homepage = "http://assimp.sourceforge.net/" 
      
      # Indicates License type of the packaged library
      license = "BSD 3-Clause"
  
      # Packages the license for the conanfile.py
      exports = ["LICENSE.md"]
  
      # Remove following lines if the target lib does not use cmake.
      exports_sources = ["CMakeLists.txt"]
      generators = "cmake"
  
      # Options may need to change depending on the packaged library.
      settings = "os", "arch", "compiler", "build_type"
      options = {"shared": [True, False], "fPIC": [True, False], "noExport": [True, False]}
      default_options = "shared=False", "fPIC=True", "noExport=False"
  
      # Custom attributes for Bincrafters recipe conventions
      source_subfolder = "source_subfolder"
      build_subfolder = "build_subfolder"
  
      # Use version ranges for dependencies unless there's a reason not to
      # Update 2/9/18 - Per conan team, ranges are slow to resolve.
      # So, with libs like zlib, updates are very rare, so we now use static version
      
      
      requires = (
          "zlib/1.2.11@conan/stable"
      )
  
      def configure(self):
          if self.settings.os == 'Windows':
              del self.options.fPIC
  
      def source(self):
          source_url = "https://github.com/assimp/assimp"
          tools.get("{0}/archive/v{1}.tar.gz".format(source_url, self.version))
          extracted_dir = self.name + "-" + self.version
  
          #Rename to "source_subfolder" is a convention to simplify later steps
          os.rename(extracted_dir, self.source_subfolder)
  
      def configure_cmake(self):
          cmake = CMake(self)
          cmake.definitions["ASSIMP_OPT_BUILD_PACKAGES"] = False
          cmake.definitions["ASSIMP_NO_EXPORT"] = self.options.noExport
          cmake.definitions["ASSIMP_BUILD_ASSIMP_TOOLS"] = False
          cmake.definitions["ASSIMP_BUILD_TESTS"] = False
          cmake.definitions["ASSIMP_INSTALL_PDB"] = False
  
          if self.settings.os != 'Windows':
              cmake.definitions['CMAKE_POSITION_INDEPENDENT_CODE'] = self.options.fPIC
          cmake.configure(build_folder=self.build_subfolder)
          return cmake
  
      def build(self):
          cmake = self.configure_cmake()
          cmake.build()
  
      def package(self):
          self.copy(pattern="LICENSE", dst="license", src=self.source_subfolder)
          cmake = self.configure_cmake()
          cmake.install()
          # If the CMakeLists.txt has a proper install method, the steps below may be redundant
          # If so, you can just remove the lines below
          #include_folder = os.path.join(self.source_subfolder, "include")
          #self.copy(pattern="*", dst="include", src=include_folder)
          #self.copy(pattern="*.dll", dst="bin", keep_path=False)
          #self.copy(pattern="*.lib", dst="lib", keep_path=False)
          #self.copy(pattern="*.a", dst="lib", keep_path=False)
          #self.copy(pattern="*.so*", dst="lib", keep_path=False)
          #self.copy(pattern="*.dylib", dst="lib", keep_path=False)
  
      def package_info(self):
          self.cpp_info.libs = tools.collect_libs(self)
  