diff --git a/libs/gltfio/CMakeLists.txt b/libs/gltfio/CMakeLists.txt index 78df781f0c..38bb0b6734 100644 --- a/libs/gltfio/CMakeLists.txt +++ b/libs/gltfio/CMakeLists.txt @@ -30,6 +30,7 @@ set(SRCS src/Wireframe.h src/math.h src/upcast.h + src/Image.cpp ) # ================================================================================================== diff --git a/third_party/stb/stb.c b/libs/gltfio/src/Image.cpp similarity index 100% rename from third_party/stb/stb.c rename to libs/gltfio/src/Image.cpp diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 3f057eca3f..2d889fb881 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -205,7 +205,9 @@ set(APP_SRCS app/FilamentApp.cpp app/IBL.cpp app/IcoSphere.cpp - app/Sphere.cpp) + app/Sphere.cpp + app/Image.cpp + ) if (APPLE) list(APPEND APP_SRCS app/NativeWindowHelperCocoa.mm) diff --git a/samples/app/Image.cpp b/samples/app/Image.cpp new file mode 100644 index 0000000000..00a5c61963 --- /dev/null +++ b/samples/app/Image.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +#define STBI_NO_BMP +#define STBI_NO_PSD +#define STBI_NO_TGA +#define STBI_NO_GIF +#define STBI_NO_HDR +#define STBI_NO_PIC +#define STBI_NO_PNM + +#define STB_IMAGE_IMPLEMENTATION +#include diff --git a/third_party/stb/tnt/CMakeLists.txt b/third_party/stb/tnt/CMakeLists.txt index 8a9852db6c..d01328c95d 100644 --- a/third_party/stb/tnt/CMakeLists.txt +++ b/third_party/stb/tnt/CMakeLists.txt @@ -2,18 +2,12 @@ cmake_minimum_required(VERSION 3.10) project(stb) set(TARGET stb) - set(OUR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) - set(PUBLIC_HDR_DIR ${OUR_DIR}) +add_library(${TARGET} INTERFACE) + +target_include_directories(${TARGET} INTERFACE ${PUBLIC_HDR_DIR}) + file(GLOB_RECURSE PUBLIC_HDRS ${PUBLIC_HDR_DIR}/*.h) -include_directories(${PUBLIC_HDR_DIR}) - -add_library(${TARGET} STATIC) - -# The stb.c file is made a public source, so static libraries that link against stb will contain it -# within their archive. This is helpful for libraries like gltfio that are used externally. -target_sources(${TARGET} PUBLIC ${PUBLIC_HDRS} ${OUR_DIR}/stb.c) - -target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR}) +target_sources(${TARGET} INTERFACE ${PUBLIC_HDRS})