This commit is contained in:
xsl
2025-09-04 10:54:47 +08:00
commit 6bc8f61b18
1808 changed files with 208268 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
# Copyright (c) 2023-2025, Thomas Atkinson
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 the "License";
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
vkb__register_component(
NAME unix_platform
HEADERS
include/unix/context.hpp
SRC
src/context.cpp
src/entrypoint.cpp
LINK_LIBS
vkb__core
)
# attach to core
target_link_libraries(vkb__core INTERFACE vkb__unix_platform)
+37
View File
@@ -0,0 +1,37 @@
/* Copyright (c) 2023-2024, Thomas Atkinson
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <core/platform/context.hpp>
namespace vkb
{
/**
* @brief Unix platform context
*
* @warning Use in extreme circumstances with code guarded by the PLATFORM__UNIX define
*/
class UnixPlatformContext final : public PlatformContext
{
public:
UnixPlatformContext(int argc, char **argv);
~UnixPlatformContext() override = default;
};
} // namespace vkb
+36
View File
@@ -0,0 +1,36 @@
/* Copyright (c) 2023, Thomas Atkinson
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "unix/context.hpp"
namespace vkb
{
UnixPlatformContext::UnixPlatformContext(int argc, char **argv) :
PlatformContext{}
{
_arguments.reserve(argc);
for (int i = 1; i < argc; ++i)
{
_arguments.emplace_back(argv[i]);
}
const char *env_temp_dir = std::getenv("TMPDIR");
_temp_directory = env_temp_dir ? std::string(env_temp_dir) + "/" : "/tmp/";
_external_storage_directory = "";
}
} // namespace vkb
+25
View File
@@ -0,0 +1,25 @@
/* Copyright (c) 2023, Thomas Atkinson
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <core/platform/entrypoint.hpp>
#include "unix/context.hpp"
std::unique_ptr<vkb::PlatformContext> create_platform_context(int argc, char **argv)
{
return std::make_unique<vkb::UnixPlatformContext>(argc, argv);
}