This commit is contained in:
Attila Uygun 2023-08-12 21:22:54 +02:00
parent f372fbed8e
commit 0a78316bce
6 changed files with 50 additions and 32 deletions

View File

@ -164,6 +164,14 @@ config("release") {
} }
} }
config("third_party_warnings") {
if (is_win) {
cflags = [
"/wd4242", # tmp:conversion from 'int' to 'uint8_t'
]
}
}
config("warnings") { config("warnings") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
@ -187,51 +195,50 @@ config("warnings") {
# switch specified. # switch specified.
# TODO: Not sure how I feel about these conversion warnings. # TODO: Not sure how I feel about these conversion warnings.
"/Wv:18", # tmp "/Wv:18",
"/wd4191", # tmp:'type cast': unsafe conversion "/wd4191", # 'type cast': unsafe conversion
"/wd4242", # tmp:conversion from 'int' to 'uint8_t'
"/wd4245", # tmp:conversion from 'int' to 'const unsigned int'
"/wd4244", # conversion, possible loss of data. 'int' to 'float' "/wd4244", # conversion, possible loss of data. 'int' to 'float'
"/wd4267", # conversion, possible loss of data. "/wd4245", # tmp:conversion from 'int' to 'const unsigned int'
# "/wd4267", # conversion, possible loss of data.
"/wd4305", # truncation from 'double' to 'float'. "/wd4305", # truncation from 'double' to 'float'.
"/wd4365", # conversion, signed/unsigned mismatch. "/wd4365", # conversion, signed/unsigned mismatch.
"/wd5219", # conversion, possible loss of data. 'int' to 'float' # "/wd5219", # conversion, possible loss of data. 'int' to 'float'
# Possible compiler bug? Needs investigation. # Possible compiler bug? Needs investigation.
"/wd4668", # '__STDC_WANT_SECURE_LIB__' is not defined as a preprocessor "/wd4668", # '__STDC_WANT_SECURE_LIB__' is not defined as a preprocessor
# macro, replacing with '0' for '#if/#elif' # macro, replacing with '0' for '#if/#elif'
# TODO: # TODO:
"/wd4263", # member function does not override any base class virtual # "/wd4263", # member function does not override any base class virtual
# member function # member function
"/wd4264", # no override available for virtual member function, function # "/wd4264", # no override available for virtual member function, function
# is hidden # is hidden
"/wd4266", # no override available for virtual member function from base, # "/wd4266", # no override available for virtual member function from base,
# function is hidden # function is hidden
"/wd4355", # 'this' used in base member initializer list # "/wd4355", # 'this' used in base member initializer list
"/wd4457", # declaration hides function parameter # "/wd4457", # declaration hides function parameter
"/wd4464", # relative include path contains '..'. # "/wd4464", # relative include path contains '..'.
"/wd4625", # copy constructor was implicitly defined as deleted "/wd4625", # copy constructor was implicitly defined as deleted
"/wd4626", # assignment operator was implicitly defined as deleted "/wd4626", # assignment operator was implicitly defined as deleted
"/wd4706", # assignment withing conditional expression. # "/wd4706", # assignment withing conditional expression.
"/wd4774", # format string expected in argument X is not a string literal # "/wd4774", # format string expected in argument X is not a string literal
"/wd4828", # The file contains a character that is illegal in the current # "/wd4828", # The file contains a character that is illegal in the current
# source character set # source character set
"/wd4946", # reinterpret_cast used between related # "/wd4946", # reinterpret_cast used between related
"/wd5026", # move constructor was implicitly defined as deleted # "/wd5026", # move constructor was implicitly defined as deleted
"/wd5027", # move assignment operator was implicitly defined as deleted # "/wd5027", # move assignment operator was implicitly defined as deleted
"/wd5039", # pointer or reference to potentially throwing function passed # "/wd5039", # pointer or reference to potentially throwing function passed
# to 'extern "C"' function under -EHc. Undefined behavior may # to 'extern "C"' function under -EHc. Undefined behavior may
# occur if this function throws an exception. # occur if this function throws an exception.
# TODO: I don't understand these or how to fix them: # TODO: I don't understand these or how to fix them:
"/wd4458", # declaration hides class member # "/wd4458", # declaration hides class member
# [ GameObject::rtti ] # [ GameObject::rtti ]
"/wd4582", # constructor is not implicitly called # "/wd4582", # constructor is not implicitly called
# [ intersection.h Contact ] # [ intersection.h Contact ]
"/wd4623", # default constructor was implicitly defined as deleted # "/wd4623", # default constructor was implicitly defined as deleted
# [ intersection.h Contact ] # [ intersection.h Contact ]
"/wd5243", # using incomplete class can cause potential one definition # "/wd5243", # using incomplete class can cause potential one definition
# rule violation due to ABI limitation # rule violation due to ABI limitation
] ]

View File

@ -12,12 +12,7 @@
#include "third_party/texture_compressor/texture_compressor.h" #include "third_party/texture_compressor/texture_compressor.h"
// Use aligned memory for SIMD in texture compressor. // Use aligned memory for SIMD in texture compressor.
#define STB_IMAGE_IMPLEMENTATION
#define STBI_NO_STDIO #define STBI_NO_STDIO
#define STBI_MALLOC(sz) base::AlignedAlloc(sz, 16)
#define STBI_REALLOC_SIZED(p, oldsz, newsz) \
base::AlignedRealloc(p, oldsz, newsz, 16)
#define STBI_FREE(p) base::AlignedFree(p)
#include "third_party/stb/stb_image.h" #include "third_party/stb/stb_image.h"
using namespace base; using namespace base;

View File

@ -3,11 +3,8 @@
#include <array> #include <array>
#include "base/log.h" #include "base/log.h"
#define MINIMP3_ONLY_MP3
#define MINIMP3_ONLY_SIMD
#define MINIMP3_FLOAT_OUTPUT #define MINIMP3_FLOAT_OUTPUT
#define MINIMP3_NO_STDIO #define MINIMP3_NO_STDIO
#define MINIMP3_IMPLEMENTATION
#include "engine/engine.h" #include "engine/engine.h"
#include "engine/platform/asset_file.h" #include "engine/platform/asset_file.h"
#include "third_party/minimp3/minimp3_ex.h" #include "third_party/minimp3/minimp3_ex.h"

View File

@ -59,9 +59,11 @@ source_set("third_party") {
"glslang/glslang/MachineIndependent/reflection.cpp", "glslang/glslang/MachineIndependent/reflection.cpp",
"jsoncpp/json.h", "jsoncpp/json.h",
"jsoncpp/jsoncpp.cpp", "jsoncpp/jsoncpp.cpp",
"minimp3/minimp3.cc",
"minimp3/minimp3.h", "minimp3/minimp3.h",
"minimp3/minimp3_ex.h", "minimp3/minimp3_ex.h",
"spirv-reflect/spirv_reflect.c", "spirv-reflect/spirv_reflect.c",
"stb/stb_image.cc",
"stb/stb_image.h", "stb/stb_image.h",
"stb/stb_truetype.h", "stb/stb_truetype.h",
"texture_compressor/dxt_encoder.cc", "texture_compressor/dxt_encoder.cc",
@ -77,7 +79,7 @@ source_set("third_party") {
"volk/volk.c", "volk/volk.c",
] ]
defines = [ "VMA_STATIC_VULKAN_FUNCTIONS=1" ] defines = [ "VMA_STATIC_VULKAN_FUNCTIONS=1", "GLEW_STATIC" ]
if (target_os == "linux" || target_os == "win") { if (target_os == "linux" || target_os == "win") {
sources += [ sources += [
@ -101,6 +103,7 @@ source_set("third_party") {
} }
configs -= [ "//build:warnings" ] configs -= [ "//build:warnings" ]
configs += [ "//build:third_party_warnings" ]
deps = [] deps = []
} }

6
src/third_party/minimp3/minimp3.cc vendored Normal file
View File

@ -0,0 +1,6 @@
#define MINIMP3_ONLY_MP3
#define MINIMP3_ONLY_SIMD
#define MINIMP3_FLOAT_OUTPUT
#define MINIMP3_NO_STDIO
#define MINIMP3_IMPLEMENTATION
#include "third_party/minimp3/minimp3_ex.h"

10
src/third_party/stb/stb_image.cc vendored Normal file
View File

@ -0,0 +1,10 @@
#include "base/mem.h"
// Use aligned memory for SIMD in texture compressor.
#define STB_IMAGE_IMPLEMENTATION
#define STBI_NO_STDIO
#define STBI_MALLOC(sz) base::AlignedAlloc(sz, 16)
#define STBI_REALLOC_SIZED(p, oldsz, newsz) \
base::AlignedRealloc(p, oldsz, newsz, 16)
#define STBI_FREE(p) base::AlignedFree(p)
#include "third_party/stb/stb_image.h"