Skip to content

Commit

Permalink
Remove local copies of stb headers, and use a submodule instead
Browse files Browse the repository at this point in the history
  • Loading branch information
cdwfs committed Jan 12, 2020
1 parent 8d11b44 commit 93659f0
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 10,302 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "third_party/stb"]
path = third_party/stb
url = https://github.com/nothings/stb
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -21,3 +21,5 @@ find_library(IMG2KTX_ISPC_TEXCOMP_LIB
DOC "the ispc_texcomp library to link against"
)
target_link_libraries(img2ktx PRIVATE ${IMG2KTX_ISPC_TEXCOMP_LIB})

add_subdirectory(third_party)
20 changes: 16 additions & 4 deletions README.md
Expand Up @@ -3,8 +3,7 @@ img2ktx

img2ktx is a simple command-line utility.

It currently runs on Windows, Linux and MacOS. Use [CMake](https://cmake.org) to generate
a project file for your platform.
It currently runs on Windows, Linux and MacOS.

It loads images with [stb_image](https://github.com/nothings/stb). Supported formats include
JPEG, PNG, BMP, TGA, GIF, etc.
Expand All @@ -20,11 +19,24 @@ It writes the compressed images to a [KTX](https://www.khronos.org/opengles/sdk/
If more than one image is provided with identical dimensions, the output KTX file can be either a
2D texture array or a cubemap.

Compile
-------
img2ktx uses submodules for its dependencies. After cloning the repository, be sure to fetch
these dependencies:
```
$ git submodule update --init
```

Then use [CMake](https://cmake.org) 3.15+ to generate a project file for your platform.

Binaries
--------
Download pre-built binaries from the [Releases](https://github.com/cdwfs/img2ktx/releases) page.

That's it!

It may eventually do the following things as well:
TODO
----
img2ktx may eventually do the following things as well (but no promises):

- Output [DDS](https://msdn.microsoft.com/en-us/library/windows/desktop/bb943991(v=vs.85).aspx) files,
because inevitably somebody is going to ask for it.
Expand Down
4 changes: 2 additions & 2 deletions img2ktx.cpp
Expand Up @@ -2,14 +2,14 @@

#pragma warning(push,3)
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include <stb_image.h>

#pragma warning(disable:4702) // unreachable code
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#define STBI_MALLOC(sz) malloc(sz)
#define STBI_REALLOC(p,newsz) realloc(p,newsz)
#define STBI_FREE(p) free(p)
#include "stb_image_resize.h"
#include <stb_image_resize.h>
#pragma warning(pop)

#include <algorithm>
Expand Down

0 comments on commit 93659f0

Please sign in to comment.