diff --git a/ports/soil/CMakeLists.txt b/ports/soil/CMakeLists.txt new file mode 100644 index 0000000000..5cee52a600 --- /dev/null +++ b/ports/soil/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.8) + +project(SOIL C) + +option(INSTALL_HEADERS "Install header files" ON) + +set(INSTALL_CMAKE_DIR share/soil) + +add_library(SOIL STATIC + src/image_helper.c + src/stb_image_aug.c + src/image_DXT.c + src/SOIL.c) + +target_include_directories(SOIL INTERFACE $) + +if(INSTALL_HEADERS) + install(TARGETS SOIL + EXPORT SOILTargets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + + install(FILES src/SOIL.h + DESTINATION include/SOIL/) + + # Prepare and install package files + set(SOIL_VERSION "2018.7.7") + + export(TARGETS SOIL FILE "${PROJECT_BINARY_DIR}/SOILTargets.cmake") + + export(PACKAGE SOIL) + + # Create the SOILConfig.cmake and SOILConfigVersion files + configure_file(SOILConfig.cmake.in "${PROJECT_BINARY_DIR}/SOILConfig.cmake" @ONLY) + configure_file(SOILConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SOILConfigVersion.cmake" @ONLY) + + # Install the SOILConfig.cmake and SOILConfigVersion.cmake + install(FILES + "${PROJECT_BINARY_DIR}/SOILConfig.cmake" + "${PROJECT_BINARY_DIR}/SOILConfigVersion.cmake" + DESTINATION "${INSTALL_CMAKE_DIR}") + + # Install the export set for use with the install-tree + install(EXPORT SOILTargets DESTINATION + "${INSTALL_CMAKE_DIR}") +else() + install(TARGETS SOIL + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) +endif() diff --git a/ports/soil/CONTROL b/ports/soil/CONTROL new file mode 100644 index 0000000000..4128570256 --- /dev/null +++ b/ports/soil/CONTROL @@ -0,0 +1,3 @@ +Source: soil +Version: 2008.07.07-1 +Description: Simple OpenGL Image Library diff --git a/ports/soil/LICENSE b/ports/soil/LICENSE new file mode 100644 index 0000000000..22f05fdf9f --- /dev/null +++ b/ports/soil/LICENSE @@ -0,0 +1,6 @@ +https://www.lonesock.net/soil.html + +Simple OpenGL Image Library + +License: +Public Domain diff --git a/ports/soil/SOILConfig.cmake.in b/ports/soil/SOILConfig.cmake.in new file mode 100644 index 0000000000..730e8879fb --- /dev/null +++ b/ports/soil/SOILConfig.cmake.in @@ -0,0 +1,13 @@ +# - Config file for the SOIL package +# It defines the following variables +# SOIL_INCLUDE_DIRS - include directories for SOIL +# SOIL_LIBRARIES - libraries to link against + +# Load targets +get_filename_component(SOIL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +include("${SOIL_CMAKE_DIR}/SOILTargets.cmake") + +# Set properties +get_target_property(SOIL_INCLUDE_DIRS SOIL INTERFACE_INCLUDE_DIRECTORIES) +set(SOIL_LIBRARIES SOIL) +mark_as_advanced(SOIL_INCLUDE_DIRS SOIL_LIBRARIES) diff --git a/ports/soil/SOILConfigVersion.cmake.in b/ports/soil/SOILConfigVersion.cmake.in new file mode 100644 index 0000000000..1e3e04965e --- /dev/null +++ b/ports/soil/SOILConfigVersion.cmake.in @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION "@SOIL_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() diff --git a/ports/soil/portfile.cmake b/ports/soil/portfile.cmake new file mode 100644 index 0000000000..69073e22df --- /dev/null +++ b/ports/soil/portfile.cmake @@ -0,0 +1,29 @@ +include(vcpkg_common_functions) + +set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/Simple OpenGL Image Library") +vcpkg_download_distfile(ARCHIVE + URLS "http://www.lonesock.net/files/soil.zip" + FILENAME "soil-2008.07.07.zip" + SHA512 a575a84aa65b7556320779d635561341f5cf156418d0462473e5d1eb082829be3bcb30600b4887af75aeddd3715de16bdb3ca1668ebaa93eea62bacf22b79548 +) + +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY + ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_LIST_DIR}/SOILConfig.cmake.in + ${CMAKE_CURRENT_LIST_DIR}/SOILConfigVersion.cmake.in + ${CMAKE_CURRENT_LIST_DIR}/LICENSE + DESTINATION ${SOURCE_PATH} +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG -DINSTALL_HEADERS=OFF +) + +vcpkg_install_cmake() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/soil RENAME copyright)