From bcf04f3979e776c82bce4036c6edbc4d9849b7a5 Mon Sep 17 00:00:00 2001 From: Rahul Sheth Date: Mon, 5 Aug 2019 16:37:03 -0400 Subject: [PATCH] Hunterize xatlas --- CMakeLists.txt | 69 +++++++++++++++++++++++++++++++++++++++++++ cmake/Config.cmake.in | 16 ++++++++++ 2 files changed, 85 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/Config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..545e7b29 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.0) + +# Project is not versioned, so use date of last upstream commit. +project(xatlas LANGUAGES CXX VERSION "0.0.0") + +set(XATLAS_SRC "xatlas.cpp") + +set(XATLAS_HEADERS "xatlas.h") + +add_library(xatlas ${XATLAS_SRC} ${XATLAS_HEADERS}) + +target_include_directories( + xatlas + PUBLIC + "$" +) + +target_compile_definitions(xatlas PUBLIC "XA_DEBUG=$") + +# Introduce variables: +# * CMAKE_INSTALL_LIBDIR +# * CMAKE_INSTALL_BINDIR +# * CMAKE_INSTALL_INCLUDEDIR +include(GNUInstallDirs) + +set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake") +set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake") + +set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + +set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") +set(NAMESPACE "${PROJECT_NAME}::") + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${VERSION_CONFIG}" COMPATIBILITY ExactVersion +) + +configure_package_config_file( + "cmake/Config.cmake.in" + "${PROJECT_CONFIG}" + INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}" +) + +install( + TARGETS xatlas + EXPORT "${TARGETS_EXPORT_NAME}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) + +install( + FILES ${XATLAS_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} +) + +install( + FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" + DESTINATION "${CONFIG_INSTALL_DIR}" +) + +install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${NAMESPACE}" + DESTINATION "${CONFIG_INSTALL_DIR}" +) diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in new file mode 100644 index 00000000..84bc1ba1 --- /dev/null +++ b/cmake/Config.cmake.in @@ -0,0 +1,16 @@ +# Copyright (c) 2016, Ruslan Baratov +# +# Licensed under the MIT License (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://opensource.org/licenses/MIT +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +check_required_components("@PROJECT_NAME@") \ No newline at end of file