Compare commits
246 Commits
7dda6d6ffb
...
05bf63d447
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05bf63d447 | ||
|
|
b45d9300bd | ||
|
|
fb4e2e2491 | ||
|
|
c088080be5 | ||
|
|
52592bea16 | ||
|
|
933c1ec10e | ||
|
|
02443c7974 | ||
|
|
dd0381a007 | ||
|
|
60b71317ce | ||
|
|
946c5d784b | ||
|
|
a4d2b732aa | ||
|
|
17d3b0ce2c | ||
|
|
f37c0ee9e6 | ||
|
|
2797b9fd3a | ||
|
|
a8689e8b58 | ||
|
|
4e9275fa88 | ||
|
|
2f9ab72258 | ||
|
|
8e82e716c7 | ||
|
|
da7805ce0c | ||
|
|
f77a3fa4ad | ||
| 5db648a99f | |||
| 1938d987f9 | |||
|
|
56fee07553 | ||
|
|
24762e4d16 | ||
|
|
4dd60fb61e | ||
|
|
4e1d5859e2 | ||
|
|
1632549b48 | ||
|
|
b092ceaf14 | ||
|
|
a43b6ee04a | ||
| 4aa7545a7f | |||
|
|
4afecc431c | ||
|
|
0db76cb793 | ||
| 6784a29086 | |||
| 7faccda488 | |||
|
|
940d5d4339 | ||
|
|
19c2f62ba9 | ||
| df9615e42a | |||
| 6298761311 | |||
|
|
7c9e75b629 | ||
|
|
5e7c274645 | ||
|
|
112be9bb0c | ||
| 7951e6ab80 | |||
|
|
3453c9780e | ||
|
|
0e862e7a61 | ||
|
|
644983408e | ||
|
|
f7c9c0c31f | ||
|
|
2e257e8abe | ||
|
|
f93a8586ae | ||
|
|
c153f2fe61 | ||
|
|
07364460c3 | ||
|
|
86523fa5bb | ||
|
|
5c0b7f9761 | ||
|
|
7fa4a74ef0 | ||
|
|
31353179e5 | ||
| 80d003e9b2 | |||
|
|
146644b3db | ||
|
|
271ceadd66 | ||
| 15db2b3006 | |||
| 836e58f634 | |||
|
|
d0c49843af | ||
|
|
b9bd0648ab | ||
|
|
cac687a2d2 | ||
| 928b87cb6e | |||
| 5f5fe2ade5 | |||
|
|
d062bf472c | ||
| 1e030e9d3a | |||
|
|
d6c01368d7 | ||
| c39c9e8a35 | |||
|
|
e89c70eddd | ||
|
|
7c5ef50f9b | ||
|
|
bbd29ea310 | ||
| 0ec18bac20 | |||
|
|
6b9b670373 | ||
|
|
ebe58e5488 | ||
|
|
b065669583 | ||
|
|
45334c77f7 | ||
|
|
895a947a60 | ||
| de2ffec17d | |||
|
|
2d21324743 | ||
| 73eee0525c | |||
|
|
8d61db9558 | ||
|
|
6a4fb6390a | ||
|
|
769854ac84 | ||
| 82307f56e4 | |||
| f972b840a6 | |||
|
|
24eecbec3b | ||
|
|
2e73c41519 | ||
|
|
29f4a43f09 | ||
|
|
6c576510b7 | ||
|
|
32b2acf739 | ||
|
|
e91bf4b35f | ||
|
|
1bb131ecd2 | ||
|
|
87caae43cc | ||
|
|
650927498c | ||
|
|
b51ef1f983 | ||
|
|
6d38a9e914 | ||
|
|
5ebc68043e | ||
|
|
2a9149c746 | ||
| f7de370212 | |||
|
|
cc38d52f6c | ||
|
|
526efb217e | ||
|
|
e8e4dc9b28 | ||
|
|
a3075433f0 | ||
|
|
c39eac4241 | ||
|
|
fe5d8c2f47 | ||
|
|
4f2741765b | ||
|
|
ede7597acb | ||
| 5c571578dd | |||
|
|
91e9a3a3a8 | ||
| 0aff255379 | |||
|
|
ebf292d993 | ||
| a580afb8b9 | |||
|
|
9012986f9d | ||
|
|
cc5401201d | ||
|
|
ed11b23d24 | ||
| 60b610d111 | |||
|
|
daf0991f0b | ||
|
|
01e6b0e355 | ||
|
|
b3efd62229 | ||
|
|
c281070ff6 | ||
|
|
1229e61702 | ||
|
|
568384658e | ||
| c31139fdec | |||
|
|
54d0af8afb | ||
|
|
322d83de9d | ||
|
|
4e070d3d04 | ||
|
|
383b34f5d6 | ||
|
|
a568d3d0da | ||
|
|
cfc96f645e | ||
|
|
512e912471 | ||
|
|
7e448812e2 | ||
| 2ae62fbc07 | |||
| f8b25e581b | |||
|
|
103c43eba1 | ||
|
|
aa84fa0823 | ||
|
|
9f75e3ad60 | ||
|
|
0fc6b483d1 | ||
|
|
d414505d15 | ||
| 1ac4c51a5d | |||
|
|
a6a275a934 | ||
|
|
4ff416757f | ||
|
|
37f0a6aa08 | ||
| 929c5aade1 | |||
|
|
ebc63e6663 | ||
|
|
d35547560e | ||
|
|
70f30b8b3a | ||
|
|
bdf721ac15 | ||
| a15b74e7a9 | |||
|
|
980b8133a8 | ||
| 527315e976 | |||
|
|
d79a684868 | ||
| 6fd0fc5868 | |||
| fe88d27632 | |||
|
|
87032466ac | ||
|
|
aac2e84ad6 | ||
|
|
b94bebdf0d | ||
|
|
fa520b5df8 | ||
|
|
8657301da0 | ||
|
|
f816b5ada8 | ||
|
|
6ea9276495 | ||
|
|
8b07b6cc3f | ||
|
|
ac31c3bbf5 | ||
|
|
a8a3b04b09 | ||
|
|
15697ebe67 | ||
|
|
2c26c5c0b5 | ||
|
|
8e5e96e3ee | ||
|
|
6c25d1f06b | ||
|
|
d84e7904e6 | ||
|
|
dc01bdf12e | ||
|
|
064d446aea | ||
|
|
4fd09212dd | ||
|
|
784da51a3f | ||
|
|
d46e5da520 | ||
|
|
b7f8a0f67a | ||
|
|
1e3be66495 | ||
|
|
eb0bae44aa | ||
|
|
aef61e19b4 | ||
|
|
a4aea4163a | ||
|
|
7616435e00 | ||
|
|
37e2c489a8 | ||
|
|
378c9c6d6d | ||
|
|
22ad0ebf98 | ||
|
|
5d31d8421f | ||
|
|
06cc639bb7 | ||
|
|
74a2dc78a6 | ||
|
|
68b31cb197 | ||
|
|
2a16970cde | ||
|
|
243dd61209 | ||
|
|
1bf6d3f0b1 | ||
|
|
5221b3a689 | ||
| 2d0c7ec166 | |||
|
|
4c397eb3d0 | ||
| 4271ef556d | |||
| 55133bbd87 | |||
| 51a1cc742c | |||
|
|
60380ee733 | ||
| b1954fd334 | |||
| 641efaf582 | |||
| dbffcf5f04 | |||
| b6684f7929 | |||
| 0c431f9c08 | |||
| e2af375aa0 | |||
| 666bfc1b37 | |||
|
|
436cf015a1 | ||
| b27b4adab3 | |||
| 613d809b43 | |||
| 880caecd97 | |||
|
|
7dd2816409 | ||
| a8ab5015b9 | |||
| 27ecda3124 | |||
|
|
43dd93a802 | ||
| bed5ae7a40 | |||
|
|
b5877a488d | ||
|
|
3fa844ddb9 | ||
|
|
7249f30b71 | ||
| d9038fee44 | |||
| 098f2b4005 | |||
|
|
69a03cf524 | ||
|
|
c6b8a52c6d | ||
|
|
f5cf579115 | ||
|
|
64ec35415c | ||
|
|
4a784036bd | ||
|
|
f5940c729c | ||
|
|
fa0a369357 | ||
| 8d8843cb11 | |||
| 0fd42529c7 | |||
| 0a37ba49c3 | |||
| b9e88547e6 | |||
|
|
dfa5786f24 | ||
|
|
407db412c7 | ||
|
|
4d2d35e34e | ||
|
|
329f1b1663 | ||
|
|
e130c2ba7f | ||
|
|
3c40d3c20d | ||
|
|
476a1e23f7 | ||
|
|
21301652ce | ||
|
|
c792e50f1b | ||
|
|
2876446ec8 | ||
|
|
826f8cbb23 | ||
|
|
0cc3dce9a8 | ||
|
|
48510c3aa6 | ||
|
|
7517b5f336 | ||
|
|
1500a7456d | ||
|
|
c8e8903ef2 | ||
|
|
cb9f6c6932 | ||
|
|
3bfac34979 |
16
.gitignore
vendored
@ -3,6 +3,8 @@
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
.vscode/
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
@ -15,7 +17,7 @@
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
.........................................................................
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
@ -385,4 +387,16 @@ FodyWeavers.xsd
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
|
||||
|
||||
sdl_app
|
||||
|
||||
*.sln.iml
|
||||
|
||||
images.zip
|
||||
script.py
|
||||
|
||||
jumpingbird.*
|
||||
jumpingbird.data
|
||||
build
|
||||
build-emcmake
|
||||
|
||||
43
AnimatedModel.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "Renderer.h"
|
||||
#include "TextureManager.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
|
||||
struct MeshGroup
|
||||
{
|
||||
std::vector<std::shared_ptr<Texture>> textures;
|
||||
std::vector<VertexDataStruct> meshes;
|
||||
std::vector<VertexRenderStruct> renderMeshes;
|
||||
};
|
||||
|
||||
struct AnimatedModel
|
||||
{
|
||||
std::vector<MeshGroup> parts;
|
||||
|
||||
void RefreshRenderMeshes()
|
||||
{
|
||||
for (int i = 0; i < parts.size(); i++)
|
||||
{
|
||||
parts[i].renderMeshes.resize(parts[i].meshes.size());
|
||||
|
||||
for (int j = 0; j < parts[i].meshes.size(); j++)
|
||||
{
|
||||
parts[i].renderMeshes[j].AssignFrom(parts[i].meshes[j]);
|
||||
parts[i].renderMeshes[j].RefreshVBO();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
93
AudioPlayerAsync.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#ifdef AUDIO
|
||||
|
||||
#include "AudioPlayerAsync.h"
|
||||
|
||||
|
||||
AudioPlayerAsync::AudioPlayerAsync() : worker(&AudioPlayerAsync::workerThread, this) {}
|
||||
|
||||
AudioPlayerAsync::~AudioPlayerAsync() {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
stop = true;
|
||||
cv.notify_all();
|
||||
}
|
||||
worker.join();
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::stopAsync() {
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
taskQueue.push([this]() {
|
||||
//audioPlayerMutex.lock();
|
||||
audioPlayer->stop();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
//audioPlayerMutex.unlock();
|
||||
});
|
||||
cv.notify_one();
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::resetAsync() {
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
taskQueue.push([this]() {
|
||||
//audioPlayerMutex.lock();
|
||||
audioPlayer.reset();
|
||||
audioPlayer = std::make_unique<AudioPlayer>();
|
||||
|
||||
//audioPlayerMutex.unlock();
|
||||
});
|
||||
cv.notify_one();
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::playSoundAsync(std::string soundName) {
|
||||
|
||||
soundNameMutex.lock();
|
||||
latestSoundName = soundName;
|
||||
soundNameMutex.unlock();
|
||||
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
taskQueue.push([this]() {
|
||||
//audioPlayerMutex.lock();
|
||||
if (audioPlayer) {
|
||||
audioPlayer->playSound(latestSoundName);
|
||||
}
|
||||
//audioPlayerMutex.unlock();
|
||||
});
|
||||
cv.notify_one();
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::playMusicAsync(std::string musicName) {
|
||||
|
||||
musicNameMutex.lock();
|
||||
latestMusicName = musicName;
|
||||
musicNameMutex.unlock();
|
||||
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
taskQueue.push([this]() {
|
||||
//audioPlayerMutex.lock();
|
||||
if (audioPlayer) {
|
||||
audioPlayer->playMusic(latestMusicName);
|
||||
}
|
||||
//audioPlayerMutex.unlock();
|
||||
});
|
||||
cv.notify_one();
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::workerThread() {
|
||||
while (true) {
|
||||
std::function<void()> task;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
cv.wait(lock, [this]() { return !taskQueue.empty() || stop; });
|
||||
|
||||
if (stop && taskQueue.empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
task = taskQueue.front();
|
||||
taskQueue.pop();
|
||||
}
|
||||
|
||||
task();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
53
AudioPlayerAsync.h
Normal file
@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef AUDIO
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <queue>
|
||||
#include <functional>
|
||||
#include "cmakeaudioplayer/include/AudioPlayer.hpp"
|
||||
|
||||
|
||||
class AudioPlayerAsync {
|
||||
public:
|
||||
AudioPlayerAsync();
|
||||
~AudioPlayerAsync();
|
||||
|
||||
void resetAsync();
|
||||
|
||||
void playSoundAsync(std::string soundName);
|
||||
|
||||
void playMusicAsync(std::string musicName);
|
||||
|
||||
void stopAsync();
|
||||
|
||||
void exit()
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
|
||||
std::thread worker;
|
||||
|
||||
private:
|
||||
std::unique_ptr<AudioPlayer> audioPlayer;
|
||||
//std::mutex audioPlayerMutex;
|
||||
|
||||
std::mutex soundNameMutex;
|
||||
std::mutex musicNameMutex;
|
||||
|
||||
std::string latestSoundName;
|
||||
std::string latestMusicName;
|
||||
|
||||
std::mutex mtx;
|
||||
std::condition_variable cv;
|
||||
std::queue<std::function<void()>> taskQueue;
|
||||
bool stop = false;
|
||||
|
||||
void workerThread();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
719
BoneAnimatedModel.cpp
Normal file
@ -0,0 +1,719 @@
|
||||
#include "BoneAnimatedModel.h"
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
|
||||
int getIndexByValue(const std::string& name, const std::vector<std::string>& words)
|
||||
{
|
||||
for (int i = 0; i < words.size(); i++)
|
||||
{
|
||||
if (words[i] == name)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void BoneSystem::LoadFromFile(const std::string& fileName, const std::string& ZIPFileName)
|
||||
{
|
||||
std::ifstream filestream;
|
||||
std::istringstream zipStream;
|
||||
|
||||
if (!ZIPFileName.empty())
|
||||
{
|
||||
std::vector<char> fileData = readFileFromZIP(fileName, ZIPFileName);
|
||||
std::string fileContents(fileData.begin(), fileData.end());
|
||||
zipStream.str(fileContents);
|
||||
}
|
||||
else
|
||||
{
|
||||
filestream.open(fileName);
|
||||
}
|
||||
|
||||
std::istream& f = (!ZIPFileName.empty()) ? static_cast<std::istream&>(zipStream) : static_cast<std::istream&>(filestream);
|
||||
|
||||
//Skip first 5 lines
|
||||
std::string tempLine;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
}
|
||||
std::getline(f, tempLine);
|
||||
|
||||
static const std::regex pattern_count(R"(\d+)");
|
||||
static const std::regex pattern_float(R"([-]?\d+\.\d+)");
|
||||
static const std::regex pattern_int(R"([-]?\d+)");
|
||||
static const std::regex pattern_boneChildren(R"(\'([^\']+)\')");
|
||||
static const std::regex pattern_bone_weight(R"(\'([^\']+)\'.*?([-]?\d+\.\d+))");
|
||||
|
||||
std::smatch match;
|
||||
|
||||
int numberBones;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberBones = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
std::vector<Bone> bones;
|
||||
std::vector<std::string> boneNames;
|
||||
std::vector<std::string> boneParentNames;
|
||||
std::unordered_map<std::string, std::vector<std::string>> boneChildren;
|
||||
|
||||
bones.resize(numberBones);
|
||||
boneNames.resize(numberBones);
|
||||
boneParentNames.resize(numberBones);
|
||||
|
||||
for (int i = 0; i < numberBones; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
std::string boneName = tempLine.substr(6);
|
||||
|
||||
boneNames[i] = boneName;
|
||||
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
bones[i].boneStartWorld = Vector3f{ floatValues[0], floatValues[1], floatValues[2] };
|
||||
|
||||
|
||||
std::getline(f, tempLine); //skip tail
|
||||
|
||||
std::getline(f, tempLine); //len
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_float)) {
|
||||
std::string len_str = match.str();
|
||||
bones[i].boneLength = std::stof(len_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
//---------- matrix begin
|
||||
|
||||
std::getline(f, tempLine);
|
||||
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
bones[i].boneMatrixWorld.m[0] = floatValues[0];
|
||||
bones[i].boneMatrixWorld.m[0 + 1 * 3] = floatValues[1];
|
||||
bones[i].boneMatrixWorld.m[0 + 2 * 3] = floatValues[2];
|
||||
|
||||
|
||||
std::getline(f, tempLine);
|
||||
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
bones[i].boneMatrixWorld.m[1] = floatValues[0];
|
||||
bones[i].boneMatrixWorld.m[1 + 1 * 3] = floatValues[1];
|
||||
bones[i].boneMatrixWorld.m[1 + 2 * 3] = floatValues[2];
|
||||
|
||||
|
||||
std::getline(f, tempLine);
|
||||
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
bones[i].boneMatrixWorld.m[2] = floatValues[0];
|
||||
bones[i].boneMatrixWorld.m[2 + 1 * 3] = floatValues[1];
|
||||
bones[i].boneMatrixWorld.m[2 + 2 * 3] = floatValues[2];
|
||||
|
||||
//----------- matrix end
|
||||
std::getline(f, tempLine); //parent
|
||||
|
||||
if (tempLine == " Parent: None")
|
||||
{
|
||||
bones[i].parent = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string boneParent = tempLine.substr(10);
|
||||
boneParentNames[i] = boneParent;
|
||||
}
|
||||
|
||||
std::getline(f, tempLine); //children
|
||||
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_boneChildren)) {
|
||||
|
||||
boneChildren[boneName].push_back(match.str(1));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Now process all the bones:
|
||||
for (int i = 0; i < numberBones; i++)
|
||||
{
|
||||
std::string boneName = boneNames[i];
|
||||
std::string boneParent = boneParentNames[i];
|
||||
if (boneParent == "")
|
||||
{
|
||||
bones[i].parent = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bones[i].parent = getIndexByValue(boneParent, boneNames);
|
||||
}
|
||||
|
||||
for (int j = 0; j < boneChildren[boneName].size(); j++)
|
||||
{
|
||||
bones[i].children.push_back(getIndexByValue(boneChildren[boneName][j], boneNames));
|
||||
}
|
||||
|
||||
/*if (boneName == "Bone.020")
|
||||
{
|
||||
std::cout << i << std::endl;
|
||||
}*/
|
||||
}
|
||||
|
||||
startBones = bones;
|
||||
currentBones = bones;
|
||||
|
||||
///std::cout << "Hello!" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //vertice count
|
||||
int numberVertices;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberVertices = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
std::vector<Vector3f> vertices;
|
||||
|
||||
vertices.resize(numberVertices);
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
vertices[i] = Vector3f{floatValues[0], floatValues[1], floatValues[2]};
|
||||
}
|
||||
|
||||
|
||||
//==== process uv and normals begin
|
||||
|
||||
std::cout << "Hello x1" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===UV Coordinates:
|
||||
|
||||
std::getline(f, tempLine); //triangle count
|
||||
int numberTriangles;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberTriangles = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
|
||||
// Now process UVs
|
||||
std::vector<std::array<Vector2f, 3>> uvCoords;
|
||||
|
||||
uvCoords.resize(numberTriangles);
|
||||
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
std::getline(f, tempLine); //Face 0
|
||||
|
||||
int uvCount;
|
||||
std::getline(f, tempLine);
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
uvCount = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
if (uvCount != 3)
|
||||
{
|
||||
throw std::runtime_error("more than 3 uvs");
|
||||
}
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
std::getline(f, tempLine); //UV <Vector (-0.3661, -1.1665)>
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
if (floatValues.size() != 2)
|
||||
{
|
||||
throw std::runtime_error("more than 2 uvs---");
|
||||
}
|
||||
|
||||
uvCoords[i][j] = Vector2f{ floatValues[0],floatValues[1] };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::cout << "Hello eee" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===Normals:
|
||||
|
||||
|
||||
std::vector<Vector3f> normals;
|
||||
|
||||
normals.resize(numberVertices);
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
normals[i] = Vector3f{ floatValues[0], floatValues[1], floatValues[2] };
|
||||
}
|
||||
|
||||
//==== process uv and normals end
|
||||
|
||||
std::getline(f, tempLine); //triangle count.
|
||||
//numberTriangles; //Need to check if new value is the same as was read before
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberTriangles = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
std::vector<std::array<int, 3>> triangles;
|
||||
|
||||
triangles.resize(numberTriangles);
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<int> intValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_int)) {
|
||||
intValues.push_back(std::stoi(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
triangles[i] = { intValues[0], intValues[1], intValues[2] };
|
||||
}
|
||||
|
||||
std::getline(f, tempLine);//=== Vertex Weights ===
|
||||
std::vector<std::array<BoneWeight, MAX_BONE_COUNT>> localVerticesBoneWeight;
|
||||
localVerticesBoneWeight.resize(numberVertices);
|
||||
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine); //skip Vertex 0:
|
||||
std::getline(f, tempLine); //vertex group count
|
||||
int boneCount;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
boneCount = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
if (boneCount > MAX_BONE_COUNT)
|
||||
{
|
||||
throw std::runtime_error("more than 5 bones");
|
||||
}
|
||||
|
||||
float sumWeights = 0;
|
||||
|
||||
for (int j = 0; j < boneCount; j++)
|
||||
{
|
||||
std::getline(f, tempLine); //Group: 'Bone', Weight: 0.9929084181785583
|
||||
if (std::regex_search(tempLine, match, pattern_bone_weight)) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
std::string word = match.str(1);
|
||||
double weight = std::stod(match.str(2));
|
||||
|
||||
int boneNumber = getIndexByValue(word, boneNames);
|
||||
localVerticesBoneWeight[i][j].boneIndex = boneNumber;
|
||||
localVerticesBoneWeight[i][j].weight = weight;
|
||||
sumWeights += weight;
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No match found in the input string.");
|
||||
}
|
||||
}
|
||||
|
||||
//Normalize weights:
|
||||
for (int j = 0; j < boneCount; j++)
|
||||
{
|
||||
localVerticesBoneWeight[i][j].weight = localVerticesBoneWeight[i][j].weight / sumWeights;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::getline(f, tempLine);//=== Animation Keyframes ===
|
||||
std::getline(f, tempLine);//=== Bone Transforms per Keyframe ===
|
||||
|
||||
|
||||
|
||||
std::getline(f, tempLine);
|
||||
int numberKeyFrames;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberKeyFrames = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
animations.resize(1);
|
||||
|
||||
animations[0].keyFrames.resize(numberKeyFrames);
|
||||
|
||||
for (int i = 0; i < numberKeyFrames; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
int numberFrame;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberFrame = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
animations[0].keyFrames[i].frame = numberFrame;
|
||||
|
||||
animations[0].keyFrames[i].bones.resize(numberBones);
|
||||
|
||||
for (int j = 0; j < numberBones; j++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
std::string boneName = tempLine.substr(8);
|
||||
int boneNumber = getIndexByValue(boneName, boneNames);
|
||||
animations[0].keyFrames[i].bones[boneNumber] = startBones[boneNumber];
|
||||
|
||||
std::getline(f, tempLine); // Location: <Vector (0.0000, 0.0000, -0.0091)>
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneStartWorld = Vector3f{ floatValues[0], floatValues[1], floatValues[2] };
|
||||
|
||||
std::getline(f, tempLine); // Rotation
|
||||
std::getline(f, tempLine); // Matrix
|
||||
|
||||
//=============== Matrix begin ==================
|
||||
std::getline(f, tempLine);
|
||||
|
||||
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[0] = floatValues[0];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[0 + 1 * 4] = floatValues[1];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[0 + 2 * 4] = floatValues[2];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[0 + 3 * 4] = floatValues[3];
|
||||
|
||||
|
||||
std::getline(f, tempLine);
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[1] = floatValues[0];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[1 + 1 * 4] = floatValues[1];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[1 + 2 * 4] = floatValues[2];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[1 + 3 * 4] = floatValues[3];
|
||||
|
||||
std::getline(f, tempLine);
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[2] = floatValues[0];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[2 + 1 * 4] = floatValues[1];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[2 + 2 * 4] = floatValues[2];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[2 + 3 * 4] = floatValues[3];
|
||||
|
||||
|
||||
std::getline(f, tempLine);
|
||||
b = tempLine.cbegin();
|
||||
e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[3] = floatValues[0];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[3 + 1 * 4] = floatValues[1];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[3 + 2 * 4] = floatValues[2];
|
||||
animations[0].keyFrames[i].bones[boneNumber].boneMatrixWorld.m[3 + 3 * 4] = floatValues[3];
|
||||
|
||||
//std::getline(f, tempLine);// ignore last matrix line
|
||||
|
||||
//=============== Matrix end ==================
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Now let's process bone weights and vertices
|
||||
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
|
||||
mesh.PositionData.push_back(vertices[triangles[i][0]]);
|
||||
mesh.PositionData.push_back(vertices[triangles[i][1]]);
|
||||
mesh.PositionData.push_back(vertices[triangles[i][2]]);
|
||||
|
||||
verticesBoneWeight.push_back(localVerticesBoneWeight[triangles[i][0]]);
|
||||
verticesBoneWeight.push_back(localVerticesBoneWeight[triangles[i][1]]);
|
||||
verticesBoneWeight.push_back(localVerticesBoneWeight[triangles[i][2]]);
|
||||
|
||||
mesh.TexCoordData.push_back(uvCoords[i][0]);
|
||||
mesh.TexCoordData.push_back(uvCoords[i][1]);
|
||||
mesh.TexCoordData.push_back(uvCoords[i][2]);
|
||||
}
|
||||
|
||||
startMesh = mesh;
|
||||
}
|
||||
|
||||
void BoneSystem::Interpolate(int frame)
|
||||
{
|
||||
int startingFrame = -1;
|
||||
for (int i = 0; i < animations[0].keyFrames.size() - 1; i++)
|
||||
{
|
||||
int oldFrame = animations[0].keyFrames[i].frame;
|
||||
int nextFrame = animations[0].keyFrames[i + 1].frame;
|
||||
if (frame >= oldFrame && frame < nextFrame)
|
||||
{
|
||||
startingFrame = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (startingFrame == -1)
|
||||
{
|
||||
throw std::runtime_error("Exception here");
|
||||
}
|
||||
|
||||
int modifiedFrameNumber = frame - animations[0].keyFrames[startingFrame].frame;
|
||||
|
||||
int diffFrames = animations[0].keyFrames[startingFrame + 1].frame - animations[0].keyFrames[startingFrame].frame;
|
||||
|
||||
float t = (modifiedFrameNumber + 0.f) / diffFrames;
|
||||
|
||||
std::vector<Bone>& oneFrameBones = animations[0].keyFrames[startingFrame].bones;
|
||||
std::vector<Bone>& nextFrameBones = animations[0].keyFrames[startingFrame+1].bones;
|
||||
|
||||
std::vector<Matrix4f> skinningMatrixForEachBone;
|
||||
//std::vector<Matrix3f> skinningMatrixForEachBone;
|
||||
skinningMatrixForEachBone.resize(currentBones.size());
|
||||
|
||||
|
||||
for (int i = 0; i < currentBones.size(); i++)
|
||||
{
|
||||
currentBones[i].boneStartWorld.v[0] = oneFrameBones[i].boneStartWorld.v[0] + t * (nextFrameBones[i].boneStartWorld.v[0] - oneFrameBones[i].boneStartWorld.v[0]);
|
||||
currentBones[i].boneStartWorld.v[1] = oneFrameBones[i].boneStartWorld.v[1] + t * (nextFrameBones[i].boneStartWorld.v[1] - oneFrameBones[i].boneStartWorld.v[1]);
|
||||
currentBones[i].boneStartWorld.v[2] = oneFrameBones[i].boneStartWorld.v[2] + t * (nextFrameBones[i].boneStartWorld.v[2] - oneFrameBones[i].boneStartWorld.v[2]);
|
||||
|
||||
Matrix3f oneFrameBonesMatrix;
|
||||
|
||||
oneFrameBonesMatrix.m[0] = oneFrameBones[i].boneMatrixWorld.m[0];
|
||||
oneFrameBonesMatrix.m[1] = oneFrameBones[i].boneMatrixWorld.m[1];
|
||||
oneFrameBonesMatrix.m[2] = oneFrameBones[i].boneMatrixWorld.m[2];
|
||||
|
||||
oneFrameBonesMatrix.m[3] = oneFrameBones[i].boneMatrixWorld.m[0 + 1*4];
|
||||
oneFrameBonesMatrix.m[4] = oneFrameBones[i].boneMatrixWorld.m[1 + 1*4];
|
||||
oneFrameBonesMatrix.m[5] = oneFrameBones[i].boneMatrixWorld.m[2 + 1*4];
|
||||
|
||||
oneFrameBonesMatrix.m[6] = oneFrameBones[i].boneMatrixWorld.m[0 + 2*4];
|
||||
oneFrameBonesMatrix.m[7] = oneFrameBones[i].boneMatrixWorld.m[1 + 2*4];
|
||||
oneFrameBonesMatrix.m[8] = oneFrameBones[i].boneMatrixWorld.m[2 + 2*4];
|
||||
|
||||
Matrix3f nextFrameBonesMatrix;
|
||||
|
||||
nextFrameBonesMatrix.m[0] = nextFrameBones[i].boneMatrixWorld.m[0];
|
||||
nextFrameBonesMatrix.m[1] = nextFrameBones[i].boneMatrixWorld.m[1];
|
||||
nextFrameBonesMatrix.m[2] = nextFrameBones[i].boneMatrixWorld.m[2];
|
||||
|
||||
nextFrameBonesMatrix.m[3] = nextFrameBones[i].boneMatrixWorld.m[0 + 1 * 4];
|
||||
nextFrameBonesMatrix.m[4] = nextFrameBones[i].boneMatrixWorld.m[1 + 1 * 4];
|
||||
nextFrameBonesMatrix.m[5] = nextFrameBones[i].boneMatrixWorld.m[2 + 1 * 4];
|
||||
|
||||
nextFrameBonesMatrix.m[6] = nextFrameBones[i].boneMatrixWorld.m[0 + 2 * 4];
|
||||
nextFrameBonesMatrix.m[7] = nextFrameBones[i].boneMatrixWorld.m[1 + 2 * 4];
|
||||
nextFrameBonesMatrix.m[8] = nextFrameBones[i].boneMatrixWorld.m[2 + 2 * 4];
|
||||
|
||||
Vector4f q1 = MatrixToQuat(oneFrameBonesMatrix);
|
||||
Vector4f q2 = MatrixToQuat(nextFrameBonesMatrix);
|
||||
Vector4f q1_norm = q1.normalized();
|
||||
Vector4f q2_norm = q2.normalized();
|
||||
|
||||
Vector4f result = slerp(q1_norm, q2_norm, t);
|
||||
|
||||
Matrix3f boneMatrixWorld3 = QuatToMatrix(result);
|
||||
|
||||
currentBones[i].boneMatrixWorld = MakeMatrix4x4(boneMatrixWorld3, currentBones[i].boneStartWorld);
|
||||
|
||||
Matrix4f currentBoneMatrixWorld4 = currentBones[i].boneMatrixWorld;
|
||||
Matrix4f startBoneMatrixWorld4 = animations[0].keyFrames[0].bones[i].boneMatrixWorld;
|
||||
|
||||
Matrix4f inverstedStartBoneMatrixWorld4 = InverseMatrix(startBoneMatrixWorld4);
|
||||
|
||||
skinningMatrixForEachBone[i] = MultMatrixMatrix(currentBoneMatrixWorld4, inverstedStartBoneMatrixWorld4);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
for (int i = 0; i < currentBones.size(); i++)
|
||||
{
|
||||
currentBones[i].boneStartWorld = oneFrameBones[i].boneStartWorld;
|
||||
currentBones[i].boneMatrixWorld = oneFrameBones[i].boneMatrixWorld;
|
||||
//Matrix4f currentBoneMatrixWorld4 = MakeMatrix4x4(currentBones[i].boneMatrixWorld, currentBones[i].boneStartWorld);
|
||||
//Matrix4f startBoneMatrixWorld4 = MakeMatrix4x4(animations[0].keyFrames[0].bones[i].boneMatrixWorld, animations[0].keyFrames[0].bones[i].boneStartWorld);
|
||||
Matrix4f currentBoneMatrixWorld4 = currentBones[i].boneMatrixWorld;
|
||||
Matrix4f startBoneMatrixWorld4 = animations[0].keyFrames[0].bones[i].boneMatrixWorld;
|
||||
Matrix4f inverstedStartBoneMatrixWorld4 = InverseMatrix(startBoneMatrixWorld4);
|
||||
skinningMatrixForEachBone[i] = MultMatrixMatrix(currentBoneMatrixWorld4, inverstedStartBoneMatrixWorld4);
|
||||
|
||||
if (i == 10)
|
||||
{
|
||||
std::cout << i << std::endl;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (int i = 0; i < mesh.PositionData.size(); i++)
|
||||
{
|
||||
Vector4f originalPos = {
|
||||
startMesh.PositionData[i].v[0],
|
||||
startMesh.PositionData[i].v[1],
|
||||
startMesh.PositionData[i].v[2], 1.0};
|
||||
|
||||
Vector4f finalPos = Vector4f{0.f, 0.f, 0.f, 0.f};
|
||||
|
||||
bool vMoved = false;
|
||||
//Vector3f finalPos = Vector3f{ 0.f, 0.f, 0.f };
|
||||
|
||||
for (int j = 0; j < MAX_BONE_COUNT; j++)
|
||||
{
|
||||
if (verticesBoneWeight[i][j].weight != 0)
|
||||
{
|
||||
vMoved = true;
|
||||
//finalPos = finalPos + MultVectorMatrix(originalPos, skinningMatrixForEachBone[verticesBoneWeight[i][j].boneIndex]) * verticesBoneWeight[i][j].weight;
|
||||
finalPos = finalPos + MultMatrixVector(skinningMatrixForEachBone[verticesBoneWeight[i][j].boneIndex], originalPos) * verticesBoneWeight[i][j].weight;
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(finalPos.v[0] - originalPos.v[0]) > 1 || abs(finalPos.v[1] - originalPos.v[1]) > 1 || abs(finalPos.v[2] - originalPos.v[2]) > 1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (!vMoved)
|
||||
{
|
||||
finalPos = originalPos;
|
||||
}
|
||||
|
||||
mesh.PositionData[i].v[0] = finalPos.v[0];
|
||||
mesh.PositionData[i].v[1] = finalPos.v[1];
|
||||
mesh.PositionData[i].v[2] = finalPos.v[2];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
60
BoneAnimatedModel.h
Normal file
@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
#include "Math.h"
|
||||
#include "Renderer.h"
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
constexpr int MAX_BONE_COUNT = 6;
|
||||
struct Bone
|
||||
{
|
||||
Vector3f boneStartWorld;
|
||||
float boneLength;
|
||||
Matrix4f boneMatrixWorld;
|
||||
// boneVector = boneLength * (0, 1, 0) <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Then multiply by boneMatrixWorld <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
int parent;
|
||||
std::vector<int> children;
|
||||
};
|
||||
|
||||
struct BoneWeight
|
||||
{
|
||||
int boneIndex = -1;
|
||||
float weight = 0;
|
||||
};
|
||||
|
||||
struct AnimationKeyFrame
|
||||
{
|
||||
int frame;
|
||||
std::vector<Bone> bones;
|
||||
};
|
||||
|
||||
struct Animation
|
||||
{
|
||||
std::vector<AnimationKeyFrame> keyFrames;
|
||||
};
|
||||
|
||||
struct BoneSystem
|
||||
{
|
||||
VertexDataStruct mesh;
|
||||
VertexDataStruct startMesh;
|
||||
std::vector<std::array<BoneWeight, MAX_BONE_COUNT>> verticesBoneWeight;
|
||||
|
||||
Matrix4f armatureMatrix;
|
||||
|
||||
std::vector<Bone> startBones;
|
||||
std::vector<Bone> currentBones;
|
||||
|
||||
std::vector<Animation> animations;
|
||||
|
||||
void LoadFromFile(const std::string& fileName, const std::string& ZIPFileName = "");
|
||||
|
||||
void Interpolate(int frame);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
34
Environment.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "Environment.h"
|
||||
|
||||
#include "Utils.h"
|
||||
#include <GL/gl.h>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
int Environment::windowHeaderHeight = 0;
|
||||
int Environment::width = 0;
|
||||
int Environment::height = 0;
|
||||
float Environment::zoom = 20.f;
|
||||
|
||||
bool Environment::leftPressed = false;
|
||||
bool Environment::rightPressed = false;
|
||||
bool Environment::upPressed = false;
|
||||
bool Environment::downPressed = false;
|
||||
|
||||
Vector3f Environment::cameraShift = {0, 0, 0};
|
||||
Vector3f Environment::characterPos = {0, 0, 0};
|
||||
|
||||
float Environment::cameraPhi = 0.f;
|
||||
float Environment::cameraAlpha = 0.3*M_PI / 2.0;
|
||||
|
||||
bool Environment::settings_inverseVertical = false;
|
||||
|
||||
SDL_Window* Environment::window = nullptr;
|
||||
|
||||
bool Environment::showMouse = false;
|
||||
|
||||
bool Environment::exitGameLoop = false;
|
||||
|
||||
|
||||
|
||||
} // namespace ZL
|
||||
39
Environment.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#include "Math.h"
|
||||
#ifdef __linux__
|
||||
#include <SDL2/SDL.h>
|
||||
#endif
|
||||
#include "OpenGlExtensions.h"
|
||||
|
||||
namespace ZL {
|
||||
|
||||
class Environment {
|
||||
public:
|
||||
static int windowHeaderHeight;
|
||||
static int width;
|
||||
static int height;
|
||||
static float zoom;
|
||||
|
||||
static bool leftPressed;
|
||||
static bool rightPressed;
|
||||
static bool upPressed;
|
||||
static bool downPressed;
|
||||
|
||||
static Vector3f cameraShift;
|
||||
static Vector3f characterPos;
|
||||
static float cameraPhi;
|
||||
static float cameraAlpha;
|
||||
|
||||
|
||||
|
||||
static bool settings_inverseVertical;
|
||||
|
||||
static SDL_Window* window;
|
||||
|
||||
static bool showMouse;
|
||||
static bool exitGameLoop;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace ZL
|
||||
404
Game.cpp
@ -1,247 +1,165 @@
|
||||
#include "Game.h"
|
||||
#include "AnimatedModel.h"
|
||||
#include "BoneAnimatedModel.h"
|
||||
#include "Utils.h"
|
||||
#include "OpenGlExtensions.h"
|
||||
#include <iostream>
|
||||
#include "TextureManager.h"
|
||||
#include "TextModel.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
namespace Env
|
||||
{
|
||||
int windowHeaderHeight = 0;
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
Vector2f birdStartPos;
|
||||
|
||||
float backgroundSectionWidth;
|
||||
|
||||
int getActualClientHeight()
|
||||
{
|
||||
return height - windowHeaderHeight;
|
||||
}
|
||||
}
|
||||
|
||||
namespace GameObjects
|
||||
{
|
||||
std::shared_ptr<Texture> birdTexturePtr;
|
||||
std::shared_ptr<Texture> backgroundTexturePtr;
|
||||
std::shared_ptr<Texture> pipeTexturePtr;
|
||||
std::shared_ptr<Texture> gameOverTexturePtr;
|
||||
|
||||
VertexDataStruct birdMesh;
|
||||
|
||||
VertexDataStruct backgroundMesh;
|
||||
|
||||
VertexDataStruct pipeMesh;
|
||||
|
||||
VertexDataStruct gameOverMesh;
|
||||
}
|
||||
|
||||
|
||||
PipePairConfig PipePairConfig::CreateTube(float xPos)
|
||||
{
|
||||
PipePairConfig r;
|
||||
|
||||
int vShift = rand() % (Env::getActualClientHeight() / 2) - Env::getActualClientHeight() / 4;
|
||||
|
||||
int holeSize = rand() % (Env::getActualClientHeight() / 4) + Env::getActualClientHeight() / 4;
|
||||
|
||||
r.topPipeVShift = holeSize * 0.5f + vShift;
|
||||
r.bottomPipeVShift = -holeSize * 0.5f + vShift;
|
||||
|
||||
r.xPos = xPos;
|
||||
|
||||
|
||||
// Create pipe lines to check intersection
|
||||
// There are 2 pipes, each consist of 3 lines, total 6 as indexed below:
|
||||
|
||||
/*
|
||||
| |
|
||||
3 | | 5
|
||||
---
|
||||
4
|
||||
|
||||
|
||||
1
|
||||
__
|
||||
| |
|
||||
0 | | 2
|
||||
*/
|
||||
|
||||
|
||||
float xRight = r.xPos - GameConsts::pipeScale * GameObjects::pipeTexturePtr->getWidth() * 0.5f;
|
||||
float xLeft = r.xPos + GameConsts::pipeScale * GameObjects::pipeTexturePtr->getWidth() * 0.5f;
|
||||
|
||||
float yUpBottomPipe = (Env::getActualClientHeight() * 0.5f + r.bottomPipeVShift);
|
||||
float yDownBottomPipe = yUpBottomPipe - GameConsts::pipeScale * GameObjects::pipeTexturePtr->getHeight();
|
||||
|
||||
float yUpTopPipe = (Env::getActualClientHeight() * 0.5f + r.topPipeVShift);
|
||||
float yDownTopPipe = yUpTopPipe + GameConsts::pipeScale * GameObjects::pipeTexturePtr->getHeight();
|
||||
|
||||
r.tubePhysicsLines[0].start.v[0] = xRight;
|
||||
r.tubePhysicsLines[0].end.v[0] = xRight;
|
||||
|
||||
r.tubePhysicsLines[0].start.v[1] = yDownBottomPipe;
|
||||
r.tubePhysicsLines[0].end.v[1] = yUpBottomPipe;
|
||||
|
||||
|
||||
r.tubePhysicsLines[1].start.v[0] = xRight;
|
||||
r.tubePhysicsLines[1].end.v[0] = xLeft;
|
||||
|
||||
r.tubePhysicsLines[1].start.v[1] = yUpBottomPipe;
|
||||
r.tubePhysicsLines[1].end.v[1] = yUpBottomPipe;
|
||||
|
||||
r.tubePhysicsLines[2].start.v[0] = xLeft;
|
||||
r.tubePhysicsLines[2].end.v[0] = xLeft;
|
||||
|
||||
r.tubePhysicsLines[2].start.v[1] = yUpBottomPipe;
|
||||
r.tubePhysicsLines[2].end.v[1] = yDownBottomPipe;
|
||||
|
||||
|
||||
r.tubePhysicsLines[3].start.v[0] = xRight;
|
||||
r.tubePhysicsLines[3].end.v[0] = xRight;
|
||||
|
||||
r.tubePhysicsLines[3].start.v[1] = yUpTopPipe;
|
||||
r.tubePhysicsLines[3].end.v[1] = yDownTopPipe;
|
||||
|
||||
|
||||
r.tubePhysicsLines[4].start.v[0] = xRight;
|
||||
r.tubePhysicsLines[4].end.v[0] = xLeft;
|
||||
|
||||
r.tubePhysicsLines[4].start.v[1] = yDownTopPipe;
|
||||
r.tubePhysicsLines[4].end.v[1] = yDownTopPipe;
|
||||
|
||||
r.tubePhysicsLines[5].start.v[0] = xLeft;
|
||||
r.tubePhysicsLines[5].end.v[0] = xLeft;
|
||||
|
||||
r.tubePhysicsLines[5].start.v[1] = yDownTopPipe;
|
||||
r.tubePhysicsLines[5].end.v[1] = yUpTopPipe;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
PipePairConfig PipePairConfig::CreateLastTube()
|
||||
{
|
||||
return PipePairConfig::CreateTube(Env::width * 1.6f);
|
||||
}
|
||||
|
||||
|
||||
void GameState::UpdateBirdPos(size_t tickCountDiff)
|
||||
{
|
||||
birdCurrentPos.v[1] = birdCurrentPos.v[1] + yVelocity * tickCountDiff;
|
||||
|
||||
yVelocity += GameConsts::yAcceleration * tickCountDiff;
|
||||
|
||||
birdAngle = -atan(yVelocity / xVelocity);
|
||||
|
||||
|
||||
if (birdCurrentPos.v[1] <= 0)
|
||||
{
|
||||
isGameOver = true;
|
||||
}
|
||||
|
||||
if (birdCurrentPos.v[1] >= Env::height)
|
||||
{
|
||||
isGameOver = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GameState::UpdateBackgroundPos(size_t tickCountDiff)
|
||||
{
|
||||
backgroundShift += GameConsts::backgroundXVelocity * tickCountDiff;
|
||||
|
||||
if (backgroundShift > Env::backgroundSectionWidth)
|
||||
{
|
||||
float c = floor(backgroundShift / Env::backgroundSectionWidth);
|
||||
|
||||
backgroundShift -= c * Env::backgroundSectionWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void GameState::UpdatePipePos(size_t tickCountDiff)
|
||||
{
|
||||
for (size_t i = 0; i < pipePairArr.size(); )
|
||||
{
|
||||
|
||||
pipePairArr[i].xPos += xVelocity * tickCountDiff;
|
||||
|
||||
if (pipePairArr[i].xPos < 0)
|
||||
{
|
||||
pipePairArr.erase(pipePairArr.begin() + i);
|
||||
|
||||
pipePairArr.push_back(PipePairConfig::CreateLastTube());
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GameState::UpdatePhysics(size_t tickCountDiff)
|
||||
{
|
||||
birdEllipse.center = birdCurrentPos;
|
||||
|
||||
for (size_t i = 0; i < pipePairArr.size(); i++)
|
||||
{
|
||||
|
||||
for (size_t j = 0; j < pipePairArr[i].tubePhysicsLines.size(); j++)
|
||||
{
|
||||
|
||||
pipePairArr[i].tubePhysicsLines[j].start.v[0] += xVelocity * tickCountDiff;
|
||||
pipePairArr[i].tubePhysicsLines[j].end.v[0] += xVelocity * tickCountDiff;
|
||||
|
||||
if (TestIntersection(pipePairArr[i].tubePhysicsLines[j], birdEllipse))
|
||||
{
|
||||
isGameOver = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameState::RestartGame()
|
||||
{
|
||||
|
||||
birdCurrentPos = Env::birdStartPos;
|
||||
|
||||
birdEllipse.center = birdCurrentPos;
|
||||
|
||||
xVelocity = -0.3f;
|
||||
yVelocity = 0.f;
|
||||
|
||||
birdAngle = 0.f;
|
||||
|
||||
backgroundShift = 0.f;
|
||||
|
||||
pipePairArr.clear();
|
||||
|
||||
pipePairArr.push_back(PipePairConfig::CreateTube(Env::width * 0.4f));
|
||||
pipePairArr.push_back(PipePairConfig::CreateTube(Env::width * 0.8f));
|
||||
pipePairArr.push_back(PipePairConfig::CreateTube(Env::width * 1.2f));
|
||||
pipePairArr.push_back(PipePairConfig::CreateTube(Env::width * 1.6f));
|
||||
|
||||
isGameOver = false;
|
||||
}
|
||||
|
||||
void GameState::UpdateScene(size_t tickCountDiff)
|
||||
{
|
||||
|
||||
if (isGameOver)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateBirdPos(tickCountDiff);
|
||||
|
||||
UpdatePipePos(tickCountDiff);
|
||||
|
||||
UpdateBackgroundPos(tickCountDiff);
|
||||
|
||||
UpdatePhysics(tickCountDiff);
|
||||
}
|
||||
|
||||
void GameState::BirdJump()
|
||||
{
|
||||
yVelocity = GameConsts::jumpVelocity;
|
||||
}
|
||||
}
|
||||
const char* CONST_ZIP_FILE = "";
|
||||
|
||||
Game::Game()
|
||||
: window(nullptr)
|
||||
, glContext(nullptr)
|
||||
, newTickCount(0)
|
||||
, lastTickCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
Game::~Game() {
|
||||
if (glContext) {
|
||||
SDL_GL_DeleteContext(glContext);
|
||||
}
|
||||
if (window) {
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
void Game::setup() {
|
||||
glContext = SDL_GL_CreateContext(ZL::Environment::window);
|
||||
|
||||
ZL::BindOpenGlFunctions();
|
||||
ZL::CheckGlError();
|
||||
|
||||
// Initialize renderer
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
renderer.shaderManager.AddShaderFromFiles("default", "./shaders/default.vertex", "./shaders/default_web.fragment", CONST_ZIP_FILE);
|
||||
renderer.shaderManager.AddShaderFromFiles("defaultColor", "./shaders/defaultColor.vertex", "./shaders/defaultColor_web.fragment", CONST_ZIP_FILE);
|
||||
#else
|
||||
renderer.shaderManager.AddShaderFromFiles("default", "./shaders/default.vertex", "./shaders/default_desktop.fragment", CONST_ZIP_FILE);
|
||||
renderer.shaderManager.AddShaderFromFiles("defaultColor", "./shaders/defaultColor.vertex", "./shaders/defaultColor_desktop.fragment", CONST_ZIP_FILE);
|
||||
#endif
|
||||
|
||||
//Load texture
|
||||
spaceshipTexture = std::make_unique<Texture>(CreateTextureDataFromPng("./resources/sship001x.png"));
|
||||
spaceshipBase = LoadFromTextFile02("./resources/spaceship004.txt");
|
||||
spaceshipBase.RotateByMatrix(QuatToMatrix(QuatFromRotateAroundY(M_PI / 2.0)));
|
||||
spaceship.AssignFrom(spaceshipBase);
|
||||
spaceship.RefreshVBO();
|
||||
|
||||
|
||||
renderer.InitOpenGL();
|
||||
|
||||
}
|
||||
|
||||
void Game::drawScene() {
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string vPositionName = "vPosition";
|
||||
static const std::string vTexCoordName = "vTexCoord";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
glClearColor(0.0f, 0.5f, 1.0f, 1.0f);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glViewport(0, 0, Environment::width, Environment::height);
|
||||
|
||||
CheckGlError();
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.EnableVertexAttribArray(vTexCoordName);
|
||||
|
||||
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5,
|
||||
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
|
||||
1, 1000);
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
renderer.TranslateMatrix({ 0,0, -1.0f*Environment::zoom });
|
||||
renderer.RotateMatrix(QuatFromRotateAroundX(M_PI/6.0));
|
||||
//renderer.RotateMatrix(QuatFromRotateAroundX(Environment::cameraAlpha));
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, spaceshipTexture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(spaceship);
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
void Game::processTickCount() {
|
||||
|
||||
if (lastTickCount == 0) {
|
||||
lastTickCount = SDL_GetTicks64();
|
||||
return;
|
||||
}
|
||||
|
||||
newTickCount = SDL_GetTicks64();
|
||||
if (newTickCount - lastTickCount > CONST_TIMER_INTERVAL) {
|
||||
size_t delta = (newTickCount - lastTickCount > CONST_MAX_TIME_INTERVAL) ?
|
||||
CONST_MAX_TIME_INTERVAL : newTickCount - lastTickCount;
|
||||
|
||||
//gameObjects.updateScene(delta);
|
||||
|
||||
Environment::cameraAlpha = Environment::cameraAlpha + delta * M_PI / 10000.f;
|
||||
|
||||
lastTickCount = newTickCount;
|
||||
}
|
||||
}
|
||||
|
||||
void Game::render() {
|
||||
SDL_GL_MakeCurrent(ZL::Environment::window, glContext);
|
||||
ZL::CheckGlError();
|
||||
|
||||
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
drawScene();
|
||||
processTickCount();
|
||||
|
||||
SDL_GL_SwapWindow(ZL::Environment::window);
|
||||
}
|
||||
|
||||
void Game::update() {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
Environment::exitGameLoop = true;
|
||||
|
||||
}
|
||||
else if (event.type == SDL_MOUSEWHEEL) {
|
||||
static const float zoomstep = 2.0f;
|
||||
if (event.wheel.y > 0) {
|
||||
Environment::zoom -= zoomstep;
|
||||
}
|
||||
else if (event.wheel.y < 0) {
|
||||
Environment::zoom += zoomstep;
|
||||
}
|
||||
if (Environment::zoom < zoomstep) {
|
||||
Environment::zoom = zoomstep;
|
||||
}
|
||||
/*if (Environment::zoom > 4) {
|
||||
Environment::zoom = 4;
|
||||
}*/
|
||||
|
||||
//this->modelMeshRender.data.Scale(0.5);
|
||||
//this->modelMeshRender.RefreshVBO();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
render();
|
||||
}
|
||||
|
||||
} // namespace ZL
|
||||
128
Game.h
@ -1,106 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math.h"
|
||||
#include "Physics.h"
|
||||
#include "TextureManager.h"
|
||||
#include "OpenGlExtensions.h"
|
||||
#include "Renderer.h"
|
||||
#include <memory>
|
||||
#include "Environment.h"
|
||||
#include "TextureManager.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
namespace GameConsts
|
||||
{
|
||||
constexpr float yAcceleration = -0.0003f;
|
||||
namespace ZL {
|
||||
|
||||
constexpr float backgroundXVelocity = 0.15f;
|
||||
class Game {
|
||||
public:
|
||||
Game();
|
||||
~Game();
|
||||
|
||||
void setup();
|
||||
void update();
|
||||
void render();
|
||||
|
||||
bool shouldExit() const { return Environment::exitGameLoop; }
|
||||
|
||||
constexpr float jumpVelocity = 0.2f;
|
||||
private:
|
||||
void processTickCount();
|
||||
void drawScene();
|
||||
|
||||
constexpr float pipeScale = 0.5f;
|
||||
SDL_Window* window;
|
||||
SDL_GLContext glContext;
|
||||
Renderer renderer;
|
||||
|
||||
size_t newTickCount;
|
||||
size_t lastTickCount;
|
||||
|
||||
static const size_t CONST_TIMER_INTERVAL = 10;
|
||||
static const size_t CONST_MAX_TIME_INTERVAL = 1000;
|
||||
|
||||
constexpr float birdScale = 0.1f;
|
||||
}
|
||||
std::shared_ptr<Texture> spaceshipTexture;
|
||||
VertexDataStruct spaceshipBase;
|
||||
VertexRenderStruct spaceship;
|
||||
};
|
||||
|
||||
namespace Env
|
||||
{
|
||||
extern int windowHeaderHeight;
|
||||
|
||||
extern int width;
|
||||
extern int height;
|
||||
|
||||
extern Vector2f birdStartPos;
|
||||
|
||||
//Calculated depending on the background texture and screen size
|
||||
extern float backgroundSectionWidth;
|
||||
|
||||
int getActualClientHeight();
|
||||
}
|
||||
|
||||
|
||||
struct PipePairConfig
|
||||
{
|
||||
float topPipeVShift;
|
||||
float bottomPipeVShift;
|
||||
|
||||
float xPos;
|
||||
|
||||
std::array<LinePhysicsObject, 6> tubePhysicsLines;
|
||||
|
||||
static PipePairConfig CreateTube(float xPos);
|
||||
|
||||
static PipePairConfig CreateLastTube();
|
||||
};
|
||||
|
||||
struct GameState
|
||||
{
|
||||
protected:
|
||||
void UpdateBirdPos(size_t tickCountDiff);
|
||||
|
||||
void UpdateBackgroundPos(size_t tickCountDiff);
|
||||
|
||||
void UpdatePipePos(size_t tickCountDiff);
|
||||
|
||||
void UpdatePhysics(size_t tickCountDiff);
|
||||
|
||||
public:
|
||||
|
||||
Vector2f birdCurrentPos = {0.f, 0.f};
|
||||
|
||||
float xVelocity = -0.3f;
|
||||
float yVelocity = 0.f;
|
||||
|
||||
float birdAngle = 0.f;
|
||||
|
||||
float backgroundShift = 0.f;
|
||||
|
||||
bool isGameOver = false;
|
||||
|
||||
std::vector<PipePairConfig> pipePairArr;
|
||||
|
||||
EllipsePhysicsObject birdEllipse;
|
||||
|
||||
void RestartGame();
|
||||
|
||||
void UpdateScene(size_t tickCountDiff);
|
||||
|
||||
void BirdJump();
|
||||
};
|
||||
|
||||
|
||||
|
||||
namespace GameObjects
|
||||
{
|
||||
extern std::shared_ptr<Texture> birdTexturePtr;
|
||||
extern std::shared_ptr<Texture> backgroundTexturePtr;
|
||||
extern std::shared_ptr<Texture> pipeTexturePtr;
|
||||
extern std::shared_ptr<Texture> gameOverTexturePtr;
|
||||
|
||||
extern VertexDataStruct birdMesh;
|
||||
|
||||
extern VertexDataStruct backgroundMesh;
|
||||
|
||||
extern VertexDataStruct pipeMesh;
|
||||
|
||||
extern VertexDataStruct gameOverMesh;
|
||||
}
|
||||
}
|
||||
} // namespace ZL
|
||||
572
Math.cpp
@ -1,6 +1,7 @@
|
||||
#include "Math.h"
|
||||
|
||||
#include <exception>
|
||||
#include <cmath>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
@ -24,6 +25,68 @@ namespace ZL {
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector3f operator+(const Vector3f& x, const Vector3f& y)
|
||||
{
|
||||
Vector3f result;
|
||||
|
||||
result.v[0] = x.v[0] + y.v[0];
|
||||
result.v[1] = x.v[1] + y.v[1];
|
||||
result.v[2] = x.v[2] + y.v[2];
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector3f operator-(const Vector3f& x, const Vector3f& y)
|
||||
{
|
||||
Vector3f result;
|
||||
|
||||
result.v[0] = x.v[0] - y.v[0];
|
||||
result.v[1] = x.v[1] - y.v[1];
|
||||
result.v[2] = x.v[2] - y.v[2];
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector4f operator+(const Vector4f& x, const Vector4f& y)
|
||||
{
|
||||
Vector4f result;
|
||||
|
||||
result.v[0] = x.v[0] + y.v[0];
|
||||
result.v[1] = x.v[1] + y.v[1];
|
||||
result.v[2] = x.v[2] + y.v[2];
|
||||
result.v[3] = x.v[3] + y.v[3];
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector4f operator-(const Vector4f& x, const Vector4f& y)
|
||||
{
|
||||
Vector4f result;
|
||||
|
||||
result.v[0] = x.v[0] - y.v[0];
|
||||
result.v[1] = x.v[1] - y.v[1];
|
||||
result.v[2] = x.v[2] - y.v[2];
|
||||
result.v[3] = x.v[3] - y.v[3];
|
||||
return result;
|
||||
}
|
||||
|
||||
Matrix3f Matrix3f::Identity()
|
||||
{
|
||||
Matrix3f r;
|
||||
|
||||
r.m[0] = 1.f;
|
||||
r.m[1] = 0.f;
|
||||
r.m[2] = 0.f;
|
||||
|
||||
r.m[3] = 0.f;
|
||||
r.m[4] = 1.f;
|
||||
r.m[5] = 0.f;
|
||||
|
||||
r.m[6] = 0.f;
|
||||
r.m[7] = 0.f;
|
||||
r.m[8] = 1.f;
|
||||
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
Matrix4f Matrix4f::Identity()
|
||||
{
|
||||
Matrix4f r;
|
||||
@ -86,7 +149,7 @@ namespace ZL {
|
||||
|
||||
if (depthRange <= 0)
|
||||
{
|
||||
throw std::exception("zFar must be greater than zNear");
|
||||
throw std::runtime_error("zFar must be greater than zNear");
|
||||
}
|
||||
|
||||
Matrix4f r;
|
||||
@ -114,6 +177,39 @@ namespace ZL {
|
||||
return r;
|
||||
}
|
||||
|
||||
Matrix4f MakePerspectiveMatrix(float fovY, float aspectRatio, float zNear, float zFar)
|
||||
{
|
||||
float tanHalfFovy = tan(fovY / 2.f);
|
||||
Matrix4f r;
|
||||
|
||||
if (zNear >= zFar || aspectRatio == 0)
|
||||
{
|
||||
throw std::runtime_error("Invalid perspective parameters");
|
||||
}
|
||||
|
||||
r.m[0] = 1.f / (aspectRatio * tanHalfFovy);
|
||||
r.m[1] = 0;
|
||||
r.m[2] = 0;
|
||||
r.m[3] = 0;
|
||||
|
||||
r.m[4] = 0;
|
||||
r.m[5] = 1.f / (tanHalfFovy);
|
||||
r.m[6] = 0;
|
||||
r.m[7] = 0;
|
||||
|
||||
r.m[8] = 0;
|
||||
r.m[9] = 0;
|
||||
r.m[10] = -(zFar + zNear) / (zFar - zNear);
|
||||
r.m[11] = -1;
|
||||
|
||||
r.m[12] = 0;
|
||||
r.m[13] = 0;
|
||||
r.m[14] = -(2.f * zFar * zNear) / (zFar - zNear);
|
||||
r.m[15] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Matrix3f QuatToMatrix(const Vector4f& q)
|
||||
{
|
||||
Matrix3f m;
|
||||
@ -148,6 +244,71 @@ namespace ZL {
|
||||
|
||||
}
|
||||
|
||||
Vector4f MatrixToQuat(const Matrix3f& m)
|
||||
{
|
||||
Vector4f r;
|
||||
float trace = m.m[0] + m.m[4] + m.m[8];
|
||||
|
||||
if (trace > 0)
|
||||
{
|
||||
float s = 0.5f / sqrtf(trace + 1.0f);
|
||||
r.v[3] = 0.25f / s;
|
||||
r.v[0] = (m.m[5] - m.m[7]) * s;
|
||||
r.v[1] = (m.m[6] - m.m[2]) * s;
|
||||
r.v[2] = (m.m[1] - m.m[3]) * s;
|
||||
}
|
||||
else if (m.m[0] > m.m[4] && m.m[0] > m.m[8])
|
||||
{
|
||||
float s = 2.0f * sqrtf(1.0f + m.m[0] - m.m[4] - m.m[8]);
|
||||
r.v[3] = (m.m[5] - m.m[7]) / s;
|
||||
r.v[0] = 0.25f * s;
|
||||
r.v[1] = (m.m[1] + m.m[3]) / s;
|
||||
r.v[2] = (m.m[6] + m.m[2]) / s;
|
||||
}
|
||||
else if (m.m[4] > m.m[8])
|
||||
{
|
||||
float s = 2.0f * sqrtf(1.0f + m.m[4] - m.m[0] - m.m[8]);
|
||||
r.v[3] = (m.m[6] - m.m[2]) / s;
|
||||
r.v[0] = (m.m[1] + m.m[3]) / s;
|
||||
r.v[1] = 0.25f * s;
|
||||
r.v[2] = (m.m[5] + m.m[7]) / s;
|
||||
}
|
||||
else
|
||||
{
|
||||
float s = 2.0f * sqrtf(1.0f + m.m[8] - m.m[0] - m.m[4]);
|
||||
r.v[3] = (m.m[1] - m.m[3]) / s;
|
||||
r.v[0] = (m.m[6] + m.m[2]) / s;
|
||||
r.v[1] = (m.m[5] + m.m[7]) / s;
|
||||
r.v[2] = 0.25f * s;
|
||||
}
|
||||
|
||||
return r.normalized();
|
||||
}
|
||||
|
||||
Vector4f QuatFromRotateAroundX(float angle)
|
||||
{
|
||||
Vector4f result;
|
||||
|
||||
result.v[0] = sinf(angle * 0.5f);
|
||||
result.v[1] = 0.f;
|
||||
result.v[2] = 0.f;
|
||||
result.v[3] = cosf(angle * 0.5f);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector4f QuatFromRotateAroundY(float angle)
|
||||
{
|
||||
Vector4f result;
|
||||
|
||||
result.v[0] = 0.f;
|
||||
result.v[1] = sinf(angle * 0.5f);
|
||||
result.v[2] = 0.f;
|
||||
result.v[3] = cosf(angle * 0.5f);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector4f QuatFromRotateAroundZ(float angle)
|
||||
{
|
||||
Vector4f result;
|
||||
@ -160,5 +321,414 @@ namespace ZL {
|
||||
return result;
|
||||
}
|
||||
|
||||
Matrix3f TransposeMatrix(const Matrix3f& m)
|
||||
{
|
||||
Matrix3f r;
|
||||
r.m[0] = m.m[0];
|
||||
r.m[1] = m.m[3];
|
||||
r.m[2] = m.m[6];
|
||||
r.m[3] = m.m[1];
|
||||
r.m[4] = m.m[4];
|
||||
r.m[5] = m.m[7];
|
||||
r.m[6] = m.m[2];
|
||||
r.m[7] = m.m[5];
|
||||
r.m[8] = m.m[8];
|
||||
return r;
|
||||
}
|
||||
|
||||
Matrix3f InverseMatrix(const Matrix3f& m)
|
||||
{
|
||||
float d;
|
||||
Matrix3f r;
|
||||
|
||||
d = m.m[0] * (m.m[4] * m.m[8] - m.m[5] * m.m[7]);
|
||||
d -= m.m[1] * (m.m[3] * m.m[8] - m.m[6] * m.m[5]);
|
||||
d += m.m[2] * (m.m[3] * m.m[7] - m.m[6] * m.m[4]);
|
||||
|
||||
if (fabs(d) < 0.01f)
|
||||
{
|
||||
throw std::runtime_error("Error: matrix cannot be inversed!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
r.m[0] = (m.m[4] * m.m[8] - m.m[5] * m.m[7]) / d;
|
||||
r.m[1] = -(m.m[1] * m.m[8] - m.m[2] * m.m[7]) / d;
|
||||
r.m[2] = (m.m[1] * m.m[5] - m.m[2] * m.m[4]) / d;
|
||||
|
||||
r.m[3] = -(m.m[3] * m.m[8] - m.m[5] * m.m[6]) / d;
|
||||
r.m[4] = (m.m[0] * m.m[8] - m.m[2] * m.m[6]) / d;
|
||||
r.m[5] = -(m.m[0] * m.m[5] - m.m[2] * m.m[3]) / d;
|
||||
|
||||
r.m[6] = (m.m[3] * m.m[7] - m.m[6] * m.m[4]) / d;
|
||||
r.m[7] = -(m.m[0] * m.m[7] - m.m[6] * m.m[1]) / d;
|
||||
r.m[8] = (m.m[0] * m.m[4] - m.m[1] * m.m[3]) / d;
|
||||
|
||||
};
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Matrix4f InverseMatrix(const Matrix4f& mat)
|
||||
{
|
||||
Matrix4f inv;
|
||||
float det;
|
||||
|
||||
inv.m[0] = mat.m[5] * mat.m[10] * mat.m[15] -
|
||||
mat.m[5] * mat.m[11] * mat.m[14] -
|
||||
mat.m[9] * mat.m[6] * mat.m[15] +
|
||||
mat.m[9] * mat.m[7] * mat.m[14] +
|
||||
mat.m[13] * mat.m[6] * mat.m[11] -
|
||||
mat.m[13] * mat.m[7] * mat.m[10];
|
||||
|
||||
inv.m[4] = -mat.m[4] * mat.m[10] * mat.m[15] +
|
||||
mat.m[4] * mat.m[11] * mat.m[14] +
|
||||
mat.m[8] * mat.m[6] * mat.m[15] -
|
||||
mat.m[8] * mat.m[7] * mat.m[14] -
|
||||
mat.m[12] * mat.m[6] * mat.m[11] +
|
||||
mat.m[12] * mat.m[7] * mat.m[10];
|
||||
|
||||
inv.m[8] = mat.m[4] * mat.m[9] * mat.m[15] -
|
||||
mat.m[4] * mat.m[11] * mat.m[13] -
|
||||
mat.m[8] * mat.m[5] * mat.m[15] +
|
||||
mat.m[8] * mat.m[7] * mat.m[13] +
|
||||
mat.m[12] * mat.m[5] * mat.m[11] -
|
||||
mat.m[12] * mat.m[7] * mat.m[9];
|
||||
|
||||
inv.m[12] = -mat.m[4] * mat.m[9] * mat.m[14] +
|
||||
mat.m[4] * mat.m[10] * mat.m[13] +
|
||||
mat.m[8] * mat.m[5] * mat.m[14] -
|
||||
mat.m[8] * mat.m[6] * mat.m[13] -
|
||||
mat.m[12] * mat.m[5] * mat.m[10] +
|
||||
mat.m[12] * mat.m[6] * mat.m[9];
|
||||
|
||||
inv.m[1] = -mat.m[1] * mat.m[10] * mat.m[15] +
|
||||
mat.m[1] * mat.m[11] * mat.m[14] +
|
||||
mat.m[9] * mat.m[2] * mat.m[15] -
|
||||
mat.m[9] * mat.m[3] * mat.m[14] -
|
||||
mat.m[13] * mat.m[2] * mat.m[11] +
|
||||
mat.m[13] * mat.m[3] * mat.m[10];
|
||||
|
||||
inv.m[5] = mat.m[0] * mat.m[10] * mat.m[15] -
|
||||
mat.m[0] * mat.m[11] * mat.m[14] -
|
||||
mat.m[8] * mat.m[2] * mat.m[15] +
|
||||
mat.m[8] * mat.m[3] * mat.m[14] +
|
||||
mat.m[12] * mat.m[2] * mat.m[11] -
|
||||
mat.m[12] * mat.m[3] * mat.m[10];
|
||||
|
||||
inv.m[9] = -mat.m[0] * mat.m[9] * mat.m[15] +
|
||||
mat.m[0] * mat.m[11] * mat.m[13] +
|
||||
mat.m[8] * mat.m[1] * mat.m[15] -
|
||||
mat.m[8] * mat.m[3] * mat.m[13] -
|
||||
mat.m[12] * mat.m[1] * mat.m[11] +
|
||||
mat.m[12] * mat.m[3] * mat.m[9];
|
||||
|
||||
inv.m[13] = mat.m[0] * mat.m[9] * mat.m[14] -
|
||||
mat.m[0] * mat.m[10] * mat.m[13] -
|
||||
mat.m[8] * mat.m[1] * mat.m[14] +
|
||||
mat.m[8] * mat.m[2] * mat.m[13] +
|
||||
mat.m[12] * mat.m[1] * mat.m[10] -
|
||||
mat.m[12] * mat.m[2] * mat.m[9];
|
||||
|
||||
inv.m[2] = mat.m[1] * mat.m[6] * mat.m[15] -
|
||||
mat.m[1] * mat.m[7] * mat.m[14] -
|
||||
mat.m[5] * mat.m[2] * mat.m[15] +
|
||||
mat.m[5] * mat.m[3] * mat.m[14] +
|
||||
mat.m[13] * mat.m[2] * mat.m[7] -
|
||||
mat.m[13] * mat.m[3] * mat.m[6];
|
||||
|
||||
inv.m[6] = -mat.m[0] * mat.m[6] * mat.m[15] +
|
||||
mat.m[0] * mat.m[7] * mat.m[14] +
|
||||
mat.m[4] * mat.m[2] * mat.m[15] -
|
||||
mat.m[4] * mat.m[3] * mat.m[14] -
|
||||
mat.m[12] * mat.m[2] * mat.m[7] +
|
||||
mat.m[12] * mat.m[3] * mat.m[6];
|
||||
|
||||
inv.m[10] = mat.m[0] * mat.m[5] * mat.m[15] -
|
||||
mat.m[0] * mat.m[7] * mat.m[13] -
|
||||
mat.m[4] * mat.m[1] * mat.m[15] +
|
||||
mat.m[4] * mat.m[3] * mat.m[13] +
|
||||
mat.m[12] * mat.m[1] * mat.m[7] -
|
||||
mat.m[12] * mat.m[3] * mat.m[5];
|
||||
|
||||
inv.m[14] = -mat.m[0] * mat.m[5] * mat.m[14] +
|
||||
mat.m[0] * mat.m[6] * mat.m[13] +
|
||||
mat.m[4] * mat.m[1] * mat.m[14] -
|
||||
mat.m[4] * mat.m[2] * mat.m[13] -
|
||||
mat.m[12] * mat.m[1] * mat.m[6] +
|
||||
mat.m[12] * mat.m[2] * mat.m[5];
|
||||
|
||||
inv.m[3] = -mat.m[1] * mat.m[6] * mat.m[11] +
|
||||
mat.m[1] * mat.m[7] * mat.m[10] +
|
||||
mat.m[5] * mat.m[2] * mat.m[11] -
|
||||
mat.m[5] * mat.m[3] * mat.m[10] -
|
||||
mat.m[9] * mat.m[2] * mat.m[7] +
|
||||
mat.m[9] * mat.m[3] * mat.m[6];
|
||||
|
||||
inv.m[7] = mat.m[0] * mat.m[6] * mat.m[11] -
|
||||
mat.m[0] * mat.m[7] * mat.m[10] -
|
||||
mat.m[4] * mat.m[2] * mat.m[11] +
|
||||
mat.m[4] * mat.m[3] * mat.m[10] +
|
||||
mat.m[8] * mat.m[2] * mat.m[7] -
|
||||
mat.m[8] * mat.m[3] * mat.m[6];
|
||||
|
||||
inv.m[11] = -mat.m[0] * mat.m[5] * mat.m[11] +
|
||||
mat.m[0] * mat.m[7] * mat.m[9] +
|
||||
mat.m[4] * mat.m[1] * mat.m[11] -
|
||||
mat.m[4] * mat.m[3] * mat.m[9] -
|
||||
mat.m[8] * mat.m[1] * mat.m[7] +
|
||||
mat.m[8] * mat.m[3] * mat.m[5];
|
||||
|
||||
inv.m[15] = mat.m[0] * mat.m[5] * mat.m[10] -
|
||||
mat.m[0] * mat.m[6] * mat.m[9] -
|
||||
mat.m[4] * mat.m[1] * mat.m[10] +
|
||||
mat.m[4] * mat.m[2] * mat.m[9] +
|
||||
mat.m[8] * mat.m[1] * mat.m[6] -
|
||||
mat.m[8] * mat.m[2] * mat.m[5];
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
det = mat.m[0] * inv.m[0] + mat.m[1] * inv.m[4] + mat.m[2] * inv.m[8] + mat.m[3] * inv.m[12];
|
||||
|
||||
if (std::fabs(det) < 0.01f)
|
||||
{
|
||||
throw std::runtime_error("Error: matrix cannot be inversed!");
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
det = 1.0f / det;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
inv.m[i] *= det;
|
||||
}
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
Matrix3f CreateZRotationMatrix(float angle)
|
||||
{
|
||||
Matrix3f result = Matrix3f::Identity();
|
||||
|
||||
result.m[0] = cosf(angle);
|
||||
result.m[1] = -sinf(angle);
|
||||
result.m[3] = sinf(angle);
|
||||
result.m[4] = cosf(angle);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Matrix4f MultMatrixMatrix(const Matrix4f& m1, const Matrix4f& m2)
|
||||
{
|
||||
Matrix4f rx;
|
||||
|
||||
rx.m[0] = m1.m[0] * m2.m[0] + m1.m[4] * m2.m[1] + m1.m[8] * m2.m[2] + m1.m[12] * m2.m[3];
|
||||
rx.m[1] = m1.m[1] * m2.m[0] + m1.m[5] * m2.m[1] + m1.m[9] * m2.m[2] + m1.m[13] * m2.m[3];
|
||||
rx.m[2] = m1.m[2] * m2.m[0] + m1.m[6] * m2.m[1] + m1.m[10] * m2.m[2] + m1.m[14] * m2.m[3];
|
||||
rx.m[3] = m1.m[3] * m2.m[0] + m1.m[7] * m2.m[1] + m1.m[11] * m2.m[2] + m1.m[15] * m2.m[3];
|
||||
|
||||
rx.m[4] = m1.m[0] * m2.m[4] + m1.m[4] * m2.m[5] + m1.m[8] * m2.m[6] + m1.m[12] * m2.m[7];
|
||||
rx.m[5] = m1.m[1] * m2.m[4] + m1.m[5] * m2.m[5] + m1.m[9] * m2.m[6] + m1.m[13] * m2.m[7];
|
||||
rx.m[6] = m1.m[2] * m2.m[4] + m1.m[6] * m2.m[5] + m1.m[10] * m2.m[6] + m1.m[14] * m2.m[7];
|
||||
rx.m[7] = m1.m[3] * m2.m[4] + m1.m[7] * m2.m[5] + m1.m[11] * m2.m[6] + m1.m[15] * m2.m[7];
|
||||
|
||||
|
||||
rx.m[8] = m1.m[0] * m2.m[8] + m1.m[4] * m2.m[9] + m1.m[8] * m2.m[10] + m1.m[12] * m2.m[11];
|
||||
rx.m[9] = m1.m[1] * m2.m[8] + m1.m[5] * m2.m[9] + m1.m[9] * m2.m[10] + m1.m[13] * m2.m[11];
|
||||
rx.m[10] = m1.m[2] * m2.m[8] + m1.m[6] * m2.m[9] + m1.m[10] * m2.m[10] + m1.m[14] * m2.m[11];
|
||||
rx.m[11] = m1.m[3] * m2.m[8] + m1.m[7] * m2.m[9] + m1.m[11] * m2.m[10] + m1.m[15] * m2.m[11];
|
||||
|
||||
rx.m[12] = m1.m[0] * m2.m[12] + m1.m[4] * m2.m[13] + m1.m[8] * m2.m[14] + m1.m[12] * m2.m[15];
|
||||
rx.m[13] = m1.m[1] * m2.m[12] + m1.m[5] * m2.m[13] + m1.m[9] * m2.m[14] + m1.m[13] * m2.m[15];
|
||||
rx.m[14] = m1.m[2] * m2.m[12] + m1.m[6] * m2.m[13] + m1.m[10] * m2.m[14] + m1.m[14] * m2.m[15];
|
||||
rx.m[15] = m1.m[3] * m2.m[12] + m1.m[7] * m2.m[13] + m1.m[11] * m2.m[14] + m1.m[15] * m2.m[15];
|
||||
|
||||
return rx;
|
||||
}
|
||||
|
||||
Matrix3f MultMatrixMatrix(const Matrix3f& m1, const Matrix3f& m2)
|
||||
{
|
||||
Matrix3f r;
|
||||
|
||||
r.m[0] = m1.m[0] * m2.m[0] + m1.m[3] * m2.m[1] + m1.m[6] * m2.m[2];
|
||||
r.m[1] = m1.m[1] * m2.m[0] + m1.m[4] * m2.m[1] + m1.m[7] * m2.m[2];
|
||||
r.m[2] = m1.m[2] * m2.m[0] + m1.m[5] * m2.m[1] + m1.m[8] * m2.m[2];
|
||||
|
||||
r.m[3] = m1.m[0] * m2.m[3] + m1.m[3] * m2.m[4] + m1.m[6] * m2.m[5];
|
||||
r.m[4] = m1.m[1] * m2.m[3] + m1.m[4] * m2.m[4] + m1.m[7] * m2.m[5];
|
||||
r.m[5] = m1.m[2] * m2.m[3] + m1.m[5] * m2.m[4] + m1.m[8] * m2.m[5];
|
||||
|
||||
r.m[6] = m1.m[0] * m2.m[6] + m1.m[3] * m2.m[7] + m1.m[6] * m2.m[8] ;
|
||||
r.m[7] = m1.m[1] * m2.m[6] + m1.m[4] * m2.m[7] + m1.m[7] * m2.m[8];
|
||||
r.m[8] = m1.m[2] * m2.m[6] + m1.m[5] * m2.m[7] + m1.m[8] * m2.m[8];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Matrix3f MakeTranslationMatrix(const Vector3f& p)
|
||||
{
|
||||
Matrix3f r = Matrix3f::Identity();
|
||||
|
||||
r.m[12] = p.v[0];
|
||||
r.m[13] = p.v[1];
|
||||
r.m[14] = p.v[2];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Matrix3f MakeScaleMatrix(float scale)
|
||||
{
|
||||
Matrix3f r = Matrix3f::Identity();
|
||||
|
||||
r.m[0] = scale;
|
||||
r.m[5] = scale;
|
||||
r.m[10] = scale;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Matrix3f MakeRotationMatrix(const Vector3f& p)
|
||||
{
|
||||
Matrix3f r = Matrix3f::Identity();
|
||||
|
||||
r.m[12] = p.v[0];
|
||||
r.m[13] = p.v[1];
|
||||
r.m[14] = p.v[2];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Vector3f operator*(Vector3f v, float scale)
|
||||
{
|
||||
Vector3f r = v;
|
||||
|
||||
r.v[0] = v.v[0] * scale;
|
||||
r.v[1] = v.v[1] * scale;
|
||||
r.v[2] = v.v[2] * scale;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Vector4f operator*(Vector4f v, float scale)
|
||||
{
|
||||
Vector4f r = v;
|
||||
|
||||
r.v[0] = v.v[0] * scale;
|
||||
r.v[1] = v.v[1] * scale;
|
||||
r.v[2] = v.v[2] * scale;
|
||||
r.v[3] = v.v[3] * scale;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Vector3f MultVectorMatrix(Vector3f v, Matrix3f mt)
|
||||
{
|
||||
Vector3f r;
|
||||
|
||||
r.v[0] = v.v[0] * mt.m[0] + v.v[1] * mt.m[1] + v.v[2] * mt.m[2];
|
||||
r.v[1] = v.v[0] * mt.m[3] + v.v[1] * mt.m[4] + v.v[2] * mt.m[5];
|
||||
r.v[2] = v.v[0] * mt.m[6] + v.v[1] * mt.m[7] + v.v[2] * mt.m[8];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Vector4f MultVectorMatrix(Vector4f v, Matrix4f mt)
|
||||
{
|
||||
Vector4f r;
|
||||
|
||||
r.v[0] = v.v[0] * mt.m[0] + v.v[1] * mt.m[1] + v.v[2] * mt.m[2] + v.v[3] * mt.m[3];
|
||||
r.v[1] = v.v[0] * mt.m[4] + v.v[1] * mt.m[5] + v.v[2] * mt.m[6] + v.v[3] * mt.m[7];
|
||||
r.v[2] = v.v[0] * mt.m[8] + v.v[1] * mt.m[9] + v.v[2] * mt.m[10] + v.v[3] * mt.m[11];
|
||||
r.v[3] = v.v[0] * mt.m[12] + v.v[1] * mt.m[13] + v.v[2] * mt.m[14] + v.v[3] * mt.m[15];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Vector4f MultMatrixVector(Matrix4f mt, Vector4f v)
|
||||
{
|
||||
Vector4f r;
|
||||
|
||||
r.v[0] = v.v[0] * mt.m[0] + v.v[1] * mt.m[4] + v.v[2] * mt.m[8] + v.v[3] * mt.m[12];
|
||||
r.v[1] = v.v[0] * mt.m[1] + v.v[1] * mt.m[5] + v.v[2] * mt.m[9] + v.v[3] * mt.m[13];
|
||||
r.v[2] = v.v[0] * mt.m[2] + v.v[1] * mt.m[6] + v.v[2] * mt.m[10] + v.v[3] * mt.m[14];
|
||||
r.v[3] = v.v[0] * mt.m[3] + v.v[1] * mt.m[7] + v.v[2] * mt.m[11] + v.v[3] * mt.m[15];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Vector4f slerp(const Vector4f& q1, const Vector4f& q2, float t)
|
||||
{
|
||||
const float epsilon = 1e-6f;
|
||||
|
||||
// Нормализация входных кватернионов
|
||||
Vector4f q1_norm = q1.normalized();
|
||||
Vector4f q2_norm = q2.normalized();
|
||||
|
||||
float cosTheta = q1_norm.dot(q2_norm);
|
||||
|
||||
// Если q1 и q2 близки к противоположным направлениям, корректируем q2
|
||||
Vector4f q2_adjusted = q2_norm;
|
||||
if (cosTheta < 0.0f) {
|
||||
q2_adjusted.v[0] = -q2_adjusted.v[0];
|
||||
q2_adjusted.v[1] = -q2_adjusted.v[1];
|
||||
q2_adjusted.v[2] = -q2_adjusted.v[2];
|
||||
q2_adjusted.v[3] = -q2_adjusted.v[3];
|
||||
cosTheta = -cosTheta;
|
||||
}
|
||||
|
||||
// Если кватернионы близки, используем линейную интерполяцию
|
||||
if (cosTheta > 1.0f - epsilon) {
|
||||
Vector4f result;
|
||||
|
||||
result.v[0] = q1_norm.v[0] + t * (q2_adjusted.v[0] - q1_norm.v[0]);
|
||||
result.v[1] = q1_norm.v[1] + t * (q2_adjusted.v[1] - q1_norm.v[1]);
|
||||
result.v[2] = q1_norm.v[2] + t * (q2_adjusted.v[2] - q1_norm.v[2]);
|
||||
result.v[3] = q1_norm.v[3] + t * (q2_adjusted.v[3] - q1_norm.v[3]);
|
||||
|
||||
return result.normalized();
|
||||
}
|
||||
|
||||
// Иначе используем сферическую интерполяцию
|
||||
float theta = std::acos(cosTheta);
|
||||
float sinTheta = std::sin(theta);
|
||||
|
||||
float coeff1 = std::sin((1.0f - t) * theta) / sinTheta;
|
||||
float coeff2 = std::sin(t * theta) / sinTheta;
|
||||
|
||||
Vector4f result;
|
||||
|
||||
result.v[0] = coeff1 * q1_norm.v[0] + coeff2 * q2_adjusted.v[0];
|
||||
result.v[1] = coeff1 * q1_norm.v[1] + coeff2 * q2_adjusted.v[1];
|
||||
result.v[2] = coeff1 * q1_norm.v[2] + coeff2 * q2_adjusted.v[2];
|
||||
result.v[3] = coeff1 * q1_norm.v[3] + coeff2 * q2_adjusted.v[3];
|
||||
|
||||
return result.normalized();
|
||||
}
|
||||
|
||||
Matrix4f MakeMatrix4x4(const Matrix3f& m, const Vector3f pos)
|
||||
{
|
||||
Matrix4f r;
|
||||
|
||||
r.m[0] = m.m[0];
|
||||
r.m[1] = m.m[1];
|
||||
r.m[2] = m.m[2];
|
||||
r.m[3] = 0;
|
||||
|
||||
r.m[4] = m.m[3];
|
||||
r.m[5] = m.m[4];
|
||||
r.m[6] = m.m[5];
|
||||
r.m[7] = 0;
|
||||
|
||||
r.m[8] = m.m[6];
|
||||
r.m[9] = m.m[7];
|
||||
r.m[10] = m.m[8];
|
||||
r.m[11] = 0;
|
||||
|
||||
r.m[12] = pos.v[0];
|
||||
r.m[13] = pos.v[1];
|
||||
r.m[14] = pos.v[2];
|
||||
r.m[15] = 1.0;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
59
Math.h
@ -1,12 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
struct Vector4f
|
||||
{
|
||||
std::array<float, 4> v = { 0.f, 0.f, 0.f, 0.f };
|
||||
|
||||
Vector4f normalized() const {
|
||||
double norm = std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2] + v[3] * v[3]);
|
||||
Vector4f r;
|
||||
|
||||
r.v[0] = v[0] / norm;
|
||||
r.v[1] = v[1] / norm;
|
||||
r.v[2] = v[2] / norm;
|
||||
r.v[3] = v[3] / norm;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
double dot(const Vector4f& other) const {
|
||||
return v[0] * other.v[0] + v[1] * other.v[1] + v[2] * other.v[2] + v[3] * other.v[3];
|
||||
}
|
||||
};
|
||||
|
||||
struct Vector3f
|
||||
@ -22,12 +41,22 @@ namespace ZL {
|
||||
Vector2f operator+(const Vector2f& x, const Vector2f& y);
|
||||
|
||||
Vector2f operator-(const Vector2f& x, const Vector2f& y);
|
||||
|
||||
Vector3f operator+(const Vector3f& x, const Vector3f& y);
|
||||
|
||||
Vector3f operator-(const Vector3f& x, const Vector3f& y);
|
||||
Vector4f operator+(const Vector4f& x, const Vector4f& y);
|
||||
|
||||
Vector4f operator-(const Vector4f& x, const Vector4f& y);
|
||||
|
||||
|
||||
struct Matrix3f
|
||||
{
|
||||
std::array<float, 9> m = { 0.f, 0.f, 0.f,
|
||||
0.f, 0.f, 0.f,
|
||||
0.f, 0.f, 0.f, };
|
||||
|
||||
static Matrix3f Identity();
|
||||
};
|
||||
|
||||
struct Matrix4f
|
||||
@ -38,14 +67,44 @@ namespace ZL {
|
||||
0.f, 0.f, 0.f, 0.f };
|
||||
|
||||
static Matrix4f Identity();
|
||||
|
||||
float& operator()(int row, int col) {
|
||||
//return m[row * 4 + col]; //OpenGL specific
|
||||
return m[col * 4 + row];
|
||||
}
|
||||
|
||||
const float& operator()(int row, int col) const {
|
||||
//return m[row * 4 + col];
|
||||
return m[col * 4 + row];
|
||||
}
|
||||
};
|
||||
|
||||
Matrix4f operator*(const Matrix4f& m1, const Matrix4f& m2);
|
||||
|
||||
Matrix4f MakeOrthoMatrix(float width, float height, float zNear, float zFar);
|
||||
|
||||
Matrix4f MakePerspectiveMatrix(float fovY, float aspectRatio, float zNear, float zFar);
|
||||
|
||||
Matrix3f QuatToMatrix(const Vector4f& q);
|
||||
|
||||
Vector4f MatrixToQuat(const Matrix3f& m);
|
||||
|
||||
Vector4f QuatFromRotateAroundX(float angle);
|
||||
Vector4f QuatFromRotateAroundY(float angle);
|
||||
Vector4f QuatFromRotateAroundZ(float angle);
|
||||
|
||||
Vector3f operator*(Vector3f v, float scale);
|
||||
Vector4f operator*(Vector4f v, float scale);
|
||||
|
||||
Vector3f MultVectorMatrix(Vector3f v, Matrix3f mt);
|
||||
Vector4f MultVectorMatrix(Vector4f v, Matrix4f mt);
|
||||
Vector4f MultMatrixVector(Matrix4f mt, Vector4f v);
|
||||
|
||||
Vector4f slerp(const Vector4f& q1, const Vector4f& q2, float t);
|
||||
Matrix3f InverseMatrix(const Matrix3f& m);
|
||||
Matrix4f InverseMatrix(const Matrix4f& m);
|
||||
Matrix3f MultMatrixMatrix(const Matrix3f& m1, const Matrix3f& m2);
|
||||
Matrix4f MultMatrixMatrix(const Matrix4f& m1, const Matrix4f& m2);
|
||||
Matrix4f MakeMatrix4x4(const Matrix3f& m, const Vector3f pos);
|
||||
|
||||
};
|
||||
@ -1,6 +1,9 @@
|
||||
#include "OpenGlExtensions.h"
|
||||
|
||||
#include "Utils.h"
|
||||
#include <iostream>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
|
||||
//====================================================
|
||||
//===================== GLSL Shaders =================
|
||||
@ -107,11 +110,19 @@ PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName = NULL;
|
||||
PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding = NULL;
|
||||
PFNGLBINDBUFFERBASEPROC glBindBufferBase = NULL;
|
||||
|
||||
|
||||
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = NULL;
|
||||
PFNGLBINDVERTEXARRAYPROC glBindVertexArray = NULL;
|
||||
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArray = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
namespace ZL {
|
||||
|
||||
bool BindOpenGlFunctions()
|
||||
{
|
||||
char* extensionList = (char*)glGetString(GL_EXTENSIONS);
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
//char* extensionList = (char*)glGetString(GL_EXTENSIONS);
|
||||
char* glVersion = (char*)glGetString(GL_VERSION);
|
||||
bool ok = true;
|
||||
|
||||
@ -226,8 +237,7 @@ namespace ZL {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (findString("GL_ARB_framebuffer_object", extensionList))
|
||||
{
|
||||
|
||||
glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)wglGetProcAddress("glIsRenderbuffer");
|
||||
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)wglGetProcAddress("glBindRenderbuffer");
|
||||
glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)wglGetProcAddress("glDeleteRenderbuffers");
|
||||
@ -274,15 +284,6 @@ namespace ZL {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (findString("GL_ARB_uniform_buffer_object", extensionList))
|
||||
{
|
||||
|
||||
glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)wglGetProcAddress("glGetUniformIndices");
|
||||
glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)wglGetProcAddress("glGetActiveUniformsiv");
|
||||
glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)wglGetProcAddress("glGetActiveUniformName");
|
||||
@ -303,22 +304,32 @@ namespace ZL {
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)wglGetProcAddress("glGenVertexArrays");
|
||||
glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)wglGetProcAddress("glBindVertexArray");
|
||||
glDeleteVertexArray = (PFNGLDELETEVERTEXARRAYSPROC)wglGetProcAddress("glBindVertexArray");
|
||||
|
||||
if (glGenVertexArrays == NULL ||
|
||||
glBindVertexArray == NULL ||
|
||||
glDeleteVertexArray == NULL)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
|
||||
|
||||
return ok;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CheckGlError()
|
||||
{
|
||||
size_t error = glGetError();
|
||||
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
throw std::exception("Gl error");
|
||||
throw std::runtime_error("Gl error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "SDL.h"
|
||||
#ifdef EMSCRIPTEN
|
||||
//#define GL_GLEXT_PROTOTYPES 1
|
||||
//#define EGL_EGLEXT_PROTOTYPES 1
|
||||
//#include <SDL2/SDL_opengl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include "emscripten.h"
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
|
||||
@ -122,8 +143,17 @@ extern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName;
|
||||
extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
|
||||
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArray;
|
||||
#else
|
||||
|
||||
#endif
|
||||
namespace ZL {
|
||||
|
||||
|
||||
|
||||
bool BindOpenGlFunctions();
|
||||
|
||||
void CheckGlError();
|
||||
|
||||
77
Physics.cpp
@ -1,77 +0,0 @@
|
||||
#include "Physics.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
|
||||
|
||||
bool TestIntersection(const LinePhysicsObject& line, const EllipsePhysicsObject& ellipse)
|
||||
{
|
||||
|
||||
// x*x / (a*a) + y*y / (b*b) = 1
|
||||
|
||||
// x = x0 + (x1 - x0) * t = x0 + dx * t
|
||||
|
||||
// y = y0 + (y1 - y0) * t = y0 + dy * t
|
||||
|
||||
//^ solve above for t, and make sure 0 > t > 1
|
||||
|
||||
float x0 = line.start.v[0] - ellipse.center.v[0];
|
||||
|
||||
float y0 = line.start.v[1] - ellipse.center.v[1];
|
||||
|
||||
float dx = line.end.v[0] - line.start.v[0];
|
||||
|
||||
float dy = line.end.v[1] - line.start.v[1];
|
||||
|
||||
|
||||
static const float EPS = 0.0001f; //Must very close to 0 to handle extreme situations
|
||||
|
||||
|
||||
float a = dx * dx * ellipse.b * ellipse.b + dy * dy * ellipse.a * ellipse.a;
|
||||
|
||||
float b = 2.f * (x0 * dx * ellipse.b * ellipse.b + y0 * dy * ellipse.a * ellipse.a);
|
||||
|
||||
float c = ellipse.b * ellipse.b * x0 * x0 + ellipse.a * ellipse.a * y0 * y0 - ellipse.a * ellipse.a * ellipse.b * ellipse.b;
|
||||
|
||||
if (abs(a) < EPS) //Here consider a = 0 and equation becomes linear
|
||||
{
|
||||
float t = -c / b;
|
||||
|
||||
if ((t > 0) && (t < 1.f))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float D2 = b * b - 4 * a * c;
|
||||
|
||||
if (D2 < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
float D = sqrtf(D2);
|
||||
|
||||
float t1 = (-b - D) / (2 * a);
|
||||
|
||||
float t2 = (-b + D) / (2 * a);
|
||||
|
||||
if (((t1 > 0) && (t1 < 1.f)) || ((t2 > 0) && (t2 < 1.f)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
22
Physics.h
@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
#include "Math.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
struct EllipsePhysicsObject
|
||||
{
|
||||
Vector2f center = {0.f, 0.f};
|
||||
|
||||
float a = 0.f;
|
||||
float b = 0.f;
|
||||
};
|
||||
|
||||
struct LinePhysicsObject
|
||||
{
|
||||
Vector2f start = { 0.f, 0.f };
|
||||
Vector2f end = { 0.f, 0.f };
|
||||
};
|
||||
|
||||
bool TestIntersection(const LinePhysicsObject& line, const EllipsePhysicsObject& ellipse);
|
||||
|
||||
}
|
||||
83
Readme.md
Normal file
@ -0,0 +1,83 @@
|
||||
# Script to run:
|
||||
|
||||
```
|
||||
C:\Work\Projects\emsdk\emsdk.bat activate latest
|
||||
C:\Work\Projects\emsdk\emsdk_env.bat
|
||||
emcc main.cpp Game.cpp Math.cpp Physics.cpp Renderer.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -sTOTAL_MEMORY=33554432 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS="[""png""]" -sUSE_SDL=2 --preload-file background.bmp --preload-file bird.bmp32 --preload-file default.fragment --preload-file default.vertex --preload-file game_over.bmp32 --preload-file pipe.bmp32 -o jumpingbird.html
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
zlib-1.3.1:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=install ..
|
||||
|
||||
then run ALL_BUILD and INSTALL in Visual Studio
|
||||
|
||||
lpng1645:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=install -DZLIB_ROOT=C:\Work\Projects\zlib-1.3.1\build\install ..
|
||||
|
||||
then run ALL_BUILD and INSTALL in Visual Studio
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
https://github.com/Bly7/OBJ-Loader/blob/master/Source/OBJ_Loader.h
|
||||
|
||||
|
||||
https://github.com/gametutorials/tutorials/blob/master/OpenGL/MD3%20Animation/Main.cpp
|
||||
|
||||
|
||||
|
||||
linux:
|
||||
```
|
||||
g++ Game.cpp main.cpp Math.cpp OpenGlExtensions.cpp Physics.cpp Renderer.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp BoneAnimatedModel.cpp ObjLoader.cpp cmakeaudioplayer/src/AudioPlayer.cpp TextModel.cpp Inventory.cpp -o sdl_app -O2 -std=c++17 \
|
||||
-I cmakeaudioplayer/include \
|
||||
$(pkg-config --cflags --libs sdl2 gl) \
|
||||
$(pkg-config --cflags --libs vorbis vorbisfile ogg) \
|
||||
-lopenal
|
||||
```
|
||||
|
||||
# Emscripten new
|
||||
|
||||
```
|
||||
|
||||
cd build-emcmake/
|
||||
|
||||
emcmake cmake -DCMAKE_INSTALL_PREFIX=install ..
|
||||
cmake --build .
|
||||
|
||||
cmake --install .
|
||||
|
||||
|
||||
emcc main.cpp Game.cpp Environment.cpp GameObjectManager.cpp BoneAnimatedModel.cpp GameWorld.cpp InputManager.cpp Inventory.cpp ObjLoader.cpp QuestScripts.cpp RenderSystem.cpp Math.cpp Physics.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -IC:\Users\ASUS\Desktop\fishrungame2\ZeptoLabTest1\thirdparty\libzip-1.11.3\build-emcmake\install\include -LC:\Users\ASUS\Desktop\fishrungame2\ZeptoLabTest1\thirdparty\libzip-1.11.3\build-emcmake\install\lib -lzip -sTOTAL_MEMORY=33554432 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS="[""png""]" -sUSE_SDL=2 --preload-file background.bmp --preload-file bird.bmp32 --preload-file default.fragment --preload-file default.vertex --preload-file game_over.bmp32 --preload-file pipe.bmp32 -o jumpingbird.html
|
||||
|
||||
emcc main.cpp Game.cpp Environment.cpp GameObjectManager.cpp BoneAnimatedModel.cpp GameWorld.cpp InputManager.cpp Inventory.cpp ObjLoader.cpp QuestScripts.cpp RenderSystem.cpp Math.cpp Physics.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -pthread -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sTOTAL_MEMORY=4294967296 -sINITIAL_MEMORY=3221225472 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1 -I./thirdparty/libzip-1.11.3/build-emcmake/install/include -I./thirdparty/zlib-1.3.1/install/include -L./thirdparty/libzip-1.11.3/build-emcmake/install/lib -L./thirdparty/zlib-1.3.1/install/lib -lzip -lz -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS='["png"]' -sUSE_SDL=2 --preload-file data.zip -o jumpingbird.html
|
||||
|
||||
|
||||
# Windows:
|
||||
emcc main.cpp Game.cpp Environment.cpp GameObjectManager.cpp BoneAnimatedModel.cpp GameWorld.cpp InputManager.cpp Inventory.cpp ObjLoader.cpp QuestScripts.cpp RenderSystem.cpp Math.cpp Physics.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -pthread -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sTOTAL_MEMORY=4294967296 -sINITIAL_MEMORY=3221225472 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1 -I./thirdparty/libzip-1.11.3/build-emcmake/install/include -L./thirdparty/libzip-1.11.3/build-emcmake/install/lib -lzip -lz -sUSE_SDL_IMAGE=2 -sUSE_SDL=2 -sUSE_LIBPNG=1 --preload-file data.zip -o viola.html
|
||||
|
||||
emrun --no_browser --port 8080 .
|
||||
```
|
||||
|
||||
# License
|
||||
Code: MIT
|
||||
|
||||
Art: CC-BY
|
||||
|
||||
# Cmake Run Linux
|
||||
Run using cmakelist
|
||||
make -j$(nproc) -C build #Компилируем
|
||||
./build/sdl_app #Запускаем
|
||||
|
||||
Для постройки без звука
|
||||
rm -rf build #Очищаем build папку
|
||||
cmake -B build -DAUDIO=1 #Пересоздаём конфигурацию CMake
|
||||
348
Renderer.cpp
@ -1,6 +1,5 @@
|
||||
#include "Renderer.h"
|
||||
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
@ -19,6 +18,31 @@ namespace ZL {
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
VAOHolder::VAOHolder()
|
||||
{
|
||||
#ifndef EMSCRIPTEN
|
||||
glGenVertexArrays(1, &vao);
|
||||
#endif
|
||||
}
|
||||
|
||||
VAOHolder::~VAOHolder()
|
||||
{
|
||||
#ifndef EMSCRIPTEN
|
||||
|
||||
#ifdef __linux__
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
#else
|
||||
//Windows
|
||||
glDeleteVertexArray(1, &vao);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
GLuint VAOHolder::getBuffer()
|
||||
{
|
||||
return vao;
|
||||
}
|
||||
|
||||
|
||||
VertexDataStruct CreateRect2D(Vector2f center, Vector2f halfWidthHeight, float zLevel)
|
||||
{
|
||||
@ -53,8 +77,6 @@ namespace ZL {
|
||||
result.TexCoordData.push_back(texCoordPos4);
|
||||
result.TexCoordData.push_back(texCoordPos1);
|
||||
|
||||
result.RefreshVBO();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -96,16 +118,96 @@ namespace ZL {
|
||||
}
|
||||
|
||||
|
||||
result.RefreshVBO();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
void VertexDataStruct::RefreshVBO()
|
||||
VertexDataStruct CreateCube3D(float scale)
|
||||
{
|
||||
|
||||
std::array<std::array<Vector3f, 4>, 6> cubeSides;
|
||||
|
||||
std::array<Vector3f, 6> cubeColors;
|
||||
|
||||
|
||||
cubeSides[0][0] = { -1, -1, -1 };
|
||||
cubeSides[0][1] = { -1, 1, -1 };
|
||||
cubeSides[0][2] = { 1, 1, -1 };
|
||||
cubeSides[0][3] = { 1, -1, -1 };
|
||||
|
||||
cubeSides[1][0] = { -1, -1, 1 };
|
||||
cubeSides[1][1] = { -1, 1, 1 };
|
||||
cubeSides[1][2] = { 1, 1, 1 };
|
||||
cubeSides[1][3] = { 1, -1, 1 };
|
||||
|
||||
//------------
|
||||
|
||||
cubeSides[2][0] = { -1, -1, -1 };
|
||||
cubeSides[2][1] = { -1, -1, 1 };
|
||||
cubeSides[2][2] = { 1, -1, 1 };
|
||||
cubeSides[2][3] = { 1, -1, -1 };
|
||||
|
||||
cubeSides[3][0] = { -1, 1, -1 };
|
||||
cubeSides[3][1] = { -1, 1, 1 };
|
||||
cubeSides[3][2] = { 1, 1, 1 };
|
||||
cubeSides[3][3] = { 1, 1, -1 };
|
||||
|
||||
//------------
|
||||
cubeSides[4][0] = { -1, -1, -1 };
|
||||
cubeSides[4][1] = { -1, -1, 1 };
|
||||
cubeSides[4][2] = { -1, 1, 1 };
|
||||
cubeSides[4][3] = { -1, 1, -1 };
|
||||
|
||||
cubeSides[5][0] = { 1, -1, -1 };
|
||||
cubeSides[5][1] = { 1, -1, 1 };
|
||||
cubeSides[5][2] = { 1, 1, 1 };
|
||||
cubeSides[5][3] = { 1, 1, -1 };
|
||||
|
||||
//-----------
|
||||
|
||||
cubeColors[0] = Vector3f{ 1, 0, 0 };
|
||||
cubeColors[1] = Vector3f{ 0, 1, 0 };
|
||||
cubeColors[2] = Vector3f{ 0, 0, 1 };
|
||||
cubeColors[3] = Vector3f{ 1, 1, 0 };
|
||||
cubeColors[4] = Vector3f{ 0, 1, 1 };
|
||||
cubeColors[5] = Vector3f{ 1, 0, 1 };
|
||||
|
||||
//-----------
|
||||
|
||||
VertexDataStruct result;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
result.PositionData.push_back(cubeSides[i][0] * scale);
|
||||
result.PositionData.push_back(cubeSides[i][1] * scale);
|
||||
result.PositionData.push_back(cubeSides[i][2] * scale);
|
||||
result.PositionData.push_back(cubeSides[i][2] * scale);
|
||||
result.PositionData.push_back(cubeSides[i][3] * scale);
|
||||
result.PositionData.push_back(cubeSides[i][0] * scale);
|
||||
|
||||
result.ColorData.push_back(cubeColors[i]);
|
||||
result.ColorData.push_back(cubeColors[i]);
|
||||
result.ColorData.push_back(cubeColors[i]);
|
||||
result.ColorData.push_back(cubeColors[i]);
|
||||
result.ColorData.push_back(cubeColors[i]);
|
||||
result.ColorData.push_back(cubeColors[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void VertexRenderStruct::RefreshVBO()
|
||||
{
|
||||
//Check if main thread, check if data is not empty...
|
||||
|
||||
#ifndef EMSCRIPTEN
|
||||
if (!vao)
|
||||
{
|
||||
vao = std::make_shared<VAOHolder>();
|
||||
}
|
||||
|
||||
glBindVertexArray(vao->getBuffer());
|
||||
#endif
|
||||
if (!positionVBO)
|
||||
{
|
||||
positionVBO = std::make_shared<VBOHolder>();
|
||||
@ -113,17 +215,124 @@ namespace ZL {
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, positionVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, PositionData.size() * 12, &PositionData[0], GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, data.PositionData.size() * 12, &data.PositionData[0], GL_STATIC_DRAW);
|
||||
|
||||
if (!texCoordVBO)
|
||||
if (data.TexCoordData.size() > 0)
|
||||
{
|
||||
texCoordVBO = std::make_shared<VBOHolder>();
|
||||
if (!texCoordVBO)
|
||||
{
|
||||
texCoordVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, texCoordVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, data.TexCoordData.size() * 8, &data.TexCoordData[0], GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, texCoordVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, TexCoordData.size() * 8, &TexCoordData[0], GL_STATIC_DRAW);
|
||||
if (data.NormalData.size() > 0)
|
||||
{
|
||||
if (!normalVBO)
|
||||
{
|
||||
normalVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, normalVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, data.NormalData.size() * 12, &data.NormalData[0], GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
if (data.TangentData.size() > 0)
|
||||
{
|
||||
if (!tangentVBO)
|
||||
{
|
||||
tangentVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, tangentVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, data.TangentData.size() * 12, &data.TangentData[0], GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
if (data.BinormalData.size() > 0)
|
||||
{
|
||||
if (!binormalVBO)
|
||||
{
|
||||
binormalVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, binormalVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, data.BinormalData.size() * 12, &data.BinormalData[0], GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
if (data.ColorData.size() > 0)
|
||||
{
|
||||
if (!colorVBO)
|
||||
{
|
||||
colorVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, colorVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, data.ColorData.size() * 12, &data.ColorData[0], GL_STATIC_DRAW);
|
||||
}
|
||||
}
|
||||
|
||||
void VertexDataStruct::Scale(float scale)
|
||||
{
|
||||
for (int i = 0; i < PositionData.size(); i++)
|
||||
{
|
||||
PositionData[i] = PositionData[i] * scale;
|
||||
}
|
||||
}
|
||||
void VertexDataStruct::Move(Vector3f diff)
|
||||
{
|
||||
for (int i = 0; i < PositionData.size(); i++)
|
||||
{
|
||||
PositionData[i] = PositionData[i] + diff;
|
||||
}
|
||||
}
|
||||
|
||||
void VertexDataStruct::SwapZandY()
|
||||
{
|
||||
for (int i = 0; i < PositionData.size(); i++)
|
||||
{
|
||||
auto value = PositionData[i].v[1];
|
||||
PositionData[i].v[1] = PositionData[i].v[2];
|
||||
PositionData[i].v[2] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void VertexDataStruct::RotateByMatrix(Matrix3f m)
|
||||
{
|
||||
|
||||
for (int i = 0; i < PositionData.size(); i++)
|
||||
{
|
||||
PositionData[i] = MultVectorMatrix(PositionData[i], m);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NormalData.size(); i++)
|
||||
{
|
||||
NormalData[i] = MultVectorMatrix(NormalData[i], m);
|
||||
}
|
||||
|
||||
for (int i = 0; i < TangentData.size(); i++)
|
||||
{
|
||||
TangentData[i] = MultVectorMatrix(TangentData[i], m);
|
||||
}
|
||||
|
||||
for (int i = 0; i < BinormalData.size(); i++)
|
||||
{
|
||||
BinormalData[i] = MultVectorMatrix(BinormalData[i], m);
|
||||
}
|
||||
}
|
||||
|
||||
void VertexRenderStruct::AssignFrom(const VertexDataStruct& v)
|
||||
{
|
||||
data = v;
|
||||
RefreshVBO();
|
||||
}
|
||||
|
||||
void Renderer::InitOpenGL()
|
||||
@ -135,14 +344,14 @@ namespace ZL {
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
#ifndef EMSCRIPTEN
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
|
||||
#endif
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
void Renderer::PushProjectionMatrix(float width, float height, float zNear, float zFar)
|
||||
@ -153,7 +362,19 @@ namespace ZL {
|
||||
|
||||
if (ProjectionMatrixStack.size() > CONST_MATRIX_STACK_SIZE)
|
||||
{
|
||||
throw std::exception("Projection matrix stack overflow!!!!");
|
||||
throw std::runtime_error("Projection matrix stack overflow!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::PushPerspectiveProjectionMatrix(float fovY, float aspectRatio, float zNear, float zFar)
|
||||
{
|
||||
Matrix4f m = MakePerspectiveMatrix(fovY, aspectRatio, zNear, zFar);
|
||||
ProjectionMatrixStack.push(m);
|
||||
SetMatrix();
|
||||
|
||||
if (ProjectionMatrixStack.size() > CONST_MATRIX_STACK_SIZE)
|
||||
{
|
||||
throw std::runtime_error("Projection matrix stack overflow!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,23 +383,27 @@ namespace ZL {
|
||||
{
|
||||
if (ProjectionMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Projection matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Projection matrix stack underflow!!!!");
|
||||
}
|
||||
ProjectionMatrixStack.pop();
|
||||
SetMatrix();
|
||||
}
|
||||
|
||||
Matrix4f Renderer::GetProjectionModelViewMatrix()
|
||||
{
|
||||
return ProjectionModelViewMatrix;
|
||||
}
|
||||
|
||||
void Renderer::SetMatrix()
|
||||
{
|
||||
if (ProjectionMatrixStack.size() <= 0)
|
||||
{
|
||||
throw std::exception("Projection matrix stack out!");
|
||||
throw std::runtime_error("Projection matrix stack out!");
|
||||
}
|
||||
|
||||
if (ModelviewMatrixStack.size() <= 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack out!");
|
||||
throw std::runtime_error("Modelview matrix stack out!");
|
||||
}
|
||||
|
||||
ProjectionModelViewMatrix = ProjectionMatrixStack.top() * ModelviewMatrixStack.top();
|
||||
@ -197,14 +422,14 @@ namespace ZL {
|
||||
{
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
|
||||
ModelviewMatrixStack.push(ModelviewMatrixStack.top());
|
||||
|
||||
if (ModelviewMatrixStack.size() > CONST_MATRIX_STACK_SIZE)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack overflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack overflow!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +437,7 @@ namespace ZL {
|
||||
{
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
|
||||
ModelviewMatrixStack.pop();
|
||||
@ -233,7 +458,7 @@ namespace ZL {
|
||||
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
|
||||
ModelviewMatrixStack.pop();
|
||||
@ -253,7 +478,7 @@ namespace ZL {
|
||||
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
|
||||
ModelviewMatrixStack.pop();
|
||||
@ -273,7 +498,7 @@ namespace ZL {
|
||||
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
|
||||
ModelviewMatrixStack.pop();
|
||||
@ -303,7 +528,7 @@ namespace ZL {
|
||||
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
|
||||
ModelviewMatrixStack.pop();
|
||||
@ -317,7 +542,7 @@ namespace ZL {
|
||||
{
|
||||
if (ModelviewMatrixStack.size() > 64)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack overflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack overflow!!!!");
|
||||
}
|
||||
ModelviewMatrixStack.push(m);
|
||||
SetMatrix();
|
||||
@ -328,7 +553,7 @@ namespace ZL {
|
||||
{
|
||||
if (ModelviewMatrixStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Modelview matrix stack underflow!!!!");
|
||||
throw std::runtime_error("Modelview matrix stack underflow!!!!");
|
||||
}
|
||||
ModelviewMatrixStack.pop();
|
||||
|
||||
@ -364,6 +589,18 @@ namespace ZL {
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::RenderUniform3fv(const std::string& uniformName, const float* value)
|
||||
{
|
||||
auto shader = shaderManager.GetCurrentShader();
|
||||
|
||||
auto uniform = shader->uniformList.find(uniformName);
|
||||
|
||||
if (uniform != shader->uniformList.end())
|
||||
{
|
||||
glUniform3fv(uniform->second, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::RenderUniform1i(const std::string& uniformName, const int value)
|
||||
{
|
||||
auto shader = shaderManager.GetCurrentShader();
|
||||
@ -395,21 +632,66 @@ namespace ZL {
|
||||
glVertexAttribPointer(shader->attribList[attribName], 3, GL_FLOAT, GL_FALSE, stride, pointer);
|
||||
}
|
||||
|
||||
void Renderer::DrawVertexDataStruct(const VertexDataStruct& vertexDataStruct)
|
||||
void Renderer::DrawVertexRenderStruct(const VertexRenderStruct& VertexRenderStruct)
|
||||
{
|
||||
static const std::string vNormal("vNormal");
|
||||
static const std::string vTangent("vTangent");
|
||||
static const std::string vBinormal("vBinormal");
|
||||
static const std::string vColor("vColor");
|
||||
static const std::string vTexCoord("vTexCoord");
|
||||
static const std::string vPosition("vPosition");
|
||||
|
||||
//glBindVertexArray(VertexRenderStruct.vao->getBuffer());
|
||||
|
||||
//Check if main thread, check if data is not empty...
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexDataStruct.texCoordVBO->getBuffer());
|
||||
VertexAttribPointer2fv(vTexCoord, 0, NULL);
|
||||
if (VertexRenderStruct.data.NormalData.size() > 0)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.normalVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vNormal, 0, NULL);
|
||||
}
|
||||
if (VertexRenderStruct.data.TangentData.size() > 0)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.tangentVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vTangent, 0, NULL);
|
||||
}
|
||||
if (VertexRenderStruct.data.BinormalData.size() > 0)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.binormalVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vBinormal, 0, NULL);
|
||||
}
|
||||
if (VertexRenderStruct.data.ColorData.size() > 0)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.colorVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vColor, 0, NULL);
|
||||
}
|
||||
if (VertexRenderStruct.data.TexCoordData.size() > 0)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.texCoordVBO->getBuffer());
|
||||
VertexAttribPointer2fv(vTexCoord, 0, NULL);
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexDataStruct.positionVBO->getBuffer());
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.positionVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vPosition, 0, NULL);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(vertexDataStruct.PositionData.size()));
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(VertexRenderStruct.data.PositionData.size()));
|
||||
|
||||
}
|
||||
|
||||
void worldToScreenCoordinates(Vector3f objectPos,
|
||||
Matrix4f projectionModelView,
|
||||
int screenWidth, int screenHeight,
|
||||
int& screenX, int& screenY) {
|
||||
|
||||
Vector4f inx = { objectPos.v[0], objectPos.v[1], objectPos.v[2], 1.0f };
|
||||
Vector4f clipCoords = MultMatrixVector(projectionModelView, inx);
|
||||
|
||||
float ndcX = clipCoords.v[0] / clipCoords.v[3];
|
||||
float ndcY = clipCoords.v[1] / clipCoords.v[3];
|
||||
|
||||
screenX = (int)((ndcX + 1.0f) * 0.5f * screenWidth);
|
||||
screenY = (int)((1.0f + ndcY) * 0.5f * screenHeight);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
56
Renderer.h
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "OpenGlExtensions.h"
|
||||
|
||||
#include "Math.h"
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include "ShaderManager.h"
|
||||
|
||||
namespace ZL {
|
||||
@ -25,19 +25,56 @@ namespace ZL {
|
||||
GLuint getBuffer();
|
||||
};
|
||||
|
||||
class VAOHolder {
|
||||
GLuint vao;
|
||||
|
||||
public:
|
||||
VAOHolder();
|
||||
|
||||
VAOHolder(const VAOHolder& v) = delete;
|
||||
|
||||
VAOHolder& operator=(const VAOHolder& v) = delete;
|
||||
|
||||
~VAOHolder();
|
||||
|
||||
GLuint getBuffer();
|
||||
};
|
||||
|
||||
struct VertexDataStruct
|
||||
{
|
||||
std::vector<Vector3f> PositionData;
|
||||
std::vector<Vector2f> TexCoordData;
|
||||
std::vector<Vector3f> NormalData;
|
||||
std::vector<Vector3f> TangentData;
|
||||
std::vector<Vector3f> BinormalData;
|
||||
std::vector<Vector3f> ColorData;
|
||||
|
||||
void RotateByMatrix(Matrix3f m);
|
||||
|
||||
void Scale(float scale);
|
||||
void Move(Vector3f diff);
|
||||
void SwapZandY();
|
||||
};
|
||||
|
||||
struct VertexRenderStruct
|
||||
{
|
||||
VertexDataStruct data;
|
||||
|
||||
std::shared_ptr<VAOHolder> vao;
|
||||
std::shared_ptr<VBOHolder> positionVBO;
|
||||
std::shared_ptr<VBOHolder> texCoordVBO;
|
||||
|
||||
std::shared_ptr<VBOHolder> normalVBO;
|
||||
std::shared_ptr<VBOHolder> tangentVBO;
|
||||
std::shared_ptr<VBOHolder> binormalVBO;
|
||||
std::shared_ptr<VBOHolder> colorVBO;
|
||||
void RefreshVBO();
|
||||
|
||||
void AssignFrom(const VertexDataStruct& v);
|
||||
};
|
||||
|
||||
VertexDataStruct CreateRect2D(Vector2f center, Vector2f halfWidthHeight, float zLevel);
|
||||
VertexDataStruct CreateRectHorizontalSections2D(Vector2f center, Vector2f halfWidthHeight, float zLevel, size_t sectionCount);
|
||||
VertexDataStruct CreateCube3D(float scale);
|
||||
|
||||
|
||||
class Renderer
|
||||
@ -55,6 +92,7 @@ namespace ZL {
|
||||
void InitOpenGL();
|
||||
|
||||
void PushProjectionMatrix(float width, float height, float zNear = 0.f, float zFar = 1.f);
|
||||
void PushPerspectiveProjectionMatrix(float fovY, float aspectRatio, float zNear, float zFar);
|
||||
void PopProjectionMatrix();
|
||||
|
||||
void PushMatrix();
|
||||
@ -67,6 +105,8 @@ namespace ZL {
|
||||
void PopMatrix();
|
||||
|
||||
|
||||
Matrix4f GetProjectionModelViewMatrix();
|
||||
|
||||
void SetMatrix();
|
||||
|
||||
|
||||
@ -78,14 +118,22 @@ namespace ZL {
|
||||
|
||||
void RenderUniformMatrix4fv(const std::string& uniformName, bool transpose, const float* value);
|
||||
void RenderUniform1i(const std::string& uniformName, const int value);
|
||||
void RenderUniform3fv(const std::string& uniformName, const float* value);
|
||||
|
||||
|
||||
void VertexAttribPointer2fv(const std::string& attribName, int stride, const char* pointer);
|
||||
|
||||
void VertexAttribPointer3fv(const std::string& attribName, int stride, const char* pointer);
|
||||
|
||||
void DrawVertexDataStruct(const VertexDataStruct& vertexDataStruct);
|
||||
void DrawVertexRenderStruct(const VertexRenderStruct& VertexRenderStruct);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void worldToScreenCoordinates(Vector3f objectPos,
|
||||
Matrix4f projectionModelView,
|
||||
int screenWidth, int screenHeight,
|
||||
int& screenX, int& screenY);
|
||||
|
||||
};
|
||||
@ -1,11 +1,12 @@
|
||||
#include "ShaderManager.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace ZL {
|
||||
|
||||
ShaderResource::ShaderResource(const std::string& vertexCode, const std::string& fragmentCode)
|
||||
{
|
||||
{
|
||||
|
||||
const int CONST_INFOLOG_LENGTH = 256;
|
||||
|
||||
char infoLog[CONST_INFOLOG_LENGTH];
|
||||
@ -40,12 +41,12 @@ namespace ZL {
|
||||
|
||||
if (!vertexShaderCompiled)
|
||||
{
|
||||
throw std::exception("Failed to compile vertex shader code!");
|
||||
throw std::runtime_error("Failed to compile vertex shader code!");
|
||||
}
|
||||
|
||||
|
||||
if (!fragmentShaderCompiled)
|
||||
{
|
||||
throw std::exception("Failed to compile fragment shader code!");
|
||||
{
|
||||
throw std::runtime_error("Failed to compile fragment shader code!");
|
||||
}
|
||||
|
||||
shaderProgram = glCreateProgram();
|
||||
@ -60,11 +61,11 @@ namespace ZL {
|
||||
|
||||
glGetProgramiv(shaderProgram, GL_LINK_STATUS, &programLinked);
|
||||
glGetProgramInfoLog(shaderProgram, CONST_INFOLOG_LENGTH, &infoLogLength, infoLog);
|
||||
|
||||
|
||||
if (!programLinked)
|
||||
{
|
||||
shaderProgram = 0;
|
||||
throw std::exception("Failed to link shader program!");
|
||||
throw std::runtime_error("Failed to link shader program!");
|
||||
}
|
||||
|
||||
|
||||
@ -120,12 +121,28 @@ namespace ZL {
|
||||
}
|
||||
|
||||
|
||||
void ShaderManager::AddShaderFromFiles(const std::string& shaderName, const std::string& vertexShaderFileName, const std::string& fragmentShaderFileName)
|
||||
void ShaderManager::AddShaderFromFiles(const std::string& shaderName, const std::string& vertexShaderFileName, const std::string& fragmentShaderFileName, const std::string& ZIPFileName)
|
||||
{
|
||||
std::string vertexShader = readTextFile(vertexShaderFileName);
|
||||
|
||||
std::string fragmentShader = readTextFile(fragmentShaderFileName);
|
||||
std::string vertexShader;
|
||||
std::string fragmentShader;
|
||||
|
||||
if (!ZIPFileName.empty()){
|
||||
|
||||
std::vector<char> vertexShaderData;
|
||||
std::vector<char> fragmentShaderData;
|
||||
|
||||
vertexShaderData = readFileFromZIP(vertexShaderFileName, ZIPFileName);
|
||||
fragmentShaderData = readFileFromZIP(fragmentShaderFileName, ZIPFileName);
|
||||
|
||||
vertexShader = std::string(vertexShaderData.begin(), vertexShaderData.end());
|
||||
fragmentShader = std::string(fragmentShaderData.begin(), fragmentShaderData.end());
|
||||
|
||||
}else{
|
||||
vertexShader = readTextFile(vertexShaderFileName);
|
||||
fragmentShader = readTextFile(fragmentShaderFileName);
|
||||
}
|
||||
///std::cout << "Shader: "<< vertexShader << std::endl;
|
||||
shaderResourceMap[shaderName] = std::make_shared<ShaderResource>(vertexShader, fragmentShader);
|
||||
}
|
||||
|
||||
@ -133,12 +150,12 @@ namespace ZL {
|
||||
{
|
||||
if (shaderStack.size() >= CONST_MAX_SHADER_STACK_SIZE)
|
||||
{
|
||||
throw std::exception("Shader stack overflow!");
|
||||
throw std::runtime_error("Shader stack overflow!");
|
||||
}
|
||||
|
||||
if (shaderResourceMap.find(shaderName) == shaderResourceMap.end())
|
||||
{
|
||||
throw std::exception("Shader does not exist!");
|
||||
throw std::runtime_error("Shader does not exist!");
|
||||
}
|
||||
|
||||
shaderStack.push(shaderName);
|
||||
@ -151,7 +168,7 @@ namespace ZL {
|
||||
{
|
||||
if (shaderStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Shader stack underflow!");
|
||||
throw std::runtime_error("Shader stack underflow!");
|
||||
}
|
||||
|
||||
shaderStack.pop();
|
||||
@ -170,7 +187,7 @@ namespace ZL {
|
||||
{
|
||||
if (shaderStack.size() == 0)
|
||||
{
|
||||
throw std::exception("Shader stack underflow!");
|
||||
throw std::runtime_error("Shader stack underflow!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "OpenGlExtensions.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
namespace ZL {
|
||||
@ -39,7 +37,7 @@ namespace ZL {
|
||||
std::stack<std::string> shaderStack;
|
||||
|
||||
public:
|
||||
void AddShaderFromFiles(const std::string& shaderName, const std::string& vertexShaderFileName, const std::string& fragmentShaderFileName);
|
||||
void AddShaderFromFiles(const std::string& shaderName, const std::string& vertexShaderFileName, const std::string& fragmentShaderFileName, const std::string& ZIPFileName = "");
|
||||
|
||||
void PushShader(const std::string& shaderName);
|
||||
void PopShader();
|
||||
|
||||
390
TextModel.cpp
Normal file
@ -0,0 +1,390 @@
|
||||
#include "TextModel.h"
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
|
||||
|
||||
VertexDataStruct LoadFromTextFile(const std::string& fileName, const std::string& ZIPFileName)
|
||||
{
|
||||
VertexDataStruct result;
|
||||
std::ifstream filestream;
|
||||
std::istringstream zipStream;
|
||||
|
||||
if (!ZIPFileName.empty())
|
||||
{
|
||||
std::vector<char> fileData = readFileFromZIP(fileName, ZIPFileName);
|
||||
std::string fileContents(fileData.begin(), fileData.end());
|
||||
zipStream.str(fileContents);
|
||||
}
|
||||
else
|
||||
{
|
||||
filestream.open(fileName);
|
||||
}
|
||||
|
||||
// Создаем ссылку f на нужный поток – после этого код ниже остается без изменений
|
||||
std::istream& f = (!ZIPFileName.empty()) ? static_cast<std::istream&>(zipStream) : static_cast<std::istream&>(filestream);
|
||||
|
||||
|
||||
//Skip first 5 lines
|
||||
std::string tempLine;
|
||||
|
||||
std::getline(f, tempLine);
|
||||
|
||||
static const std::regex pattern_count(R"(\d+)");
|
||||
static const std::regex pattern_float(R"([-]?\d+\.\d+)");
|
||||
static const std::regex pattern_int(R"([-]?\d+)");
|
||||
|
||||
|
||||
std::smatch match;
|
||||
|
||||
int numberVertices;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberVertices = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
std::vector<Vector3f> vertices;
|
||||
|
||||
vertices.resize(numberVertices);
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
vertices[i] = Vector3f{ floatValues[0], floatValues[1], floatValues[2] };
|
||||
}
|
||||
|
||||
std::cout << "UV Coordinates" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===UV Coordinates:
|
||||
|
||||
std::getline(f, tempLine); //triangle count
|
||||
int numberTriangles;
|
||||
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
numberTriangles = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
|
||||
// Now process UVs
|
||||
std::vector<std::array<Vector2f, 3>> uvCoords;
|
||||
|
||||
uvCoords.resize(numberTriangles);
|
||||
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
std::getline(f, tempLine); //Face 0
|
||||
|
||||
int uvCount;
|
||||
std::getline(f, tempLine);
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
std::string number_str = match.str();
|
||||
uvCount = std::stoi(number_str);
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("No number found in the input string.");
|
||||
}
|
||||
|
||||
if (uvCount != 3)
|
||||
{
|
||||
throw std::runtime_error("more than 3 uvs");
|
||||
}
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
std::getline(f, tempLine); //UV <Vector (-0.3661, -1.1665)>
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
floatValues.clear();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
if (floatValues.size() != 2)
|
||||
{
|
||||
throw std::runtime_error("more than 2 uvs---");
|
||||
}
|
||||
|
||||
uvCoords[i][j] = Vector2f{ floatValues[0],floatValues[1] };
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Normals go" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===Normals:
|
||||
|
||||
|
||||
std::vector<Vector3f> normals;
|
||||
|
||||
normals.resize(numberVertices);
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<float> floatValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
normals[i] = Vector3f{ floatValues[0], floatValues[1], floatValues[2] };
|
||||
}
|
||||
|
||||
std::cout << "Triangles go:" << std::endl;
|
||||
|
||||
std::getline(f, tempLine); //===Triangles: 3974
|
||||
|
||||
|
||||
std::vector<std::array<int, 3>> triangles;
|
||||
|
||||
triangles.resize(numberTriangles);
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
|
||||
std::vector<int> intValues;
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_int)) {
|
||||
intValues.push_back(std::stoi(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
triangles[i] = { intValues[0], intValues[1], intValues[2] };
|
||||
}
|
||||
|
||||
|
||||
std::cout << "Process vertices" << std::endl;
|
||||
|
||||
|
||||
|
||||
// Now let's process vertices
|
||||
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
|
||||
result.PositionData.push_back(vertices[triangles[i][0]]);
|
||||
result.PositionData.push_back(vertices[triangles[i][1]]);
|
||||
result.PositionData.push_back(vertices[triangles[i][2]]);
|
||||
|
||||
/*
|
||||
result.NormalData.push_back(normals[triangles[i][0]]);
|
||||
result.NormalData.push_back(normals[triangles[i][1]]);
|
||||
result.NormalData.push_back(normals[triangles[i][2]]);
|
||||
*/
|
||||
result.TexCoordData.push_back(uvCoords[i][0]);
|
||||
result.TexCoordData.push_back(uvCoords[i][1]);
|
||||
result.TexCoordData.push_back(uvCoords[i][2]);
|
||||
|
||||
}
|
||||
|
||||
//Swap from Blender format to OpenGL format
|
||||
for (int i = 0; i < result.PositionData.size(); i++)
|
||||
{
|
||||
Vector3f tempVec = result.PositionData[i];
|
||||
result.PositionData[i].v[0] = tempVec.v[1];
|
||||
result.PositionData[i].v[1] = tempVec.v[2];
|
||||
result.PositionData[i].v[2] = tempVec.v[0];
|
||||
|
||||
/*
|
||||
tempVec = result.NormalData[i];
|
||||
result.NormalData[i].v[0] = tempVec.v[1];
|
||||
result.NormalData[i].v[1] = tempVec.v[2];
|
||||
result.NormalData[i].v[2] = tempVec.v[0];*/
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
VertexDataStruct LoadFromTextFile02(const std::string& fileName, const std::string& ZIPFileName)
|
||||
{
|
||||
VertexDataStruct result;
|
||||
std::ifstream filestream;
|
||||
std::istringstream zipStream;
|
||||
|
||||
// --- 1. Открытие потока (без изменений) ---
|
||||
if (!ZIPFileName.empty())
|
||||
{
|
||||
std::vector<char> fileData = readFileFromZIP(fileName, ZIPFileName);
|
||||
std::string fileContents(fileData.begin(), fileData.end());
|
||||
zipStream.str(fileContents);
|
||||
}
|
||||
else
|
||||
{
|
||||
filestream.open(fileName);
|
||||
if (!filestream.is_open()) {
|
||||
throw std::runtime_error("Failed to open file: " + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
std::istream& f = (!ZIPFileName.empty()) ? static_cast<std::istream&>(zipStream) : static_cast<std::istream&>(filestream);
|
||||
|
||||
std::string tempLine;
|
||||
std::smatch match;
|
||||
|
||||
// Обновленные регулярки
|
||||
// pattern_float стал чуть надежнее для чисел вида "0" или "-1" без точки, если вдруг Python округлит до int
|
||||
static const std::regex pattern_count(R"(\d+)");
|
||||
static const std::regex pattern_float(R"([-]?\d+(\.\d+)?)");
|
||||
static const std::regex pattern_int(R"([-]?\d+)");
|
||||
|
||||
// --- 2. Парсинг Вершин (Pos + Norm + UV) ---
|
||||
|
||||
// Ищем заголовок ===Vertices
|
||||
while (std::getline(f, tempLine)) {
|
||||
if (tempLine.find("===Vertices") != std::string::npos) break;
|
||||
}
|
||||
|
||||
int numberVertices = 0;
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
numberVertices = std::stoi(match.str());
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("Vertices header not found or invalid.");
|
||||
}
|
||||
|
||||
// Временные буферы для хранения "уникальных" вершин перед разверткой по индексам
|
||||
std::vector<Vector3f> tempPositions(numberVertices);
|
||||
std::vector<Vector3f> tempNormals(numberVertices);
|
||||
std::vector<Vector2f> tempUVs(numberVertices);
|
||||
|
||||
for (int i = 0; i < numberVertices; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
// Строка вида: V 0: Pos(x, y, z) Norm(x, y, z) UV(u, v)
|
||||
|
||||
std::vector<float> floatValues;
|
||||
floatValues.reserve(8); // Ожидаем ровно 8 чисел (3 pos + 3 norm + 2 uv)
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_float)) {
|
||||
floatValues.push_back(std::stof(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
// Проверка целостности строки (ID вершины regex может поймать первым, но нас интересуют данные)
|
||||
// Обычно ID идет первым (0), потом 3+3+2 float. Итого 9 чисел, если считать ID.
|
||||
// Ваш Python пишет "V 0:", regex поймает 0. Потом 8 флоатов.
|
||||
|
||||
// Если regex ловит ID вершины как float (что вероятно), нам нужно смещение.
|
||||
// ID - floatValues[0]
|
||||
// Pos - [1], [2], [3]
|
||||
// Norm - [4], [5], [6]
|
||||
// UV - [7], [8]
|
||||
|
||||
if (floatValues.size() < 9) {
|
||||
throw std::runtime_error("Malformed vertex line at index " + std::to_string(i));
|
||||
}
|
||||
|
||||
tempPositions[i] = Vector3f{ floatValues[1], floatValues[2], floatValues[3] };
|
||||
tempNormals[i] = Vector3f{ floatValues[4], floatValues[5], floatValues[6] };
|
||||
tempUVs[i] = Vector2f{ floatValues[7], floatValues[8] };
|
||||
}
|
||||
|
||||
// --- 3. Парсинг Треугольников (Индексов) ---
|
||||
|
||||
// Пропускаем пустые строки до заголовка треугольников
|
||||
while (std::getline(f, tempLine)) {
|
||||
if (tempLine.find("===Triangles") != std::string::npos) break;
|
||||
}
|
||||
|
||||
int numberTriangles = 0;
|
||||
if (std::regex_search(tempLine, match, pattern_count)) {
|
||||
numberTriangles = std::stoi(match.str());
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("Triangles header not found.");
|
||||
}
|
||||
|
||||
// Резервируем память в result, чтобы избежать лишних аллокаций
|
||||
result.PositionData.reserve(numberTriangles * 3);
|
||||
result.NormalData.reserve(numberTriangles * 3);
|
||||
result.TexCoordData.reserve(numberTriangles * 3);
|
||||
|
||||
for (int i = 0; i < numberTriangles; i++)
|
||||
{
|
||||
std::getline(f, tempLine);
|
||||
// Строка вида: Tri: 0 1 2
|
||||
|
||||
std::vector<int> indices;
|
||||
indices.reserve(3);
|
||||
|
||||
auto b = tempLine.cbegin();
|
||||
auto e = tempLine.cend();
|
||||
while (std::regex_search(b, e, match, pattern_int)) {
|
||||
indices.push_back(std::stoi(match.str()));
|
||||
b = match.suffix().first;
|
||||
}
|
||||
|
||||
if (indices.size() != 3) {
|
||||
throw std::runtime_error("Malformed triangle line at index " + std::to_string(i));
|
||||
}
|
||||
|
||||
// --- 4. Заполнение VertexDataStruct (Flattening) ---
|
||||
// Берем данные из временных буферов по индексам и кладем в итоговый массив
|
||||
|
||||
for (int k = 0; k < 3; k++) {
|
||||
int idx = indices[k];
|
||||
result.PositionData.push_back(tempPositions[idx]);
|
||||
result.NormalData.push_back(tempNormals[idx]);
|
||||
result.TexCoordData.push_back(tempUVs[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
// --- 5. Конвертация координат (Blender -> OpenGL/Engine) ---
|
||||
// Сохраняем вашу логику смены осей: X->Z, Y->X, Z->Y
|
||||
|
||||
for (size_t i = 0; i < result.PositionData.size(); i++)
|
||||
{
|
||||
Vector3f originalPos = result.PositionData[i];
|
||||
result.PositionData[i].v[0] = originalPos.v[1]; // New X = Old Y
|
||||
result.PositionData[i].v[1] = originalPos.v[2]; // New Y = Old Z
|
||||
result.PositionData[i].v[2] = originalPos.v[0]; // New Z = Old X
|
||||
|
||||
Vector3f originalNorm = result.NormalData[i];
|
||||
result.NormalData[i].v[0] = originalNorm.v[1];
|
||||
result.NormalData[i].v[1] = originalNorm.v[2];
|
||||
result.NormalData[i].v[2] = originalNorm.v[0];
|
||||
}
|
||||
|
||||
std::cout << "Model loaded: " << numberVertices << " verts, " << numberTriangles << " tris." << std::endl;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
12
TextModel.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math.h"
|
||||
#include "Renderer.h"
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
VertexDataStruct LoadFromTextFile(const std::string& fileName, const std::string& ZIPFileName = "");
|
||||
VertexDataStruct LoadFromTextFile02(const std::string& fileName, const std::string& ZIPFileName = "");
|
||||
}
|
||||
@ -1,4 +1,7 @@
|
||||
#include "TextureManager.h"
|
||||
#ifdef PNG_ENABLED
|
||||
#include "png.h"
|
||||
#endif
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
@ -13,16 +16,22 @@ namespace ZL
|
||||
|
||||
if (texID == 0)
|
||||
{
|
||||
throw std::exception("glGenTextures did not work");
|
||||
throw std::runtime_error("glGenTextures did not work");
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texID);
|
||||
|
||||
CheckGlError();
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
CheckGlError();
|
||||
|
||||
//This should be only for Windows
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
|
||||
CheckGlError();
|
||||
|
||||
if (texData.bitSize == TextureDataStruct::BS_24BIT)
|
||||
{
|
||||
@ -33,6 +42,8 @@ namespace ZL
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(texData.width), static_cast<GLsizei>(texData.height), 0, GL_RGBA, GL_UNSIGNED_BYTE, &texData.data[0]);
|
||||
}
|
||||
|
||||
CheckGlError();
|
||||
|
||||
}
|
||||
|
||||
Texture::~Texture()
|
||||
@ -58,18 +69,19 @@ namespace ZL
|
||||
|
||||
|
||||
|
||||
TextureDataStruct CreateTextureDataFromBmp24(const std::string& fullFileName)
|
||||
TextureDataStruct CreateTextureDataFromBmp24(const std::string& fullFileName, const std::string& ZIPFileName)
|
||||
{
|
||||
|
||||
TextureDataStruct texData;
|
||||
|
||||
std::vector<char> fileArr = readFile(fullFileName);
|
||||
std::vector<char> fileArr;
|
||||
|
||||
fileArr = !ZIPFileName.empty() ? readFileFromZIP(fullFileName, ZIPFileName) : readFile(fullFileName);
|
||||
|
||||
size_t fileSize = fileArr.size();
|
||||
|
||||
if (fileSize < 22)
|
||||
{
|
||||
throw std::exception("File is too short or not correct!");
|
||||
throw std::runtime_error("File is too short or not correct!");
|
||||
}
|
||||
|
||||
//This refers to BITMAPV5HEADER
|
||||
@ -91,7 +103,7 @@ namespace ZL
|
||||
|
||||
if (pos + 3 > fileSize)
|
||||
{
|
||||
throw std::exception("File is too short!");
|
||||
throw std::runtime_error("File is too short!");
|
||||
}
|
||||
|
||||
|
||||
@ -106,18 +118,19 @@ namespace ZL
|
||||
return texData;
|
||||
}
|
||||
|
||||
TextureDataStruct CreateTextureDataFromBmp32(const std::string& fullFileName)
|
||||
TextureDataStruct CreateTextureDataFromBmp32(const std::string& fullFileName, const std::string& ZIPFileName)
|
||||
{
|
||||
|
||||
TextureDataStruct texData;
|
||||
|
||||
std::vector<char> fileArr = readFile(fullFileName);
|
||||
std::vector<char> fileArr;
|
||||
|
||||
fileArr = !ZIPFileName.empty() ? readFileFromZIP(fullFileName, ZIPFileName) : readFile(fullFileName);
|
||||
|
||||
size_t fileSize = fileArr.size();
|
||||
|
||||
if (fileSize < 22)
|
||||
{
|
||||
throw std::exception("File is too short or not correct!");
|
||||
throw std::runtime_error("File is too short or not correct!");
|
||||
}
|
||||
|
||||
//This refers to BITMAPV5HEADER
|
||||
@ -139,7 +152,7 @@ namespace ZL
|
||||
|
||||
if (pos + 4 > fileSize)
|
||||
{
|
||||
throw std::exception("File is too short!");
|
||||
throw std::runtime_error("File is too short!");
|
||||
}
|
||||
|
||||
|
||||
@ -155,5 +168,118 @@ namespace ZL
|
||||
return texData;
|
||||
}
|
||||
|
||||
#ifdef PNG_ENABLED
|
||||
|
||||
TextureDataStruct CreateTextureDataFromPng(const std::string& fullFileName)
|
||||
{
|
||||
TextureDataStruct texData;
|
||||
|
||||
FILE* file = fopen(fullFileName.c_str(), "rb");
|
||||
if (!file) {
|
||||
fclose(file);
|
||||
throw std::runtime_error("Could not open file " + fullFileName);
|
||||
}
|
||||
|
||||
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (!png) {
|
||||
fclose(file);
|
||||
throw std::runtime_error("Could not create PNG read structure");
|
||||
}
|
||||
|
||||
png_infop info = png_create_info_struct(png);
|
||||
if (!info) {
|
||||
fclose(file);
|
||||
png_destroy_read_struct(&png, nullptr, nullptr);
|
||||
throw std::runtime_error("Could not create PNG info structure");
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(png))) {
|
||||
png_destroy_read_struct(&png, &info, nullptr);
|
||||
fclose(file);
|
||||
throw std::runtime_error("Error during PNG read");
|
||||
}
|
||||
|
||||
png_init_io(png, file);
|
||||
png_read_info(png, info);
|
||||
|
||||
texData.width = png_get_image_width(png, info);
|
||||
texData.height = png_get_image_height(png, info);
|
||||
png_byte color_type = png_get_color_type(png, info);
|
||||
png_byte bit_depth = png_get_bit_depth(png, info);
|
||||
|
||||
if (bit_depth == 16)
|
||||
png_set_strip_16(png);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb(png);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||
png_set_expand_gray_1_2_4_to_8(png);
|
||||
|
||||
if (png_get_valid(png, info, PNG_INFO_tRNS))
|
||||
png_set_tRNS_to_alpha(png);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_filler(png, 0xFF, PNG_FILLER_AFTER);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png);
|
||||
|
||||
png_read_update_info(png, info);
|
||||
|
||||
|
||||
png_bytep* row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * texData.height);
|
||||
for (int y = 0; y < texData.height; y++) {
|
||||
row_pointers[y] = (png_byte*)malloc(png_get_rowbytes(png, info));
|
||||
}
|
||||
|
||||
png_read_image(png, row_pointers);
|
||||
|
||||
fclose(file);
|
||||
|
||||
bool has_alpha = (color_type & PNG_COLOR_MASK_ALPHA) || (png_get_valid(png, info, PNG_INFO_tRNS));
|
||||
|
||||
size_t dataSize;
|
||||
|
||||
if (has_alpha)
|
||||
{
|
||||
texData.bitSize = TextureDataStruct::BS_32BIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
texData.bitSize = TextureDataStruct::BS_24BIT;
|
||||
}
|
||||
|
||||
int channels = has_alpha ? 4 : 3;
|
||||
|
||||
dataSize = texData.width * texData.height * channels;
|
||||
texData.data.resize(dataSize);
|
||||
|
||||
|
||||
//for (int y = 0; y < texData.height; y++) { //Go in reverse because of UV coord start point
|
||||
for (int y = texData.height-1; y >= 0; y--) {
|
||||
//png_bytep row = row_pointers[y];//Go in reverse because of UV coord start point
|
||||
png_bytep row = row_pointers[texData.height - 1 - y];
|
||||
for (int x = 0; x < texData.width; x++) {
|
||||
png_bytep px = &(row[x * 4]);
|
||||
texData.data[(y * texData.width + x) * channels + 0] = px[0]; // R
|
||||
texData.data[(y * texData.width + x) * channels + 1] = px[1]; // G
|
||||
texData.data[(y * texData.width + x) * channels + 2] = px[2]; // B
|
||||
if (has_alpha) {
|
||||
texData.data[(y * texData.width + x) * channels + 3] = px[3]; // A
|
||||
}
|
||||
}
|
||||
//free(row_pointers[y]);//Go in reverse because of UV coord start point
|
||||
free(row_pointers[texData.height - 1 - y]);//Go in reverse because of UV coord start point
|
||||
}
|
||||
free(row_pointers);
|
||||
|
||||
png_destroy_read_struct(&png, &info, nullptr);
|
||||
|
||||
return texData;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "OpenGlExtensions.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
namespace ZL
|
||||
@ -40,6 +39,9 @@ namespace ZL
|
||||
|
||||
};
|
||||
|
||||
TextureDataStruct CreateTextureDataFromBmp24(const std::string& fullFileName);
|
||||
TextureDataStruct CreateTextureDataFromBmp32(const std::string& fullFileName);
|
||||
TextureDataStruct CreateTextureDataFromBmp24(const std::string& fullFileName, const std::string& ZIPFileName="");
|
||||
TextureDataStruct CreateTextureDataFromBmp32(const std::string& fullFileName, const std::string& ZIPFileName="");
|
||||
#ifdef PNG_ENABLED
|
||||
TextureDataStruct CreateTextureDataFromPng(const std::string& fullFileName);
|
||||
#endif
|
||||
}
|
||||
|
||||
43
Utils.cpp
@ -1,10 +1,11 @@
|
||||
#include "Utils.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
//#include <zip.h>
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
@ -39,6 +40,46 @@ namespace ZL
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
std::vector<char> readFileFromZIP(const std::string& filename, const std::string& zipfilename) {
|
||||
/*const std::string zipPath = zipfilename;
|
||||
int zipErr;
|
||||
zip_t* archive = zip_open(zipPath.c_str(), ZIP_RDONLY, &zipErr);
|
||||
if (!archive) {
|
||||
throw std::runtime_error("Ошибка открытия ZIP: " + zipPath);
|
||||
}
|
||||
|
||||
std::string cleanFilename = filename;
|
||||
if (cleanFilename.rfind("./", 0) == 0) {
|
||||
cleanFilename = cleanFilename.substr(2);
|
||||
}
|
||||
|
||||
std::cout << "Ищем в ZIP: " << cleanFilename << std::endl;
|
||||
|
||||
zip_file_t* zipFile = zip_fopen(archive, cleanFilename.c_str(), 0);
|
||||
if (!zipFile) {
|
||||
zip_close(archive);
|
||||
throw std::runtime_error("Файл не найден в ZIP: " + cleanFilename);
|
||||
}
|
||||
|
||||
zip_stat_t fileStat;
|
||||
if (zip_stat(archive, cleanFilename.c_str(), 0, &fileStat) != 0) {
|
||||
zip_fclose(zipFile);
|
||||
zip_close(archive);
|
||||
throw std::runtime_error("Ошибка чтения ZIP-статистики.");
|
||||
}
|
||||
|
||||
std::vector<char> fileData;
|
||||
fileData.resize(fileStat.size);
|
||||
|
||||
zip_fread(zipFile, fileData.data(), fileData.size());
|
||||
|
||||
zip_fclose(zipFile);
|
||||
zip_close(archive);
|
||||
|
||||
return fileData;*/
|
||||
return {};
|
||||
}
|
||||
|
||||
bool findString(const char* in, char* list)
|
||||
{
|
||||
|
||||
8
Utils.h
@ -2,13 +2,19 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <exception>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
namespace ZL
|
||||
{
|
||||
std::string readTextFile(const std::string& filename);
|
||||
|
||||
std::vector<char> readFile(const std::string& filename);
|
||||
|
||||
std::vector<char> readFileFromZIP(const std::string& filename, const std::string& zipfilename);
|
||||
|
||||
bool findString(const char* in, char* list);
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 3.8 MiB |
|
Before Width: | Height: | Size: 1.4 MiB |
BIN
background.bmp
|
Before Width: | Height: | Size: 1.3 MiB |
BIN
bird.bmp32
|
Before Width: | Height: | Size: 1.0 MiB |
36
cmakeaudioplayer/CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(AudioPlayer)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Use pkg-config to find Vorbis
|
||||
#find_package(PkgConfig REQUIRED)
|
||||
#pkg_check_modules(VORBIS REQUIRED vorbis vorbisfile)
|
||||
#pkg_check_modules(OGG REQUIRED ogg)
|
||||
find_package(OpenAL REQUIRED)
|
||||
|
||||
add_library(audioplayer
|
||||
src/AudioPlayer.cpp
|
||||
include/AudioPlayer.hpp
|
||||
)
|
||||
|
||||
target_include_directories(audioplayer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${VORBIS_INCLUDE_DIRS}
|
||||
${OGG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(audioplayer
|
||||
PUBLIC
|
||||
${OPENAL_LIBRARY}
|
||||
${VORBIS_LIBRARIES}
|
||||
${OGG_LIBRARIES}
|
||||
)
|
||||
|
||||
# Test executable
|
||||
add_executable(test_audio examples/test_audio.cpp)
|
||||
target_link_libraries(test_audio PRIVATE audioplayer stdc++fs)
|
||||
#git add ../../sounds
|
||||
32
cmakeaudioplayer/examples/test_audio.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "AudioPlayer.hpp"
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
int main() {
|
||||
try {
|
||||
AudioPlayer player;
|
||||
const std::string filename = "Symphony No.6 (1st movement).ogg";
|
||||
|
||||
std::cout << "🔍 Looking for file: " << filename << " in sounds directory...\n";
|
||||
|
||||
if (!player.playFromSoundsDir(filename)) {
|
||||
std::cout << "❌ Failed to play audio file\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "✅ Playing symphony...\n";
|
||||
|
||||
// Check status for 30 seconds
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
std::cout << "📊 Status: " << (player.isPlaying() ? "Playing ▶️" : "Stopped ⏹️") << "\n";
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
return 0;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "❌ Error: " << e.what() << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
37
cmakeaudioplayer/include/AudioPlayer.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
class AudioPlayer {
|
||||
public:
|
||||
AudioPlayer();
|
||||
~AudioPlayer();
|
||||
|
||||
// Для музыки с зацикливанием (если filename пустой - продолжает играть текущую)
|
||||
bool playMusic(const std::string& filename = "");
|
||||
|
||||
// Для одноразовых звуковых эффектов
|
||||
bool playSound(const std::string& filename);
|
||||
|
||||
void stop();
|
||||
bool isPlaying() const;
|
||||
|
||||
private:
|
||||
ALCdevice* device;
|
||||
ALCcontext* context;
|
||||
ALuint musicSource; // Источник для музыки
|
||||
ALuint soundSource; // Источник для звуков
|
||||
ALuint musicBuffer; // Буфер для музыки
|
||||
ALuint soundBuffer; // Буфер для звуков
|
||||
bool playing;
|
||||
std::string currentMusic; // Хранит имя текущего музыкального файла
|
||||
|
||||
std::vector<char> loadOgg(const std::string& filename, ALuint buffer);
|
||||
std::string findFileInSounds(const std::string& filename);
|
||||
bool isOggFile(const std::string& filename) const;
|
||||
};
|
||||
194
cmakeaudioplayer/src/AudioPlayer.cpp
Normal file
@ -0,0 +1,194 @@
|
||||
#include "AudioPlayer.hpp"
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
|
||||
AudioPlayer::AudioPlayer() : device(nullptr), context(nullptr),
|
||||
musicSource(0), soundSource(0), musicBuffer(0), soundBuffer(0), playing(false) {
|
||||
device = alcOpenDevice(nullptr);
|
||||
if (!device) {
|
||||
throw std::runtime_error("Failed to open audio device");
|
||||
}
|
||||
|
||||
context = alcCreateContext(device, nullptr);
|
||||
if (!context) {
|
||||
alcCloseDevice(device);
|
||||
throw std::runtime_error("Failed to create audio context");
|
||||
}
|
||||
|
||||
alcMakeContextCurrent(context);
|
||||
alGenSources(1, &musicSource);
|
||||
alGenSources(1, &soundSource);
|
||||
alGenBuffers(1, &musicBuffer);
|
||||
alGenBuffers(1, &soundBuffer);
|
||||
}
|
||||
|
||||
AudioPlayer::~AudioPlayer() {
|
||||
if (musicSource)
|
||||
alDeleteSources(1, &musicSource);
|
||||
if (soundSource)
|
||||
alDeleteSources(1, &soundSource);
|
||||
if (musicBuffer)
|
||||
alDeleteBuffers(1, &musicBuffer);
|
||||
if (soundBuffer)
|
||||
alDeleteBuffers(1, &soundBuffer);
|
||||
|
||||
if (context) {
|
||||
alcMakeContextCurrent(nullptr);
|
||||
alcDestroyContext(context);
|
||||
}
|
||||
if (device)
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
|
||||
bool AudioPlayer::isOggFile(const std::string& filename) const {
|
||||
std::string ext = std::filesystem::path(filename).extension().string();
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||
return ext == ".ogg";
|
||||
}
|
||||
|
||||
std::string AudioPlayer::findFileInSounds(const std::string& filename) {
|
||||
// Primary search path - "sounds" directory next to executable
|
||||
std::filesystem::path soundsDir = std::filesystem::current_path() / "sounds";
|
||||
|
||||
// Alternative search paths
|
||||
std::vector<std::filesystem::path> altPaths = {
|
||||
std::filesystem::current_path() / ".." / "sounds", // One level up
|
||||
std::filesystem::current_path() / ".." / ".." / "sounds", // Two levels up
|
||||
"/home/albert/gay-jam/ZeptoLabTest1/sounds" // Absolute path
|
||||
};
|
||||
|
||||
std::cout << "🔍 Searching for \"" << filename << "\" in:\n";
|
||||
std::cout << " " << soundsDir << "\n";
|
||||
|
||||
if (std::filesystem::exists(soundsDir / filename)) {
|
||||
return (soundsDir / filename).string();
|
||||
}
|
||||
|
||||
// Try alternative paths
|
||||
for (const auto& path : altPaths) {
|
||||
std::cout << " " << path << "\n";
|
||||
if (std::filesystem::exists(path / filename)) {
|
||||
return (path / filename).string();
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error("❌ File not found: " + filename);
|
||||
}
|
||||
|
||||
std::vector<char> AudioPlayer::loadOgg(const std::string& filename, ALuint buffer) {
|
||||
FILE* file = fopen(filename.c_str(), "rb");
|
||||
if (!file) {
|
||||
throw std::runtime_error("Cannot open file: " + filename);
|
||||
}
|
||||
|
||||
OggVorbis_File vf;
|
||||
if (ov_open_callbacks(file, &vf, nullptr, 0, OV_CALLBACKS_DEFAULT) < 0) {
|
||||
fclose(file);
|
||||
throw std::runtime_error("Input not an Ogg file: " + filename);
|
||||
}
|
||||
|
||||
vorbis_info* vi = ov_info(&vf, -1);
|
||||
std::vector<char> audioData;
|
||||
char data[4096];
|
||||
int bitstream;
|
||||
long bytes;
|
||||
|
||||
do {
|
||||
bytes = ov_read(&vf, data, sizeof(data), 0, 2, 1, &bitstream);
|
||||
if (bytes > 0) {
|
||||
audioData.insert(audioData.end(), data, data + bytes);
|
||||
}
|
||||
} while (bytes > 0);
|
||||
|
||||
// Setup the buffer with the audio data
|
||||
alBufferData(buffer,
|
||||
(vi->channels == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16,
|
||||
audioData.data(),
|
||||
audioData.size(),
|
||||
vi->rate);
|
||||
|
||||
ov_clear(&vf);
|
||||
return audioData;
|
||||
}
|
||||
|
||||
bool AudioPlayer::playMusic(const std::string& filename) {
|
||||
try {
|
||||
// Если filename пустой, просто проверяем играет ли музыка
|
||||
if (filename.empty()) {
|
||||
if (!isPlaying()) {
|
||||
alSourcei(musicSource, AL_LOOPING, AL_TRUE); // Включаем зацикливание
|
||||
alSourcePlay(musicSource);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Если filename не пустой, загружаем новую музыку
|
||||
if (!isOggFile(filename)) {
|
||||
std::cerr << "❌ Error: Music file must be an .ogg file\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string fullPath = findFileInSounds(filename);
|
||||
std::cout << "✅ Found music file: " << fullPath << "\n";
|
||||
|
||||
// Останавливаем текущую музыку
|
||||
alSourceStop(musicSource);
|
||||
|
||||
// Загружаем и настраиваем новую музыку
|
||||
loadOgg(fullPath, musicBuffer);
|
||||
alSourcei(musicSource, AL_BUFFER, musicBuffer);
|
||||
alSourcei(musicSource, AL_LOOPING, AL_TRUE); // Включаем зацикливание
|
||||
|
||||
std::cout << "▶️ Starting music playback... " << musicSource << std::endl;
|
||||
std::cout << "▶️ Music buffer... " << musicBuffer << std::endl;
|
||||
alSourcePlay(musicSource);
|
||||
|
||||
currentMusic = filename;
|
||||
playing = true;
|
||||
return true;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "❌ Error playing music: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool AudioPlayer::playSound(const std::string& filename) {
|
||||
try {
|
||||
if (!isOggFile(filename)) {
|
||||
std::cerr << "❌ Error: Sound file must be an .ogg file\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string fullPath = findFileInSounds(filename);
|
||||
std::cout << "✅ Found sound file: " << fullPath << "\n";
|
||||
|
||||
// Загружаем и настраиваем звук
|
||||
loadOgg(fullPath, soundBuffer);
|
||||
alSourcei(soundSource, AL_BUFFER, soundBuffer);
|
||||
alSourcei(soundSource, AL_LOOPING, AL_FALSE); // Выключаем зацикливание
|
||||
|
||||
std::cout << "▶️ Playing sound effect...\n";
|
||||
alSourcePlay(soundSource);
|
||||
|
||||
return true;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "❌ Error playing sound: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioPlayer::stop() {
|
||||
alSourceStop(musicSource);
|
||||
alSourceStop(soundSource);
|
||||
playing = false;
|
||||
}
|
||||
|
||||
bool AudioPlayer::isPlaying() const {
|
||||
ALint state;
|
||||
alGetSourcei(musicSource, AL_SOURCE_STATE, &state);
|
||||
return state == AL_PLAYING;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
precision mediump float;
|
||||
uniform sampler2D Texture;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(Texture,texCoord).rgba;
|
||||
|
||||
gl_FragColor = color;
|
||||
|
||||
}
|
||||
BIN
game_over.bmp32
|
Before Width: | Height: | Size: 3.8 MiB |
504
main.cpp
@ -1,428 +1,78 @@
|
||||
#include "TextureManager.h"
|
||||
#include "ShaderManager.h"
|
||||
#include "Renderer.h"
|
||||
|
||||
#include "Physics.h"
|
||||
#include <string>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
#include "Game.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
|
||||
HGLRC hRC; //Render context
|
||||
HWND Hwnd; //Main window handle
|
||||
HDC hDC; //Device context
|
||||
|
||||
Renderer renderer;
|
||||
|
||||
GameState gs;
|
||||
|
||||
|
||||
//There might be anything
|
||||
const wchar_t CONST_WINDOW_CLASS_NAME[] = L"ZeptoLabClass";
|
||||
|
||||
const size_t CONST_TIMER_INTERVAL = 10;
|
||||
|
||||
const size_t CONST_MAX_TIME_INTERVAL = 1000;
|
||||
|
||||
bool ExitGameLoop = false;
|
||||
|
||||
//To calculate when to call Update
|
||||
size_t NewTickCount;
|
||||
size_t LastTickCount;
|
||||
|
||||
|
||||
void DrawBackground()
|
||||
{
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
|
||||
renderer.TranslateMatrix({ -gs.backgroundShift, 0.0f, 0.f });
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, GameObjects::backgroundTexturePtr->getTexID());
|
||||
|
||||
renderer.DrawVertexDataStruct(GameObjects::backgroundMesh);
|
||||
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
|
||||
void DrawBird()
|
||||
{
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
|
||||
Vector2f birdScreenShift = gs.birdCurrentPos - Env::birdStartPos;
|
||||
|
||||
renderer.TranslateMatrix({ 200.f + birdScreenShift.v[0], Env::getActualClientHeight() * 0.5f + birdScreenShift.v[1], 0.f });
|
||||
|
||||
renderer.RotateMatrix(QuatFromRotateAroundZ(gs.birdAngle));
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, GameObjects::birdTexturePtr->getTexID());
|
||||
|
||||
renderer.DrawVertexDataStruct(GameObjects::birdMesh);
|
||||
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
|
||||
void DrawPipes()
|
||||
{
|
||||
for (auto& pipePair : gs.pipePairArr)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, GameObjects::pipeTexturePtr->getTexID());
|
||||
|
||||
|
||||
//Draw bottom pipe:
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
|
||||
renderer.TranslateMatrix({ (pipePair.xPos), pipePair.bottomPipeVShift, 0.f });
|
||||
|
||||
renderer.DrawVertexDataStruct(GameObjects::pipeMesh);
|
||||
|
||||
|
||||
//Draw top pipe:
|
||||
|
||||
renderer.LoadIdentity();
|
||||
|
||||
renderer.TranslateMatrix({ (pipePair.xPos), Env::getActualClientHeight() + pipePair.topPipeVShift, 0.f });
|
||||
|
||||
renderer.ScaleMatrix({ 1.f, -1.f, 1.f });
|
||||
|
||||
renderer.DrawVertexDataStruct(GameObjects::pipeMesh);
|
||||
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawUi()
|
||||
{
|
||||
if (gs.isGameOver)
|
||||
{
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, GameObjects::gameOverTexturePtr->getTexID());
|
||||
|
||||
renderer.DrawVertexDataStruct(GameObjects::gameOverMesh);
|
||||
|
||||
renderer.PopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawScene()
|
||||
{
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string vPositionName = "vPosition";
|
||||
static const std::string vTexCoordName = "vTexCoord";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
CheckGlError();
|
||||
|
||||
glViewport(0, 0, Env::width, Env::height);
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.EnableVertexAttribArray(vTexCoordName);
|
||||
|
||||
renderer.PushProjectionMatrix(static_cast<float>(Env::width), static_cast<float>(Env::height));
|
||||
|
||||
DrawBackground();
|
||||
|
||||
DrawPipes();
|
||||
|
||||
DrawBird();
|
||||
|
||||
DrawUi();
|
||||
|
||||
renderer.PopProjectionMatrix();
|
||||
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ProcessTickCount()
|
||||
{
|
||||
|
||||
if (LastTickCount == 0)
|
||||
{
|
||||
LastTickCount = GetTickCount64();
|
||||
return;
|
||||
}
|
||||
|
||||
NewTickCount = GetTickCount64();
|
||||
if (NewTickCount - LastTickCount > CONST_TIMER_INTERVAL)
|
||||
{
|
||||
if (NewTickCount - LastTickCount > CONST_MAX_TIME_INTERVAL)
|
||||
{
|
||||
gs.UpdateScene(CONST_MAX_TIME_INTERVAL); //Limit game update speed to FPS
|
||||
}
|
||||
else
|
||||
{
|
||||
gs.UpdateScene(NewTickCount - LastTickCount);
|
||||
}
|
||||
|
||||
LastTickCount = NewTickCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
LRESULT WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static PAINTSTRUCT ps;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
ExitGameLoop = true;
|
||||
break;
|
||||
case WM_PAINT:
|
||||
|
||||
DrawScene();
|
||||
BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
|
||||
ProcessTickCount();
|
||||
break;
|
||||
case WM_SIZE:
|
||||
|
||||
PostMessage(hWnd, WM_PAINT, 0, 0);
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
|
||||
if (gs.isGameOver)
|
||||
{
|
||||
gs.RestartGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
gs.BirdJump();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
bool CreateOpenGLWindow(const wchar_t* title, int x, int y, int width, int height, HWND& hWnd, HDC& hDC, HGLRC& hRC)
|
||||
{
|
||||
int pf;
|
||||
WNDCLASS wc;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
static HINSTANCE hInstance = 0;
|
||||
|
||||
if (!hInstance)
|
||||
{
|
||||
hInstance = GetModuleHandle(NULL);
|
||||
wc.style = CS_OWNDC;
|
||||
wc.lpfnWndProc = (WNDPROC)WindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = CONST_WINDOW_CLASS_NAME;
|
||||
|
||||
if (!RegisterClass(&wc))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RECT r;
|
||||
r.left = x;
|
||||
r.right = x + width;
|
||||
r.top = y;
|
||||
r.bottom = y + height;
|
||||
|
||||
DWORD windowStyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||
|
||||
AdjustWindowRect(&r, windowStyle, false);
|
||||
|
||||
Env::windowHeaderHeight = abs(r.top);
|
||||
|
||||
hWnd = CreateWindow(CONST_WINDOW_CLASS_NAME, title, windowStyle, 0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, hInstance, NULL);
|
||||
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
memset(&pfd, 0, sizeof(pfd));
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 32;
|
||||
|
||||
pf = ChoosePixelFormat(hDC, &pfd);
|
||||
if (pf == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SetPixelFormat(hDC, pf, &pfd) == FALSE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hRC = wglCreateContext(hDC);
|
||||
wglMakeCurrent(hDC, hRC);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DestroyEngine()
|
||||
{
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
ReleaseDC(Hwnd, hDC);
|
||||
wglDeleteContext(hRC);
|
||||
DestroyWindow(Hwnd);
|
||||
|
||||
}
|
||||
|
||||
void MainLoop()
|
||||
{
|
||||
|
||||
MSG msg;
|
||||
|
||||
ShowWindow(Hwnd, SW_SHOW);
|
||||
UpdateWindow(Hwnd);
|
||||
|
||||
NewTickCount = GetTickCount64();
|
||||
LastTickCount = NewTickCount;
|
||||
|
||||
while (!ExitGameLoop)
|
||||
{
|
||||
while (PeekMessage(&msg, Hwnd, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if (GetMessage(&msg, Hwnd, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitGameLoop = true;
|
||||
}
|
||||
}
|
||||
DrawScene();
|
||||
|
||||
ProcessTickCount();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
|
||||
{
|
||||
using namespace ZL;
|
||||
|
||||
try {
|
||||
|
||||
srand((unsigned)time(NULL));
|
||||
|
||||
constexpr int CONST_WIDTH = 1280;
|
||||
constexpr int CONST_HEIGHT = 720;
|
||||
|
||||
Env::width = CONST_WIDTH;
|
||||
Env::height = CONST_HEIGHT;
|
||||
|
||||
if (!CreateOpenGLWindow(L"ZeptoLabTest", 0, 0, Env::width, Env::height, Hwnd, hDC, hRC))
|
||||
{
|
||||
throw std::exception("Failed to create OpenGL Window!");
|
||||
}
|
||||
|
||||
BindOpenGlFunctions();
|
||||
|
||||
//Load shaders:
|
||||
renderer.shaderManager.AddShaderFromFiles("default", "./default.vertex", "./default.fragment");
|
||||
|
||||
//Load textures
|
||||
GameObjects::birdTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./bird.bmp32"));
|
||||
GameObjects::backgroundTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./background.bmp"));
|
||||
GameObjects::pipeTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./pipe.bmp32"));
|
||||
GameObjects::gameOverTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./game_over.bmp32"));
|
||||
|
||||
|
||||
|
||||
//Create bird mesh
|
||||
GameObjects::birdMesh = CreateRect2D({ 0.f, 0.f }, { GameConsts::birdScale * GameObjects::birdTexturePtr->getWidth(), GameConsts::birdScale * GameObjects::birdTexturePtr->getHeight() }, 0);
|
||||
|
||||
float backgroundTextureScale = Env::height / static_cast<float>(GameObjects::backgroundTexturePtr->getHeight());
|
||||
|
||||
|
||||
//Create pipe mesh
|
||||
GameObjects::pipeMesh = CreateRect2D({ GameObjects::pipeTexturePtr->getWidth() * GameConsts::pipeScale * (-0.5f), Env::getActualClientHeight() * 0.5f + GameObjects::pipeTexturePtr->getHeight() * GameConsts::pipeScale * (-0.5f) }, { GameObjects::pipeTexturePtr->getWidth() * GameConsts::pipeScale * 0.5f, GameObjects::pipeTexturePtr->getHeight() * GameConsts::pipeScale * 0.5f }, 0);
|
||||
|
||||
|
||||
//Create background mesh depending on screen size
|
||||
|
||||
Env::backgroundSectionWidth = GameObjects::backgroundTexturePtr->getWidth() * backgroundTextureScale;
|
||||
|
||||
GameObjects::backgroundMesh = CreateRectHorizontalSections2D({ GameObjects::backgroundTexturePtr->getWidth() * backgroundTextureScale * (0.5f), GameObjects::backgroundTexturePtr->getHeight() * backgroundTextureScale * (0.5f) }, { GameObjects::backgroundTexturePtr->getWidth() * backgroundTextureScale * 0.5f, GameObjects::backgroundTexturePtr->getHeight() * backgroundTextureScale * 0.5f }, 0, 2);
|
||||
|
||||
|
||||
|
||||
//Create Game Over UI mesh depending on screen size
|
||||
|
||||
float gameOverTextureScale = Env::height / static_cast<float>(GameObjects::gameOverTexturePtr->getHeight());
|
||||
|
||||
GameObjects::gameOverMesh = CreateRect2D({ GameObjects::gameOverTexturePtr->getWidth() * gameOverTextureScale * 0.5f, GameObjects::gameOverTexturePtr->getHeight() * gameOverTextureScale * 0.5f }, { GameObjects::gameOverTexturePtr->getWidth() * gameOverTextureScale * 0.5f, GameObjects::gameOverTexturePtr->getHeight() * gameOverTextureScale * 0.5f }, 0.1f);
|
||||
|
||||
|
||||
|
||||
//Set some game values
|
||||
Env::birdStartPos = { Env::width * 0.2f, Env::getActualClientHeight() * 0.5f };
|
||||
|
||||
//Exact value depends on the bird look texture and must be calculated manually:
|
||||
gs.birdEllipse.a = GameConsts::birdScale * 236.f;
|
||||
gs.birdEllipse.b = GameConsts::birdScale * 160.f;
|
||||
|
||||
gs.RestartGame();
|
||||
|
||||
renderer.InitOpenGL();
|
||||
|
||||
MainLoop();
|
||||
|
||||
DestroyEngine();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "Oops: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
#include "Environment.h"
|
||||
ZL::Game game;
|
||||
void MainLoop() {
|
||||
game.update();
|
||||
}
|
||||
int main(int argc, char* argv[]) {
|
||||
constexpr int CONST_WIDTH = 1280;
|
||||
constexpr int CONST_HEIGHT = 720;
|
||||
|
||||
ZL::Environment::width = CONST_WIDTH;
|
||||
ZL::Environment::height = CONST_HEIGHT;
|
||||
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||
std::cerr << "SDL_Init failed: " << SDL_GetError() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
|
||||
SDL_Window* win = SDL_CreateWindow("Space Ship Game",
|
||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
CONST_WIDTH, CONST_HEIGHT,
|
||||
SDL_WINDOW_OPENGL);
|
||||
|
||||
if (!win) {
|
||||
std::cerr << "SDL_CreateWindow failed: " << SDL_GetError() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_GLContext glContext = SDL_GL_CreateContext(win);
|
||||
if (!glContext) {
|
||||
std::cerr << "SDL_GL_CreateContext failed: " << SDL_GetError() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Привязка контекста к окну — важно!
|
||||
SDL_GL_MakeCurrent(win, glContext);
|
||||
|
||||
ZL::Environment::window = win;
|
||||
#else
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0) {
|
||||
SDL_Log("SDL init failed: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
|
||||
ZL::Environment::window = SDL_CreateWindow(
|
||||
"Space Ship Game",
|
||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
CONST_WIDTH, CONST_HEIGHT,
|
||||
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN
|
||||
);
|
||||
|
||||
SDL_GLContext ctx = SDL_GL_CreateContext(ZL::Environment::window);
|
||||
SDL_GL_MakeCurrent(ZL::Environment::window, ctx);
|
||||
#endif
|
||||
|
||||
game.setup();
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
emscripten_set_main_loop(MainLoop, 0, 1);
|
||||
#else
|
||||
while (!game.shouldExit()) {
|
||||
game.update();
|
||||
SDL_Delay(2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIN
pipe.bmp32
|
Before Width: | Height: | Size: 1.4 MiB |
14508
resources/spaceship004.txt
Normal file
BIN
resources/sship001.png
Normal file
|
After Width: | Height: | Size: 653 KiB |
BIN
resources/sship001x.png
Normal file
|
After Width: | Height: | Size: 599 KiB |
20
default.vertex → shaders/default.vertex
Executable file → Normal file
@ -1,11 +1,11 @@
|
||||
attribute vec3 vPosition;
|
||||
attribute vec2 vTexCoord;
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform mat4 ProjectionModelViewMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
|
||||
texCoord = vTexCoord;
|
||||
attribute vec3 vPosition;
|
||||
attribute vec2 vTexCoord;
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform mat4 ProjectionModelViewMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
|
||||
texCoord = vTexCoord;
|
||||
}
|
||||
20
ZeptoLabTestBin/default.vertex → shaders/defaultColor.vertex
Executable file → Normal file
@ -1,11 +1,11 @@
|
||||
attribute vec3 vPosition;
|
||||
attribute vec2 vTexCoord;
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform mat4 ProjectionModelViewMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
|
||||
texCoord = vTexCoord;
|
||||
attribute vec3 vPosition;
|
||||
attribute vec3 vColor;
|
||||
varying vec3 color;
|
||||
|
||||
uniform mat4 ProjectionModelViewMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
|
||||
color = vColor;
|
||||
}
|
||||
9
shaders/defaultColor_desktop.fragment
Normal file
@ -0,0 +1,9 @@
|
||||
//precision mediump float;
|
||||
varying vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
//gl_FragColor = vec4(color, 1.0);
|
||||
gl_FragColor = vec4(1.0, 1.0, 0.5, 1.0);
|
||||
|
||||
}
|
||||
9
shaders/defaultColor_web.fragment
Normal file
@ -0,0 +1,9 @@
|
||||
precision mediump float;
|
||||
varying vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
//gl_FragColor = vec4(color, 1.0);
|
||||
gl_FragColor = vec4(1.0, 1.0, 0.5, 1.0);
|
||||
|
||||
}
|
||||
12
shaders/default_desktop.fragment
Normal file
@ -0,0 +1,12 @@
|
||||
//precision mediump float;
|
||||
uniform sampler2D Texture;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(Texture,texCoord).rgba;
|
||||
gl_FragColor = vec4(color.rgb*0.9 + vec3(0.1, 0.1, 0.1), 1.0);
|
||||
|
||||
//gl_FragColor = color;
|
||||
|
||||
}
|
||||
21
ZeptoLabTestBin/default.fragment → shaders/default_web.fragment
Executable file → Normal file
@ -1,11 +1,12 @@
|
||||
precision mediump float;
|
||||
uniform sampler2D Texture;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(Texture,texCoord).rgba;
|
||||
|
||||
gl_FragColor = color;
|
||||
|
||||
precision mediump float;
|
||||
uniform sampler2D Texture;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(Texture,texCoord).rgba;
|
||||
//gl_FragColor = vec4(color.rgb*0.1 + vec3(0.9, 0.9, 0.9), 1.0);
|
||||
|
||||
gl_FragColor = color;
|
||||
|
||||
}
|
||||
62
ZeptoLabTest1.sln → space-game001.sln
Executable file → Normal file
@ -1,31 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31402.337
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeptoLabTest1", "ZeptoLabTest1.vcxproj", "{400A41AE-F904-4D49-9DBC-95934D0EF82E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x64.Build.0 = Debug|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x64.ActiveCfg = Release|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x64.Build.0 = Release|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3D1B89D-D5F1-4E33-8439-56D6C43B07A2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31402.337
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "space-game001", "space-game001.vcxproj", "{400A41AE-F904-4D49-9DBC-95934D0EF82E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x64.Build.0 = Debug|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x64.ActiveCfg = Release|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x64.Build.0 = Release|x64
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{400A41AE-F904-4D49-9DBC-95934D0EF82E}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3D1B89D-D5F1-4E33-8439-56D6C43B07A2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
349
ZeptoLabTest1.vcxproj → space-game001.vcxproj
Executable file → Normal file
@ -1,167 +1,184 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{400a41ae-f904-4d49-9dbc-95934d0ef82e}</ProjectGuid>
|
||||
<RootNamespace>ZeptoLabTest1</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Math.cpp" />
|
||||
<ClCompile Include="OpenGlExtensions.cpp" />
|
||||
<ClCompile Include="Physics.cpp" />
|
||||
<ClCompile Include="Renderer.cpp" />
|
||||
<ClCompile Include="ShaderManager.cpp" />
|
||||
<ClCompile Include="TextureManager.cpp" />
|
||||
<ClCompile Include="Utils.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game.h" />
|
||||
<ClInclude Include="Math.h" />
|
||||
<ClInclude Include="OpenGlExtensions.h" />
|
||||
<ClInclude Include="Physics.h" />
|
||||
<ClInclude Include="Renderer.h" />
|
||||
<ClInclude Include="ShaderManager.h" />
|
||||
<ClInclude Include="TextureManager.h" />
|
||||
<ClInclude Include="Utils.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{400a41ae-f904-4d49-9dbc-95934d0ef82e}</ProjectGuid>
|
||||
<RootNamespace>ZeptoLabTest1</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>space-game001</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>Viola</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>PNG_ENABLED;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\SDL2-2.28.3\include;..\lpng1645\build\install\include;C:\Work\OpenAL 1.1 SDK\include;..\Projects\libogg\include;..\vorbis\include</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libpng16_staticd.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;shell32.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\SDL2-2.28.3\lib\x64;..\lpng1645\build\install\lib</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>
|
||||
</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\Work\SDL2-2.28.3\include;C:\Work\Projects\lpng1645\build\install\include;C:\Work\OpenAL 1.1 SDK\include;C:\Work\Projects\libogg\include;C:\Work\Projects\vorbis\include</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libogg_static.lib;audioplayer.lib;vorbisfile.lib;vorbis.lib;OpenAL32.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;shell32.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Work\Projects\ZeptoLabTest1\cmakeaudioplayer\build\Release;C:\Work\SDL2-2.28.3\lib\x64;C:\Work\Projects\vorbis\build\lib\Release;C:\Work\OpenAL 1.1 SDK\libs\Win64;C:\Work\Projects\libogg\win32\VS2010\x64\Release</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioPlayerAsync.cpp" />
|
||||
<ClCompile Include="BoneAnimatedModel.cpp" />
|
||||
<ClCompile Include="Environment.cpp" />
|
||||
<ClCompile Include="Game.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Math.cpp" />
|
||||
<ClCompile Include="OpenGlExtensions.cpp" />
|
||||
<ClCompile Include="Renderer.cpp" />
|
||||
<ClCompile Include="ShaderManager.cpp" />
|
||||
<ClCompile Include="TextModel.cpp" />
|
||||
<ClCompile Include="TextureManager.cpp" />
|
||||
<ClCompile Include="Utils.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AnimatedModel.h" />
|
||||
<ClInclude Include="AudioPlayerAsync.h" />
|
||||
<ClInclude Include="BoneAnimatedModel.h" />
|
||||
<ClInclude Include="Environment.h" />
|
||||
<ClInclude Include="Game.h" />
|
||||
<ClInclude Include="Math.h" />
|
||||
<ClInclude Include="OpenGlExtensions.h" />
|
||||
<ClInclude Include="Renderer.h" />
|
||||
<ClInclude Include="ShaderManager.h" />
|
||||
<ClInclude Include="TextModel.h" />
|
||||
<ClInclude Include="TextureManager.h" />
|
||||
<ClInclude Include="Utils.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
163
ZeptoLabTest1.vcxproj.filters → space-game001.vcxproj.filters
Executable file → Normal file
@ -1,72 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TextureManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Renderer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShaderManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGlExtensions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Physics.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Math.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Game.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="TextureManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Renderer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShaderManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGlExtensions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Physics.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Math.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TextureManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Renderer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShaderManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGlExtensions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Math.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Game.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BoneAnimatedModel.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TextModel.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Environment.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AudioPlayerAsync.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="TextureManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Renderer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShaderManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGlExtensions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Math.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AnimatedModel.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BoneAnimatedModel.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TextModel.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Environment.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AudioPlayerAsync.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
12
start.sh
Executable file
@ -0,0 +1,12 @@
|
||||
g++ Game.cpp main.cpp Math.cpp OpenGlExtensions.cpp Physics.cpp Renderer.cpp \
|
||||
ShaderManager.cpp TextureManager.cpp Utils.cpp BoneAnimatedModel.cpp \
|
||||
ObjLoader.cpp cmakeaudioplayer/src/AudioPlayer.cpp TextModel.cpp \
|
||||
Inventory.cpp Environment.cpp GameObjectManager.cpp RenderSystem.cpp QuestScripts.cpp \
|
||||
AudioPlayerAsync.cpp \
|
||||
-o sdl_app -O2 -std=c++17 -pthread \
|
||||
-I cmakeaudioplayer/include \
|
||||
$(pkg-config --cflags --libs sdl2 gl) \
|
||||
$(pkg-config --cflags --libs vorbis vorbisfile ogg) \
|
||||
-lopenal
|
||||
|
||||
#./sdl_app
|
||||
12
thirdparty/libzip-1.11.3/.clang-format
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
ColumnLimit: 2000
|
||||
AlwaysBreakAfterReturnType: TopLevelDefinitions
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 2
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
BeforeElse: true
|
||||
AlignEscapedNewlines: Left
|
||||
UseTab: Never
|
||||
#PPDirectiveIndentStyle: AfterHash
|
||||
32
thirdparty/libzip-1.11.3/.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Report where libzip didn't behave like you expected.
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the Bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Expected Behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Observed Behavior**
|
||||
A clear and concise description of what actually happened.
|
||||
|
||||
**To Reproduce**
|
||||
Short program or code snippet that reproduces the problem.
|
||||
|
||||
**libzip Version**
|
||||
Version of libzip or revision repository used.
|
||||
|
||||
**Operating System**
|
||||
Operating system and version, used compiler.
|
||||
|
||||
**Test Files**
|
||||
If applicable, attach and describe zip archives that trigger the problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
25
thirdparty/libzip-1.11.3/.github/ISSUE_TEMPLATE/compile-error.md
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
name: Compile Error
|
||||
about: Report when libzip does not compile.
|
||||
title: ''
|
||||
labels: compile
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Compiler Error**
|
||||
Output from the compiler, including exact and complete error message, file name and line number.
|
||||
|
||||
**libzip Version**
|
||||
Version of libzip or revision repository used.
|
||||
|
||||
**Operating System and Compiler**
|
||||
The operating system and compiler used, including version number.
|
||||
|
||||
Also, any flags passed to `cmake`.
|
||||
|
||||
**Autodetected Configuration**
|
||||
Attach `CmakeCache.txt` from your build directory. This list everything `cmake` detected on your system.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
22
thirdparty/libzip-1.11.3/.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for this project.
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Description**
|
||||
A clear and concise description of what you want to achieve, why the current features are insufficient, and why you think it is generally useful.
|
||||
|
||||
Also, have you checked whether the feature is already mentioned in TODO.md? If so, only submit a new issue if you expand on it.
|
||||
|
||||
**Solution**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the feature request here.
|
||||
10
thirdparty/libzip-1.11.3/.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Other
|
||||
about: If you have a question about libzip , consider using Discussions instead.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
25
thirdparty/libzip-1.11.3/.github/workflows/CIFuzz.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'libzip'
|
||||
dry-run: false
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'libzip'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
23
thirdparty/libzip-1.11.3/.github/workflows/bsd.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: BSD
|
||||
on: [push]
|
||||
jobs:
|
||||
NetBSD:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: NetBSD test
|
||||
uses: vmactions/netbsd-vm@v1
|
||||
with:
|
||||
usesh: true
|
||||
copyback: false
|
||||
prepare: |
|
||||
/usr/sbin/pkg_add cmake zstd py313-pip
|
||||
/usr/pkg/bin/pip-3.13 install nihtest
|
||||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
|
||||
echo "/usr/pkg/bin" >> "$GITHUB_PATH"
|
||||
run: |
|
||||
cmake -E make_directory ${{runner.workspace}}/build
|
||||
cmake ${{ matrix.cmake_extra }} ${{github.workspace}}
|
||||
cmake --build . --config Release
|
||||
ctest --output-on-failure -V -C Release
|
||||
65
thirdparty/libzip-1.11.3/.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
name: build
|
||||
on: [push]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
all:
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.os }}${{ matrix.name_extra }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
cmake_extra: [""]
|
||||
name_extra: [""]
|
||||
include:
|
||||
- os: windows-latest
|
||||
cmake_extra: "-T ClangCl"
|
||||
name_extra: " clang-cl"
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: install python and pip
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: install dependencies (Linux)
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: |
|
||||
sudo apt-get install libzstd-dev
|
||||
- name: install latest CMake and Ninja for lukka/run-vcpkg (Windows)
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
uses: lukka/get-cmake@latest
|
||||
- name: install dependencies (Windows)
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgGitCommitId: 2cf957350da28ad032178a974607f59f961217d9
|
||||
- name: prepare build directory and install nihtest
|
||||
run: |
|
||||
cmake -E make_directory ${{runner.workspace}}/build
|
||||
pip install nihtest
|
||||
- name: configure (Unix)
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: |
|
||||
cmake ${{ matrix.cmake_extra }} ${{github.workspace}}
|
||||
- name: configure (Windows)
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: |
|
||||
cmake ${{ matrix.cmake_extra }} -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake ${{github.workspace}}
|
||||
- name: build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: |
|
||||
cmake --build . --config Release
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: regress-directory-${{ matrix.os }}-${{ matrix.name_extra }}
|
||||
path: |
|
||||
${{runner.workspace}}/build/regress
|
||||
- name: test
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: |
|
||||
ctest --output-on-failure -V -C Release
|
||||
74
thirdparty/libzip-1.11.3/.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: '0 10 * * 4'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Override automatic language detection by changing the below list
|
||||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
||||
language: ['cpp']
|
||||
# Learn more...
|
||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
80
thirdparty/libzip-1.11.3/.github/workflows/coverity.yml
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
name: Coverity
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * 1'
|
||||
# Mondays at 03:00
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Coverity
|
||||
runs-on: ubuntu-latest
|
||||
environment: coverity
|
||||
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_TOKEN }}
|
||||
PROJECT: libzip
|
||||
SHORT_PROJECT: libzip
|
||||
EMAIL: wiz@gatalith.at
|
||||
COV_TOOLS: cov-tools
|
||||
COV_RESULTS: cov-int
|
||||
|
||||
steps:
|
||||
- name: Check Secret
|
||||
run: |
|
||||
[ -n "${{ secrets.COVERITY_TOKEN }}" ]
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get install libzstd-dev
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -E make_directory ${{runner.workspace}}/build
|
||||
cmake ${{ matrix.cmake_extra }} ${{github.workspace}}
|
||||
|
||||
- name: Download Coverity
|
||||
run: |
|
||||
wget --quiet https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$PROJECT" -O "$COV_TOOLS.tar.gz"
|
||||
mkdir "$COV_TOOLS"
|
||||
tar xzf "$COV_TOOLS.tar.gz" --strip 1 -C "$COV_TOOLS"
|
||||
ls -l "$COV_TOOLS"
|
||||
|
||||
- name: Build with Coverity
|
||||
run: |
|
||||
export PATH="$(pwd)/$COV_TOOLS/bin:$PATH"
|
||||
cov-build --dir $COV_RESULTS make -j ${{steps.cpu-cores.outputs.count}}
|
||||
# Filter out private info
|
||||
sed -E -i 's/TOKEN=([-_A-Za-z0-9]+)/TOKEN=XXX/g' cov-int/build-log.txt
|
||||
|
||||
- name: Upload build log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-log
|
||||
path: cov-int/build-log.txt
|
||||
retention-days: 10
|
||||
|
||||
- name: Submit Results
|
||||
run: |
|
||||
tar -czf $SHORT_PROJECT.tgz $COV_RESULTS
|
||||
ls -lh $SHORT_PROJECT.tgz
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
GIT_HASH="$(git rev-parse --short HEAD)"
|
||||
echo "HASH: $GIT_HASH"
|
||||
GIT_DESC="$(git log -n1 --format="%s" $GIT_HASH)"
|
||||
echo "DESC: $GIT_DESC"
|
||||
curl --fail --output curl.log \
|
||||
--form token=$TOKEN \
|
||||
--form email=$EMAIL \
|
||||
--form file=@$SHORT_PROJECT.tgz \
|
||||
--form version="$GIT_HASH" \
|
||||
--form description="$GIT_DESC" \
|
||||
https://scan.coverity.com/builds?project=$PROJECT
|
||||
# If we go over quota, alert the user
|
||||
cat curl.log
|
||||
grep -qv "quota.*reached" curl.log || false
|
||||
|
||||
174
thirdparty/libzip-1.11.3/API-CHANGES.md
vendored
Normal file
@ -0,0 +1,174 @@
|
||||
# libzip API changes
|
||||
|
||||
This file describes changes in the libzip API and how to adapt your
|
||||
code for them.
|
||||
|
||||
You can define `ZIP_DISABLE_DEPRECATED` before including `<zip.h>` to hide
|
||||
prototypes for deprecated functions, to find out about functions that
|
||||
might be removed at some point.
|
||||
|
||||
## Changed in libzip-1.10.0
|
||||
|
||||
### deprecated `zip_source_zip` and `zip_source_zip_create`
|
||||
|
||||
These functions were replaced with `zip_source_zip_file` and `zip_source_zip_file_create`. The implicit handling of the flag `ZIP_FL_COMPRESSED` was removed, the flag can now be specified explicitly.
|
||||
|
||||
If you want to get the compressed data for the whole file, use
|
||||
|
||||
```C
|
||||
zip_source_zip_file(za, source_archive, source_index, ZIP_FL_COMPRESSED, 0, -1, NULL)
|
||||
```
|
||||
|
||||
## Changed in libzip-1.0
|
||||
|
||||
### new type `zip_error_t`
|
||||
|
||||
Error information is stored in the newly public type `zip_error_t`. Use
|
||||
this to access information about an error, instead of the deprecated
|
||||
functions that operated on two ints.
|
||||
|
||||
deprecated functions:
|
||||
- `zip_error_get_sys_type()`
|
||||
- `zip_error_get()`
|
||||
- `zip_error_to_str()`
|
||||
- `zip_file_error_get()`
|
||||
|
||||
See their man pages for instructions on how to replace them.
|
||||
|
||||
The most common affected use is `zip_open`. The new recommended usage
|
||||
is:
|
||||
|
||||
```c
|
||||
int err;
|
||||
if ((za = zip_open(archive, flags, &err)) == NULL) {
|
||||
zip_error_t error;
|
||||
zip_error_init_with_code(&error, err);
|
||||
fprintf(stderr, "can't open zip archive '%s': %s\n", archive, zip_error_strerror(&error));
|
||||
zip_error_fini(&error);
|
||||
}
|
||||
```
|
||||
|
||||
### more typedefs
|
||||
|
||||
The following typedefs have been added for better readability:
|
||||
|
||||
```c
|
||||
typedef struct zip zip_t;
|
||||
typedef struct zip_file zip_file_t;
|
||||
typedef struct zip_source zip_source_t;
|
||||
typedef struct zip_stat zip_stat_t;
|
||||
```
|
||||
|
||||
This means you can use "`zip_t`" instead of "`struct zip`", etc.
|
||||
|
||||
|
||||
### torrentzip support removed
|
||||
|
||||
torrentzip depends on a particular zlib version which is by now quite
|
||||
old.
|
||||
|
||||
## Changed in libzip-0.11
|
||||
|
||||
### new type `zip_flags_t`
|
||||
|
||||
The functions which have flags now use the `zip_flags_t` type for this.
|
||||
All old flags fit; you need only to adapt code if you were saving flags in a
|
||||
local variable. Use `zip_flags_t` for such a variable.
|
||||
This affects:
|
||||
- `zip_fopen()`
|
||||
- `zip_fopen_encrypted()`
|
||||
- `zip_fopen_index()`
|
||||
- `zip_fopen_index_encrypted()`
|
||||
- `zip_get_archive_comment()`
|
||||
- `zip_get_archive_flag()`
|
||||
- `zip_get_num_entries()`
|
||||
- `zip_get_name()`
|
||||
- `zip_name_locate()`
|
||||
- `zip_set_archive_flag()`
|
||||
- `zip_source_zip()`
|
||||
- `zip_stat()`
|
||||
- `zip_stat_index()`
|
||||
|
||||
#### `ZIP_FL_*`, `ZIP_AFL_*`, `ZIP_STAT_*` are now unsigned constants
|
||||
|
||||
To match the new `zip_flags_t` type.
|
||||
|
||||
#### `zip_add()`, `zip_add_dir()`
|
||||
|
||||
These functions were replaced with `zip_file_add()` and `zip_dir_add()`, respectively,
|
||||
to add a flags argument.
|
||||
|
||||
#### `zip_rename()`, `zip_replace()`
|
||||
|
||||
These functions were replaced with `zip_file_rename()` and `zip_file_replace()`,
|
||||
respectively, to add a flags argument.
|
||||
|
||||
#### `zip_get_file_comment()`
|
||||
|
||||
This function was replaced with `zip_file_get_comment()`; one argument was promoted from
|
||||
`int` to `zip_uint32_t`, the other is now a `zip_flags_t`.
|
||||
|
||||
#### `zip_set_file_comment()`
|
||||
|
||||
This function was replaced with `zip_file_set_comment()`; an argument was promoted from
|
||||
`int` to `zip_uint16_t`, and a `zip_flags_t` argument was added.
|
||||
|
||||
### integer type size changes
|
||||
|
||||
Some argument and return values were not the right size or sign.
|
||||
|
||||
#### `zip_name_locate()`
|
||||
|
||||
The return value was `int`, which can be too small. The function now returns `zip_int64_t`.
|
||||
|
||||
|
||||
#### `zip_get_num_entries()`
|
||||
|
||||
The return type is now signed, to allow signaling errors.
|
||||
|
||||
#### `zip_set_archive_comment()`
|
||||
|
||||
The last argument changed from `int` to `zip_uint16_t`.
|
||||
|
||||
### extra field handling rewritten
|
||||
|
||||
The `zip_get_file_extra()` and `zip_set_file_extra()` functions were removed.
|
||||
They only worked on the whole extra field set.
|
||||
|
||||
Instead, you can now set, get, count, and delete each extra field separately,
|
||||
using the functions:
|
||||
- `zip_file_extra_field_delete()`
|
||||
- `zip_file_extra_field_delete_by_id()`
|
||||
- `zip_file_extra_field_get()`
|
||||
- `zip_file_extra_field_get_by_id()`
|
||||
- `zip_file_extra_fields_count()`
|
||||
- `zip_file_extra_fields_count_by_id()`
|
||||
- `zip_file_extra_field_set()`
|
||||
|
||||
Please read the corresponding man pages for details.
|
||||
|
||||
### new functions
|
||||
|
||||
#### `zip_discard()`
|
||||
|
||||
The new `zip_discard()` function closes an archive without committing the
|
||||
scheduled changes.
|
||||
|
||||
#### `zip_set_file_compression()`
|
||||
|
||||
The new `zip_set_file_compression()` function allows setting compression
|
||||
levels for files.
|
||||
|
||||
### argument changes
|
||||
|
||||
#### file names
|
||||
|
||||
File names arguments are now allowed to be `NULL` to have an empty file name.
|
||||
This mostly affects `zip_file_add()`, `zip_dir_add()`, and `zip_file_rename()`.
|
||||
|
||||
For `zip_get_name()`, `zip_file_get_comment()`, and `zip_get_archive_comment()`, if
|
||||
the file name or comment is empty, a string of length 0 is returned.
|
||||
`NULL` is returned for errors only.
|
||||
|
||||
Previously, `NULL` was returned for empty/unset file names and comments and
|
||||
errors, leaving no way to differentiate between the two.
|
||||
2
thirdparty/libzip-1.11.3/AUTHORS
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
Dieter Baron <dillo@nih.at>
|
||||
Thomas Klausner <wiz@gatalith.at>
|
||||
499
thirdparty/libzip-1.11.3/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,499 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
if (${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-compat)
|
||||
endif()
|
||||
|
||||
|
||||
project(libzip
|
||||
VERSION 1.11.3
|
||||
LANGUAGES C)
|
||||
|
||||
if(NOT libzip_VERSION_PATCH)
|
||||
set(libzip_VERSION_PATCH 0)
|
||||
endif()
|
||||
|
||||
option(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" ON)
|
||||
option(ENABLE_GNUTLS "Enable use of GnuTLS" ON)
|
||||
option(ENABLE_MBEDTLS "Enable use of mbed TLS" ON)
|
||||
option(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
|
||||
option(ENABLE_WINDOWS_CRYPTO "Enable use of Windows cryptography libraries" ON)
|
||||
|
||||
option(ENABLE_BZIP2 "Enable use of BZip2" ON)
|
||||
option(ENABLE_LZMA "Enable use of LZMA" ON)
|
||||
option(ENABLE_ZSTD "Enable use of Zstandard" ON)
|
||||
|
||||
option(ENABLE_FDOPEN "Enable zip_fdopen, which is not allowed in Microsoft CRT secure libraries" ON)
|
||||
|
||||
option(BUILD_TOOLS "Build tools in the src directory (zipcmp, zipmerge, ziptool)" ON)
|
||||
option(BUILD_REGRESS "Build regression tests" ON)
|
||||
option(BUILD_OSSFUZZ "Build fuzzers for ossfuzz" ON)
|
||||
option(BUILD_EXAMPLES "Build examples" ON)
|
||||
option(BUILD_DOC "Build documentation" ON)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckTypeSize)
|
||||
include(CheckCSourceRuns)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckStructHasMember)
|
||||
include(TestBigEndian)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(ENABLE_COMMONCRYPTO)
|
||||
check_include_files(CommonCrypto/CommonCrypto.h COMMONCRYPTO_FOUND)
|
||||
endif()
|
||||
if(ENABLE_GNUTLS)
|
||||
find_package(Nettle 3.0)
|
||||
find_package(GnuTLS)
|
||||
endif()
|
||||
if(ENABLE_MBEDTLS)
|
||||
find_package(MbedTLS 1.0)
|
||||
endif()
|
||||
if(ENABLE_OPENSSL)
|
||||
find_package(OpenSSL)
|
||||
endif()
|
||||
if(WIN32)
|
||||
if(ENABLE_WINDOWS_CRYPTO)
|
||||
set(WINDOWS_CRYPTO_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
option(LIBZIP_DO_INSTALL "Install libzip and the related files" ON)
|
||||
|
||||
option(SHARED_LIB_VERSIONNING "Add SO version in .so build" ON)
|
||||
|
||||
find_program(MDOCTOOL NAMES mandoc groff)
|
||||
if (MDOCTOOL)
|
||||
set(DOCUMENTATION_FORMAT "mdoc" CACHE STRING "Documentation format")
|
||||
else()
|
||||
find_program(MANTOOL NAMES nroff)
|
||||
if (MANTOOL)
|
||||
set(DOCUMENTATION_FORMAT "man" CACHE STRING "Documentation format")
|
||||
else()
|
||||
set(DOCUMENTATION_FORMAT "html" CACHE STRING "Documentation format")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(Dist)
|
||||
Dist(${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION})
|
||||
|
||||
#ADD_CUSTOM_TARGET(uninstall
|
||||
# COMMAND cat ${PROJECT_BINARY_DIR}/install_manifest.txt | xargs rm
|
||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
# )
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(HAVE_SHARED TRUE)
|
||||
else()
|
||||
set(ZIP_STATIC TRUE)
|
||||
endif()
|
||||
|
||||
# Checks
|
||||
|
||||
# Request ISO C secure library functions (memcpy_s &c)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D__STDC_WANT_LIB_EXT1__=1)
|
||||
|
||||
check_function_exists(_close HAVE__CLOSE)
|
||||
check_function_exists(_dup HAVE__DUP)
|
||||
check_function_exists(_fdopen HAVE__FDOPEN)
|
||||
check_function_exists(_fileno HAVE__FILENO)
|
||||
check_function_exists(_fseeki64 HAVE__FSEEKI64)
|
||||
check_function_exists(_fstat64 HAVE__FSTAT64)
|
||||
check_function_exists(_setmode HAVE__SETMODE)
|
||||
check_function_exists(_stat64 HAVE__STAT64)
|
||||
check_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF)
|
||||
check_symbol_exists(_snprintf_s stdio.h HAVE__SNPRINTF_S)
|
||||
check_symbol_exists(_snwprintf_s stdio.h HAVE__SNWPRINTF_S)
|
||||
check_function_exists(_strdup HAVE__STRDUP)
|
||||
check_symbol_exists(_stricmp string.h HAVE__STRICMP)
|
||||
check_function_exists(_strtoi64 HAVE__STRTOI64)
|
||||
check_function_exists(_strtoui64 HAVE__STRTOUI64)
|
||||
check_function_exists(_unlink HAVE__UNLINK)
|
||||
check_function_exists(arc4random HAVE_ARC4RANDOM)
|
||||
check_function_exists(clonefile HAVE_CLONEFILE)
|
||||
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
|
||||
check_function_exists(explicit_memset HAVE_EXPLICIT_MEMSET)
|
||||
check_function_exists(fchmod HAVE_FCHMOD)
|
||||
check_function_exists(fileno HAVE_FILENO)
|
||||
check_function_exists(fseeko HAVE_FSEEKO)
|
||||
check_function_exists(ftello HAVE_FTELLO)
|
||||
check_function_exists(getprogname HAVE_GETPROGNAME)
|
||||
check_function_exists(GetSecurityInfo HAVE_GETSECURITYINFO)
|
||||
check_symbol_exists(localtime_r time.h HAVE_LOCALTIME_R)
|
||||
check_symbol_exists(localtime_s time.h HAVE_LOCALTIME_S)
|
||||
check_function_exists(memcpy_s HAVE_MEMCPY_S)
|
||||
check_function_exists(random HAVE_RANDOM)
|
||||
check_function_exists(setmode HAVE_SETMODE)
|
||||
check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
|
||||
check_symbol_exists(snprintf_s stdio.h HAVE_SNPRINTF_S)
|
||||
check_symbol_exists(strcasecmp strings.h HAVE_STRCASECMP)
|
||||
check_function_exists(strdup HAVE_STRDUP)
|
||||
check_function_exists(strerror_s HAVE_STRERROR_S)
|
||||
check_function_exists(strerrorlen_s HAVE_STRERRORLEN_S)
|
||||
check_function_exists(stricmp HAVE_STRICMP)
|
||||
check_function_exists(strncpy_s HAVE_STRNCPY_S)
|
||||
check_function_exists(strtoll HAVE_STRTOLL)
|
||||
check_function_exists(strtoull HAVE_STRTOULL)
|
||||
|
||||
check_include_files("sys/types.h;sys/stat.h;fts.h" HAVE_FTS_H)
|
||||
# fts functions may be in external library
|
||||
if(HAVE_FTS_H)
|
||||
check_function_exists(fts_open HAVE_FTS_OPEN)
|
||||
if(NOT HAVE_FTS_OPEN)
|
||||
check_library_exists(fts fts_open "" HAVE_LIB_FTS)
|
||||
else(NOT HAVE_FTS_OPEN)
|
||||
set(HAVE_LIB_FTS "" CACHE INTERNAL "")
|
||||
endif(NOT HAVE_FTS_OPEN)
|
||||
else(HAVE_FTS_H)
|
||||
set(HAVE_LIB_FTS "" CACHE INTERNAL "")
|
||||
endif(HAVE_FTS_H)
|
||||
|
||||
if(HAVE_LIB_FTS)
|
||||
set(FTS_LIB fts CACHE INTERNAL "")
|
||||
else()
|
||||
set(FTS_LIB "" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
check_include_files(stdbool.h HAVE_STDBOOL_H)
|
||||
check_include_files(strings.h HAVE_STRINGS_H)
|
||||
check_include_files(unistd.h HAVE_UNISTD_H)
|
||||
|
||||
check_include_files(inttypes.h HAVE_INTTYPES_H_LIBZIP)
|
||||
check_include_files(stdint.h HAVE_STDINT_H_LIBZIP)
|
||||
check_include_files(sys/types.h HAVE_SYS_TYPES_H_LIBZIP)
|
||||
|
||||
# TODO: fix test
|
||||
# this test does not find __progname even when it exists
|
||||
#check_symbol_exists(__progname stdlib.h HAVE___PROGNAME)
|
||||
|
||||
check_type_size(__int8 __INT8_LIBZIP)
|
||||
check_type_size(int8_t INT8_T_LIBZIP)
|
||||
check_type_size(uint8_t UINT8_T_LIBZIP)
|
||||
check_type_size(__int16 __INT16_LIBZIP)
|
||||
check_type_size(int16_t INT16_T_LIBZIP)
|
||||
check_type_size(uint16_t UINT16_T_LIBZIP)
|
||||
check_type_size(__int32 __INT32_LIBZIP)
|
||||
check_type_size(int32_t INT32_T_LIBZIP)
|
||||
check_type_size(uint32_t UINT32_T_LIBZIP)
|
||||
check_type_size(__int64 __INT64_LIBZIP)
|
||||
check_type_size(int64_t INT64_T_LIBZIP)
|
||||
check_type_size(uint64_t UINT64_T_LIBZIP)
|
||||
check_type_size("short" SHORT_LIBZIP)
|
||||
check_type_size("int" INT_LIBZIP)
|
||||
check_type_size("long" LONG_LIBZIP)
|
||||
check_type_size("long long" LONG_LONG_LIBZIP)
|
||||
check_type_size("off_t" SIZEOF_OFF_T)
|
||||
check_type_size("size_t" SIZEOF_SIZE_T)
|
||||
|
||||
check_c_source_compiles("#include <sys/ioctl.h>
|
||||
#include <linux/fs.h>
|
||||
int main(int argc, char *argv[]) { unsigned long x = FICLONERANGE; }" HAVE_FICLONERANGE)
|
||||
|
||||
test_big_endian(WORDS_BIGENDIAN)
|
||||
|
||||
find_package(ZLIB 1.1.2 REQUIRED)
|
||||
# so developers on systems where zlib is named differently (Windows, sometimes)
|
||||
# can override the name used in the pkg-config file
|
||||
if (NOT ZLIB_LINK_LIBRARY_NAME)
|
||||
set(ZLIB_LINK_LIBRARY_NAME "z")
|
||||
|
||||
# Get the correct name in common cases
|
||||
list(LENGTH ZLIB_LIBRARIES N_ZLIB_LIBRARIES)
|
||||
if(N_ZLIB_LIBRARIES EQUAL 1)
|
||||
set(ZLIB_FILENAME ${ZLIB_LIBRARIES})
|
||||
elseif(N_ZLIB_LIBRARIES EQUAL 4)
|
||||
# ZLIB_LIBRARIES might have the target_link_library() format like
|
||||
# "optimized;path/to/zlib.lib;debug;path/to/zlibd.lib". Use the 'optimized'
|
||||
# case unless we know we are in a Debug build.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(FIND ZLIB_LIBRARIES "debug" ZLIB_LIBRARIES_INDEX_OF_CONFIG)
|
||||
else()
|
||||
list(FIND ZLIB_LIBRARIES "optimized" ZLIB_LIBRARIES_INDEX_OF_CONFIG)
|
||||
endif()
|
||||
if(ZLIB_LIBRARIES_INDEX_OF_CONFIG GREATER_EQUAL 0)
|
||||
math(EXPR ZLIB_FILENAME_INDEX "${ZLIB_LIBRARIES_INDEX_OF_CONFIG}+1")
|
||||
list(GET ZLIB_LIBRARIES ${ZLIB_FILENAME_INDEX} ZLIB_FILENAME)
|
||||
endif()
|
||||
endif()
|
||||
if(ZLIB_FILENAME)
|
||||
get_filename_component(ZLIB_FILENAME ${ZLIB_FILENAME} NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" ZLIB_LINK_LIBRARY_NAME ${ZLIB_FILENAME})
|
||||
endif()
|
||||
endif(NOT ZLIB_LINK_LIBRARY_NAME)
|
||||
|
||||
if(ENABLE_BZIP2)
|
||||
find_package(BZip2)
|
||||
if(BZIP2_FOUND)
|
||||
set(HAVE_LIBBZ2 1)
|
||||
else()
|
||||
message(WARNING "-- bzip2 library not found; bzip2 support disabled")
|
||||
endif(BZIP2_FOUND)
|
||||
endif(ENABLE_BZIP2)
|
||||
|
||||
if(ENABLE_LZMA)
|
||||
find_package(LibLZMA 5.2)
|
||||
if(LIBLZMA_FOUND)
|
||||
set(HAVE_LIBLZMA 1)
|
||||
else()
|
||||
message(WARNING "-- lzma library not found; lzma/xz support disabled")
|
||||
endif(LIBLZMA_FOUND)
|
||||
endif(ENABLE_LZMA)
|
||||
|
||||
if(ENABLE_ZSTD)
|
||||
find_package(zstd 1.4.0)
|
||||
if(zstd_FOUND)
|
||||
set(HAVE_LIBZSTD 1)
|
||||
if(TARGET zstd::libzstd_shared AND BUILD_SHARED_LIBS)
|
||||
set(zstd_TARGET zstd::libzstd_shared)
|
||||
else()
|
||||
set(zstd_TARGET zstd::libzstd_static)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "-- zstd library not found; zstandard support disabled")
|
||||
endif(zstd_FOUND)
|
||||
endif(ENABLE_ZSTD)
|
||||
|
||||
if (COMMONCRYPTO_FOUND)
|
||||
set(HAVE_CRYPTO 1)
|
||||
set(HAVE_COMMONCRYPTO 1)
|
||||
elseif (WINDOWS_CRYPTO_FOUND)
|
||||
set(HAVE_CRYPTO 1)
|
||||
set(HAVE_WINDOWS_CRYPTO 1)
|
||||
elseif (OPENSSL_FOUND)
|
||||
set(HAVE_CRYPTO 1)
|
||||
set(HAVE_OPENSSL 1)
|
||||
elseif (GNUTLS_FOUND AND NETTLE_FOUND)
|
||||
set(HAVE_CRYPTO 1)
|
||||
set(HAVE_GNUTLS 1)
|
||||
elseif (MBEDTLS_FOUND)
|
||||
set(HAVE_CRYPTO 1)
|
||||
set(HAVE_MBEDTLS 1)
|
||||
endif()
|
||||
|
||||
if ((ENABLE_COMMONCRYPTO OR ENABLE_GNUTLS OR ENABLE_MBEDTLS OR ENABLE_OPENSSL OR ENABLE_WINDOWS_CRYPTO) AND NOT HAVE_CRYPTO)
|
||||
message(WARNING "-- neither Common Crypto, GnuTLS, mbed TLS, OpenSSL, nor Windows Cryptography found; AES support disabled")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
add_compile_definitions(_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif(MSVC)
|
||||
|
||||
if(WIN32)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
|
||||
add_compile_definitions(MS_UWP)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
|
||||
endif(WIN32)
|
||||
|
||||
# rpath handling: use rpath in installed binaries
|
||||
if(NOT CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif()
|
||||
|
||||
# for code completion frameworks
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Testing
|
||||
ENABLE_TESTING()
|
||||
|
||||
# Targets
|
||||
ADD_SUBDIRECTORY(lib)
|
||||
|
||||
if(BUILD_DOC)
|
||||
ADD_SUBDIRECTORY(man)
|
||||
endif()
|
||||
|
||||
if(BUILD_TOOLS)
|
||||
ADD_SUBDIRECTORY(src)
|
||||
else(BUILD_TOOLS)
|
||||
if(BUILD_REGRESS)
|
||||
message(WARNING "-- tools build has been disabled, but they are needed for regression tests; regression testing disabled")
|
||||
set(BUILD_REGRESS OFF)
|
||||
endif(BUILD_REGRESS)
|
||||
endif()
|
||||
|
||||
find_program(NIHTEST nihtest)
|
||||
|
||||
if(BUILD_REGRESS AND NOT NIHTEST)
|
||||
message(WARNING "-- nihtest not found, regression testing disabled")
|
||||
set(BUILD_REGRESS OFF)
|
||||
endif()
|
||||
|
||||
if(BUILD_REGRESS)
|
||||
add_subdirectory(regress)
|
||||
endif()
|
||||
|
||||
if(BUILD_OSSFUZZ)
|
||||
add_subdirectory(ossfuzz)
|
||||
endif()
|
||||
|
||||
if(BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
|
||||
# pkgconfig file
|
||||
file(RELATIVE_PATH pc_relative_bindir ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_BINDIR})
|
||||
set(bindir "\${prefix}/${pc_relative_bindir}")
|
||||
file(RELATIVE_PATH pc_relative_libdir ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||
set(libdir "\${prefix}/${pc_relative_libdir}")
|
||||
file(RELATIVE_PATH pc_relative_includedir ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
||||
set(includedir "\${prefix}/${pc_relative_includedir}")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
set(PKG_CONFIG_RPATH "-Wl,-R\${libdir}")
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
get_target_property(LIBS_PRIVATE zip LINK_LIBRARIES)
|
||||
foreach(LIB ${LIBS_PRIVATE})
|
||||
if(LIB MATCHES "^/")
|
||||
get_filename_component(LIB ${LIB} NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" LIB ${LIB})
|
||||
endif()
|
||||
set(LIBS "${LIBS} -l${LIB}")
|
||||
endforeach()
|
||||
STRING(CONCAT zlib_link_name "-l" ${ZLIB_LINK_LIBRARY_NAME})
|
||||
string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS})
|
||||
string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS})
|
||||
if(zstd_TARGET)
|
||||
string(REGEX REPLACE "-l${zstd_TARGET}" "-lzstd" LIBS ${LIBS})
|
||||
endif()
|
||||
string(REGEX REPLACE "-lOpenSSL::Crypto" "-lssl -lcrypto" LIBS ${LIBS})
|
||||
string(REGEX REPLACE "-lZLIB::ZLIB" ${zlib_link_name} LIBS ${LIBS})
|
||||
string(REGEX REPLACE "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS})
|
||||
string(REGEX REPLACE "-lNettle::Nettle" "-lnettle" LIBS ${LIBS})
|
||||
configure_file(libzip.pc.in libzip.pc @ONLY)
|
||||
if(LIBZIP_DO_INSTALL)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/libzip.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
|
||||
# fixed size integral types
|
||||
|
||||
if(HAVE_INTTYPES_H_LIBZIP)
|
||||
set(LIBZIP_TYPES_INCLUDE "#if !defined(__STDC_FORMAT_MACROS)
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
||||
#include <inttypes.h>")
|
||||
elseif(HAVE_STDINT_H_LIBZIP)
|
||||
set(LIBZIP_TYPES_INCLUDE "#include <stdint.h>")
|
||||
elseif(HAVE_SYS_TYPES_H_LIBZIP)
|
||||
set(LIBZIP_TYPES_INCLUDE "#include <sys/types.h>")
|
||||
endif()
|
||||
|
||||
if(HAVE_INT8_T_LIBZIP)
|
||||
set(ZIP_INT8_T int8_t)
|
||||
elseif(HAVE___INT8_LIBZIP)
|
||||
set(ZIP_INT8_T __int8)
|
||||
else()
|
||||
set(ZIP_INT8_T "signed char")
|
||||
endif()
|
||||
|
||||
if(HAVE_UINT8_T_LIBZIP)
|
||||
set(ZIP_UINT8_T uint8_t)
|
||||
elseif(HAVE___INT8_LIBZIP)
|
||||
set(ZIP_UINT8_T "unsigned __int8")
|
||||
else()
|
||||
set(ZIP_UINT8_T "unsigned char")
|
||||
endif()
|
||||
|
||||
if(HAVE_INT16_T_LIBZIP)
|
||||
set(ZIP_INT16_T int16_t)
|
||||
elseif(HAVE___INT16_LIBZIP)
|
||||
set(INT16_T_LIBZIP __int16)
|
||||
elseif(SHORT_LIBZIP EQUAL 2)
|
||||
set(INT16_T_LIBZIP short)
|
||||
endif()
|
||||
|
||||
if(HAVE_UINT16_T_LIBZIP)
|
||||
set(ZIP_UINT16_T uint16_t)
|
||||
elseif(HAVE___INT16_LIBZIP)
|
||||
set(UINT16_T_LIBZIP "unsigned __int16")
|
||||
elseif(SHORT_LIBZIP EQUAL 2)
|
||||
set(UINT16_T_LIBZIP "unsigned short")
|
||||
endif()
|
||||
|
||||
if(HAVE_INT32_T_LIBZIP)
|
||||
set(ZIP_INT32_T int32_t)
|
||||
elseif(HAVE___INT32_LIBZIP)
|
||||
set(ZIP_INT32_T __int32)
|
||||
elseif(INT_LIBZIP EQUAL 4)
|
||||
set(ZIP_INT32_T int)
|
||||
elseif(LONG_LIBZIP EQUAL 4)
|
||||
set(ZIP_INT32_T long)
|
||||
endif()
|
||||
|
||||
if(HAVE_UINT32_T_LIBZIP)
|
||||
set(ZIP_UINT32_T uint32_t)
|
||||
elseif(HAVE___INT32_LIBZIP)
|
||||
set(ZIP_UINT32_T "unsigned __int32")
|
||||
elseif(INT_LIBZIP EQUAL 4)
|
||||
set(ZIP_UINT32_T "unsigned int")
|
||||
elseif(LONG_LIBZIP EQUAL 4)
|
||||
set(ZIP_UINT32_T "unsigned long")
|
||||
endif()
|
||||
|
||||
if(HAVE_INT64_T_LIBZIP)
|
||||
set(ZIP_INT64_T int64_t)
|
||||
elseif(HAVE___INT64_LIBZIP)
|
||||
set(ZIP_INT64_T __int64)
|
||||
elseif(LONG_LIBZIP EQUAL 8)
|
||||
set(ZIP_INT64_T long)
|
||||
elseif(LONG_LONG_LIBZIP EQUAL 8)
|
||||
set(ZIP_INT64_T "long long")
|
||||
endif()
|
||||
|
||||
if(HAVE_UINT64_T_LIBZIP)
|
||||
set(ZIP_UINT64_T uint64_t)
|
||||
elseif(HAVE___INT64_LIBZIP)
|
||||
set(ZIP_UINT64_T "unsigned __int64")
|
||||
elseif(LONG_LIBZIP EQUAL 8)
|
||||
set(ZIP_UINT64_T "unsigned long")
|
||||
elseif(LONG_LONG_LIBZIP EQUAL 8)
|
||||
set(ZIP_UINT64_T "unsigned long long")
|
||||
endif()
|
||||
|
||||
# write out config file
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zipconf.h.in ${PROJECT_BINARY_DIR}/zipconf.h)
|
||||
|
||||
# for tests
|
||||
|
||||
set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}/regress)
|
||||
set(abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR}/regress)
|
||||
set(top_builddir ${PROJECT_BINARY_DIR}) # used to find config.h
|
||||
|
||||
# create package config file
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
if(LIBZIP_DO_INSTALL)
|
||||
configure_package_config_file("${PROJECT_NAME}-config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libzip)
|
||||
|
||||
# Install Find* modules, they are required by libzip-config.cmake to resolve dependencies
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindNettle.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findzstd.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindMbedTLS.cmake
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_LIBDIR}/cmake/libzip/modules
|
||||
)
|
||||
|
||||
# Add targets to the build-tree export set
|
||||
export(TARGETS zip
|
||||
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake")
|
||||
|
||||
# installation
|
||||
install(FILES ${PROJECT_BINARY_DIR}/zipconf.h DESTINATION include)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
||||
)
|
||||
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE libzip:: FILE ${PROJECT_NAME}-targets.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
||||
)
|
||||
endif()
|
||||
71
thirdparty/libzip-1.11.3/INSTALL.md
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
libzip uses [cmake](https://cmake.org) to build.
|
||||
|
||||
You'll need [zlib](http://www.zlib.net/) (at least version 1.1.2). It
|
||||
comes with most operating systems.
|
||||
|
||||
For supporting bzip2-compressed zip archives, you need
|
||||
[bzip2](http://bzip.org/).
|
||||
|
||||
For supporting lzma- and xz-compressed zip archives, you need
|
||||
[liblzma](https://tukaani.org/xz/) which is part of xz, at least version 5.2.
|
||||
|
||||
For supporting zstd-compressed zip archives, you need
|
||||
[zstd](https://github.com/facebook/zstd/).
|
||||
|
||||
For AES (encryption) support, you need one of these cryptographic libraries,
|
||||
listed in order of preference:
|
||||
|
||||
- Apple's CommonCrypto (available on macOS and iOS)
|
||||
- Microsoft Windows Cryptography Framework
|
||||
- [OpenSSL](https://www.openssl.org/) >= 1.0.
|
||||
- [GnuTLS](https://www.gnutls.org/) and [Nettle](https://www.lysator.liu.se/~nisse/nettle/) (at least nettle 3.0)
|
||||
- [mbed TLS](https://tls.mbed.org/)
|
||||
|
||||
If you don't want a library even if it is installed, you can
|
||||
pass `-DENABLE_<LIBRARY>=OFF` to cmake, where `<LIBRARY>` is one of
|
||||
`COMMONCRYPTO`, `GNUTLS`, `MBEDTLS`, or `OPENSSL`.
|
||||
|
||||
For running the tests, you need to have
|
||||
[Python](https://www.python.org/) and
|
||||
[nihtest](https://pypi.org/project/nihtest/) installed.
|
||||
|
||||
The basic usage is
|
||||
```sh
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
make test
|
||||
make install
|
||||
```
|
||||
|
||||
Some useful parameters you can pass to `cmake` with `-Dparameter=value`:
|
||||
|
||||
- `BUILD_SHARED_LIBS`: set to `ON` or `OFF` to enable/disable building
|
||||
of shared libraries, defaults to `ON`
|
||||
- `CMAKE_INSTALL_PREFIX`: for setting the installation path
|
||||
- `DOCUMENTATION_FORMAT`: choose one of `man`, `mdoc`, and `html` for
|
||||
the installed documentation (default: decided by cmake depending on
|
||||
available tools)
|
||||
- `LIBZIP_DO_INSTALL`: If you include libzip as a subproject, link it
|
||||
statically and do not want to let it install its files, set this
|
||||
variable to `OFF`. Defaults to `ON`.
|
||||
|
||||
If you want to compile with custom `CFLAGS`, set them in the environment
|
||||
before running `cmake`:
|
||||
```sh
|
||||
CFLAGS=-DMY_CUSTOM_FLAG cmake ..
|
||||
```
|
||||
|
||||
If you are compiling on a system with a small stack size, add
|
||||
`-DZIP_ALLOCATE_BUFFER` to `CFLAGS`.
|
||||
|
||||
If you are building on a 32-bit Linux system it might be necessary
|
||||
to define `_FILE_OFFSET_BITS` to `64`. Your distro will need to provide
|
||||
a `fts.h` file that is new enough to support this, or the build
|
||||
will break in `zipcmp`.
|
||||
|
||||
You can get verbose build output with by passing `VERBOSE=1` to
|
||||
`make`.
|
||||
|
||||
You can also check the [cmake FAQ](https://gitlab.kitware.com/cmake/community/-/wikis/FAQ).
|
||||
31
thirdparty/libzip-1.11.3/LICENSE
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
|
||||
|
||||
The authors can be contacted at <info@libzip.org>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
3. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
354
thirdparty/libzip-1.11.3/NEWS.md
vendored
Normal file
@ -0,0 +1,354 @@
|
||||
# 1.11.3 [2025-01-20]
|
||||
|
||||
* Report read error for corrupted encrypted file data.
|
||||
* Avoid unnecessary seeks when writing archive.
|
||||
* Don't hardcode `_Nullable` support in `zip.h` to allow it to be used with different compilers.
|
||||
* Improve check for GetSecurityInformation availability on Windows.
|
||||
|
||||
# 1.11.2 [2024-10-31]
|
||||
|
||||
* Fix performance regression in `zip_stat` introduced in 1.11.
|
||||
|
||||
# 1.11.1 [2024-09-19]
|
||||
|
||||
* Fix zipconf.h for version number with missing third component.
|
||||
|
||||
# 1.11 [2024-09-19]
|
||||
|
||||
* Stop searching after finding acceptable central directory, even if it contains inconsistencies.
|
||||
* Only write Zip64 EOCD if fields don't fit in normal EOCD. Previously libzip also wrote it when any directory entry required Zip64.
|
||||
* Allow bytes from 0x00-0x1F as UTF-8.
|
||||
* Add new error code `ZIP_ER_TRUNCATED_ZIP` for files that start with a valid local header signature.
|
||||
* `zipcmp`: add `-T` option for comparing timestamps.
|
||||
* `zip_file_replace` now removes the target's extra field information.
|
||||
|
||||
# 1.10.1 [2023-08-23]
|
||||
|
||||
* Add `ZIP_LENGTH_TO_END` and `ZIP_LENGTH_UNCHECKED`. Unless `ZIP_LENGTH_UNCHECKED` is used as `length`, it is an error for a file to shrink between the time when the source is created and when its data is read.
|
||||
* Fix test on Windows.
|
||||
|
||||
# 1.10.0 [2023-06-23]
|
||||
|
||||
* Make support for layered sources public.
|
||||
* Add `zip_source_zip_file` and `zip_source_zip_file_create`, deprecate `zip_source_zip` and `zip_source_zip_create`.
|
||||
* Allow reading changed file data.
|
||||
* Fix handling of files of size 4294967295.
|
||||
* `zipmerge`: copy extra fields.
|
||||
* `zipmerge`: add option to keep files uncompressed.
|
||||
* Switch test framework to use nihtest instead of Perl.
|
||||
* Fix reading/writing compressed data with buffers > 4GiB.
|
||||
* Restore support for torrentzip.
|
||||
* Add warnings when using deprecated functions.
|
||||
* Allow keeping files for empty archives.
|
||||
* Support mbedTLS>=3.3.0.
|
||||
* Support OpenSSL 3.
|
||||
* Use ISO C secure library functions, if available.
|
||||
|
||||
|
||||
# 1.9.2 [2022-06-28]
|
||||
|
||||
* Fix version number in header file.
|
||||
|
||||
|
||||
# 1.9.1 [2022-06-28]
|
||||
|
||||
* Fix `zip_file_is_seekable()`.
|
||||
|
||||
|
||||
# 1.9.0 [2022-06-13]
|
||||
|
||||
* Add `zip_file_is_seekable()`.
|
||||
* Improve compatibility with WinAES.
|
||||
* Fix encoding handling in `zip_name_locate()`.
|
||||
* Add option to `zipcmp` to output summary of changes.
|
||||
* Various bug fixes and documentation improvements.
|
||||
|
||||
|
||||
# 1.8.0 [2021-06-18]
|
||||
|
||||
* Add support for zstd (Zstandard) compression.
|
||||
* Add support for lzma (ID 14) compression.
|
||||
* Add `zip_source_window_create()`.
|
||||
* Add `zip_source_zip_create()` variant to `zip_source_zip()`.
|
||||
* Allow method specific `comp_flags` in `zip_set_file_compression()`.
|
||||
* Allow `zip_source_tell()` on sources that don't support seeking and `zip_ftell()` on compressed data.
|
||||
* Provide more details for consistency check errors.
|
||||
* Improve output of `zipcmp`.
|
||||
* In `zipcmp`, don’t ignore empty directories when comparing directory listing.
|
||||
* Treat empty string as no password given in `zip_file_set_encryption()`, `zip_fopen_encrypted()`, and `zip_set_default_password()`.
|
||||
|
||||
|
||||
# 1.7.3 [2020-07-15]
|
||||
|
||||
* Support cmake < 3.17 again.
|
||||
* Fix pkgconfig file (regression in 1.7.2).
|
||||
|
||||
|
||||
# 1.7.2 [2020-07-11]
|
||||
|
||||
* Fixes for the CMake `find_project()` files.
|
||||
* libzip moved to the CMake `libzip::` `NAMESPACE`.
|
||||
* CMake usage best practice cleanups.
|
||||
|
||||
|
||||
# 1.7.1 [2020-06-13]
|
||||
|
||||
* Restore `LIBZIP_VERSION_{MAJOR,MINOR,MICRO}` symbols.
|
||||
* Fixes warnings reported by PVS-Studio.
|
||||
* Add `LIBZIP_DO_INSTALL` build setting to make it easier to use
|
||||
libzip as subproject.
|
||||
|
||||
|
||||
# 1.7.0 [2020-06-05]
|
||||
|
||||
* Add support for encrypting using traditional PKWare encryption.
|
||||
* Add `zip_compression_method_supported()`.
|
||||
* Add `zip_encryption_method_supported()`.
|
||||
* Add the `ZIP_SOURCE_GET_FILE_ATTRIBUTES` source command.
|
||||
* Refactor stdio file backend.
|
||||
* Add CMake find_project() support.
|
||||
|
||||
|
||||
# 1.6.1 [2020-02-03]
|
||||
|
||||
* Bugfix for double-free in `zipcmp(1)` during cleanup.
|
||||
|
||||
|
||||
# 1.6.0 [2020-01-24]
|
||||
|
||||
* Avoid using `umask()` since it's not thread-safe.
|
||||
* Set close-on-exec flag when opening files.
|
||||
* Do not accept empty files as valid zip archives any longer.
|
||||
* Add support for XZ compressed files (using liblzma).
|
||||
* Add support for cancelling while closing zip archives.
|
||||
* Add support for setting the time in the on-disk format.
|
||||
|
||||
|
||||
# 1.5.2 [2019-03-12]
|
||||
|
||||
* Fix bug in AES encryption affecting certain file sizes
|
||||
* Keep file permissions when modifying zip archives
|
||||
* Support systems with small stack size.
|
||||
* Support mbed TLS as crypto backend.
|
||||
* Add nullability annotations.
|
||||
|
||||
|
||||
# 1.5.1 [2018-04-11]
|
||||
|
||||
* Choose format of installed documentation based on available tools.
|
||||
* Fix visibility of symbols.
|
||||
* Fix zipcmp directory support.
|
||||
* Don't set RPATH on Linux.
|
||||
* Use Libs.private for link dependencies in pkg-config file.
|
||||
* Fix build with LibreSSL.
|
||||
* Various bugfixes.
|
||||
|
||||
|
||||
# 1.5.0 [2018-03-11]
|
||||
|
||||
* Use standard cryptographic library instead of custom AES implementation.
|
||||
This also simplifies the license.
|
||||
* Use `clang-format` to format the source code.
|
||||
* More Windows improvements.
|
||||
|
||||
|
||||
# 1.4.0 [2017-12-29]
|
||||
|
||||
* Improve build with cmake
|
||||
* Retire autoconf/automake build system
|
||||
* Add `zip_source_buffer_fragment()`.
|
||||
* Add support to clone unchanged beginning of archive (instead of rewriting it).
|
||||
Supported for buffer sources and on Apple File System.
|
||||
* Add support for Microsoft Universal Windows Platform.
|
||||
|
||||
|
||||
# 1.3.2 [2017-11-20]
|
||||
|
||||
* Fix bug introduced in last: zip_t was erroneously freed if zip_close() failed.
|
||||
|
||||
|
||||
# 1.3.1 [2017-11-19]
|
||||
|
||||
* Install zipconf.h into ${PREFIX}/include
|
||||
* Add zip_libzip_version()
|
||||
* Fix AES tests on Linux
|
||||
|
||||
|
||||
# 1.3.0 [2017-09-02]
|
||||
|
||||
* Support bzip2 compressed zip archives
|
||||
* Improve file progress callback code
|
||||
* Fix zip_fdopen()
|
||||
* CVE-2017-12858: Fix double free()
|
||||
* CVE-2017-14107: Improve EOCD64 parsing
|
||||
|
||||
|
||||
# 1.2.0 [2017-02-19]
|
||||
|
||||
* Support for AES encryption (Winzip version), both encryption
|
||||
and decryption
|
||||
* Support legacy zip files with >64k entries
|
||||
* Fix seeking in zip_source_file if start > 0
|
||||
* Add zip_fseek() for seeking in uncompressed data
|
||||
* Add zip_ftell() for telling position in uncompressed data
|
||||
* Add zip_register_progress_callback() for UI updates during zip_close()
|
||||
|
||||
|
||||
# 1.1.3 [2016-05-28]
|
||||
|
||||
* Fix build on Windows when using autoconf
|
||||
|
||||
|
||||
# 1.1.2 [2016-02-19]
|
||||
|
||||
* Improve support for 3MF files
|
||||
|
||||
|
||||
# 1.1.1 [2016-02-07]
|
||||
|
||||
* Build fixes for Linux
|
||||
* Fix some warnings reported by PVS-Studio
|
||||
|
||||
|
||||
# 1.1 [2016-01-26]
|
||||
|
||||
* ziptool(1): command line tool to modify zip archives
|
||||
* Speedups for archives with many entries
|
||||
* Coverity fixes
|
||||
* Better APK support
|
||||
* Support for running tests on Windows
|
||||
* More build fixes for Windows
|
||||
* Portability fixes
|
||||
* Documentation improvements
|
||||
|
||||
|
||||
# 1.0.1 [2015-05-04]
|
||||
|
||||
* Build fixes for Windows
|
||||
|
||||
|
||||
# 1.0 [2015-05-03]
|
||||
|
||||
* Implemented an I/O abstraction layer
|
||||
* Added support for native Windows API for files
|
||||
* Added support for setting the last modification time for a file
|
||||
* Added a new type zip_error_t for errors
|
||||
* Added more typedefs for structs
|
||||
* Torrentzip support was removed
|
||||
* CVE-2015-2331 was fixed
|
||||
* Addressed all Coverity CIDs
|
||||
|
||||
|
||||
# 0.11.2 [2013-12-19]
|
||||
|
||||
* Support querying/setting operating system and external attributes
|
||||
* For newly added files, set operating system to UNIX, permissions
|
||||
to 0666 (0777 for directories)
|
||||
* Fix bug when writing zip archives containing files bigger than 4GB
|
||||
|
||||
|
||||
# 0.11.1 [2013-04-27]
|
||||
|
||||
* Fix bugs in zip_set_file_compression()
|
||||
* Include Xcode build infrastructure
|
||||
|
||||
|
||||
# 0.11 [2013-03-23]
|
||||
|
||||
* Added Zip64 support (large file support)
|
||||
* Added UTF-8 support for file names, file comments, and archive comments
|
||||
* Changed API for name and comment related functions for UTF-8 support
|
||||
* Added zip_discard()
|
||||
* Added ZIP_TRUNCATE for zip_open()
|
||||
* Added zip_set_file_compression()
|
||||
* Added API for accessing and modifying extra fields
|
||||
* Improved API type consistency
|
||||
* Use gcc4's visibility __attribute__
|
||||
* More changes for Windows support
|
||||
* Additional test cases
|
||||
|
||||
|
||||
# 0.10.1 [2012-03-20]
|
||||
|
||||
* Fixed CVE-2012-1162
|
||||
* Fixed CVE-2012-1163
|
||||
|
||||
|
||||
# 0.10 [2010-03-18]
|
||||
|
||||
* Added zip_get_num_entries(), deprecated zip_get_num_files()
|
||||
* Better windows support
|
||||
* Support for traditional PKWARE encryption added
|
||||
* Fix opening archives with more than 65535 entries
|
||||
* Fix some memory leaks
|
||||
* Fix cmake build and installation
|
||||
* Fix memory leak in error case in zip_open()
|
||||
* Fixed CVE-2011-0421 (no security implications though)
|
||||
* More documentation
|
||||
|
||||
|
||||
# 0.9.3 [2010-02-01]
|
||||
|
||||
* Include m4/ directory in distribution; some packagers need it
|
||||
|
||||
|
||||
# 0.9.2 [2010-01-31]
|
||||
|
||||
* Avoid passing uninitialized data to deflate()
|
||||
* Fix memory leak when closing zip archives
|
||||
|
||||
|
||||
# 0.9.1 [2010-01-24]
|
||||
|
||||
* Fix infinite loop on reading some broken files
|
||||
* Optimization in time conversion (don't call localtime())
|
||||
* Clear data descriptor flag in central directory, fixing Open Office files
|
||||
* Allow more than 64k entries
|
||||
|
||||
|
||||
# 0.9 [2008-07-25]
|
||||
|
||||
* on Windows, explicitly set dllimport/dllexport
|
||||
* remove erroneous references to GPL
|
||||
* add support for torrentzip
|
||||
* new functions: zip_get_archive_flag, zip_set_archive_flag
|
||||
* zip_source_zip: add flag to force recompression
|
||||
* zip_sorce_file: only keep file open while reading from it
|
||||
|
||||
|
||||
# 0.8 [2007-06-06]
|
||||
|
||||
* fix for zip archives larger than 2GiB
|
||||
* fix zip_error_strerror to include libzip error string
|
||||
* add support for reading streamed zip files
|
||||
* new functions: zip_add_dir, zip_error_clear, zip_file_error_clear
|
||||
* add basic support for building with CMake (incomplete)
|
||||
|
||||
|
||||
# 0.7.1 [2006-05-18]
|
||||
|
||||
* bugfix for zip_close
|
||||
|
||||
|
||||
# 0.7 [2006-05-06]
|
||||
|
||||
* struct zip_stat increased for future encryption support
|
||||
* zip_add return value changed (now returns new index of added file)
|
||||
* shared library major bump because of previous two
|
||||
* added functions for reading and writing file and archive comments
|
||||
New functions: zip_get_archive_comment, zip_get_file_comment,
|
||||
zip_set_archive_comment, zip_set_file_comment, zip_unchange_archive
|
||||
|
||||
|
||||
# 0.6.1 [2005-07-14]
|
||||
|
||||
* various bug fixes
|
||||
|
||||
|
||||
# 0.6 [2005-06-09]
|
||||
|
||||
* first standalone release
|
||||
* changed license to three-clause BSD
|
||||
* overhauled API
|
||||
* added man pages
|
||||
* install zipcmp and zipmerge
|
||||
35
thirdparty/libzip-1.11.3/README.md
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
This is libzip, a C library for reading, creating, and modifying
|
||||
zip and zip64 archives. Files can be added from data buffers, files,
|
||||
or compressed data copied directly from other zip archives. Changes
|
||||
made without closing the archive can be reverted. Decryption and
|
||||
encryption of Winzip AES and legacy PKware encrypted files is
|
||||
supported.
|
||||
|
||||
libzip is fully documented via man pages. HTML versions of the man
|
||||
pages are on [libzip.org](https://libzip.org/documentation/) and
|
||||
in the [man](man) directory. You can start with
|
||||
[libzip(3)](https://libzip.org/documentation/libzip.html), which
|
||||
lists
|
||||
all others. Example source code is in the [examples](examples) and
|
||||
[src](src) subdirectories.
|
||||
|
||||
See the [INSTALL.md](INSTALL.md) file for installation instructions and
|
||||
dependencies.
|
||||
|
||||
If you have developed an application using libzip, you can find out
|
||||
about API changes and how to adapt your code for them in the included
|
||||
file [API-CHANGES.md](API-CHANGES.md).
|
||||
|
||||
If you make a binary distribution, please include a pointer to the
|
||||
distribution site:
|
||||
> https://libzip.org/
|
||||
|
||||
The latest version can always be found there. The official repository
|
||||
is at [github](https://github.com/nih-at/libzip/).
|
||||
|
||||
If you want to reach the authors in private, use <info@libzip.org>.
|
||||
|
||||
[](https://github.com/nih-at/libzip/actions?query=workflow%3Abuild)
|
||||
[](https://ci.appveyor.com/project/nih-at/libzip)
|
||||
[](https://scan.coverity.com/projects/libzip)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libzip)
|
||||
13
thirdparty/libzip-1.11.3/SECURITY.md
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We are not maintaining multiple branches, so all fixes will be committed to head and included in the next release.
|
||||
|
||||
We take great care to maintain backwards compatibility, so we expect our users to use the latest version.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
You can reach us per email at info@libzip.org.
|
||||
|
||||
For less sensitive reports, you can also open an issue or pull request on GitHub.
|
||||
173
thirdparty/libzip-1.11.3/THANKS
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
Thanks to Info-ZIP for info on the DOS-time/date conversion code,
|
||||
and some other general information gathered from their sources.
|
||||
|
||||
Thanks to these people for suggestions, testing, and bug reports:
|
||||
|
||||
ag2s20150909
|
||||
Agostino Sarubbo
|
||||
Alberto Spin
|
||||
Alexander Galanin <al@galanin.nnov.ru>
|
||||
Alexandr Shadchin <alexandr.shadchin@gmail.com>
|
||||
Alexey Bykov <gnfalex@rambler.ru>
|
||||
Andreas Deininger <andreas@deininger.net>
|
||||
Andreas Falkenhahn <andreas@falkenhahn.com>
|
||||
Andrew Brampton <brampton@gmail.com>
|
||||
Andrew Molyneux <andrew@molyneuxfamily.co.uk>
|
||||
Ankur Kothari <ankz.kothari@gmail.com>
|
||||
Antonin Décimo <antonin.decimo@gmail.com>
|
||||
Arseniy Terekhin <senyai@gmail.com>
|
||||
BALATON Zoltan <balaton@eik.bme.hu>
|
||||
Benjamin Gilbert <bgilbert@backtick.net>
|
||||
Beuc <beuc@beuc.net>
|
||||
Boaz Stolk <bstolk@aweta.nl>
|
||||
Bogdan <bogiebog@gmail.com>
|
||||
Brian 'geeknik' Carpenter <geeknik@protonmail.ch>
|
||||
BruceFan <fanrong_1992@163.com>
|
||||
Carl Mastrangelo <notcarl@google.com>
|
||||
Cédric Tabin
|
||||
celan69
|
||||
chaoticgd
|
||||
Charlie Li <git@vishwin.info>
|
||||
ChrisAm1224
|
||||
Chris Nehren <cnehren+libzip@pobox.com>
|
||||
Christoph Cullmann <cullmann@kde.org>
|
||||
Christoph M. Becker <cmbecker69@gmx.de>
|
||||
Corentin Schreiber
|
||||
Coverity <info@coverity.com>
|
||||
cryi <cryi@tutanota.com>
|
||||
ctenter-scs
|
||||
Dane Springmeyer <dane.springmeyer@gmail.com>
|
||||
Daniel Russel <drussel@gmail.com>
|
||||
Ларионов Даниил <scumcoder@yandex.ru>
|
||||
David Demelier <demelier.david@gmail.com>
|
||||
Dean Ellis <dellis1972@googlemail.com>
|
||||
Declan Moran
|
||||
Del Merritt <del@alum.mit.edu>
|
||||
Devin Davila <daviladsoftware@gmail.com>
|
||||
Dmytro Rybachenko <atmoliton@gmail.com>
|
||||
Dylan T. <dktapps@pmmp.io>
|
||||
Eelco Dolstra
|
||||
Elvis Angelaccio
|
||||
Erin Melucci <emelucci@opera.com>
|
||||
Erwin Haid <erwin.haid@gmx.de>
|
||||
Eun-cheol Joo
|
||||
Fabrice Fontaine
|
||||
Filip Niksic
|
||||
Florian Delizy <florian.delizy@gmail.com>
|
||||
Force Charlie <charlieio@outlook.com>
|
||||
François Simon <AT.GFI.Francois.SIMON@sesam-vitale.fr>
|
||||
Frederik Ramm <frederik@remote.org>
|
||||
Gabriela Gutierrez <gabigutierrez@google.com>
|
||||
Gerard ODonnell
|
||||
Giovanni
|
||||
gk7huki <gk7huki@gmail.com>
|
||||
Hanno Böck <hanno@hboeck.de>
|
||||
HeeMyung
|
||||
Heiko Becker
|
||||
Heiko Hund <heiko@ist.eigentlich.net>
|
||||
hongjunwang
|
||||
Ilya Voronin
|
||||
Info-ZIP group
|
||||
Ivan Kolesnikov <kiv.apple@gmail.com>
|
||||
Jan Weiß <jan@geheimwerk.de>
|
||||
Jay Freeman (saurik) <saurik@saurik.com>
|
||||
jloqfjgk@github
|
||||
Joachim Reichel <joachim.reichel@gmx.de>
|
||||
João Custódio <joao_custodio@symantec.com>
|
||||
Joel Ebrahimi <joel.ebrahimi@gmail.com>
|
||||
Jono Spiro <jono.spiro@gmail.com>
|
||||
Julien Matthey <julien@turtlespeak.net>
|
||||
Julien Schueller <schueller@phimeca.com>
|
||||
Justin Cohen <justincohen@google.com>
|
||||
kensington <kensington@gentoo.org>
|
||||
Kei Takahashi <ktakahashi@minitab.com>
|
||||
Keith Jones <keith@keithjjones.com>
|
||||
Khaled Mardam-Bey
|
||||
Kohei Yoshida <kohei.yoshida@gmail.com>
|
||||
Krzesimir Nowak <qdlacz@gmail.com>
|
||||
Leith Bade <leith@mapbox.com>
|
||||
Lubomir I. Ivanov <neolit123@gmail.com>
|
||||
Lucas Bustamante
|
||||
Ludovic LANGE
|
||||
M. Reiningħaus
|
||||
Maël Nison
|
||||
Manuel Massing <m.massing@virtualities.de>
|
||||
Marcin Kowalczyk <QrczakMK@gmail.com>
|
||||
Mark A. Tsuchida <marktsuchida@gmail.com>
|
||||
Martin Buchholz <martinrb@google.com>
|
||||
Martin Herkt <lachs0r@srsfckn.biz>
|
||||
Martin Szulecki <m.szulecki@libimobiledevice.org>
|
||||
Michael Balzer
|
||||
Michael Beck <mm.beck@gmx.net>
|
||||
Michael Heimpold <mhei@heimpold.de>
|
||||
Michał Janiszewski <janisozaur+libzip@gmail.com>
|
||||
Michal Vyskocil <mvyskocil@suse.cz>
|
||||
Mikhail Gusarov <dottedmag@dottedmag.net>.
|
||||
Miklos Vajna
|
||||
Morris Hafner
|
||||
Muhammad Arslan Kabeer
|
||||
Mykyta Mudryi <Nikita.Mudryi@leviathansecurity.com>
|
||||
nieder <nieder@users.sourceforge.net>
|
||||
Oliver Kaiser <under.northern.sky@googlemail.com>
|
||||
Oliver Kuckertz <oliver.kuckertz@mologie.de>
|
||||
OSS-Fuzz Team
|
||||
Ørjan Malde <red@foxi.me>
|
||||
Pascal Terjan <pterjan@gmail.com>
|
||||
Patrick Spendrin <ps_ml@gmx.de>
|
||||
Paul Harris <harris.pc@gmail.com>
|
||||
Paul Sheppard <shepsoft@googlemail.com>
|
||||
Pavel Raiskup <praiskup@redhat.com>
|
||||
Pierre Joye <pierre.php@gmail.com>
|
||||
Pierre Wendling <pierre.wendling.4@gmail.com>
|
||||
Pierre-Louis Cabelguen <plcabelguen@googlemail.com>
|
||||
PW Hu <jlu.hpw@foxmail.com>
|
||||
Rafał Mikrut
|
||||
ralfjunker
|
||||
Randy <randy408@protonmail.com>
|
||||
Remi Collet <remi@fedoraproject.org>
|
||||
rezso <rezso@rezso.net>
|
||||
Richard Schütz
|
||||
Rick Carback <carback1@umbc.edu>
|
||||
Rikard Falkeborn <rikard.falkeborn@gmail.com>
|
||||
Robert Norris <rw_norris@hotmail.com>
|
||||
Roberto Tirabassi <rtirabassi@3di.it>
|
||||
robhz786 <robhz786@gmail.com>
|
||||
Roland Ortloff <Ortloff.R@gmx.de>
|
||||
Rosen Penev <rosenp@gmail.com>
|
||||
Rudi Heitbaum
|
||||
Ryan Burns <rtburns@protonmail.com>
|
||||
Sam James
|
||||
Sam Sappenfield
|
||||
Sandro Mani <manisandro@gmail.com>
|
||||
scribam
|
||||
Sebastian Kemper <sebastian_ml@gmx.net>
|
||||
Sebastian Schmitt <sebastian.schmitt@auvesy.de>
|
||||
Sergei Ozerov <ru.programmist@gmail.com>
|
||||
shenlebantongying
|
||||
Shimi
|
||||
Simon Talbot <simont@nse.co.uk>
|
||||
SpaceIm
|
||||
Stephen Bryant <steve@bawue.de>
|
||||
sxkan
|
||||
Tabata Shintaro <tabata.shintaro@gmail.com>
|
||||
takase1121
|
||||
Tarmo Pikaro <tapika@yahoo.com>
|
||||
Taylor C. Richberger
|
||||
TC
|
||||
Thomas Debesse <dev@illwieckz.net>
|
||||
Tim Lunn <Tim@feathertop.org>
|
||||
Timo Warns <warns@pre-sense.de>
|
||||
Timofey
|
||||
Tom Callaway <tcallawa@redhat.com>
|
||||
Tomas Hoger <thoger@redhat.com>
|
||||
Tomáš Malý <malytomas@ucpu.cz>
|
||||
Torsten Paul <Torsten.Paul@gmx.de>
|
||||
Transporter <ogre.transporter@gmail.com>
|
||||
Vassili Courzakis <vcoxvco@googlemail.com>
|
||||
Vinpasso
|
||||
Vitaly Murashev <vitaly.murashev@gmail.com>
|
||||
William Lee
|
||||
William Ouwehand <mail@syncoda.nl>
|
||||
Wojciech Michalski <wmichalski@quay.pl>
|
||||
Wolfgang Glunz <Wolfgang.Glunz@gmx.de>
|
||||
Yufan You
|
||||
189
thirdparty/libzip-1.11.3/TODO.md
vendored
Normal file
@ -0,0 +1,189 @@
|
||||
## Fuzzing
|
||||
|
||||
- improve AES and PKWARE encryption tests
|
||||
- add more
|
||||
- review memset() uses
|
||||
|
||||
### Torrentzip
|
||||
|
||||
- Handle data sources with unknown uncompressed size: if we forced ZIP64 and don't need it, return specific error (so calling code can decide what to do (e. g. clear torrentzip flag and call `zip_close()` again)).
|
||||
|
||||
## Other
|
||||
|
||||
- split `zip_source_t` in main part and reference so we can keep track which reference called open and we can invalidate references if the underlying source gets invalidated (e. g. by `zip_close`).
|
||||
|
||||
## Prefixes
|
||||
|
||||
For example for adding extractors for self-extracting zip archives.
|
||||
````c
|
||||
zip_set_archive_prefix(struct zip *za, const zip_uint8_t *data, zip_uint64_t length);
|
||||
const zip_uint8_t *zip_get_archive_prefix(struct zip *za, zip_uint64_t *lengthp);
|
||||
````
|
||||
|
||||
## Compression
|
||||
|
||||
* add lzma2 support
|
||||
* add deflate64 support (https://github.com/madler/zlib/blob/master/contrib/infback9/infback9.h)
|
||||
|
||||
## API Issues
|
||||
|
||||
* Add `zip_file_use_password` to set per-file password to use if libzip needs to decrypt the file (e.g. when changing encryption or compression method).
|
||||
|
||||
* `zip_get_archive_comment` has `int *lenp` argument. Cleaner would be `zip_uint32_t *`.
|
||||
rename and fix. which other functions for naming consistency?
|
||||
* rename remaining `zip_XXX_{file,archive}_*` to `zip_{file,archive}_XXX_*`?
|
||||
* compression/crypt implementations: how to set error code on failure
|
||||
* compression/crypt error messages a la `ZIP_ER_ZLIB` (no detailed info passing)
|
||||
|
||||
## Features
|
||||
|
||||
* consistently use `_zip_crypto_clear()` for passwords
|
||||
* support setting extra fields from `zip_source`
|
||||
* introduce layers of extra fields:
|
||||
* original
|
||||
* from `zip_source`
|
||||
* manually set
|
||||
* when querying extra fields, search all of them in reverse order
|
||||
* add whiteout (deleted) flag
|
||||
* allow invalid data flag, used when computing extra field size before writing data
|
||||
* new command `ZIP_SOURCE_EXTRA_FIELDS`
|
||||
* no support for multiple copies of same extra field
|
||||
* function to copy file from one archive to another
|
||||
* set `O_CLOEXEC` flag after fopen and mkstemp
|
||||
* support streaming output (creating new archive to e.g. stdout)
|
||||
* add function to read/set ASCII file flag
|
||||
* `zip_commit()` (to finish changes without closing archive)
|
||||
* add custom compression function support
|
||||
* `zip_source_zip()`: allow rewinding
|
||||
* `zipcmp`: add option for file content comparison
|
||||
* `zipcmp`: add more paranoid checks:
|
||||
* external attributes/opsys
|
||||
* version needed/made by
|
||||
* general purpose bit flags
|
||||
* add more consistency checks:
|
||||
* for stored files, test compressed = uncompressed
|
||||
* data descriptor
|
||||
* local headers come before central dir
|
||||
* support for old compression methods?
|
||||
|
||||
## Bugs
|
||||
|
||||
* ensure that nentries is small enough not to cause overflow (size_t for entry, uint64 for CD on disk)
|
||||
* check for limits imposed by format (central dir size, file size, extra fields, ...)
|
||||
* `_zip_u2d_time()`: handle `localtime(3)` failure
|
||||
* POSIX: `zip_open()`: check whether file can be created and fail if not
|
||||
* fix inconsistent usage of valid flags (not checked in many places)
|
||||
* `cdr == NULL` -> `ER_NOENT` vs. `idx > cdir->nentry` -> `ER_INVAL` inconsistent (still there?)
|
||||
|
||||
## Cleanup
|
||||
|
||||
* go over cdir parser and rename various offset/size variables to make it clearer
|
||||
* use bool
|
||||
* use `ZIP_SOURCE_SUPPORTS_{READABLE,SEEKABLE,WRITABLE}`
|
||||
* use `zip_source_seek_compute_offset()`
|
||||
* get rid of `zip_get_encryption_implementation()`
|
||||
* use `zip_*int*_t` internally
|
||||
* `zip_source_file()`: don't allow write if start/len specify a part of the file
|
||||
|
||||
## Documentation
|
||||
|
||||
* document valid file paths
|
||||
* document: `zip_source_write()`: length can't be > `ZIP_INT64_MAX`
|
||||
* document: `ZIP_SOURCE_CLOSE` implementation can't return error
|
||||
* keep error codes in man pages in sync
|
||||
* document error codes in new man pages
|
||||
|
||||
## Infrastructure
|
||||
|
||||
* add coverage reports, e.g. using gcovr or https://github.com/eddyxu/cpp-coveralls (coveralls.io)
|
||||
* review guidelines/community standards
|
||||
- [Linux Foundation Core Infrastructure Initiative Best Practices](https://bestpractices.coreinfrastructure.org/)
|
||||
- [Readme Maturity Level](https://github.com/LappleApple/feedmereadmes/blob/master/README-maturity-model.md)
|
||||
- [Github Community Profile](https://github.com/nih-at/libzip/community)
|
||||
* test different crypto backends with GitHub actions.
|
||||
* improve man page formatting of tagged lists on webpage (`<dl>`)
|
||||
* rewrite `make_zip_errors.sh` in cmake
|
||||
* script to check if all exported symbols are marked with `ZIP_EXTERN`, add to `make distcheck`
|
||||
|
||||
## macOS / iOS framework
|
||||
|
||||
* get cmake to optionally build frameworks
|
||||
|
||||
## Test Case Issues
|
||||
|
||||
* add test cases for all `ZIP_INCONS` detail errors
|
||||
* `incons-local-filename-short.zzip` doesn't test short filename, since extra fields fail to parse.
|
||||
* test error cases with special source
|
||||
- tell it which command should fail
|
||||
- use it both as source for `zip_add` and `zip_open_from_source`
|
||||
- `ziptool_regress`:
|
||||
- `-e error_spec`: source containing zip fails depending on `error_spec`
|
||||
- `add_with_error name content error_spec`: add content to archive, where source fails depending on `error_spec`
|
||||
- `add_file_with_error name file_to_add offset len error_spec`: add file to archive, len bytes starting from offset, where source fails depending on `error_spec`
|
||||
- `error_spec`:
|
||||
- source command that fails
|
||||
- error code that source returns
|
||||
- conditions that must be met for error to trigger
|
||||
- Nth call of command
|
||||
- read/write: total byte count so far
|
||||
- state of source (opened, EOF reached, ...)
|
||||
* test for zipcmp reading directory (requires fts)
|
||||
* add test case for clone with files > 4k
|
||||
* consider testing for `malloc`/`realloc` failures
|
||||
* Winzip AES support
|
||||
* test cases decryption: <=20, >20, stat for both
|
||||
* test cases encryption: no password, default password, file-specific password, 128/192/256, <=20, >20
|
||||
* support testing on macOS
|
||||
* add test cases for lots of files (including too many)
|
||||
* add test cases for holes (between files, between files and cdir, between cdir and eocd, + zip64 where appropriate)
|
||||
* test seek in `zip_source_crc_create()`
|
||||
* test cases for `set_extra*`, `delete_extra*`, `*extra_field*`
|
||||
* test cases for in memory archives
|
||||
* add
|
||||
* delete
|
||||
* delete all
|
||||
* modify
|
||||
* use gcov output to increase test coverage
|
||||
* add test case to change values for newly added files (name, compression method, comment, mtime, . . .)
|
||||
* `zip_open()` file less than `EOCDLEN` bytes long
|
||||
* test calls against old API
|
||||
* rename file to dir/ and vice versa (fails)
|
||||
* fix comment test to be newline insensitive
|
||||
* check if http://bugs.python.org/issue20078 provides ideas for new tests
|
||||
|
||||
* (`add`, `replace`)
|
||||
* add to empty zip
|
||||
* add to existing zip
|
||||
* add w/ existing file name [E]
|
||||
* replace ok
|
||||
* replace w/ illegal index [E]
|
||||
* replace w/ deleted name [E]
|
||||
* unchange added/replaced file
|
||||
* (`close`)
|
||||
* copy zip file
|
||||
* open copy
|
||||
* rename, delete, replace, add w/ new name, add w/ deleted name
|
||||
* close
|
||||
* zipcmp copy expected
|
||||
* remove copy
|
||||
* (`error_get`)
|
||||
* (`error_get_sys_type`)
|
||||
* (`error_to_str`)
|
||||
* (`extra_fields`)
|
||||
* (`file_error_get`)
|
||||
* (`file_strerror`)
|
||||
* (`replace`)
|
||||
* (`source_buffer`)
|
||||
* (`source_file`)
|
||||
* (`source_filep`)
|
||||
* (`source_free`)
|
||||
* (`source_function`)
|
||||
* (`source_zip`)
|
||||
* (`strerror`)
|
||||
* (`unchange`)
|
||||
* (`unchange_all`)
|
||||
* `open(ZIP_RDONLY)`
|
||||
* I/O abstraction layer
|
||||
* `zip_open_from_source`
|
||||
* read two zip entries interleaved
|
||||
* test `zip_file_is_seekable` (via `ziptool`?)
|
||||
63
thirdparty/libzip-1.11.3/android/do.sh
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
# Author: Declan Moran
|
||||
# www.silverglint.com
|
||||
# Thanks to damaex (https://github.com/damaex), for significant contributions
|
||||
|
||||
ANDROID_NDK_ROOT=/home/android/android-ndk-r19c
|
||||
|
||||
INSTALL_DIR=install
|
||||
BUILD_DIR=build
|
||||
START_DIR=$(pwd)
|
||||
|
||||
rm -rf $INSTALL_DIR
|
||||
rm -rf $BUILD_DIR
|
||||
mkdir -p $BUILD_DIR #"${ANDROID_TARGET_PLATFORM}"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
build_it()
|
||||
{
|
||||
# builds either a static or shared lib depending on parm passed (ON or OFF)
|
||||
want_shared=$1
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$(pwd)/../../${INSTALL_DIR}/${ANDROID_TARGET_PLATFORM} \
|
||||
-DANDROID_ABI=${ANDROID_TARGET_PLATFORM} \
|
||||
-DENABLE_OPENSSL:BOOL=OFF \
|
||||
-DENABLE_COMMONCRYPTO:BOOL=OFF \
|
||||
-DENABLE_GNUTLS:BOOL=OFF \
|
||||
-DENABLE_MBEDTLS:BOOL=OFF \
|
||||
-DENABLE_OPENSSL:BOOL=OFF \
|
||||
-DENABLE_WINDOWS_CRYPTO:BOOL=OFF \
|
||||
-DBUILD_TOOLS:BOOL=OFF \
|
||||
-DBUILD_REGRESS:BOOL=OFF \
|
||||
-DBUILD_EXAMPLES:BOOL=OFF \
|
||||
-DBUILD_SHARED_LIBS:BOOL=$want_shared \
|
||||
-DBUILD_DOC:BOOL=OFF \
|
||||
-DANDROID_TOOLCHAIN=clang cmake -H.. -B$BUILD_DIR/${ANDROID_TARGET_PLATFORM}
|
||||
|
||||
#run make with all system threads and install
|
||||
cd $BUILD_DIR/${ANDROID_TARGET_PLATFORM}
|
||||
make install -j$(nproc --all)
|
||||
cd $START_DIR
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
for ANDROID_TARGET_PLATFORM in armeabi-v7a arm64-v8a x86 x86_64
|
||||
do
|
||||
echo "Building libzip for ${ANDROID_TARGET_PLATFORM}"
|
||||
|
||||
build_it ON
|
||||
build_it OFF
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error executing: cmake"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error executing make install for platform: ${ANDROID_TARGET_PLATFORM}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
done
|
||||
122
thirdparty/libzip-1.11.3/android/docker/Dockerfile
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
# Version: 1.0
|
||||
|
||||
# Dockerfile for building libzip for android
|
||||
# https://github.com/dec1/libzip.git
|
||||
# creates docker container with all tools, libraries and sources required to build libzip for android.
|
||||
|
||||
# Author: Declan Moran
|
||||
# www.silverglint.com
|
||||
|
||||
|
||||
# Usage:
|
||||
#---------
|
||||
# download the libzip repository
|
||||
# > git clone https://github.com/dec1/libzip.git
|
||||
# > cd libzip
|
||||
#
|
||||
# build docker image "my_img_zip" from the dockerfile in "docker" dir
|
||||
# > docker build -t my_img_zip ./android/docker
|
||||
#
|
||||
# run docker container "my_ctr_zip" from this image, mounting the current dir. (Need to pass absolute host paths to mount volume- hence "pwd")
|
||||
# > docker run -v $(pwd):/home/docker-share/libzip -it --entrypoint=/bin/bash --name my_ctr_zip my_img_zip
|
||||
#
|
||||
# Now inside docker container
|
||||
# $ cd /home/docker-share/libzip/android
|
||||
#
|
||||
# Modify ./do.sh (on host), to match the boost and android ndk versions/paths in the "Configure here" section below
|
||||
# Build from running docker container.
|
||||
# $./do.sh
|
||||
#
|
||||
# "./build" dir contains required build, but owned by root. chown to your username/group
|
||||
# > sudo chown -R <userid>:<groupid> ./build
|
||||
# > sudo chown -R <userid>:<groupid> ./install
|
||||
#
|
||||
# Exit container, when build is finished.
|
||||
# $ exit
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
FROM ubuntu:18.04
|
||||
|
||||
|
||||
## --------------------------------------------------------------------
|
||||
## Configure here
|
||||
# ---------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------
|
||||
# Here you can speciofy exactly what android ndk (and sdk) version you want to use.
|
||||
|
||||
|
||||
|
||||
# (2) Android SDK
|
||||
# https://developer.android.com/studio#downloads
|
||||
ARG SDK_URL_BASE=https://dl.google.com/android/repository
|
||||
ARG SDK_FILE=sdk-tools-linux-4333796.zip
|
||||
|
||||
# the sdk platform to use
|
||||
# https://developer.android.com/guide/topics/manifest/uses-sdk-element
|
||||
ARG ANDROID_SDK_PLATFORM_VERS="platforms;android-28"
|
||||
|
||||
|
||||
|
||||
# (3) Android NDK
|
||||
# https://developer.android.com/ndk/downloads
|
||||
ARG NDK_URL_BASE=https://dl.google.com/android/repository
|
||||
ARG NDK_FILE=android-ndk-r19c-linux-x86_64.zip
|
||||
# ---------------------------------------------------------------------
|
||||
## --------------------------------------------------------------------
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get -y dist-upgrade
|
||||
|
||||
|
||||
# for downloading archives
|
||||
RUN apt-get -y install wget
|
||||
|
||||
# for unzipping downloaded android archives
|
||||
RUN apt-get -y install zip
|
||||
RUN apt-get -y install cmake
|
||||
|
||||
RUN apt-get -y install lib32z1
|
||||
|
||||
|
||||
# need this this to install some (32 bit) prerequisites for android builds
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update
|
||||
RUN apt-get -y dist-upgrade
|
||||
RUN apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 libbz2-1.0:i386
|
||||
|
||||
|
||||
# need c compiler to set up create boost build system (before building boost with it and android toolchain)
|
||||
RUN apt-get -y install build-essential
|
||||
RUN apt-get -y install libc6-dev-i386
|
||||
RUN apt-get -y install clang
|
||||
|
||||
RUN apt-get -y install openjdk-8-jdk
|
||||
#--------------------------------------
|
||||
|
||||
ARG ANDROID_HOME=/home/android
|
||||
WORKDIR ${ANDROID_HOME}
|
||||
|
||||
|
||||
# SDK
|
||||
# ----
|
||||
# download android sdk command line tools
|
||||
RUN wget ${SDK_URL_BASE}/$SDK_FILE
|
||||
RUN unzip $SDK_FILE
|
||||
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
|
||||
|
||||
|
||||
RUN yes | sdkmanager --licenses
|
||||
|
||||
RUN sdkmanager "platform-tools" $ANDROID_SDK_PLATFORM_VERS
|
||||
#RUN sdkmanager "platform-tools" "platforms;android-28"
|
||||
|
||||
|
||||
# NDK
|
||||
# ----
|
||||
RUN wget ${NDK_URL_BASE}/$NDK_FILE
|
||||
RUN unzip $NDK_FILE
|
||||
|
||||
13
thirdparty/libzip-1.11.3/android/readme.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
Cross compile libzip for android.
|
||||
--------------------------------
|
||||
Modify "do.sh" as appropriate if you need to specify a different ndk dir or wish to specify different build parameters
|
||||
|
||||
Prerequisites for the development machine - see docker/Dockerfile
|
||||
|
||||
You can either set you host machine up with these prerequisites or simply use docker (in which case you need not install anything on your host machine except docker itself).
|
||||
|
||||
See "Usage" in docker/Dockerfile for detailed instructions.
|
||||
|
||||
|
||||
Please note: The libzip development team does not use Android, so this script is provided as is, as we cannot properly maintain it. We will, however, gladly accept fixes and try to work with users to resolve any issues they may have.
|
||||
92
thirdparty/libzip-1.11.3/appveyor.yml
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
os:
|
||||
- Visual Studio 2019
|
||||
|
||||
environment:
|
||||
PATH: C:\Python311-x64\Scripts;C:\Python311-arm\Scripts;$(PATH)
|
||||
VCPKG_BINARY_SOURCES: clear;files,C:\vcpkg.cache,readwrite
|
||||
matrix:
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: x64
|
||||
TRIPLET: x64-windows
|
||||
CMAKE_OPTS: "-DBUILD_SHARED_LIBS=off"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: yes
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: x64
|
||||
TRIPLET: x64-uwp
|
||||
CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: no
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: Win32
|
||||
TRIPLET: x86-windows
|
||||
CMAKE_OPTS: "-DBUILD_SHARED_LIBS=off"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: yes
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: Win32
|
||||
TRIPLET: x86-uwp
|
||||
CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: no
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: ARM
|
||||
TRIPLET: arm-windows
|
||||
CMAKE_OPTS: "-DENABLE_OPENSSL=off"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: no
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: ARM
|
||||
TRIPLET: arm-uwp
|
||||
CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DENABLE_OPENSSL=off"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: no
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: ARM64
|
||||
TRIPLET: arm64-windows
|
||||
CMAKE_OPTS: "-DENABLE_OPENSSL=off"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: no
|
||||
TOXENV: py311
|
||||
- GENERATOR: "Visual Studio 16 2019"
|
||||
PLATFORM: ARM64
|
||||
TRIPLET: arm64-uwp
|
||||
CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DENABLE_OPENSSL=off"
|
||||
CMAKE_CONFIG: Release
|
||||
RUN_TESTS: no
|
||||
TOXENV: py311
|
||||
|
||||
before_build:
|
||||
cmd: >-
|
||||
py -m pip install nihtest
|
||||
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake .. -G "%GENERATOR%" -A "%PLATFORM%" %CMAKE_OPTS%
|
||||
|
||||
appveyor PushArtifact config.h
|
||||
|
||||
appveyor PushArtifact CMakeCache.txt
|
||||
|
||||
build_script:
|
||||
cmd: >-
|
||||
cmake --build . --config %CMAKE_CONFIG% --target INSTALL
|
||||
|
||||
cmake --build . --config %CMAKE_CONFIG%
|
||||
|
||||
test_script:
|
||||
cmd: >-
|
||||
set VERBOSE=yes
|
||||
|
||||
IF %RUN_TESTS%==yes ( ctest -C %CMAKE_CONFIG% --output-on-failure )
|
||||
|
||||
cache:
|
||||
- c:\vcpkg.cache -> vcpkg.json
|
||||
887
thirdparty/libzip-1.11.3/build-emcmake/CMakeCache.txt
vendored
Normal file
@ -0,0 +1,887 @@
|
||||
# This is the CMakeCache file.
|
||||
# For build in directory: /home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake
|
||||
# It was generated by CMake: /usr/bin/cmake
|
||||
# You can edit this file to change values found and used by cmake.
|
||||
# If you do not want to change any of the values, simply exit the editor.
|
||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
||||
# The syntax for the file is as follows:
|
||||
# KEY:TYPE=VALUE
|
||||
# KEY is the name of a variable in the cache.
|
||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
||||
# VALUE is the current value for the KEY.
|
||||
|
||||
########################
|
||||
# EXTERNAL cache entries
|
||||
########################
|
||||
|
||||
//Build documentation
|
||||
BUILD_DOC:BOOL=ON
|
||||
|
||||
//Build examples
|
||||
BUILD_EXAMPLES:BOOL=ON
|
||||
|
||||
//Build fuzzers for ossfuzz
|
||||
BUILD_OSSFUZZ:BOOL=ON
|
||||
|
||||
//Build regression tests
|
||||
BUILD_REGRESS:BOOL=ON
|
||||
|
||||
//Build shared libraries
|
||||
BUILD_SHARED_LIBS:BOOL=ON
|
||||
|
||||
//Build tools in the src directory (zipcmp, zipmerge, ziptool)
|
||||
BUILD_TOOLS:BOOL=ON
|
||||
|
||||
//Path to a file.
|
||||
BZIP2_INCLUDE_DIR:PATH=BZIP2_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
BZIP2_LIBRARY_DEBUG:FILEPATH=BZIP2_LIBRARY_DEBUG-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
BZIP2_LIBRARY_RELEASE:FILEPATH=BZIP2_LIBRARY_RELEASE-NOTFOUND
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
|
||||
|
||||
//Choose the type of build, options are: None Debug Release RelWithDebInfo
|
||||
// MinSizeRel ...
|
||||
CMAKE_BUILD_TYPE:STRING=
|
||||
|
||||
//Enable/Disable color output during build.
|
||||
CMAKE_COLOR_MAKEFILE:BOOL=ON
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_CROSSCOMPILING_EMULATOR:UNINITIALIZED=/home/romazan/Рабочий стол/emsdk/node/20.18.0_64bit/bin/node
|
||||
|
||||
//`clang-scan-deps` dependency scanner
|
||||
CMAKE_C_COMPILER_CLANG_SCAN_DEPS:FILEPATH=CMAKE_C_COMPILER_CLANG_SCAN_DEPS-NOTFOUND
|
||||
|
||||
//Flags used by the C compiler during all build types.
|
||||
CMAKE_C_FLAGS:STRING=
|
||||
|
||||
//Flags used by the C compiler during DEBUG builds.
|
||||
CMAKE_C_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the C compiler during MINSIZEREL builds.
|
||||
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELEASE builds.
|
||||
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELWITHDEBINFO builds.
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
|
||||
|
||||
//Flags used by the linker during all build types.
|
||||
CMAKE_EXE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during DEBUG builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during MINSIZEREL builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during RELEASE builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during RELWITHDEBINFO builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Enable/Disable output of compile commands during generation.
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=
|
||||
|
||||
//Value Computed by CMake.
|
||||
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/pkgRedirects
|
||||
|
||||
//User executables (bin)
|
||||
CMAKE_INSTALL_BINDIR:PATH=bin
|
||||
|
||||
//Read-only architecture-independent data (DATAROOTDIR)
|
||||
CMAKE_INSTALL_DATADIR:PATH=
|
||||
|
||||
//Read-only architecture-independent data root (share)
|
||||
CMAKE_INSTALL_DATAROOTDIR:PATH=share
|
||||
|
||||
//Documentation root (DATAROOTDIR/doc/PROJECT_NAME)
|
||||
CMAKE_INSTALL_DOCDIR:PATH=
|
||||
|
||||
//C header files (include)
|
||||
CMAKE_INSTALL_INCLUDEDIR:PATH=include
|
||||
|
||||
//Info documentation (DATAROOTDIR/info)
|
||||
CMAKE_INSTALL_INFODIR:PATH=
|
||||
|
||||
//Object code libraries (lib)
|
||||
CMAKE_INSTALL_LIBDIR:PATH=lib
|
||||
|
||||
//Program executables (libexec)
|
||||
CMAKE_INSTALL_LIBEXECDIR:PATH=libexec
|
||||
|
||||
//Locale-dependent data (DATAROOTDIR/locale)
|
||||
CMAKE_INSTALL_LOCALEDIR:PATH=
|
||||
|
||||
//Modifiable single-machine data (var)
|
||||
CMAKE_INSTALL_LOCALSTATEDIR:PATH=var
|
||||
|
||||
//Man documentation (DATAROOTDIR/man)
|
||||
CMAKE_INSTALL_MANDIR:PATH=
|
||||
|
||||
//C header files for non-gcc (/usr/include)
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR:PATH=/usr/include
|
||||
|
||||
//Install path prefix, prepended onto install directories.
|
||||
CMAKE_INSTALL_PREFIX:PATH=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake/install
|
||||
|
||||
//Run-time variable data (LOCALSTATEDIR/run)
|
||||
CMAKE_INSTALL_RUNSTATEDIR:PATH=
|
||||
|
||||
//System admin executables (sbin)
|
||||
CMAKE_INSTALL_SBINDIR:PATH=sbin
|
||||
|
||||
//Modifiable architecture-independent data (com)
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR:PATH=com
|
||||
|
||||
//Read-only single-machine data (etc)
|
||||
CMAKE_INSTALL_SYSCONFDIR:PATH=etc
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_LINKER:FILEPATH=/usr/bin/ld
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// all build types.
|
||||
CMAKE_MODULE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// DEBUG builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// MINSIZEREL builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELEASE builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELWITHDEBINFO builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_NAME:STATIC=libzip
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION:STATIC=1.11.3
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_MAJOR:STATIC=1
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_MINOR:STATIC=11
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_PATCH:STATIC=3
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_TWEAK:STATIC=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_READELF:FILEPATH=/usr/bin/readelf
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during all build types.
|
||||
CMAKE_SHARED_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//If set, runtime paths are not added when installing shared libraries,
|
||||
// but are added when building.
|
||||
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
|
||||
|
||||
//If set, runtime paths are not added when using shared libraries.
|
||||
CMAKE_SKIP_RPATH:BOOL=NO
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during all build types.
|
||||
CMAKE_STATIC_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_STRIP:FILEPATH=/usr/bin/strip
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND
|
||||
|
||||
//The CMake toolchain file
|
||||
CMAKE_TOOLCHAIN_FILE:FILEPATH=/home/romazan/Рабочий стол/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
||||
|
||||
//If this value is on, makefiles will be generated without the
|
||||
// .SILENT directive, and all commands will be echoed to the console
|
||||
// during the make. This is useful for debugging only. With Visual
|
||||
// Studio IDE projects all commands are done without /nologo.
|
||||
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
|
||||
|
||||
//Documentation format
|
||||
DOCUMENTATION_FORMAT:STRING=mdoc
|
||||
|
||||
//Force C/C++ compiler
|
||||
EMSCRIPTEN_FORCE_COMPILERS:BOOL=OFF
|
||||
|
||||
//If set, static library targets generate LLVM bitcode files (.bc).
|
||||
// If disabled (default), UNIX ar archives (.a) are generated.
|
||||
EMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES:BOOL=OFF
|
||||
|
||||
//Enable use of BZip2
|
||||
ENABLE_BZIP2:BOOL=ON
|
||||
|
||||
//Enable use of CommonCrypto
|
||||
ENABLE_COMMONCRYPTO:BOOL=ON
|
||||
|
||||
//Enable zip_fdopen, which is not allowed in Microsoft CRT secure
|
||||
// libraries
|
||||
ENABLE_FDOPEN:BOOL=ON
|
||||
|
||||
//Enable use of GnuTLS
|
||||
ENABLE_GNUTLS:BOOL=ON
|
||||
|
||||
//Enable use of LZMA
|
||||
ENABLE_LZMA:BOOL=ON
|
||||
|
||||
//Enable use of mbed TLS
|
||||
ENABLE_MBEDTLS:BOOL=ON
|
||||
|
||||
//Enable use of OpenSSL
|
||||
ENABLE_OPENSSL:BOOL=ON
|
||||
|
||||
//Enable use of Windows cryptography libraries
|
||||
ENABLE_WINDOWS_CRYPTO:BOOL=ON
|
||||
|
||||
//Enable use of Zstandard
|
||||
ENABLE_ZSTD:BOOL=ON
|
||||
|
||||
//Path to a file.
|
||||
GNUTLS_INCLUDE_DIR:PATH=GNUTLS_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
GNUTLS_LIBRARY:FILEPATH=GNUTLS_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
LIBLZMA_INCLUDE_DIR:PATH=LIBLZMA_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
LIBLZMA_LIBRARY_DEBUG:FILEPATH=LIBLZMA_LIBRARY_DEBUG-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
LIBLZMA_LIBRARY_RELEASE:FILEPATH=LIBLZMA_LIBRARY_RELEASE-NOTFOUND
|
||||
|
||||
//Install libzip and the related files
|
||||
LIBZIP_DO_INSTALL:BOOL=ON
|
||||
|
||||
//Path to a program.
|
||||
MDOCTOOL:FILEPATH=/usr/bin/groff
|
||||
|
||||
//Path to a file.
|
||||
MbedTLS_INCLUDE_DIR:PATH=MbedTLS_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
MbedTLS_LIBRARY:FILEPATH=MbedTLS_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a program.
|
||||
NIHTEST:FILEPATH=NIHTEST-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
Nettle_INCLUDE_DIR:PATH=Nettle_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
Nettle_LIBRARY:FILEPATH=Nettle_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
OPENSSL_CRYPTO_LIBRARY:FILEPATH=OPENSSL_CRYPTO_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
OPENSSL_INCLUDE_DIR:PATH=OPENSSL_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
OPENSSL_SSL_LIBRARY:FILEPATH=OPENSSL_SSL_LIBRARY-NOTFOUND
|
||||
|
||||
//Arguments to supply to pkg-config
|
||||
PKG_CONFIG_ARGN:STRING=
|
||||
|
||||
//pkg-config executable
|
||||
PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config
|
||||
|
||||
//Add SO version in .so build
|
||||
SHARED_LIB_VERSIONNING:BOOL=ON
|
||||
|
||||
//Path to a file.
|
||||
ZLIB_INCLUDE_DIR:PATH=/home/romazan/Рабочий стол/cproject/thirdparty/zlib-1.3.1/install/include
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
ZLIB_LIBRARY:UNINITIALIZED=/home/romazan/Рабочий стол/cproject/thirdparty/zlib-1.3.1/install/lib/libz.a
|
||||
|
||||
//Value Computed by CMake
|
||||
libzip_BINARY_DIR:STATIC=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake
|
||||
|
||||
//Value Computed by CMake
|
||||
libzip_IS_TOP_LEVEL:STATIC=ON
|
||||
|
||||
//Value Computed by CMake
|
||||
libzip_SOURCE_DIR:STATIC=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3
|
||||
|
||||
//Dependencies for the target
|
||||
zip_LIB_DEPENDS:STATIC=general;ZLIB::ZLIB;
|
||||
|
||||
//Path to a file.
|
||||
zstd_DLL:FILEPATH=zstd_DLL-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
zstd_INCLUDE_DIR:PATH=zstd_INCLUDE_DIR-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
zstd_SHARED_LIBRARY:FILEPATH=zstd_SHARED_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
zstd_STATIC_LIBRARY:FILEPATH=zstd_STATIC_LIBRARY-NOTFOUND
|
||||
|
||||
|
||||
########################
|
||||
# INTERNAL cache entries
|
||||
########################
|
||||
|
||||
//ADVANCED property for variable: BZIP2_INCLUDE_DIR
|
||||
BZIP2_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: BZIP2_LIBRARY_DEBUG
|
||||
BZIP2_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: BZIP2_LIBRARY_RELEASE
|
||||
BZIP2_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_ADDR2LINE
|
||||
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
|
||||
//This is the directory where this CMakeCache.txt was created
|
||||
CMAKE_CACHEFILE_DIR:INTERNAL=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake
|
||||
//Major version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
||||
//Minor version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=28
|
||||
//Patch version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
|
||||
//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
|
||||
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//Path to CMake executable.
|
||||
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
|
||||
//Path to cpack program executable.
|
||||
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
|
||||
//Path to ctest program executable.
|
||||
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_CLANG_SCAN_DEPS
|
||||
CMAKE_C_COMPILER_CLANG_SCAN_DEPS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_DLLTOOL
|
||||
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
|
||||
//Executable file format
|
||||
CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
|
||||
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
|
||||
//Name of external makefile project generator.
|
||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
||||
//Name of generator.
|
||||
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
|
||||
//Generator instance identifier.
|
||||
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
||||
//Name of generator platform.
|
||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
||||
//Name of generator toolset.
|
||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
||||
//Source directory with the top level CMakeLists.txt file for this
|
||||
// project
|
||||
CMAKE_HOME_DIRECTORY:INTERNAL=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_BINDIR
|
||||
CMAKE_INSTALL_BINDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_DATADIR
|
||||
CMAKE_INSTALL_DATADIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_DATAROOTDIR
|
||||
CMAKE_INSTALL_DATAROOTDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_DOCDIR
|
||||
CMAKE_INSTALL_DOCDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_INCLUDEDIR
|
||||
CMAKE_INSTALL_INCLUDEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_INFODIR
|
||||
CMAKE_INSTALL_INFODIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_LIBDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LIBEXECDIR
|
||||
CMAKE_INSTALL_LIBEXECDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LOCALEDIR
|
||||
CMAKE_INSTALL_LOCALEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LOCALSTATEDIR
|
||||
CMAKE_INSTALL_LOCALSTATEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_MANDIR
|
||||
CMAKE_INSTALL_MANDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_OLDINCLUDEDIR
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_RUNSTATEDIR
|
||||
CMAKE_INSTALL_RUNSTATEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_SBINDIR
|
||||
CMAKE_INSTALL_SBINDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_SHAREDSTATEDIR
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_SYSCONFDIR
|
||||
CMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_LINKER
|
||||
CMAKE_LINKER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
|
||||
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
|
||||
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//number of local generators
|
||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=6
|
||||
//ADVANCED property for variable: CMAKE_OBJCOPY
|
||||
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJDUMP
|
||||
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
|
||||
//Platform information initialized
|
||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_READELF
|
||||
CMAKE_READELF-ADVANCED:INTERNAL=1
|
||||
//Path to CMake installation.
|
||||
CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.28
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
|
||||
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
|
||||
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_RPATH
|
||||
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
|
||||
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STRIP
|
||||
CMAKE_STRIP-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_TAPI
|
||||
CMAKE_TAPI-ADVANCED:INTERNAL=1
|
||||
//uname command
|
||||
CMAKE_UNAME:INTERNAL=/usr/bin/uname
|
||||
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
|
||||
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//Have includes CommonCrypto/CommonCrypto.h
|
||||
COMMONCRYPTO_FOUND:INTERNAL=
|
||||
//If true, we are targeting Emscripten output.
|
||||
EMSCRIPTEN:INTERNAL=1
|
||||
//Details about finding PkgConfig
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_PkgConfig:INTERNAL=[/usr/bin/pkg-config][v1.8.1()]
|
||||
//Details about finding ZLIB
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_ZLIB:INTERNAL=[/home/romazan/Рабочий стол/cproject/thirdparty/zlib-1.3.1/install/lib/libz.a][/home/romazan/Рабочий стол/cproject/thirdparty/zlib-1.3.1/install/include][c ][v1.3.1(1.1.2)]
|
||||
FTS_LIB:INTERNAL=
|
||||
//ADVANCED property for variable: GNUTLS_INCLUDE_DIR
|
||||
GNUTLS_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: GNUTLS_LIBRARY
|
||||
GNUTLS_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//Have function arc4random
|
||||
HAVE_ARC4RANDOM:INTERNAL=
|
||||
//Have function clonefile
|
||||
HAVE_CLONEFILE:INTERNAL=
|
||||
//Have function explicit_bzero
|
||||
HAVE_EXPLICIT_BZERO:INTERNAL=1
|
||||
//Have function explicit_memset
|
||||
HAVE_EXPLICIT_MEMSET:INTERNAL=
|
||||
//Have function fchmod
|
||||
HAVE_FCHMOD:INTERNAL=1
|
||||
//Test HAVE_FICLONERANGE
|
||||
HAVE_FICLONERANGE:INTERNAL=
|
||||
//Have function fileno
|
||||
HAVE_FILENO:INTERNAL=1
|
||||
//Have function fseeko
|
||||
HAVE_FSEEKO:INTERNAL=1
|
||||
//Have function ftello
|
||||
HAVE_FTELLO:INTERNAL=1
|
||||
//Have includes sys/types.h;sys/stat.h;fts.h
|
||||
HAVE_FTS_H:INTERNAL=
|
||||
//Have function getopt
|
||||
HAVE_GETOPT:INTERNAL=1
|
||||
//Have function getprogname
|
||||
HAVE_GETPROGNAME:INTERNAL=
|
||||
//Have function GetSecurityInfo
|
||||
HAVE_GETSECURITYINFO:INTERNAL=
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_INT16_T_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_INT32_T_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_INT64_T_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_INT8_T_LIBZIP:INTERNAL=TRUE
|
||||
//Have include inttypes.h
|
||||
HAVE_INTTYPES_H_LIBZIP:INTERNAL=1
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_INT_LIBZIP:INTERNAL=TRUE
|
||||
HAVE_LIB_FTS:INTERNAL=
|
||||
//Have symbol localtime_r
|
||||
HAVE_LOCALTIME_R:INTERNAL=1
|
||||
//Have symbol localtime_s
|
||||
HAVE_LOCALTIME_S:INTERNAL=
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_LONG_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_LONG_LONG_LIBZIP:INTERNAL=TRUE
|
||||
//Have function memcpy_s
|
||||
HAVE_MEMCPY_S:INTERNAL=
|
||||
//Have function random
|
||||
HAVE_RANDOM:INTERNAL=1
|
||||
//Have function setmode
|
||||
HAVE_SETMODE:INTERNAL=
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_SHORT_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_SIZEOF_OFF_T:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_SIZEOF_SIZE_T:INTERNAL=TRUE
|
||||
//Have symbol snprintf
|
||||
HAVE_SNPRINTF:INTERNAL=1
|
||||
//Have symbol snprintf_s
|
||||
HAVE_SNPRINTF_S:INTERNAL=
|
||||
//Have include stdbool.h
|
||||
HAVE_STDBOOL_H:INTERNAL=1
|
||||
//Have include stddef.h
|
||||
HAVE_STDDEF_H:INTERNAL=1
|
||||
//Have include stdint.h
|
||||
HAVE_STDINT_H:INTERNAL=1
|
||||
//Have include stdint.h
|
||||
HAVE_STDINT_H_LIBZIP:INTERNAL=1
|
||||
//Have symbol strcasecmp
|
||||
HAVE_STRCASECMP:INTERNAL=1
|
||||
//Have function strdup
|
||||
HAVE_STRDUP:INTERNAL=1
|
||||
//Have function strerrorlen_s
|
||||
HAVE_STRERRORLEN_S:INTERNAL=
|
||||
//Have function strerror_s
|
||||
HAVE_STRERROR_S:INTERNAL=
|
||||
//Have function stricmp
|
||||
HAVE_STRICMP:INTERNAL=
|
||||
//Have include strings.h
|
||||
HAVE_STRINGS_H:INTERNAL=1
|
||||
//Have function strncpy_s
|
||||
HAVE_STRNCPY_S:INTERNAL=
|
||||
//Have function strtoll
|
||||
HAVE_STRTOLL:INTERNAL=1
|
||||
//Have function strtoull
|
||||
HAVE_STRTOULL:INTERNAL=1
|
||||
//Have include sys/types.h
|
||||
HAVE_SYS_TYPES_H:INTERNAL=1
|
||||
//Have include sys/types.h
|
||||
HAVE_SYS_TYPES_H_LIBZIP:INTERNAL=1
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_UINT16_T_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_UINT32_T_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_UINT64_T_LIBZIP:INTERNAL=TRUE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE_UINT8_T_LIBZIP:INTERNAL=TRUE
|
||||
//Have include unistd.h
|
||||
HAVE_UNISTD_H:INTERNAL=1
|
||||
//Have function _close
|
||||
HAVE__CLOSE:INTERNAL=
|
||||
//Have function _dup
|
||||
HAVE__DUP:INTERNAL=
|
||||
//Have function _fdopen
|
||||
HAVE__FDOPEN:INTERNAL=
|
||||
//Have function _fileno
|
||||
HAVE__FILENO:INTERNAL=
|
||||
//Have function _fseeki64
|
||||
HAVE__FSEEKI64:INTERNAL=
|
||||
//Have function _fstat64
|
||||
HAVE__FSTAT64:INTERNAL=
|
||||
//Have function _setmode
|
||||
HAVE__SETMODE:INTERNAL=
|
||||
//Have symbol _snprintf
|
||||
HAVE__SNPRINTF:INTERNAL=
|
||||
//Have symbol _snprintf_s
|
||||
HAVE__SNPRINTF_S:INTERNAL=
|
||||
//Have symbol _snwprintf_s
|
||||
HAVE__SNWPRINTF_S:INTERNAL=
|
||||
//Have function _stat64
|
||||
HAVE__STAT64:INTERNAL=
|
||||
//Have function _strdup
|
||||
HAVE__STRDUP:INTERNAL=
|
||||
//Have symbol _stricmp
|
||||
HAVE__STRICMP:INTERNAL=
|
||||
//Have function _strtoi64
|
||||
HAVE__STRTOI64:INTERNAL=
|
||||
//Have function _strtoui64
|
||||
HAVE__STRTOUI64:INTERNAL=
|
||||
//Have function _unlink
|
||||
HAVE__UNLINK:INTERNAL=
|
||||
//Result of TRY_COMPILE
|
||||
HAVE___INT16_LIBZIP:INTERNAL=FALSE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE___INT32_LIBZIP:INTERNAL=FALSE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE___INT64_LIBZIP:INTERNAL=FALSE
|
||||
//Result of TRY_COMPILE
|
||||
HAVE___INT8_LIBZIP:INTERNAL=FALSE
|
||||
//CHECK_TYPE_SIZE: sizeof(int16_t)
|
||||
INT16_T_LIBZIP:INTERNAL=2
|
||||
//CHECK_TYPE_SIZE: sizeof(int32_t)
|
||||
INT32_T_LIBZIP:INTERNAL=4
|
||||
//CHECK_TYPE_SIZE: sizeof(int64_t)
|
||||
INT64_T_LIBZIP:INTERNAL=8
|
||||
//CHECK_TYPE_SIZE: sizeof(int8_t)
|
||||
INT8_T_LIBZIP:INTERNAL=1
|
||||
//CHECK_TYPE_SIZE: sizeof(int)
|
||||
INT_LIBZIP:INTERNAL=4
|
||||
//ADVANCED property for variable: LIBLZMA_INCLUDE_DIR
|
||||
LIBLZMA_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: LIBLZMA_LIBRARY_DEBUG
|
||||
LIBLZMA_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: LIBLZMA_LIBRARY_RELEASE
|
||||
LIBLZMA_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//CHECK_TYPE_SIZE: sizeof(long)
|
||||
LONG_LIBZIP:INTERNAL=4
|
||||
//CHECK_TYPE_SIZE: sizeof(long long)
|
||||
LONG_LONG_LIBZIP:INTERNAL=8
|
||||
//ADVANCED property for variable: MbedTLS_INCLUDE_DIR
|
||||
MbedTLS_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: MbedTLS_LIBRARY
|
||||
MbedTLS_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Nettle_INCLUDE_DIR
|
||||
Nettle_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Nettle_LIBRARY
|
||||
Nettle_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: OPENSSL_CRYPTO_LIBRARY
|
||||
OPENSSL_CRYPTO_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: OPENSSL_INCLUDE_DIR
|
||||
OPENSSL_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: OPENSSL_SSL_LIBRARY
|
||||
OPENSSL_SSL_LIBRARY-ADVANCED:INTERNAL=1
|
||||
PC_GNUTLS_CFLAGS:INTERNAL=
|
||||
PC_GNUTLS_CFLAGS_I:INTERNAL=
|
||||
PC_GNUTLS_CFLAGS_OTHER:INTERNAL=
|
||||
PC_GNUTLS_FOUND:INTERNAL=
|
||||
PC_GNUTLS_INCLUDEDIR:INTERNAL=
|
||||
PC_GNUTLS_LIBDIR:INTERNAL=
|
||||
PC_GNUTLS_LIBS:INTERNAL=
|
||||
PC_GNUTLS_LIBS_L:INTERNAL=
|
||||
PC_GNUTLS_LIBS_OTHER:INTERNAL=
|
||||
PC_GNUTLS_LIBS_PATHS:INTERNAL=
|
||||
PC_GNUTLS_MODULE_NAME:INTERNAL=
|
||||
PC_GNUTLS_PREFIX:INTERNAL=
|
||||
PC_GNUTLS_STATIC_CFLAGS:INTERNAL=
|
||||
PC_GNUTLS_STATIC_CFLAGS_I:INTERNAL=
|
||||
PC_GNUTLS_STATIC_CFLAGS_OTHER:INTERNAL=
|
||||
PC_GNUTLS_STATIC_LIBDIR:INTERNAL=
|
||||
PC_GNUTLS_STATIC_LIBS:INTERNAL=
|
||||
PC_GNUTLS_STATIC_LIBS_L:INTERNAL=
|
||||
PC_GNUTLS_STATIC_LIBS_OTHER:INTERNAL=
|
||||
PC_GNUTLS_STATIC_LIBS_PATHS:INTERNAL=
|
||||
PC_GNUTLS_VERSION:INTERNAL=
|
||||
PC_GNUTLS_gnutls_INCLUDEDIR:INTERNAL=
|
||||
PC_GNUTLS_gnutls_LIBDIR:INTERNAL=
|
||||
PC_GNUTLS_gnutls_PREFIX:INTERNAL=
|
||||
PC_GNUTLS_gnutls_VERSION:INTERNAL=
|
||||
PC_Nettle_CFLAGS:INTERNAL=
|
||||
PC_Nettle_CFLAGS_I:INTERNAL=
|
||||
PC_Nettle_CFLAGS_OTHER:INTERNAL=
|
||||
PC_Nettle_FOUND:INTERNAL=
|
||||
PC_Nettle_INCLUDEDIR:INTERNAL=
|
||||
PC_Nettle_LIBDIR:INTERNAL=
|
||||
PC_Nettle_LIBS:INTERNAL=
|
||||
PC_Nettle_LIBS_L:INTERNAL=
|
||||
PC_Nettle_LIBS_OTHER:INTERNAL=
|
||||
PC_Nettle_LIBS_PATHS:INTERNAL=
|
||||
PC_Nettle_MODULE_NAME:INTERNAL=
|
||||
PC_Nettle_PREFIX:INTERNAL=
|
||||
PC_Nettle_STATIC_CFLAGS:INTERNAL=
|
||||
PC_Nettle_STATIC_CFLAGS_I:INTERNAL=
|
||||
PC_Nettle_STATIC_CFLAGS_OTHER:INTERNAL=
|
||||
PC_Nettle_STATIC_LIBDIR:INTERNAL=
|
||||
PC_Nettle_STATIC_LIBS:INTERNAL=
|
||||
PC_Nettle_STATIC_LIBS_L:INTERNAL=
|
||||
PC_Nettle_STATIC_LIBS_OTHER:INTERNAL=
|
||||
PC_Nettle_STATIC_LIBS_PATHS:INTERNAL=
|
||||
PC_Nettle_VERSION:INTERNAL=
|
||||
PC_Nettle_nettle_INCLUDEDIR:INTERNAL=
|
||||
PC_Nettle_nettle_LIBDIR:INTERNAL=
|
||||
PC_Nettle_nettle_PREFIX:INTERNAL=
|
||||
PC_Nettle_nettle_VERSION:INTERNAL=
|
||||
PC_zstd_CFLAGS:INTERNAL=
|
||||
PC_zstd_CFLAGS_I:INTERNAL=
|
||||
PC_zstd_CFLAGS_OTHER:INTERNAL=
|
||||
PC_zstd_FOUND:INTERNAL=
|
||||
PC_zstd_INCLUDEDIR:INTERNAL=
|
||||
PC_zstd_LIBDIR:INTERNAL=
|
||||
PC_zstd_LIBS:INTERNAL=
|
||||
PC_zstd_LIBS_L:INTERNAL=
|
||||
PC_zstd_LIBS_OTHER:INTERNAL=
|
||||
PC_zstd_LIBS_PATHS:INTERNAL=
|
||||
PC_zstd_MODULE_NAME:INTERNAL=
|
||||
PC_zstd_PREFIX:INTERNAL=
|
||||
PC_zstd_STATIC_CFLAGS:INTERNAL=
|
||||
PC_zstd_STATIC_CFLAGS_I:INTERNAL=
|
||||
PC_zstd_STATIC_CFLAGS_OTHER:INTERNAL=
|
||||
PC_zstd_STATIC_LIBDIR:INTERNAL=
|
||||
PC_zstd_STATIC_LIBS:INTERNAL=
|
||||
PC_zstd_STATIC_LIBS_L:INTERNAL=
|
||||
PC_zstd_STATIC_LIBS_OTHER:INTERNAL=
|
||||
PC_zstd_STATIC_LIBS_PATHS:INTERNAL=
|
||||
PC_zstd_VERSION:INTERNAL=
|
||||
PC_zstd_libzstd_INCLUDEDIR:INTERNAL=
|
||||
PC_zstd_libzstd_LIBDIR:INTERNAL=
|
||||
PC_zstd_libzstd_PREFIX:INTERNAL=
|
||||
PC_zstd_libzstd_VERSION:INTERNAL=
|
||||
//ADVANCED property for variable: PKG_CONFIG_ARGN
|
||||
PKG_CONFIG_ARGN-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE
|
||||
PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//CHECK_TYPE_SIZE: sizeof(short)
|
||||
SHORT_LIBZIP:INTERNAL=2
|
||||
//CHECK_TYPE_SIZE: sizeof(off_t)
|
||||
SIZEOF_OFF_T:INTERNAL=8
|
||||
//CHECK_TYPE_SIZE: sizeof(size_t)
|
||||
SIZEOF_SIZE_T:INTERNAL=4
|
||||
//CHECK_TYPE_SIZE: sizeof(uint16_t)
|
||||
UINT16_T_LIBZIP:INTERNAL=2
|
||||
//CHECK_TYPE_SIZE: sizeof(uint32_t)
|
||||
UINT32_T_LIBZIP:INTERNAL=4
|
||||
//CHECK_TYPE_SIZE: sizeof(uint64_t)
|
||||
UINT64_T_LIBZIP:INTERNAL=8
|
||||
//CHECK_TYPE_SIZE: sizeof(uint8_t)
|
||||
UINT8_T_LIBZIP:INTERNAL=1
|
||||
//Result of TEST_BIG_ENDIAN
|
||||
WORDS_BIGENDIAN:INTERNAL=0
|
||||
//ADVANCED property for variable: ZLIB_INCLUDE_DIR
|
||||
ZLIB_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//CMAKE_INSTALL_PREFIX during last run
|
||||
_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX:INTERNAL=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake/install
|
||||
_OPENSSL_CFLAGS:INTERNAL=
|
||||
_OPENSSL_CFLAGS_I:INTERNAL=
|
||||
_OPENSSL_CFLAGS_OTHER:INTERNAL=
|
||||
_OPENSSL_FOUND:INTERNAL=
|
||||
_OPENSSL_INCLUDEDIR:INTERNAL=
|
||||
_OPENSSL_LIBDIR:INTERNAL=
|
||||
_OPENSSL_LIBS:INTERNAL=
|
||||
_OPENSSL_LIBS_L:INTERNAL=
|
||||
_OPENSSL_LIBS_OTHER:INTERNAL=
|
||||
_OPENSSL_LIBS_PATHS:INTERNAL=
|
||||
_OPENSSL_MODULE_NAME:INTERNAL=
|
||||
_OPENSSL_PREFIX:INTERNAL=
|
||||
_OPENSSL_STATIC_CFLAGS:INTERNAL=
|
||||
_OPENSSL_STATIC_CFLAGS_I:INTERNAL=
|
||||
_OPENSSL_STATIC_CFLAGS_OTHER:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBDIR:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS_L:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS_OTHER:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS_PATHS:INTERNAL=
|
||||
_OPENSSL_VERSION:INTERNAL=
|
||||
_OPENSSL_openssl_INCLUDEDIR:INTERNAL=
|
||||
_OPENSSL_openssl_LIBDIR:INTERNAL=
|
||||
_OPENSSL_openssl_PREFIX:INTERNAL=
|
||||
_OPENSSL_openssl_VERSION:INTERNAL=
|
||||
//CHECK_TYPE_SIZE: __int16 unknown
|
||||
__INT16_LIBZIP:INTERNAL=
|
||||
//CHECK_TYPE_SIZE: __int32 unknown
|
||||
__INT32_LIBZIP:INTERNAL=
|
||||
//CHECK_TYPE_SIZE: __int64 unknown
|
||||
__INT64_LIBZIP:INTERNAL=
|
||||
//CHECK_TYPE_SIZE: __int8 unknown
|
||||
__INT8_LIBZIP:INTERNAL=
|
||||
__pkg_config_checked_PC_GNUTLS:INTERNAL=1
|
||||
__pkg_config_checked_PC_Nettle:INTERNAL=1
|
||||
__pkg_config_checked_PC_zstd:INTERNAL=1
|
||||
__pkg_config_checked__OPENSSL:INTERNAL=1
|
||||
//ADVANCED property for variable: zstd_DLL
|
||||
zstd_DLL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: zstd_INCLUDE_DIR
|
||||
zstd_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: zstd_SHARED_LIBRARY
|
||||
zstd_SHARED_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: zstd_STATIC_LIBRARY
|
||||
zstd_STATIC_LIBRARY-ADVANCED:INTERNAL=1
|
||||
|
||||
74
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/3.28.3/CMakeCCompiler.cmake
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
set(CMAKE_C_COMPILER "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/emcc")
|
||||
set(CMAKE_C_COMPILER_ARG1 "")
|
||||
set(CMAKE_C_COMPILER_ID "Clang")
|
||||
set(CMAKE_C_COMPILER_VERSION "21.0.0")
|
||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17")
|
||||
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
|
||||
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
|
||||
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
|
||||
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
|
||||
set(CMAKE_C17_COMPILE_FEATURES "c_std_17")
|
||||
set(CMAKE_C23_COMPILE_FEATURES "c_std_23")
|
||||
|
||||
set(CMAKE_C_PLATFORM_ID "")
|
||||
set(CMAKE_C_SIMULATE_ID "")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
set(CMAKE_C_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/emar")
|
||||
set(CMAKE_C_COMPILER_AR "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/emar")
|
||||
set(CMAKE_RANLIB "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/emranlib")
|
||||
set(CMAKE_C_COMPILER_RANLIB "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/emranlib")
|
||||
set(CMAKE_LINKER "/usr/bin/ld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND")
|
||||
set(CMAKE_COMPILER_IS_GNUCC )
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_C_ABI_COMPILED TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
||||
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
||||
set(CMAKE_C_LINKER_DEPFILE_SUPPORTED FALSE)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_C_SIZEOF_DATA_PTR "4")
|
||||
set(CMAKE_C_COMPILER_ABI "")
|
||||
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "")
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/cache/sysroot/include/fakesdl;/home/romazan/Рабочий стол/emsdk/upstream/emscripten/cache/sysroot/include/compat;/home/romazan/Рабочий стол/emsdk/upstream/lib/clang/21/include;/home/romazan/Рабочий стол/emsdk/upstream/emscripten/cache/sysroot/include")
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "GL-getprocaddr;al;html5;stubs-debug;noexit;c-debug;dlmalloc-debug;compiler_rt;c++-noexcept;c++abi-debug-noexcept;sockets")
|
||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/home/romazan/Рабочий стол/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten;/home/romazan/Рабочий стол/emsdk/upstream/emscripten/src/lib")
|
||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
||||
1521
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin
vendored
Normal file
15
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/3.28.3/CMakeSystem.cmake
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
set(CMAKE_HOST_SYSTEM "Linux-6.8.0-53-generic")
|
||||
set(CMAKE_HOST_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "6.8.0-53-generic")
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
include("/home/romazan/Рабочий стол/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake")
|
||||
|
||||
set(CMAKE_SYSTEM "Emscripten-1")
|
||||
set(CMAKE_SYSTEM_NAME "Emscripten")
|
||||
set(CMAKE_SYSTEM_VERSION "1")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
|
||||
set(CMAKE_CROSSCOMPILING "TRUE")
|
||||
|
||||
set(CMAKE_SYSTEM_LOADED 1)
|
||||
880
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c
vendored
Normal file
@ -0,0 +1,880 @@
|
||||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#if defined(__18CXX)
|
||||
# define ID_VOID_MAIN
|
||||
#endif
|
||||
#if defined(__CLASSIC_C__)
|
||||
/* cv-qualifiers did not exist in K&R C */
|
||||
# define const
|
||||
# define volatile
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_C >= 0x5100
|
||||
/* __SUNPRO_C = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_cc)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_cc = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
|
||||
|
||||
#elif defined(__DECC)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECC_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
|
||||
|
||||
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__open_xl__) && defined(__clang__)
|
||||
# define COMPILER_ID "IBMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__clang__) && defined(__cray__)
|
||||
# define COMPILER_ID "CrayClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__cray_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__cray_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
# define COMPILER_ID "Tasking"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
|
||||
|
||||
#elif defined(__ORANGEC__)
|
||||
# define COMPILER_ID "OrangeC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__)
|
||||
|
||||
#elif defined(__TINYC__)
|
||||
# define COMPILER_ID "TinyCC"
|
||||
|
||||
#elif defined(__BCC__)
|
||||
# define COMPILER_ID "Bruce"
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
|
||||
# define COMPILER_ID "LCC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100)
|
||||
# if defined(__LCC_MINOR__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(_ADI_COMPILER)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VERSIONNUM__)
|
||||
/* __VERSIONNUM__ = 0xVVRRPPTT */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
|
||||
# define COMPILER_ID "SDCC"
|
||||
# if defined(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
|
||||
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
|
||||
# else
|
||||
/* SDCC = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
# elif defined(_ADI_COMPILER)
|
||||
# define PLATFORM_ID "ADSP"
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
# elif defined(__ADSPSHARC__)
|
||||
# define ARCHITECTURE_ID "SHARC"
|
||||
|
||||
# elif defined(__ADSPBLACKFIN__)
|
||||
# define ARCHITECTURE_ID "Blackfin"
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
|
||||
# if defined(__CTC__) || defined(__CPTC__)
|
||||
# define ARCHITECTURE_ID "TriCore"
|
||||
|
||||
# elif defined(__CMCS__)
|
||||
# define ARCHITECTURE_ID "MCS"
|
||||
|
||||
# elif defined(__CARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__CARC__)
|
||||
# define ARCHITECTURE_ID "ARC"
|
||||
|
||||
# elif defined(__C51__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__CPCP__)
|
||||
# define ARCHITECTURE_ID "PCP"
|
||||
|
||||
# else
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if !defined(__STDC__) && !defined(__clang__)
|
||||
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
|
||||
# define C_VERSION "90"
|
||||
# else
|
||||
# define C_VERSION
|
||||
# endif
|
||||
#elif __STDC_VERSION__ > 201710L
|
||||
# define C_VERSION "23"
|
||||
#elif __STDC_VERSION__ >= 201710L
|
||||
# define C_VERSION "17"
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_VERSION "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_VERSION "99"
|
||||
#else
|
||||
# define C_VERSION "90"
|
||||
#endif
|
||||
const char* info_language_standard_default =
|
||||
"INFO" ":" "standard_default[" C_VERSION "]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(__STRICT_ANSI__)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ID_VOID_MAIN
|
||||
void main() {}
|
||||
#else
|
||||
# if defined(__CLASSIC_C__)
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
# else
|
||||
int main(int argc, char* argv[])
|
||||
# endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
#endif
|
||||
1521
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/3.28.3/CompilerIdC/a.out.js
vendored
Normal file
BIN
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/3.28.3/CompilerIdC/a.out.wasm
vendored
Executable file
2887
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CMakeConfigureLog.yaml
vendored
Normal file
16
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CMakeDirectoryInformation.cmake
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.28
|
||||
|
||||
# Relative path conversion top directories.
|
||||
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3")
|
||||
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake")
|
||||
|
||||
# Force unix paths in dependencies.
|
||||
set(CMAKE_FORCE_UNIX_PATHS 1)
|
||||
|
||||
|
||||
# The C and CXX include file regular expressions for this directory.
|
||||
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
|
||||
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
|
||||
324
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CMakeRuleHashes.txt
vendored
Normal file
@ -0,0 +1,324 @@
|
||||
# Hashes of file build rules.
|
||||
fe079431874bb5fcf98e6127380d9915 CMakeFiles/dist
|
||||
9b6bf55f9963fcde040964803255f01e CMakeFiles/distcheck
|
||||
8115c1d2692ccedb887651f3561eff6f lib/zip_err_str.c
|
||||
0294d9259a337993e4dc0847a4eb94eb man/CMakeFiles/man
|
||||
0294d9259a337993e4dc0847a4eb94eb man/CMakeFiles/update-html
|
||||
0294d9259a337993e4dc0847a4eb94eb man/CMakeFiles/update-man
|
||||
0316b03f8ec2c16e60838065eebd441f man/CMakeFiles/update_zip_errors
|
||||
d159ddf2c2d73a4e2ec0b77217306397 man/ZIP_SOURCE_GET_ARGS.3
|
||||
3c2cdfb10713a65a707342fd8b543f9d man/ZIP_SOURCE_GET_ARGS.html
|
||||
24bbd5b7c58a1a012d3def4f089c20fc man/ZIP_SOURCE_GET_ARGS.man
|
||||
42273a05e248870f09470c0a8d1ab4d8 man/libzip.3
|
||||
beff02be812b943e5137b8dee3c7cbeb man/libzip.html
|
||||
8fc1a91b88f81ca9cff6c4c51ba74e07 man/libzip.man
|
||||
fdd5c85b90e8035f69409a418d05d840 man/zip_add.3
|
||||
d14e461ea0b1c56df20efae0b354a090 man/zip_add.html
|
||||
79c17569bf49c7bf09791496ca98a6ab man/zip_add.man
|
||||
7b16b30c91cc789b760b0771144752e2 man/zip_add_dir.3
|
||||
66f107ca4ba186f08593aed2c9599704 man/zip_add_dir.html
|
||||
4e712df7a5460e8856c541958226d2e5 man/zip_add_dir.man
|
||||
092c953c43a8a7708ba9a37fab0b6473 man/zip_close.3
|
||||
9706e4a4b67a1f2bed60a8d52efee130 man/zip_close.html
|
||||
10c4dc15c9e0664644c696472379b25e man/zip_close.man
|
||||
0f7556f52f43ac6add41f8a7ab6c2274 man/zip_compression_method_supported.3
|
||||
4190436e2f0936a92b764ae24c536771 man/zip_compression_method_supported.html
|
||||
4faa7d9eba28dde2088b234ab5dedfcf man/zip_compression_method_supported.man
|
||||
1bdffaef4935bbb3c5f45160fb3ba065 man/zip_delete.3
|
||||
da5730c8a1d6f7f94e862c97280f1d26 man/zip_delete.html
|
||||
d1bd4dfd2ce79d869260d771c1f8d430 man/zip_delete.man
|
||||
cbb0caf9b6493a3ddb4459abd6ebdf64 man/zip_dir_add.3
|
||||
67c1b6050a1e61879f88fe30f4e56b3d man/zip_dir_add.html
|
||||
911fab9ca855f89dcedcb9559bf3c608 man/zip_dir_add.man
|
||||
73b01c40b94c1c221280c43a618ede62 man/zip_discard.3
|
||||
d95f0f05ac4ba90750b38e3020cf26fa man/zip_discard.html
|
||||
4c0ba145a251867e922a369119879617 man/zip_discard.man
|
||||
a1effc9165f97dfbfdc0335c6802c541 man/zip_encryption_method_supported.3
|
||||
37cb98b50257af95f292054ff14210f6 man/zip_encryption_method_supported.html
|
||||
ed58a1a1431ae705d17370292392353b man/zip_encryption_method_supported.man
|
||||
0ccf5c543cd6466ad36701a1797e2150 man/zip_error_clear.3
|
||||
40408650dcadbe6ea70f01a369a045f0 man/zip_error_clear.html
|
||||
d47926a18f4019793cef93a1eb540c07 man/zip_error_clear.man
|
||||
ab91b656ced50a87e7bef67d8626875b man/zip_error_code_system.3
|
||||
ccdf3ba48c5ab8b4e5eab2283e2f959e man/zip_error_code_system.html
|
||||
8a11aa2fe7d1042716302ac4bd63c99b man/zip_error_code_system.man
|
||||
5b7dd4e72620bfdd2c0626563699c0b1 man/zip_error_code_zip.3
|
||||
a2ee3aea90618df8e9243b3a0ba8d540 man/zip_error_code_zip.html
|
||||
846e89d92de3624332a5b5ac239083aa man/zip_error_code_zip.man
|
||||
7341f93e94eaa68417ae93d98ecd2187 man/zip_error_fini.3
|
||||
c16e9d25d2ac33c9e8e5a7f778d09e1d man/zip_error_fini.html
|
||||
6eee166beb19524b9f7712ffc55f21e5 man/zip_error_fini.man
|
||||
f0daae402067bdfa09a933f4eb9b8c11 man/zip_error_get.3
|
||||
1dbe3708fedca4e4be038c6598f44c4a man/zip_error_get.html
|
||||
076e27c2d314588847288299bfef01f4 man/zip_error_get.man
|
||||
d1078525de898dea808276a402828e85 man/zip_error_get_sys_type.3
|
||||
9c52a32947c0c673376afc75baf8d2c2 man/zip_error_get_sys_type.html
|
||||
61feb8423737870266931cd13eec9954 man/zip_error_get_sys_type.man
|
||||
daa3cc499f0ff2f831deb1ddedc26105 man/zip_error_init.3
|
||||
ee262460403b267002b0def7f06619fe man/zip_error_init.html
|
||||
bd1b5ec45fd5d09d7ba59917061a262c man/zip_error_init.man
|
||||
b1741b37334a3e44960fbc593c13da54 man/zip_error_set.3
|
||||
a69702c7fea7974f6e759d9c37d952c7 man/zip_error_set.html
|
||||
7f756947c4497a3335fa1f32a1893c49 man/zip_error_set.man
|
||||
fc45be7d661ecdd02f8c23eda6cd39f9 man/zip_error_set_from_source.3
|
||||
dbda9b64eeaf5a9a2bb2860740945680 man/zip_error_set_from_source.html
|
||||
2e604e44adc6fc042455c0c45b68a1fe man/zip_error_set_from_source.man
|
||||
9520eb7ef3d97d21a2f886def2c6a9c5 man/zip_error_strerror.3
|
||||
7425cce562a54a2e95754bc74512795f man/zip_error_strerror.html
|
||||
fa8d5d8a4ed266f607a04b766dfc7fd0 man/zip_error_strerror.man
|
||||
f96c88d229ade4e770e7345d4fb3f0d5 man/zip_error_system_type.3
|
||||
4f95b4ef6383d9aaab879576370e76c7 man/zip_error_system_type.html
|
||||
b330460476f4d4d6beecb09feaf6c5b3 man/zip_error_system_type.man
|
||||
a4ef761313728475ce333b1cff908e77 man/zip_error_to_data.3
|
||||
e3dd7efa659e26c80a9c77e60e92f75f man/zip_error_to_data.html
|
||||
f27bbbe8d48487a75d0ae37161a5c3b2 man/zip_error_to_data.man
|
||||
01ec765896e6bb6bed40aae97db1cf03 man/zip_error_to_str.3
|
||||
a744d386715c4c83bd2d8567a7366f0e man/zip_error_to_str.html
|
||||
4ef4d3c68090ea63aa24c82924e498ce man/zip_error_to_str.man
|
||||
21000f889abf4a81891bb21432fd6398 man/zip_errors.3
|
||||
ec7a64407c9b335b543efea5e346527e man/zip_errors.html
|
||||
0bb8cb829219c4be01c5f969c72e25f9 man/zip_errors.man
|
||||
94e63061d23034c4d58d6b97d5a16c20 man/zip_fclose.3
|
||||
6d026bb55dc0f36a56f9b10ab6067127 man/zip_fclose.html
|
||||
41d4aee9a2cb184bc9279940dc797618 man/zip_fclose.man
|
||||
3e45e125209f0945aeea4027e76618b0 man/zip_fdopen.3
|
||||
61a7c57dc3eb352d997790ea2bdee80f man/zip_fdopen.html
|
||||
3b629c2305b86cda59c32afa9175ac1e man/zip_fdopen.man
|
||||
d79bad67de1ba03f87cd62b5b600f8c7 man/zip_file_add.3
|
||||
e74dbe1017f5a276ca54a1666c8c41f9 man/zip_file_add.html
|
||||
c3f4975cdb310d0a0302785f0379d817 man/zip_file_add.man
|
||||
990fd92227b243f043c1412c320c329c man/zip_file_attributes_init.3
|
||||
82a9c7e7b9a133ac8b4564b5000b8254 man/zip_file_attributes_init.html
|
||||
974d171bc077be252b6db0050b31350c man/zip_file_attributes_init.man
|
||||
94ae53ba0bfec342cff096d2007e8b16 man/zip_file_extra_field_delete.3
|
||||
3f025b3ff464cd847b9d9c5c6e7b9172 man/zip_file_extra_field_delete.html
|
||||
d103bf5581c1f4963018becb5a7745a1 man/zip_file_extra_field_delete.man
|
||||
37902b6dbe02634393155e612112f890 man/zip_file_extra_field_get.3
|
||||
5a189309f96e8277ef52c8279e6a9bb4 man/zip_file_extra_field_get.html
|
||||
17e416b0ab5cb24061d668d918ec5047 man/zip_file_extra_field_get.man
|
||||
2c3ec84aabc0a028703a77a769a4749d man/zip_file_extra_field_set.3
|
||||
12d2911434a46edac7dd9c30e253fe16 man/zip_file_extra_field_set.html
|
||||
f4b94e74e113aeab9ef319c9fd980ae6 man/zip_file_extra_field_set.man
|
||||
a4b2254d5fdcfce6d3871355a4055e1a man/zip_file_extra_fields_count.3
|
||||
3047681a825f39b26419614fb1930309 man/zip_file_extra_fields_count.html
|
||||
8f02fc52194a23339986d39e102f0ec8 man/zip_file_extra_fields_count.man
|
||||
e2e969ce5a70c82d3f7d2ae8bd797cfe man/zip_file_get_comment.3
|
||||
c3e8b568750f4f6763119e3582078f4b man/zip_file_get_comment.html
|
||||
51f33a7364edc8e8c84c5a87beff4fe1 man/zip_file_get_comment.man
|
||||
439d0ea26e1c2680a66bbbeffb904466 man/zip_file_get_error.3
|
||||
af1ce940225d06b8f42941cc63983699 man/zip_file_get_error.html
|
||||
3ba7de4a4e6215c96be0d078b6e67e00 man/zip_file_get_error.man
|
||||
61231dcb024825dff2d3360c66a4762f man/zip_file_get_external_attributes.3
|
||||
c968ce8e530cc5c3db979dcb5bb4afce man/zip_file_get_external_attributes.html
|
||||
12892e9c4053b041813b85d88cdfabbc man/zip_file_get_external_attributes.man
|
||||
d40340f6b434e18da29c754bc8b7ba45 man/zip_file_rename.3
|
||||
a15006364919a987adebbd57ca189e6f man/zip_file_rename.html
|
||||
837a062241bb85fd7ce1b999033b7e56 man/zip_file_rename.man
|
||||
269565770f0faa35f0d5ef07b0c35c72 man/zip_file_set_comment.3
|
||||
de4892ccf24634949a825b00b50990a2 man/zip_file_set_comment.html
|
||||
0c33781477a3fb62b33028ae1d4d6993 man/zip_file_set_comment.man
|
||||
16ff951f7c92d4c9d13b269abe8bd099 man/zip_file_set_encryption.3
|
||||
ed131e12dd9f37b860351c00d6513856 man/zip_file_set_encryption.html
|
||||
189fef372d2357ec97e53aab878262f7 man/zip_file_set_encryption.man
|
||||
6de0589dad11cdbf08a99faa54f5294b man/zip_file_set_external_attributes.3
|
||||
7db55ab9263cf470bc64de5c0a1da90e man/zip_file_set_external_attributes.html
|
||||
d7f3cfe56559fbc139bea9a26f314594 man/zip_file_set_external_attributes.man
|
||||
0005689a5df959efcebc4f46e03b6e9b man/zip_file_set_mtime.3
|
||||
8fc84ff2fb8d16fc4996d9f0b30c87ce man/zip_file_set_mtime.html
|
||||
28f4e8dc8372e0874cc5b819c883e852 man/zip_file_set_mtime.man
|
||||
bf13c0cb662335066625d8a71ebc9024 man/zip_file_strerror.3
|
||||
631f0eb6b32e754ea6d4cdb2fb114d92 man/zip_file_strerror.html
|
||||
297e9a51f53cee9dfa83f7028f1fc1a4 man/zip_file_strerror.man
|
||||
8d2888512abc14611f3f207ea72d0413 man/zip_fopen.3
|
||||
21561ac488e779411f3498106537832f man/zip_fopen.html
|
||||
7e829c97824e257a8267acceeac868df man/zip_fopen.man
|
||||
199e0f1ecfaf6ec3c00e3a10dbebb08a man/zip_fopen_encrypted.3
|
||||
bf0254f0253ee098f770d3afdf6cbaf2 man/zip_fopen_encrypted.html
|
||||
6afefd4d1a35467069dd3b808e735fc4 man/zip_fopen_encrypted.man
|
||||
f21edcc370396b514b94d4eaa604905c man/zip_fread.3
|
||||
b0248a8e7b92efaba52d80459dcfd8c2 man/zip_fread.html
|
||||
b0a03949bed997236a58981a23e36b84 man/zip_fread.man
|
||||
5bd694a85d2dc21c9f1623012288b61d man/zip_fseek.3
|
||||
99abe355a1f5470d2c14f0e08dd64625 man/zip_fseek.html
|
||||
02c480aba599d3e79cd9e38a65b47829 man/zip_fseek.man
|
||||
2eeb9b42642ca6b3bcbcc8dac65f53a4 man/zip_ftell.3
|
||||
b73d962894dfff2296756b755033c58d man/zip_ftell.html
|
||||
d2d0a72f8d46b580be23f0bb762a078c man/zip_ftell.man
|
||||
3b2aee434752084774c2a72702120a1d man/zip_get_archive_comment.3
|
||||
3816dd1d97fb5d1c64aa9516e84ebfbb man/zip_get_archive_comment.html
|
||||
aaa4173e40fbc17981229dcfe6c5f204 man/zip_get_archive_comment.man
|
||||
7abcfcbaf617cb71fe32f276e1562347 man/zip_get_archive_flag.3
|
||||
5c02c35084e476bb92d2556d5fcb218e man/zip_get_archive_flag.html
|
||||
c55c7d93e16a9427b4911bfe2a22d42b man/zip_get_archive_flag.man
|
||||
a17b9d64e5005e6ef0cb416b4097bfe4 man/zip_get_error.3
|
||||
ff01adb6af5daad514207b6974f9a064 man/zip_get_error.html
|
||||
c0470c21995f62648980ae8788127b83 man/zip_get_error.man
|
||||
c04c60080b093051df8c66fbf3ff3938 man/zip_get_file_comment.3
|
||||
937dca7f39b6e89997c71d23185950a2 man/zip_get_file_comment.html
|
||||
921d65e87672074174e56176946e3cd8 man/zip_get_file_comment.man
|
||||
90cdced489b360fda30ab108aacb143a man/zip_get_name.3
|
||||
d71eef2d220cdeafb277479043a45d57 man/zip_get_name.html
|
||||
162cad6767f2e383652fa2b5a846ad32 man/zip_get_name.man
|
||||
89817348b21f405da1a8de81c7cd9d80 man/zip_get_num_entries.3
|
||||
a681e117cada11e65414645a442f7082 man/zip_get_num_entries.html
|
||||
61c0088de93892ff9fb9d8480c72e91f man/zip_get_num_entries.man
|
||||
588f486cc27d11234452aa9af6af7418 man/zip_get_num_files.3
|
||||
ce44b480050aef035abc713b9cc2fad9 man/zip_get_num_files.html
|
||||
7170270f2ec4e44f9cbe35fade04b218 man/zip_get_num_files.man
|
||||
2425ebb73bebaf899680fdc34f3ccc43 man/zip_libzip_version.3
|
||||
afd5d1f893a959f07759112a42e2f5ff man/zip_libzip_version.html
|
||||
e2424374811d6d9427ea218dd07cc121 man/zip_libzip_version.man
|
||||
3f04d1b17a656428d725fafe3620c4e5 man/zip_name_locate.3
|
||||
f75ccbc1c32917b6d228918a45de7952 man/zip_name_locate.html
|
||||
fdcb0caa7e9c59965d516f3410192566 man/zip_name_locate.man
|
||||
b6355123807c159ad2003209de9185e2 man/zip_open.3
|
||||
d8a38c4cf97a263e0f58814ea0d62608 man/zip_open.html
|
||||
3acc7cd72f10f92d5d18f5f450168300 man/zip_open.man
|
||||
9e8bf0beea93fc0184c8d2cd31164d5b man/zip_register_cancel_callback_with_state.3
|
||||
c60ea6e3db77863d44a5cb461039bf98 man/zip_register_cancel_callback_with_state.html
|
||||
7887dc19309d7a74f979c2f6eb3fc579 man/zip_register_cancel_callback_with_state.man
|
||||
0d0f662a406323d2508fb351f8407907 man/zip_register_progress_callback.3
|
||||
f5c7fdfc4b24c6eba8ce5417d401a3f1 man/zip_register_progress_callback.html
|
||||
0093e65f5cf81685fed89d8844535013 man/zip_register_progress_callback.man
|
||||
c3044f0509aea200eb849b1872a91d21 man/zip_register_progress_callback_with_state.3
|
||||
1d6769f867fdde788b41d91c9e5933bf man/zip_register_progress_callback_with_state.html
|
||||
bbb87f5379837f32fde31e0efe546821 man/zip_register_progress_callback_with_state.man
|
||||
aaae480df7a76e473634be19a4268b42 man/zip_rename.3
|
||||
4e2cb263e2edb15f209468bfd87977f6 man/zip_rename.html
|
||||
d8f6a59f1aa00f397be41bdca0437da6 man/zip_rename.man
|
||||
bd863a689a782a887f8c59d97155589e man/zip_set_archive_comment.3
|
||||
5dddb5f511761b2cbc5b1abed9aeb23c man/zip_set_archive_comment.html
|
||||
2810299df9fb34af1920df3dd1ecf09f man/zip_set_archive_comment.man
|
||||
e62145c1b446f79d9fa601b6f70edebd man/zip_set_archive_flag.3
|
||||
c9c0830a531f966b681b84553eccffdc man/zip_set_archive_flag.html
|
||||
f2556d5278b5d2d031c3ed20574a8901 man/zip_set_archive_flag.man
|
||||
54fcefbbc31e6d5806a80aa90d30e480 man/zip_set_default_password.3
|
||||
8fd1ce5ef877e4c0c76f70431ac850a4 man/zip_set_default_password.html
|
||||
30984467b6fb53cd37261109affe2caa man/zip_set_default_password.man
|
||||
b86f8fe26ec033fe66014dc9234f0c5c man/zip_set_file_comment.3
|
||||
cd974bf3e748e239e974dccab27d5cc8 man/zip_set_file_comment.html
|
||||
6ddbfd73b251111e749611eb0cf382fa man/zip_set_file_comment.man
|
||||
59db870679dda4761277fa3d781f2cb0 man/zip_set_file_compression.3
|
||||
f0496874c3f266fb933808016f40ba7b man/zip_set_file_compression.html
|
||||
6a446cdc0efa7f9c54921d71ef1de4dd man/zip_set_file_compression.man
|
||||
ae3a0ff79727afe83b8b21417f595abd man/zip_source.3
|
||||
add7c3b66b1161ebd2a44f2a73189a1b man/zip_source.html
|
||||
e8da3d1d0dc86b2d6ff830c9a513da72 man/zip_source.man
|
||||
e0413a2558ac2144e146fccc5d37854a man/zip_source_begin_write.3
|
||||
b9425034328f68350586230d45b2430c man/zip_source_begin_write.html
|
||||
a82177023a8650e0a4dba947a22e5469 man/zip_source_begin_write.man
|
||||
91113bc75bee538369f6d0e074432b9a man/zip_source_buffer.3
|
||||
95e3e3b82429a4c570aa89925563121e man/zip_source_buffer.html
|
||||
752b5c58a794944057826f31a5240663 man/zip_source_buffer.man
|
||||
83af792dc37964f3549695f4088821f9 man/zip_source_buffer_fragment.3
|
||||
2ecd9d4754995d865c7b72accfea99d9 man/zip_source_buffer_fragment.html
|
||||
00f764e111dcb3b62e6880b9251c69eb man/zip_source_buffer_fragment.man
|
||||
10c937eafdb8ffbb2b21e3551b6d25c6 man/zip_source_close.3
|
||||
4478ef881b32b1d86bb1cf338ac620ff man/zip_source_close.html
|
||||
520fd6ee47133d27ddbb70e52de0602c man/zip_source_close.man
|
||||
946d7b3784a77bde0bf691d5a3013945 man/zip_source_commit_write.3
|
||||
def67301615520dda9f4dc568042bc09 man/zip_source_commit_write.html
|
||||
a4d41b7ffd42279ee3fc14738154d7af man/zip_source_commit_write.man
|
||||
1477842d2d6b68cff1e2496cacb30f2d man/zip_source_error.3
|
||||
2156c72f4de0f63079b3014f564cd9ee man/zip_source_error.html
|
||||
5e29bc7c509d5bf8edb4778534fea206 man/zip_source_error.man
|
||||
51bba96f9177499da725b3391144490c man/zip_source_file.3
|
||||
4d855ae1ce404591ac77a77bd13fa1ae man/zip_source_file.html
|
||||
4c06ffb2d7cfeeae64298b9be4189042 man/zip_source_file.man
|
||||
85d60252a12865a9d1cf372e8ddc116f man/zip_source_filep.3
|
||||
7dc4ddd1d8fb8c31619f2c1afe528828 man/zip_source_filep.html
|
||||
3060a1e9a88d7cb75480caf03da58923 man/zip_source_filep.man
|
||||
ba2371763698fc7a28e9b647fc0460f0 man/zip_source_free.3
|
||||
0537950e9ce14b77c503be2674301cc6 man/zip_source_free.html
|
||||
bb305b6799ff957dda51bc6b87c28973 man/zip_source_free.man
|
||||
4dbfd5341fcb6f29647cc6f1f8396900 man/zip_source_function.3
|
||||
47da973de0cc944abe3012c870124c67 man/zip_source_function.html
|
||||
ec0fce03599b9ee22c7ed90476d47dd5 man/zip_source_function.man
|
||||
d44cbec10a35995d4937016eb5b37e87 man/zip_source_is_deleted.3
|
||||
642e3c3456a26644a4c09c360354810c man/zip_source_is_deleted.html
|
||||
479bffe9e356958b9a6926152ebb510c man/zip_source_is_deleted.man
|
||||
e20e60e29944fc5875f984706bf958ca man/zip_source_is_seekable.3
|
||||
821aa59b632684fd5d1a5eb6fe92b2d0 man/zip_source_is_seekable.html
|
||||
57f836064e02a6a20fda3e2fb6bd99bf man/zip_source_is_seekable.man
|
||||
7f2d4f6d3dfc3cd4c07f6c8f169316b8 man/zip_source_keep.3
|
||||
8f69112d11dee9bedae0d0c93a8be3c2 man/zip_source_keep.html
|
||||
782a5e4822adb395af2f993021637d51 man/zip_source_keep.man
|
||||
aa78734a998df4e68e2ae20bd3fee61d man/zip_source_layered.3
|
||||
96c4f8f035cfb9ade5110e0a0e55a287 man/zip_source_layered.html
|
||||
99cd96d25355d5bdb9c9a1066eafe9d6 man/zip_source_layered.man
|
||||
7285f7ed4a2b65ae363d3dd982abaf97 man/zip_source_make_command_bitmap.3
|
||||
2da74d06580a4cc2bd342f3ce269dbe0 man/zip_source_make_command_bitmap.html
|
||||
4c3d752cfffa9e5332b4dc9b093fedd3 man/zip_source_make_command_bitmap.man
|
||||
0a8c1b38dc721d19298b286374034640 man/zip_source_open.3
|
||||
b8809b73e7c4558c33e4df4c0b909d75 man/zip_source_open.html
|
||||
c9ba8c8753dab04c8b1bd94e187ae92b man/zip_source_open.man
|
||||
8e5342bb18cf7a112d56097229cf7165 man/zip_source_read.3
|
||||
c21dc49ae87579616edc0204034358eb man/zip_source_read.html
|
||||
1e37a53b0d910f572f9fe890ae65ac8c man/zip_source_read.man
|
||||
27f6839f4b756e4abe570bd0e714029a man/zip_source_rollback_write.3
|
||||
3ef1fb8233ff3cc7e3c3e993e2d83333 man/zip_source_rollback_write.html
|
||||
4d114d1a9b1497d34c92e946e0915b8a man/zip_source_rollback_write.man
|
||||
1a380a824745648ed37ad9bc14b0edd2 man/zip_source_seek.3
|
||||
d7ef841daea9504b4b0f36725ed3fa45 man/zip_source_seek.html
|
||||
4c2a024ea0444c5a0e51041eca7a1e25 man/zip_source_seek.man
|
||||
7e1c252aab5caeacf25a8a0d49808da0 man/zip_source_seek_compute_offset.3
|
||||
b73cc54ac3e1bad0db4cf145d00d33a8 man/zip_source_seek_compute_offset.html
|
||||
f3fb15e7d30849c3dbe268d8a7f0c46e man/zip_source_seek_compute_offset.man
|
||||
2c0441a3cd69a3f1841aa66aadd89bec man/zip_source_seek_write.3
|
||||
a78c9a8de236c64502135b9e81c6f60d man/zip_source_seek_write.html
|
||||
696dc86eecdca2a1fe88a6d037dc0903 man/zip_source_seek_write.man
|
||||
9793a8d3251b8e67479f62475ebca6e7 man/zip_source_stat.3
|
||||
1fdd397f2f3150a2cc4c57066b218ebf man/zip_source_stat.html
|
||||
7064bc1c1f4731330d00bf7eebe8a9ae man/zip_source_stat.man
|
||||
a152d4f908dba7f5be7c9d6f9911e11e man/zip_source_tell.3
|
||||
23808f0272b6147fd268d78906ade152 man/zip_source_tell.html
|
||||
64a7c39b656a853a3b9e5acabac5c291 man/zip_source_tell.man
|
||||
ac02d18ae6f01537e14676bd195531a9 man/zip_source_tell_write.3
|
||||
ea0ff3a4eb0b327ed1c8fe4547ea6f38 man/zip_source_tell_write.html
|
||||
9f3a9f522c473662dfb86c83cce08966 man/zip_source_tell_write.man
|
||||
b98dfedd043a50e8cb96d8764a5c5b78 man/zip_source_win32a.3
|
||||
626b5bb229bb031ce3b99ece293f93a6 man/zip_source_win32a.html
|
||||
f6d9264140db79f0170113de9c8b55e8 man/zip_source_win32a.man
|
||||
891ff4708b88131cbdea911e776b7a54 man/zip_source_win32handle.3
|
||||
d24024cbb46faa1f4da9cd442a0d8362 man/zip_source_win32handle.html
|
||||
912de020c1d58528bca0ef0bbecf6c9a man/zip_source_win32handle.man
|
||||
d8ac1b191a4f14f443247ab64c201c66 man/zip_source_win32w.3
|
||||
2716abe5efd61230a2f1542f43ad70b6 man/zip_source_win32w.html
|
||||
950ab82a2fe37087c34774db089e3d99 man/zip_source_win32w.man
|
||||
03550611ce3629acc8d097a5bbe06c98 man/zip_source_window_create.3
|
||||
a20e3462fb22aa17d0c8ae2d5b5f70ee man/zip_source_window_create.html
|
||||
644a8eb996950aad0dc059e5ffdc5285 man/zip_source_window_create.man
|
||||
042ce586ec3f4241dcd138c3ca058f58 man/zip_source_write.3
|
||||
a30b1f83ae1e991e1bedf05c965346bc man/zip_source_write.html
|
||||
4de2e7af74db76a71cbed0d6b28b5af0 man/zip_source_write.man
|
||||
ac8b50d248b458981214caf687bbe980 man/zip_source_zip.3
|
||||
0175fb4f814f12baed55a1b18f832f45 man/zip_source_zip.html
|
||||
a44a3c5bdedb62047e69c7b29b181d9c man/zip_source_zip.man
|
||||
5183f855dffbea9b2f18e3fe49f0ff0d man/zip_source_zip_file.3
|
||||
8c62774132656aef2ce10849fb3eb933 man/zip_source_zip_file.html
|
||||
67bd970e3997af7600f56d36eab68a14 man/zip_source_zip_file.man
|
||||
7b1cb628704acecb18c351143eb88b4a man/zip_stat.3
|
||||
913e7269347a85de88476ba253fb2844 man/zip_stat.html
|
||||
74ca748c4879aa04c7af78921e031024 man/zip_stat.man
|
||||
c6344020ab0f86434b3a644d07fd3b17 man/zip_stat_init.3
|
||||
26cb7bb3d459c7280196866df43b02b0 man/zip_stat_init.html
|
||||
5af4a860ee9a38415fe2a43e8c57fabc man/zip_stat_init.man
|
||||
a38c818d1d96cd49304cc6c71ee8f7aa man/zip_unchange.3
|
||||
d3e596aeef2d8fb1ec0b2ccfe10cee41 man/zip_unchange.html
|
||||
3cad0fc26336abe29405f74c6bbc70b5 man/zip_unchange.man
|
||||
e8487c5515b0b9e2e2e58293ed0e24bd man/zip_unchange_all.3
|
||||
f4deced7b7e4ec288d2a1b140d354983 man/zip_unchange_all.html
|
||||
a1cc2a9a8a5dfaaa6100aa3d5a240c90 man/zip_unchange_all.man
|
||||
1ba5ccbae608caee379aed02e9e4749d man/zip_unchange_archive.3
|
||||
14890fc68fdf63b20e842e8413ac28d9 man/zip_unchange_archive.html
|
||||
b7bfe339e0155ce2767f4da306a5532a man/zip_unchange_archive.man
|
||||
46e62c01c08734f0d2e12020919182dd man/zipcmp.1
|
||||
e15be517c1210d684c2f90e90777d46c man/zipcmp.html
|
||||
644605d026594ac61818c7198e0e98ae man/zipcmp.man
|
||||
3dd3e5ac99602e62f239afc86f7b7f36 man/zipmerge.1
|
||||
9f0722da1ffa82861698be3bd9c2825e man/zipmerge.html
|
||||
355a7d8a710ae3ae95c7dad5ace7312b man/zipmerge.man
|
||||
f0fa92e007957d83297fd3e5b901cc2f man/ziptool.1
|
||||
1f565dc36cbef96afd2e467b39eb7809 man/ziptool.html
|
||||
df359c96eb34e16c97b56b05bd6cece2 man/ziptool.man
|
||||
b8981b63665bad1e01674cb95066a3ec ossfuzz/CMakeFiles/list-fuzzers
|
||||
BIN
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT16_T_LIBZIP.bin
vendored
Executable file
46
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT16_T_LIBZIP.c
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
#undef KEY
|
||||
#if defined(__i386)
|
||||
# define KEY '_','_','i','3','8','6'
|
||||
#elif defined(__x86_64)
|
||||
# define KEY '_','_','x','8','6','_','6','4'
|
||||
#elif defined(__ppc__)
|
||||
# define KEY '_','_','p','p','c','_','_'
|
||||
#elif defined(__ppc64__)
|
||||
# define KEY '_','_','p','p','c','6','4','_','_'
|
||||
#elif defined(__aarch64__)
|
||||
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
|
||||
#elif defined(__ARM_ARCH_7A__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
|
||||
#elif defined(__ARM_ARCH_7S__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
|
||||
#endif
|
||||
|
||||
#define SIZE (sizeof(int16_t))
|
||||
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
|
||||
('0' + ((SIZE / 10000)%10)),
|
||||
('0' + ((SIZE / 1000)%10)),
|
||||
('0' + ((SIZE / 100)%10)),
|
||||
('0' + ((SIZE / 10)%10)),
|
||||
('0' + (SIZE % 10)),
|
||||
']',
|
||||
#ifdef KEY
|
||||
' ','k','e','y','[', KEY, ']',
|
||||
#endif
|
||||
'\0'};
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_size[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
BIN
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT32_T_LIBZIP.bin
vendored
Executable file
46
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT32_T_LIBZIP.c
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
#undef KEY
|
||||
#if defined(__i386)
|
||||
# define KEY '_','_','i','3','8','6'
|
||||
#elif defined(__x86_64)
|
||||
# define KEY '_','_','x','8','6','_','6','4'
|
||||
#elif defined(__ppc__)
|
||||
# define KEY '_','_','p','p','c','_','_'
|
||||
#elif defined(__ppc64__)
|
||||
# define KEY '_','_','p','p','c','6','4','_','_'
|
||||
#elif defined(__aarch64__)
|
||||
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
|
||||
#elif defined(__ARM_ARCH_7A__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
|
||||
#elif defined(__ARM_ARCH_7S__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
|
||||
#endif
|
||||
|
||||
#define SIZE (sizeof(int32_t))
|
||||
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
|
||||
('0' + ((SIZE / 10000)%10)),
|
||||
('0' + ((SIZE / 1000)%10)),
|
||||
('0' + ((SIZE / 100)%10)),
|
||||
('0' + ((SIZE / 10)%10)),
|
||||
('0' + (SIZE % 10)),
|
||||
']',
|
||||
#ifdef KEY
|
||||
' ','k','e','y','[', KEY, ']',
|
||||
#endif
|
||||
'\0'};
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_size[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
BIN
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT64_T_LIBZIP.bin
vendored
Executable file
46
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT64_T_LIBZIP.c
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
#undef KEY
|
||||
#if defined(__i386)
|
||||
# define KEY '_','_','i','3','8','6'
|
||||
#elif defined(__x86_64)
|
||||
# define KEY '_','_','x','8','6','_','6','4'
|
||||
#elif defined(__ppc__)
|
||||
# define KEY '_','_','p','p','c','_','_'
|
||||
#elif defined(__ppc64__)
|
||||
# define KEY '_','_','p','p','c','6','4','_','_'
|
||||
#elif defined(__aarch64__)
|
||||
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
|
||||
#elif defined(__ARM_ARCH_7A__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
|
||||
#elif defined(__ARM_ARCH_7S__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
|
||||
#endif
|
||||
|
||||
#define SIZE (sizeof(int64_t))
|
||||
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
|
||||
('0' + ((SIZE / 10000)%10)),
|
||||
('0' + ((SIZE / 1000)%10)),
|
||||
('0' + ((SIZE / 100)%10)),
|
||||
('0' + ((SIZE / 10)%10)),
|
||||
('0' + (SIZE % 10)),
|
||||
']',
|
||||
#ifdef KEY
|
||||
' ','k','e','y','[', KEY, ']',
|
||||
#endif
|
||||
'\0'};
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_size[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
BIN
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT8_T_LIBZIP.bin
vendored
Executable file
46
thirdparty/libzip-1.11.3/build-emcmake/CMakeFiles/CheckTypeSize/INT8_T_LIBZIP.c
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
#undef KEY
|
||||
#if defined(__i386)
|
||||
# define KEY '_','_','i','3','8','6'
|
||||
#elif defined(__x86_64)
|
||||
# define KEY '_','_','x','8','6','_','6','4'
|
||||
#elif defined(__ppc__)
|
||||
# define KEY '_','_','p','p','c','_','_'
|
||||
#elif defined(__ppc64__)
|
||||
# define KEY '_','_','p','p','c','6','4','_','_'
|
||||
#elif defined(__aarch64__)
|
||||
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
|
||||
#elif defined(__ARM_ARCH_7A__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
|
||||
#elif defined(__ARM_ARCH_7S__)
|
||||
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
|
||||
#endif
|
||||
|
||||
#define SIZE (sizeof(int8_t))
|
||||
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
|
||||
('0' + ((SIZE / 10000)%10)),
|
||||
('0' + ((SIZE / 1000)%10)),
|
||||
('0' + ((SIZE / 100)%10)),
|
||||
('0' + ((SIZE / 10)%10)),
|
||||
('0' + (SIZE % 10)),
|
||||
']',
|
||||
#ifdef KEY
|
||||
' ','k','e','y','[', KEY, ']',
|
||||
#endif
|
||||
'\0'};
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_size[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||