forked from jkuhlmann/cgltf
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from elisemorysc/hunter-1.9
Hunter 1.9
- Loading branch information
Showing
3 changed files
with
101 additions
and
0 deletions.
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,82 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(cgltf LANGUAGES C CXX VERSION 1.7) | ||
|
||
# Introduce variables: | ||
# * CMAKE_INSTALL_LIBDIR | ||
# * CMAKE_INSTALL_BINDIR | ||
# * CMAKE_INSTALL_INCLUDEDIR | ||
include(GNUInstallDirs) | ||
|
||
option(BUILD_AS_LIBRARY "Build library" FALSE) | ||
option(BUILD_SHARED_LIBS "Build shared libraries" FALSE) | ||
option(BUILD_TESTS "Build tests" FALSE) | ||
|
||
if(MSVC AND BUILD_SHARED_LIBS) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | ||
endif() | ||
|
||
set(CGLTF_SRC_LIST cgltf.c) | ||
set(CGLTF_HDR_LIST cgltf.h cgltf_write.h) | ||
if(BUILD_AS_LIBRARY) | ||
if(BUILD_SHARED_LIBS) | ||
add_library(cgltf SHARED ${CGLTF_SRC_LIST} ${CGLTF_HDR_LIST}) | ||
else() | ||
add_library(cgltf STATIC ${CGLTF_SRC_LIST} ${CGLTF_HDR_LIST}) | ||
endif() | ||
else() | ||
add_library(cgltf INTERFACE) | ||
endif() | ||
target_include_directories(cgltf INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}> | ||
) | ||
|
||
if(BUILD_TESTS) | ||
add_subdirectory(test) | ||
endif() | ||
|
||
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 cgltf | ||
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 ${CGLTF_HDR_LIST} | ||
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}" | ||
) |
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 @@ | ||
#define CGLTF_IMPLEMENTATION | ||
#define CGLTF_WRITE_IMPLEMENTATION | ||
#include "cgltf_write.h" |
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 @@ | ||
# 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@") |