Add STB library as submodule "vendor/stb"
This commit is contained in:
parent
2c303581fe
commit
302414b7a4
5 changed files with 75 additions and 2 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -5,3 +5,6 @@
|
|||
[submodule "vendor/glm"]
|
||||
path = vendor/glm
|
||||
url = https://github.com/g-truc/glm.git
|
||||
[submodule "vendor/stb"]
|
||||
path = vendor/stb
|
||||
url = https://github.com/nothings/stb.git
|
||||
|
|
|
@ -5,7 +5,7 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "build")
|
|||
|
||||
project (Matabstrix)
|
||||
add_definitions ("-std=c++14 -Wall -Wextra")
|
||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--embed-file data -s STB_IMAGE=1 -s TOTAL_MEMORY=67108864")
|
||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--embed-file data -s TOTAL_MEMORY=67108864")
|
||||
|
||||
file (GLOB_RECURSE sources "src/**.cpp"
|
||||
"examples/**.cpp")
|
||||
|
@ -16,3 +16,6 @@ set_target_properties (matabstrix PROPERTIES OUTPUT_NAME "index")
|
|||
|
||||
find_package (GLM REQUIRED)
|
||||
include_directories (${GLM_INCLUDE_DIRS})
|
||||
|
||||
find_package (STB REQUIRED)
|
||||
include_directories (${STB_INCLUDE_DIRS})
|
||||
|
|
64
cmake/Modules/FindSTB.cmake
Normal file
64
cmake/Modules/FindSTB.cmake
Normal file
|
@ -0,0 +1,64 @@
|
|||
# FindSTB - attempts to locate the stb single-file public domain
|
||||
# libraries for C/C++
|
||||
#
|
||||
# This module defines the following variables (on success):
|
||||
# STB_INCLUDE_DIRS - where to find stb_image.h
|
||||
# STB_FOUND - if the library was successfully located
|
||||
#
|
||||
# It is trying a few standard installation locations, but can be customized
|
||||
# with the following variables:
|
||||
# STB_ROOT_DIR - root directory of a stb installation
|
||||
# Headers are expected to be found in either:
|
||||
# <STB_ROOT_DIR>/stb_image.h OR
|
||||
# <STB_ROOT_DIR>/include/stb_image.h
|
||||
# This variable can either be a cmake or environment
|
||||
# variable. Note however that changing the value
|
||||
# of the environment varible will NOT result in
|
||||
# re-running the header search and therefore NOT
|
||||
# adjust the variables set by this module.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2012 Carsten Neumann
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# default search dirs
|
||||
SET(_stb_HEADER_SEARCH_DIRS
|
||||
"/usr/include"
|
||||
"/usr/local/include")
|
||||
|
||||
# check environment variable
|
||||
SET(_stb_ENV_ROOT_DIR "$ENV{STB_ROOT_DIR}")
|
||||
|
||||
IF(NOT STB_ROOT_DIR AND _stb_ENV_ROOT_DIR)
|
||||
SET(STB_ROOT_DIR "${_stb_ENV_ROOT_DIR}")
|
||||
ENDIF(NOT STB_ROOT_DIR AND _stb_ENV_ROOT_DIR)
|
||||
|
||||
# put user specified location at beginning of search
|
||||
IF(STB_ROOT_DIR)
|
||||
SET(_stb_HEADER_SEARCH_DIRS "${STB_ROOT_DIR}"
|
||||
"${STB_ROOT_DIR}/include"
|
||||
${_stb_HEADER_SEARCH_DIRS})
|
||||
ENDIF(STB_ROOT_DIR)
|
||||
|
||||
# locate header
|
||||
FIND_PATH(STB_INCLUDE_DIR "stb_image.h"
|
||||
PATHS ${_stb_HEADER_SEARCH_DIRS})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(STB DEFAULT_MSG
|
||||
STB_INCLUDE_DIR)
|
||||
|
||||
IF(STB_FOUND)
|
||||
SET(STB_INCLUDE_DIRS "${STB_INCLUDE_DIR}")
|
||||
|
||||
MESSAGE(STATUS "STB_INCLUDE_DIR = ${STB_INCLUDE_DIR}")
|
||||
ENDIF(STB_FOUND)
|
4
configure
vendored
4
configure
vendored
|
@ -3,7 +3,9 @@
|
|||
VENDOR="vendor"
|
||||
|
||||
GLM="$VENDOR/glm"
|
||||
STB="$VENDOR/stb"
|
||||
|
||||
cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$EMSCRIPTEN/cmake/Modules/Platform/Emscripten.cmake" \
|
||||
-DGLM_INCLUDE_DIR="$GLM"
|
||||
-DGLM_INCLUDE_DIR="$GLM" \
|
||||
-DSTB_INCLUDE_DIR="$STB"
|
||||
|
|
1
vendor/stb
vendored
Submodule
1
vendor/stb
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 5809508de3329c992d4d8dea03a8be7e1a0d0f35
|
Reference in a new issue