mirror of https://github.com/AxioDL/metaforce.git
Merge remote-tracking branch 'origin/c++20'
This commit is contained in:
commit
11d948943d
|
@ -40,8 +40,8 @@ project(urde VERSION 0.1.0)
|
||||||
# when available. GCC and Clang posess no such flag, and must be
|
# when available. GCC and Clang posess no such flag, and must be
|
||||||
# manually enforced. CMake, curiously, also doesn't have a "latest"
|
# manually enforced. CMake, curiously, also doesn't have a "latest"
|
||||||
# standard flag either.
|
# standard flag either.
|
||||||
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
if (NOT MSVC)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -86,30 +86,41 @@ if(MSVC)
|
||||||
add_compile_options(/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311 /wd4068
|
add_compile_options(/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311 /wd4068
|
||||||
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 ${VS_OPTIONS})
|
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 ${VS_OPTIONS})
|
||||||
|
|
||||||
if(WINDOWS_STORE)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /AI\"$ENV{PROGRAMFILES\(X86\)}/Microsoft Visual Studio/2017/Community/Common7/IDE/VC/vcpackages\" /AI\"$ENV{PROGRAMFILES\(X86\)}/Windows Kits/10/UnionMetadata\"")
|
|
||||||
set(HAVE_WORDS_BIGENDIAN_EXITCODE 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_compile_options(/EHsc)
|
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
/std:c++latest # Use latest C++ standard.
|
# Disable exceptions
|
||||||
/permissive- # Enforce various standards compliance features.
|
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
|
||||||
/Zc:externConstexpr # Allow extern constexpr variables according to the standard.
|
|
||||||
/Zc:throwingNew # Assume new throws, allowing for better code generation.
|
# Enforce various standards compliant behavior.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
||||||
|
|
||||||
|
# Enable standard volatile semantics.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
||||||
|
|
||||||
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
||||||
|
|
||||||
|
# Use latest C++ standard.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Link-time Code Generation for Release builds (excluding clang-cl)
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy /MD")
|
# Flags for MSVC (not clang-cl)
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy /MD")
|
add_compile_options(
|
||||||
|
# Allow constexpr variables to have explicit external linkage.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
||||||
|
|
||||||
|
# Assume that new throws exceptions, allowing better code generation.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
||||||
|
|
||||||
|
# Link-time Code Generation for Release builds
|
||||||
|
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>:/GL>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link-time Code Generation for Release builds
|
||||||
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
|
||||||
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "/LTCG")
|
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "/LTCG")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
@ -144,21 +155,19 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(URDE_MSAN)
|
if(URDE_MSAN)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++> -fsanitize=memory
|
||||||
add_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all)
|
-fsanitize-memory-track-origins -fsanitize-recover=all)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||||
add_compile_options(-Wall -Wno-multichar -Werror=implicit-fallthrough -Wno-unknown-warning-option
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
||||||
|
-Wall -Wno-multichar -Werror=implicit-fallthrough -Wno-unknown-warning-option
|
||||||
-Wno-lto-type-mismatch -Wno-unused-variable -Wno-unused-private-field
|
-Wno-lto-type-mismatch -Wno-unused-variable -Wno-unused-private-field
|
||||||
-Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Werror)
|
-Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Werror)
|
||||||
add_compile_definitions(FMT_EXCEPTIONS=0)
|
add_compile_definitions(FMT_EXCEPTIONS=0)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_compile_options(-Wno-error=deprecated-declarations)
|
add_compile_options(-Wno-error=deprecated-declarations
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin")
|
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>:-flto=thin>)
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto=thin")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto=thin")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -601,7 +601,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
DLReader::DLPrimVert maxIdxs;
|
DLReader::DLPrimVert maxIdxs;
|
||||||
std::vector<atInt16> skinIndices;
|
std::vector<atInt16> skinIndices;
|
||||||
DLReader::ExtraVertTracker extraTracker;
|
DLReader::ExtraVertTracker extraTracker;
|
||||||
for (size_t s = 0; s < lastDlSec; ++s) {
|
for (atUint32 s = 0; s < lastDlSec; ++s) {
|
||||||
atUint64 secStart = reader.position();
|
atUint64 secStart = reader.position();
|
||||||
if (s < matSecCount) {
|
if (s < matSecCount) {
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
@ -683,7 +683,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
unsigned createdUVLayers = 0;
|
unsigned createdUVLayers = 0;
|
||||||
unsigned surfIdx = 0;
|
unsigned surfIdx = 0;
|
||||||
|
|
||||||
for (size_t s = 0; s < lastDlSec; ++s) {
|
for (atUint32 s = 0; s < lastDlSec; ++s) {
|
||||||
atUint64 secStart = reader.position();
|
atUint64 secStart = reader.position();
|
||||||
if (s < matSecCount) {
|
if (s < matSecCount) {
|
||||||
MaterialSet matSet;
|
MaterialSet matSet;
|
||||||
|
@ -698,7 +698,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
atUint32 vertCount = maxIdxs.pos + 1;
|
atUint32 vertCount = maxIdxs.pos + 1;
|
||||||
std::vector<atVec3f> positions;
|
std::vector<atVec3f> positions;
|
||||||
positions.reserve(vertCount);
|
positions.reserve(vertCount);
|
||||||
for (size_t i = 0; i <= maxIdxs.pos; ++i) {
|
for (atUint16 i = 0; i <= maxIdxs.pos; ++i) {
|
||||||
positions.push_back(reader.readVec3fBig());
|
positions.push_back(reader.readVec3fBig());
|
||||||
const atVec3f& pos = positions.back();
|
const atVec3f& pos = positions.back();
|
||||||
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||||
|
@ -712,7 +712,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
if (rp.first.second && SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
if (rp.first.second && SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||||
vertCount += extraTracker.sendAdditionalVertsToBlender(os, rp, 0);
|
vertCount += extraTracker.sendAdditionalVertsToBlender(os, rp, 0);
|
||||||
os.format(fmt("two_face_vert = {}\n"), vertCount);
|
os.format(fmt("two_face_vert = {}\n"), vertCount);
|
||||||
for (size_t i = 0; i <= maxIdxs.pos; ++i) {
|
for (atUint16 i = 0; i <= maxIdxs.pos; ++i) {
|
||||||
const atVec3f& pos = positions[i];
|
const atVec3f& pos = positions[i];
|
||||||
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||||
if (rp.first.second) {
|
if (rp.first.second) {
|
||||||
|
@ -730,16 +730,16 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
/* Normals */
|
/* Normals */
|
||||||
os << "norm_list = []\n";
|
os << "norm_list = []\n";
|
||||||
if (shortNormals) {
|
if (shortNormals) {
|
||||||
size_t normCount = secSizes[s] / 6;
|
atUint32 normCount = secSizes[s] / 6;
|
||||||
for (size_t i = 0; i < normCount; ++i) {
|
for (atUint32 i = 0; i < normCount; ++i) {
|
||||||
float x = reader.readInt16Big() / 16384.0f;
|
float x = reader.readInt16Big() / 16384.0f;
|
||||||
float y = reader.readInt16Big() / 16384.0f;
|
float y = reader.readInt16Big() / 16384.0f;
|
||||||
float z = reader.readInt16Big() / 16384.0f;
|
float z = reader.readInt16Big() / 16384.0f;
|
||||||
os.format(fmt("norm_list.append(({},{},{}))\n"), x, y, z);
|
os.format(fmt("norm_list.append(({},{},{}))\n"), x, y, z);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t normCount = secSizes[s] / 12;
|
atUint32 normCount = secSizes[s] / 12;
|
||||||
for (size_t i = 0; i < normCount; ++i) {
|
for (atUint32 i = 0; i < normCount; ++i) {
|
||||||
const atVec3f norm = reader.readVec3fBig();
|
const atVec3f norm = reader.readVec3fBig();
|
||||||
os.format(fmt("norm_list.append(({},{},{}))\n"), norm.simd[0], norm.simd[1], norm.simd[2]);
|
os.format(fmt("norm_list.append(({},{},{}))\n"), norm.simd[0], norm.simd[1], norm.simd[2]);
|
||||||
}
|
}
|
||||||
|
@ -753,8 +753,8 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
case 3: {
|
case 3: {
|
||||||
/* Float UVs */
|
/* Float UVs */
|
||||||
os << "uv_list = []\n";
|
os << "uv_list = []\n";
|
||||||
size_t uvCount = secSizes[s] / 8;
|
atUint32 uvCount = secSizes[s] / 8;
|
||||||
for (size_t i = 0; i < uvCount; ++i) {
|
for (atUint32 i = 0; i < uvCount; ++i) {
|
||||||
const atVec2f uv = reader.readVec2fBig();
|
const atVec2f uv = reader.readVec2fBig();
|
||||||
os.format(fmt("uv_list.append(({},{}))\n"), uv.simd[0], uv.simd[1]);
|
os.format(fmt("uv_list.append(({},{}))\n"), uv.simd[0], uv.simd[1]);
|
||||||
}
|
}
|
||||||
|
@ -768,8 +768,8 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
/* Short UVs */
|
/* Short UVs */
|
||||||
os << "suv_list = []\n";
|
os << "suv_list = []\n";
|
||||||
if (shortUVs) {
|
if (shortUVs) {
|
||||||
size_t uvCount = secSizes[s] / 4;
|
atUint32 uvCount = secSizes[s] / 4;
|
||||||
for (size_t i = 0; i < uvCount; ++i) {
|
for (atUint32 i = 0; i < uvCount; ++i) {
|
||||||
float x = reader.readInt16Big() / 32768.0f;
|
float x = reader.readInt16Big() / 32768.0f;
|
||||||
float y = reader.readInt16Big() / 32768.0f;
|
float y = reader.readInt16Big() / 32768.0f;
|
||||||
os.format(fmt("suv_list.append(({},{}))\n"), x, y);
|
os.format(fmt("suv_list.append(({},{}))\n"), x, y);
|
||||||
|
@ -1085,7 +1085,7 @@ void NameCMDL(athena::io::IStreamReader& reader, PAKRouter& pakRouter, typename
|
||||||
if (head.matSetCount)
|
if (head.matSetCount)
|
||||||
matSecCount = MaterialSet::OneSection() ? 1 : head.matSetCount;
|
matSecCount = MaterialSet::OneSection() ? 1 : head.matSetCount;
|
||||||
atUint32 lastDlSec = head.secCount;
|
atUint32 lastDlSec = head.secCount;
|
||||||
for (size_t s = 0; s < lastDlSec; ++s) {
|
for (atUint32 s = 0; s < lastDlSec; ++s) {
|
||||||
atUint64 secStart = reader.position();
|
atUint64 secStart = reader.position();
|
||||||
if (s < matSecCount) {
|
if (s < matSecCount) {
|
||||||
MaterialSet matSet;
|
MaterialSet matSet;
|
||||||
|
|
|
@ -46,6 +46,10 @@ void MaterialSet::RegisterMaterialProps(Stream& out) {
|
||||||
|
|
||||||
static void LoadTexture(Stream& out, const UniqueID64& tex,
|
static void LoadTexture(Stream& out, const UniqueID64& tex,
|
||||||
const PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry) {
|
const PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry) {
|
||||||
|
if (!tex.isValid()) {
|
||||||
|
out << "image = None\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string texName = pakRouter.getBestEntryName(tex);
|
std::string texName = pakRouter.getBestEntryName(tex);
|
||||||
const nod::Node* node;
|
const nod::Node* node;
|
||||||
const typename PAKRouter<PAKBridge>::EntryType* texEntry = pakRouter.lookupEntry(tex, &node);
|
const typename PAKRouter<PAKBridge>::EntryType* texEntry = pakRouter.lookupEntry(tex, &node);
|
||||||
|
|
2
amuse
2
amuse
|
@ -1 +1 @@
|
||||||
Subproject commit 9c75aeccbec4d344b9481bc3c312a50241f5ecb1
|
Subproject commit 40efdcc38cc59dbb66a8c12d96583f2133d534f7
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 87ad5cbc81dad92d54c60d388157ca6300475c19
|
Subproject commit 8f31e8bb7d5f3d0fde26e17824456d1b88fb084d
|
2
jbus
2
jbus
|
@ -1 +1 @@
|
||||||
Subproject commit d72163ad27c4a8b4d993e1a29d758a3548d92bed
|
Subproject commit b8e1e4673e66d45876d87439faf463a7301ee05c
|
2
kabufuda
2
kabufuda
|
@ -1 +1 @@
|
||||||
Subproject commit 35e5c7c90f9d368f29ab191a005d30f91774e50e
|
Subproject commit 6d8d389459243a38efc585dc03b877b4697cdcf2
|
2
nod
2
nod
|
@ -1 +1 @@
|
||||||
Subproject commit f147e1235646b849f78a8574a6d554214b70792d
|
Subproject commit dffcac50c5fe3eb67fdee222553fc508cd241579
|
2
specter
2
specter
|
@ -1 +1 @@
|
||||||
Subproject commit 27eb476b05efeb1b94329eb85f36a1fd83858870
|
Subproject commit a2c154db8fde276206ae87628d6baa40f1e399a9
|
|
@ -2,8 +2,10 @@ if(NOT WINDOWS_STORE)
|
||||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||||
project(visigen)
|
project(visigen)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
if (NOT MSVC)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_executable(visigen
|
add_executable(visigen
|
||||||
|
|
Loading…
Reference in New Issue