[soil2] Add new package soil2 (#5554)

This commit is contained in:
Jacob 2019-03-06 11:32:25 -08:00 committed by Victor Romero
parent 8e65c10058
commit f6f2def009
6 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,90 @@
cmake_minimum_required(VERSION 3.9)
# Create the soil2 project
project("soil2" LANGUAGES C)
find_package(OpenGL)
# Do we want to install the headers?
option(INSTALL_HEADERS "Install header files" ON)
# Set the install dir
set(INSTALL_CMAKE_DIR share/soil2)
# Set the source files to compile
set(SOIL2_SRC
src/SOIL2/etc1_utils.c
src/SOIL2/image_DXT.c
src/SOIL2/image_helper.c
src/SOIL2/SOIL2.c
)
# Set the soil2 headers
set(SOIL2_HEADERS
src/SOIL2/SOIL2.h
src/SOIL2/etc1_utils.h
src/SOIL2/image_DXT.h
src/SOIL2/image_helper.h
src/SOIL2/jo_jpeg.h
src/SOIL2/pkm_helper.h
src/SOIL2/pvr_helper.h
src/SOIL2/stb_image.h
src/SOIL2/stb_image_write.h
src/SOIL2/stbi_DDS.h
src/SOIL2/stbi_ext.h
src/SOIL2/stbi_pkm.h
src/SOIL2/stbi_pvr.h
)
# Add the library as a static linkage
add_library(soil2 STATIC ${SOIL2_SRC})
# The include dir
target_include_directories(soil2 INTERFACE $<INSTALL_INTERFACE:include>)
# link opengl32
target_link_libraries(soil2 PRIVATE ${OPENGL_gl_LIBRARY})
# If its msvc mute the secure warnings
if(MSVC)
target_compile_definitions(soil2 PRIVATE _CRT_SECURE_NO_WARNINGS)
endif(MSVC)
if(INSTALL_HEADERS)
# Install the library object
install(TARGETS soil2 EXPORT soil2Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
# Install the headers
install(FILES ${SOIL2_HEADERS}
DESTINATION include/SOIL2/)
# Prepare for install package files
set(SOIL2_VERSION "release-1.11")
# Export the stuff
export(TARGETS soil2 FILE "${PROJECT_BINARY_DIR}/soil2Targets.cmake")
export(PACKAGE soil2)
# Create the soil2Config.cmake and soil2ConfigVersion.cmake
configure_file(soil2Config.cmake.in "${PROJECT_BINARY_DIR}/soil2Config.cmake" @ONLY)
configure_file(soil2ConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/soil2ConfigVersion.cmake" @ONLY)
# Install the soil2Config.cmake and soil2ConfigVersion.cmake
install(FILES
"${PROJECT_BINARY_DIR}/soil2Config.cmake"
"${PROJECT_BINARY_DIR}/soil2ConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}"
)
# Install the export set for use with the install-tree
install(EXPORT soil2Targets DESTINATION "${INSTALL_CMAKE_DIR}")
else(INSTALL_HEADERS)
# Install the library object
install(TARGETS soil2 EXPORT soil2
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
endif(INSTALL_HEADERS)

3
ports/soil2/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: soil2
Version: release-1.11
Description: Simple OpenGL Image Library 2

7
ports/soil2/LICENSE Normal file
View File

@ -0,0 +1,7 @@
Copyright 2018 Matrin Lucas Golini
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,33 @@
include(vcpkg_common_functions)
# Download the release-1.11 from bitbucket
vcpkg_from_bitbucket(
OUT_SOURCE_PATH SOURCE_PATH
REPO SpartanJ/soil2
REF release-1.11
SHA512 203c2306fd72e24b9e990cb054f3b1b0391eaf26ed645842fb381971673dab8ea20c2739c8dff1fc11c83d6f66add0ad77ae79d8ff68930e3e1cb003e34f2414
HEAD_REF master
)
# Copy the CMakeLists and LICENSE
file(
COPY
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
${CMAKE_CURRENT_LIST_DIR}/LICENSE
${CMAKE_CURRENT_LIST_DIR}/soil2Config.cmake.in
${CMAKE_CURRENT_LIST_DIR}/soil2ConfigVersion.cmake.in
DESTINATION ${SOURCE_PATH}
)
# Configure the cmake file (we imported)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG -DINSTALL_HEADERS=OFF
)
# Run the install
vcpkg_install_cmake()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/soil2 RENAME copyright)

View File

@ -0,0 +1,13 @@
# - Config file for the soil2 package
# It defines the following variables
# SOIL2_INCLUDE_DIRS - include directories for SOIL2
# SOIL2_LIBRARIES - libraries to link against
# Load targets
get_filename_component(SOIL2_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${SOIL2_CMAKE_DIR}/soil2Targets.cmake")
# Set properties
get_target_property(SOIL2_INCLUDE_DIRS soil2 INTERFACE_INCLUDE_DIRECTORIES)
set(SOIL2_LIBRARIES soil2)
mark_as_advanced(SOIL2_INCLUDE_DIRS SOIL2_LIBRARIES)

View File

@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@SOIL2_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()