mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
Texture2DDecoderNative - Linux/macOS compatibility fix
+ CMakeLists.txt
This commit is contained in:
parent
07a81d9bfe
commit
f67965b1dd
52
Texture2DDecoderNative/CMakeLists.txt
Normal file
52
Texture2DDecoderNative/CMakeLists.txt
Normal file
@ -0,0 +1,52 @@
|
||||
# Set the minimum version of CMake that can be used
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
|
||||
# Set the project name
|
||||
project("Texture2DDecoderNative")
|
||||
|
||||
# Set the C++ standard to C++ 14
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
# Add definitions from the project file
|
||||
# 'Release|x64'
|
||||
# <PreprocessorDefinitions>_T2D_DLL;NDEBUG;TEXTURE2DDECODERNATIVE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
add_compile_definitions(_T2D_DLL)
|
||||
add_compile_definitions(NDEBUG)
|
||||
add_compile_definitions(TEXTURE2DDECODERNATIVE_EXPORTS)
|
||||
|
||||
# Add the given directories to those the compiler uses to search for include files
|
||||
include_directories(.)
|
||||
include_directories(crunch)
|
||||
include_directories(fp16)
|
||||
include_directories(unitycrunch)
|
||||
|
||||
# Generate the shared library from the library sources
|
||||
add_library(Texture2DDecoderNative SHARED
|
||||
crunch/crn_decomp.h
|
||||
crunch/crnlib.h
|
||||
fp16/bitcasts.h
|
||||
fp16/fp16.h
|
||||
unitycrunch/crn_decomp.h
|
||||
unitycrunch/crn_defs.h
|
||||
unitycrunch/crnlib.h
|
||||
astc.cpp
|
||||
astc.h
|
||||
atc.cpp
|
||||
atc.h
|
||||
bcn.cpp
|
||||
bcn.h
|
||||
bool32_t.h
|
||||
color.h
|
||||
crunch.cpp
|
||||
crunch.h
|
||||
dllexport.h
|
||||
dllmain.cpp
|
||||
endianness.h
|
||||
etc.cpp
|
||||
etc.h
|
||||
fp16.h
|
||||
pvrtc.cpp
|
||||
pvrtc.h
|
||||
resource.h
|
||||
unitycrunch.cpp
|
||||
unitycrunch.h)
|
@ -317,8 +317,15 @@ namespace crnd
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <memory.h>
|
||||
#else
|
||||
#define MALLOC_SIZE _msize
|
||||
#elif __APPLE__
|
||||
#include <cstring>
|
||||
#include <malloc/malloc.h>
|
||||
#define MALLOC_SIZE malloc_size
|
||||
#else // Linux
|
||||
#include <cstring>
|
||||
#include <malloc.h>
|
||||
#define MALLOC_SIZE malloc_usable_size
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <new> // needed for placement new, _msize, _expand
|
||||
@ -2424,11 +2431,7 @@ namespace crnd
|
||||
|
||||
if (pActual_size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
*pActual_size = p_new ? ::_msize(p_new) : 0;
|
||||
#else
|
||||
*pActual_size = p_new ? malloc_usable_size(p_new) : 0;
|
||||
#endif
|
||||
*pActual_size = p_new ? MALLOC_SIZE(p_new) : 0;
|
||||
}
|
||||
}
|
||||
else if (!size)
|
||||
@ -2460,11 +2463,7 @@ namespace crnd
|
||||
|
||||
if (pActual_size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
*pActual_size = ::_msize(p_final_block);
|
||||
#else
|
||||
*pActual_size = ::malloc_usable_size(p_final_block);
|
||||
#endif
|
||||
*pActual_size = ::MALLOC_SIZE(p_final_block);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2474,11 +2473,7 @@ namespace crnd
|
||||
static size_t crnd_default_msize(void* p, void* pUser_data)
|
||||
{
|
||||
pUser_data;
|
||||
#ifdef _WIN32
|
||||
return p ? _msize(p) : 0;
|
||||
#else
|
||||
return p ? malloc_usable_size(p) : 0;
|
||||
#endif
|
||||
return p ? MALLOC_SIZE(p) : 0;
|
||||
}
|
||||
|
||||
static crnd_realloc_func g_pRealloc = crnd_default_realloc;
|
||||
|
@ -19,8 +19,15 @@
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <memory.h>
|
||||
#else
|
||||
#define MALLOC_SIZE _msize
|
||||
#elif __APPLE__
|
||||
#include <cstring>
|
||||
#include <malloc/malloc.h>
|
||||
#define MALLOC_SIZE malloc_size
|
||||
#else // Linux
|
||||
#include <cstring>
|
||||
#include <malloc.h>
|
||||
#define MALLOC_SIZE malloc_usable_size
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <new> // needed for placement new, _msize, _expand
|
||||
@ -1923,11 +1930,7 @@ static void* crnd_default_realloc(void* p, size_t size, size_t* pActual_size, bo
|
||||
p_new = ::malloc(size);
|
||||
|
||||
if (pActual_size) {
|
||||
#ifdef _WIN32
|
||||
*pActual_size = p_new ? ::_msize(p_new) : 0;
|
||||
#else
|
||||
*pActual_size = p_new ? malloc_usable_size(p_new) : 0;
|
||||
#endif
|
||||
*pActual_size = p_new ? MALLOC_SIZE(p_new) : 0;
|
||||
}
|
||||
} else if (!size) {
|
||||
::free(p);
|
||||
@ -1953,11 +1956,7 @@ static void* crnd_default_realloc(void* p, size_t size, size_t* pActual_size, bo
|
||||
}
|
||||
|
||||
if (pActual_size) {
|
||||
#ifdef _WIN32
|
||||
*pActual_size = ::_msize(p_final_block);
|
||||
#else
|
||||
*pActual_size = ::malloc_usable_size(p_final_block);
|
||||
#endif
|
||||
*pActual_size = ::MALLOC_SIZE(p_final_block);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1966,11 +1965,7 @@ static void* crnd_default_realloc(void* p, size_t size, size_t* pActual_size, bo
|
||||
|
||||
static size_t crnd_default_msize(void* p, void* pUser_data) {
|
||||
pUser_data;
|
||||
#ifdef _WIN32
|
||||
return p ? _msize(p) : 0;
|
||||
#else
|
||||
return p ? malloc_usable_size(p) : 0;
|
||||
#endif
|
||||
return p ? MALLOC_SIZE(p) : 0;
|
||||
}
|
||||
|
||||
static crnd_realloc_func g_pRealloc = crnd_default_realloc;
|
||||
|
Loading…
Reference in New Issue
Block a user