mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
added patches in order to use the original lodepng repository
This commit is contained in:
parent
ecbd169616
commit
92983f2bd7
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,3 +1,3 @@
|
|||
[submodule "oss-internship-2020/sapi_lodepng/lodepng"]
|
||||
path = oss-internship-2020/sapi_lodepng/lodepng
|
||||
url = https://github.com/andreimedar/lodepng
|
||||
url = https://github.com/lvandeve/lodepng
|
||||
|
|
|
@ -19,14 +19,23 @@ project(lodepng_sapi CXX)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED 17)
|
||||
|
||||
# Build static library
|
||||
# Apply the patches to the header file.
|
||||
add_custom_command(
|
||||
OUTPUT "${PROJECT_SOURCE_DIR}/lodepng/lodepng.h"
|
||||
COMMAND cp "${PROJECT_SOURCE_DIR}/lodepng/lodepng.h" "${PROJECT_SOURCE_DIR}/patches/"
|
||||
COMMAND cd "${PROJECT_SOURCE_DIR}/patches" && patch < header.patch
|
||||
COMMAND mv "${PROJECT_SOURCE_DIR}/patches/lodepng.h" "${PROJECT_SOURCE_DIR}/lodepng/"
|
||||
)
|
||||
|
||||
# Build static library.
|
||||
add_library(lodepng STATIC
|
||||
lodepng/lodepng.cpp
|
||||
lodepng/lodepng.h
|
||||
"${PROJECT_SOURCE_DIR}/lodepng/lodepng.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/lodepng/lodepng.h"
|
||||
)
|
||||
|
||||
# Build SAPI library
|
||||
set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
|
||||
#set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
|
||||
set(SAPI_ROOT "/usr/local/google/home/amedar/internship/sandboxed-api" CACHE PATH "Path to the Sandboxed API source tree")
|
||||
|
||||
add_subdirectory("${SAPI_ROOT}"
|
||||
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
|
||||
|
@ -56,7 +65,7 @@ add_sapi_library(
|
|||
lodepng_save_file
|
||||
lodepng_load_file
|
||||
|
||||
INPUTS lodepng/lodepng.h
|
||||
INPUTS "${PROJECT_SOURCE_DIR}/lodepng/lodepng.h"
|
||||
LIBRARY lodepng
|
||||
LIBRARY_NAME Lodepng
|
||||
NAMESPACE ""
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit aa6cc42db701b01d6d2afad001ad286556988061
|
||||
Subproject commit 34628e89e80cd007179b25b0b2695e6af0f57fac
|
86
oss-internship-2020/sapi_lodepng/patches/header.patch
Normal file
86
oss-internship-2020/sapi_lodepng/patches/header.patch
Normal file
|
@ -0,0 +1,86 @@
|
|||
--- lodepng.h 2020-09-11 08:41:22.280259945 +0000
|
||||
+++ lodepng2.h 2020-09-11 08:45:17.134266042 +0000
|
||||
@@ -89,6 +89,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+
|
||||
+
|
||||
#ifdef LODEPNG_COMPILE_CPP
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -126,6 +128,9 @@
|
||||
bitdepth: the desired bit depth for the raw output image. See explanation on PNG color types.
|
||||
Return value: LodePNG error code (0 means no error).
|
||||
*/
|
||||
+
|
||||
+extern "C" {
|
||||
+
|
||||
unsigned lodepng_decode_memory(unsigned char** out, unsigned* w, unsigned* h,
|
||||
const unsigned char* in, size_t insize,
|
||||
LodePNGColorType colortype, unsigned bitdepth);
|
||||
@@ -154,10 +159,12 @@
|
||||
/*Same as lodepng_decode_file, but always decodes to 24-bit RGB raw image.*/
|
||||
unsigned lodepng_decode24_file(unsigned char** out, unsigned* w, unsigned* h,
|
||||
const char* filename);
|
||||
+
|
||||
#endif /*LODEPNG_COMPILE_DISK*/
|
||||
#endif /*LODEPNG_COMPILE_DECODER*/
|
||||
|
||||
|
||||
+
|
||||
#ifdef LODEPNG_COMPILE_ENCODER
|
||||
/*
|
||||
Converts raw pixel data into a PNG image in memory. The colortype and bitdepth
|
||||
@@ -204,6 +211,9 @@
|
||||
/*Same as lodepng_encode_file, but always encodes from 24-bit RGB raw image.*/
|
||||
unsigned lodepng_encode24_file(const char* filename,
|
||||
const unsigned char* image, unsigned w, unsigned h);
|
||||
+
|
||||
+}
|
||||
+
|
||||
#endif /*LODEPNG_COMPILE_DISK*/
|
||||
#endif /*LODEPNG_COMPILE_ENCODER*/
|
||||
|
||||
@@ -219,6 +229,8 @@
|
||||
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
|
||||
const std::vector<unsigned char>& in,
|
||||
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
|
||||
+
|
||||
+
|
||||
#ifdef LODEPNG_COMPILE_DISK
|
||||
/*
|
||||
Converts PNG file from disk to raw pixel data in memory.
|
||||
@@ -251,6 +263,7 @@
|
||||
unsigned encode(const std::string& filename,
|
||||
const std::vector<unsigned char>& in, unsigned w, unsigned h,
|
||||
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
|
||||
+
|
||||
#endif /* LODEPNG_COMPILE_DISK */
|
||||
#endif /* LODEPNG_COMPILE_ENCODER */
|
||||
} /* namespace lodepng */
|
||||
@@ -318,6 +331,7 @@
|
||||
|
||||
extern const LodePNGCompressSettings lodepng_default_compress_settings;
|
||||
void lodepng_compress_settings_init(LodePNGCompressSettings* settings);
|
||||
+
|
||||
#endif /*LODEPNG_COMPILE_ENCODER*/
|
||||
|
||||
#ifdef LODEPNG_COMPILE_PNG
|
||||
@@ -943,6 +957,8 @@
|
||||
#endif /*LODEPNG_COMPILE_ZLIB*/
|
||||
|
||||
#ifdef LODEPNG_COMPILE_DISK
|
||||
+
|
||||
+extern "C" {
|
||||
/*
|
||||
Load a file from disk into buffer. The function allocates the out buffer, and
|
||||
after usage you should free it.
|
||||
@@ -962,6 +978,7 @@
|
||||
return value: error code (0 means ok)
|
||||
*/
|
||||
unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename);
|
||||
+}
|
||||
#endif /*LODEPNG_COMPILE_DISK*/
|
||||
|
||||
#ifdef LODEPNG_COMPILE_CPP
|
Loading…
Reference in New Issue
Block a user