Merge fixes
This commit is contained in:
parent
5567a39a65
commit
cee75dcc11
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include <Nazara/Audio.hpp>
|
||||
#include <Nazara/Core/Application.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Modules.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
|
@ -26,7 +27,7 @@ int main()
|
|||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Modules<Nz::Audio> audio;
|
||||
Nz::Application<Nz::Audio> app;
|
||||
|
||||
Nz::Sound sound;
|
||||
if (!sound.LoadFromFile(resourceDir / "Audio/siren.wav"))
|
||||
|
|
@ -54,31 +55,20 @@ int main()
|
|||
// On joue le son
|
||||
sound.Play();
|
||||
|
||||
// La boucle du programme (Pour déplacer le son)
|
||||
Nz::MillisecondClock clock;
|
||||
while (sound.GetStatus() == Nz::SoundStatus::Playing)
|
||||
app.AddUpdater([&](Nz::Time elapsedTime)
|
||||
{
|
||||
// Comme le son se joue dans un thread séparé, on peut mettre en pause le principal régulièrement
|
||||
Nz::Time sleepTime = Nz::Time::TickDuration(60) - clock.GetElapsedTime(); // 60 FPS
|
||||
|
||||
if (sleepTime > Nz::Time::Millisecond())
|
||||
std::this_thread::sleep_for(sleepTime.AsDuration<std::chrono::milliseconds>());
|
||||
if (sound.GetStatus() != Nz::SoundStatus::Playing)
|
||||
app.Quit();
|
||||
|
||||
// On bouge la source du son en fonction du temps depuis chaque mise à jour
|
||||
Nz::Vector3f pos = sound.GetPosition() + sound.GetVelocity() * clock.GetElapsedTime().AsSeconds();
|
||||
sound.SetPosition(pos);
|
||||
|
||||
std::cout << "Sound position: " << pos << std::endl;
|
||||
|
||||
// Si la position de la source atteint une certaine position, ou si l'utilisateur appuie sur echap
|
||||
if (pos.x > Nz::Vector3f::Left().x * -50.f || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Escape))
|
||||
sound.Stop(); // On arrête le son (Stoppant également la boucle)
|
||||
|
||||
clock.Restart();
|
||||
}
|
||||
// Si la position de la source atteint une certaine position, ou si l'utilisateur appuie sur echap
|
||||
if (pos.x > Nz::Vector3f::Left().x * -50.f || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Escape))
|
||||
sound.Stop(); // On arrête le son (Stoppant également la boucle)
|
||||
});
|
||||
|
||||
// La boucle du programme (Pour déplacer le son)
|
||||
|
||||
return 0;
|
||||
return app.Run();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
|
||||
#include <Nazara/Audio.hpp>
|
||||
#include <Nazara/Core/Application.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Modules.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
|
@ -22,7 +23,7 @@ int main()
|
|||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Modules<Nz::Audio> audio;
|
||||
Nz::Application<Nz::Audio> app;
|
||||
|
||||
Nz::SoundStreamParams streamParams;
|
||||
streamParams.forceMono = false;
|
||||
|
|
@ -41,13 +42,13 @@ int main()
|
|||
|
||||
std::cout << "Playing sound..." << std::endl;
|
||||
|
||||
Nz::Window window;
|
||||
|
||||
Nz::Clock clock;
|
||||
Nz::BasicMainloop(window, [&] {
|
||||
app.AddUpdater([&](Nz::Time /*elapsedTime*/)
|
||||
{
|
||||
if (!music.IsPlaying())
|
||||
app.Quit();
|
||||
});
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return app.Run();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ end
|
|||
target("Showcase")
|
||||
set_group("Examples")
|
||||
set_kind("binary")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraPhysics2D", "NazaraWidgets")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraPhysics2D", "NazaraPhysics3D", "NazaraWidgets")
|
||||
if has_config("embed_plugins") then
|
||||
add_deps("PluginAssimp")
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/ApplicationBase.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#ifdef NAZARA_PLATFORM_WEB
|
||||
#include <emscripten/html5.h>
|
||||
#endif
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
@ -17,11 +21,30 @@ namespace Nz
|
|||
// Ignore time between creation and Run() call
|
||||
m_clock.Restart();
|
||||
|
||||
#ifndef NAZARA_PLATFORM_WEB
|
||||
while (m_running)
|
||||
{
|
||||
Time elapsedTime = m_clock.Restart();
|
||||
Update(elapsedTime);
|
||||
}
|
||||
#else
|
||||
emscripten_set_main_loop_arg([](void* application)
|
||||
{
|
||||
ApplicationBase* app = static_cast<ApplicationBase*>(application);
|
||||
if (!app->m_running)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Time elapsedTime = app->m_clock.Restart();
|
||||
app->Update(elapsedTime);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(e.what());
|
||||
}
|
||||
}, this, 0, 1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ int main()
|
|||
if (!frame)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
framePipeline.GetDebugDrawer().DrawLine(Nz::Vector3f::Zero(), Nz::Vector3f::Forward(), Nz::Color::Blue());
|
||||
|
|
@ -225,7 +225,7 @@ int main()
|
|||
Nz::Boxf aabb = model.GetAABB();
|
||||
aabb.Transform(worldInstance->GetWorldMatrix());
|
||||
|
||||
framePipeline.GetDebugDrawer().DrawBox(aabb, Nz::Color::Green);
|
||||
framePipeline.GetDebugDrawer().DrawBox(aabb, Nz::Color::Green());
|
||||
}
|
||||
|
||||
viewerInstance.UpdateViewMatrix(Nz::Matrix4f::TransformInverse(viewerPos, camAngles));
|
||||
|
|
@ -243,7 +243,7 @@ int main()
|
|||
window.SetTitle(windowTitle + " - " + Nz::NumberToString(fps) + " FPS");
|
||||
fps = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
diff --git a/include/assimp/defs.h b/include/assimp/defs.h
|
||||
index 05a5e3fd4..8b90edfca 100644
|
||||
--- a/include/assimp/defs.h
|
||||
+++ b/include/assimp/defs.h
|
||||
@@ -126,7 +126,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* GENBOUNDINGBOXES */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-#ifdef _MSC_VER
|
||||
+#ifdef _WIN32
|
||||
# undef ASSIMP_API
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -135,7 +135,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ifdef ASSIMP_BUILD_DLL_EXPORT
|
||||
# define ASSIMP_API __declspec(dllexport)
|
||||
# define ASSIMP_API_WINONLY __declspec(dllexport)
|
||||
-# pragma warning (disable : 4251)
|
||||
+# ifdef _MSC_VER
|
||||
+# pragma warning (disable : 4251)
|
||||
+# endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
|
||||
@@ -149,6 +151,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# define ASSIMP_API_WINONLY
|
||||
# endif
|
||||
|
||||
+# ifdef _MSC_VER
|
||||
+
|
||||
/* Force the compiler to inline a function, if possible
|
||||
*/
|
||||
# define AI_FORCE_INLINE __forceinline
|
||||
@@ -157,6 +161,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* to skip dead paths (e.g. after an assertion evaluated to false). */
|
||||
# define AI_WONT_RETURN __declspec(noreturn)
|
||||
|
||||
+# else
|
||||
+
|
||||
+# define AI_FORCE_INLINE inline
|
||||
+# define AI_WONT_RETURN
|
||||
+
|
||||
+# endif
|
||||
+
|
||||
#elif defined(SWIG)
|
||||
|
||||
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
|
||||
@@ -170,7 +181,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# define AI_FORCE_INLINE inline
|
||||
#endif // (defined _MSC_VER)
|
||||
|
||||
-#ifdef __GNUC__
|
||||
+#if defined(__GNUC__) || defined(__MINGW32__)
|
||||
# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
|
||||
#else
|
||||
# define AI_WONT_RETURN_SUFFIX
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
diff --git a/code/Common/ZipArchiveIOSystem.cpp b/code/Common/ZipArchiveIOSystem.cpp
|
||||
index e0c9883d2..c748b3255 100644
|
||||
--- a/code/Common/ZipArchiveIOSystem.cpp
|
||||
+++ b/code/Common/ZipArchiveIOSystem.cpp
|
||||
@@ -196,7 +196,9 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) {
|
||||
zlib_filefunc_def mapping;
|
||||
|
||||
mapping.zopen_file = (open_file_func)open;
|
||||
+#ifdef ZOPENDISK64
|
||||
mapping.zopendisk_file = (opendisk_file_func)opendisk;
|
||||
+#endif
|
||||
mapping.zread_file = (read_file_func)read;
|
||||
mapping.zwrite_file = (write_file_func)write;
|
||||
mapping.ztell_file = (tell_file_func)tell;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f48391edf..66f7b726d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -155,22 +155,6 @@ IF (WIN32)
|
||||
# "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users
|
||||
# a choice to opt for the shared runtime if they want.
|
||||
option(USE_STATIC_CRT "Link against the static runtime libraries." OFF)
|
||||
-
|
||||
- # The CMAKE_CXX_FLAGS vars can be overriden by some Visual Studio generators, so we use an alternative
|
||||
- # global method here:
|
||||
- if (${USE_STATIC_CRT})
|
||||
- add_compile_options(
|
||||
- $<$<CONFIG:>:/MT>
|
||||
- $<$<CONFIG:Debug>:/MTd>
|
||||
- $<$<CONFIG:Release>:/MT>
|
||||
- )
|
||||
- else()
|
||||
- add_compile_options(
|
||||
- $<$<CONFIG:>:/MD>
|
||||
- $<$<CONFIG:Debug>:/MDd>
|
||||
- $<$<CONFIG:Release>:/MD>
|
||||
- )
|
||||
- endif()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
diff --git a/code/Common/DefaultIOStream.cpp b/code/Common/DefaultIOStream.cpp
|
||||
index e30f26acd3..17fc44f9a2 100644
|
||||
--- a/code/Common/DefaultIOStream.cpp
|
||||
+++ b/code/Common/DefaultIOStream.cpp
|
||||
@@ -63,7 +63,7 @@ inline int select_fseek(FILE *file, int64_t offset, int origin) {
|
||||
|
||||
|
||||
|
||||
-#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||
+#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||
template <>
|
||||
inline size_t select_ftell<8>(FILE *file) {
|
||||
return (size_t)::_ftelli64(file);
|
||||
@@ -149,7 +149,7 @@ size_t DefaultIOStream::FileSize() const {
|
||||
//
|
||||
// See here for details:
|
||||
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
|
||||
-#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||
+#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||
struct __stat64 fileStat;
|
||||
//using fileno + fstat avoids having to handle the filename
|
||||
int err = _fstat64(_fileno(mFile), &fileStat);
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
package("assimp")
|
||||
|
||||
set_homepage("https://assimp.org")
|
||||
set_description("Portable Open-Source library to import various well-known 3D model formats in a uniform manner")
|
||||
set_license("BSD-3-Clause")
|
||||
|
||||
set_urls("https://github.com/assimp/assimp/archive/$(version).zip",
|
||||
"https://github.com/assimp/assimp.git")
|
||||
add_versions("v5.2.5", "5384877d53be7b5bbf50c26ab3f054bec91b3df8614372dcd7240f44f61c509b")
|
||||
add_versions("v5.2.4", "713e9aa035ae019e5f3f0de1605de308d63538897249a2ba3a2d7d40036ad2b1")
|
||||
add_versions("v5.2.3", "9667cfc8ddabd5dd5e83f3aebb99dbf232fce99f17b9fe59540dccbb5e347393")
|
||||
add_versions("v5.2.2", "7b833182b89917b3c6e8aee6432b74870fb71f432cc34aec5f5411bd6b56c1b5")
|
||||
add_versions("v5.2.1", "636fe5c2cfe925b559b5d89e53a42412a2d2ab49a0712b7d655d1b84c51ed504")
|
||||
add_versions("v5.1.4", "59a00cf72fa5ceff960460677e2b37be5cd1041e85bae9c02828c27ade7e4160")
|
||||
add_versions("v5.0.1", "d10542c95e3e05dece4d97bb273eba2dfeeedb37a78fb3417fd4d5e94d879192")
|
||||
|
||||
add_patches("v5.0.1", path.join(os.scriptdir(), "patches", "5.0.1", "fix-mingw.patch"), "a3375489e2bbb2dd97f59be7dd84e005e7e9c628b4395d7022a6187ca66b5abb")
|
||||
add_patches("v5.2.1", path.join(os.scriptdir(), "patches", "5.2.1", "fix_zlib_filefunc_def.patch"), "a9f8a9aa1975888ea751b80c8268296dee901288011eeb1addf518eac40b71b1")
|
||||
add_patches("v5.2.2", path.join(os.scriptdir(), "patches", "5.2.1", "fix_zlib_filefunc_def.patch"), "a9f8a9aa1975888ea751b80c8268296dee901288011eeb1addf518eac40b71b1")
|
||||
add_patches("v5.2.3", path.join(os.scriptdir(), "patches", "5.2.1", "fix_zlib_filefunc_def.patch"), "a9f8a9aa1975888ea751b80c8268296dee901288011eeb1addf518eac40b71b1")
|
||||
add_patches("v5.2.3", path.join(os.scriptdir(), "patches", "5.2.3", "cmake_static_crt.patch"), "3872a69976055bed9e40814e89a24a3420692885b50e9f9438036e8d809aafb4")
|
||||
add_patches("v5.2.4", path.join(os.scriptdir(), "patches", "5.2.4", "fix_x86_windows_build.patch"), "becb4039c220678cf1e888e3479f8e68d1964c49d58f14c5d247c86b4a5c3293")
|
||||
|
||||
if not is_host("windows") then
|
||||
add_extsources("pkgconfig::assimp")
|
||||
end
|
||||
|
||||
if is_plat("mingw") and is_subhost("msys") then
|
||||
add_extsources("pacman::assimp")
|
||||
elseif is_plat("linux") then
|
||||
add_extsources("pacman::assimp", "apt::libassimp-dev")
|
||||
elseif is_plat("macosx") then
|
||||
add_extsources("brew::assimp")
|
||||
end
|
||||
|
||||
add_configs("build_tools", {description = "Build the supplementary tools for Assimp.", default = false, type = "boolean"})
|
||||
add_configs("double_precision", {description = "Enable double precision processing.", default = false, type = "boolean"})
|
||||
add_configs("no_export", {description = "Disable Assimp's export functionality (reduces library size).", default = false, type = "boolean"})
|
||||
add_configs("android_jniiosysystem", {description = "Enable Android JNI IOSystem support.", default = false, type = "boolean"})
|
||||
add_configs("asan", {description = "Enable AddressSanitizer.", default = false, type = "boolean"})
|
||||
add_configs("ubsan", {description = "Enable Undefined Behavior sanitizer.", default = false, type = "boolean"})
|
||||
|
||||
add_deps("cmake", "zlib")
|
||||
|
||||
if is_plat("windows") then
|
||||
add_syslinks("advapi32")
|
||||
end
|
||||
|
||||
on_load(function (package)
|
||||
if not package:gitref() and package:version():le("5.1.0") then
|
||||
package:add("deps", "irrxml")
|
||||
end
|
||||
if package:is_plat("linux", "macosx") and package:config("shared") then
|
||||
package:add("links", "assimp")
|
||||
end
|
||||
end)
|
||||
|
||||
on_install("windows", "linux", "macosx", "mingw", "wasm", function (package)
|
||||
local configs = {"-DASSIMP_BUILD_SAMPLES=OFF",
|
||||
"-DASSIMP_BUILD_TESTS=OFF",
|
||||
"-DASSIMP_BUILD_DOCS=OFF",
|
||||
"-DASSIMP_BUILD_FRAMEWORK=OFF",
|
||||
"-DASSIMP_INSTALL_PDB=ON",
|
||||
"-DASSIMP_INJECT_DEBUG_POSTFIX=ON",
|
||||
"-DASSIMP_BUILD_ZLIB=ON",
|
||||
"-DSYSTEM_IRRXML=ON",
|
||||
"-DASSIMP_WARNINGS_AS_ERRORS=OFF"}
|
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
|
||||
|
||||
local function add_config_arg(config_name, cmake_name)
|
||||
table.insert(configs, "-D" .. cmake_name .. "=" .. (package:config(config_name) and "ON" or "OFF"))
|
||||
end
|
||||
add_config_arg("shared", "BUILD_SHARED_LIBS")
|
||||
add_config_arg("double_precision", "ASSIMP_DOUBLE_PRECISION")
|
||||
add_config_arg("no_export", "ASSIMP_NO_EXPORT")
|
||||
add_config_arg("asan", "ASSIMP_ASAN")
|
||||
add_config_arg("ubsan", "ASSIMP_UBSAN")
|
||||
|
||||
if package:is_plat("android") then
|
||||
add_config_arg("android_jniiosysystem", "ASSIMP_ANDROID_JNIIOSYSTEM")
|
||||
end
|
||||
if package:is_plat("windows", "linux", "macosx", "mingw") then
|
||||
add_config_arg("build_tools", "ASSIMP_BUILD_ASSIMP_TOOLS")
|
||||
else
|
||||
table.insert(configs, "-DASSIMP_BUILD_ASSIMP_TOOLS=OFF")
|
||||
end
|
||||
|
||||
if not package:gitref() and package:version():lt("v5.2.4") then
|
||||
-- ASSIMP_WARNINGS_AS_ERRORS is not supported before v5.2.4
|
||||
if package:is_plat("windows") then
|
||||
io.replace("code/CMakeLists.txt", "TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX)", "", {plain = true})
|
||||
else
|
||||
io.replace("code/CMakeLists.txt", "TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)", "", {plain = true})
|
||||
end
|
||||
end
|
||||
if package:is_plat("mingw") and package:version():lt("v5.1.5") then
|
||||
-- CMAKE_COMPILER_IS_MINGW has been removed: https://github.com/assimp/assimp/pull/4311
|
||||
io.replace("CMakeLists.txt", "CMAKE_COMPILER_IS_MINGW", "MINGW", {plain = true})
|
||||
end
|
||||
|
||||
import("package.tools.cmake").install(package, configs)
|
||||
|
||||
-- copy pdb
|
||||
if package:is_plat("windows") then
|
||||
if package:config("shared") then
|
||||
os.trycp(path.join(package:buildir(), "bin", "**.pdb"), package:installdir("bin"))
|
||||
else
|
||||
os.trycp(path.join(package:buildir(), "lib", "**.pdb"), package:installdir("lib"))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
assert(package:check_cxxsnippets({test = [[
|
||||
#include <cassert>
|
||||
void test() {
|
||||
Assimp::Importer importer;
|
||||
}
|
||||
]]}, {configs = {languages = "c++11"}, includes = "assimp/Importer.hpp"}))
|
||||
end)
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
add_rules("mode.debug", "mode.release")
|
||||
|
||||
option("enable_tools")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
|
||||
target("bz2")
|
||||
set_kind("$(kind)")
|
||||
set_languages("c89")
|
||||
add_headerfiles("bzlib.h")
|
||||
add_files("blocksort.c")
|
||||
add_files("bzlib.c")
|
||||
add_files("compress.c")
|
||||
add_files("crctable.c")
|
||||
add_files("decompress.c")
|
||||
add_files("huffman.c")
|
||||
add_files("randtable.c")
|
||||
if is_plat("windows") and is_kind("shared") then
|
||||
set_filename("libbz2.dll")
|
||||
add_files("libbz2.def")
|
||||
end
|
||||
if is_plat("wasm") then
|
||||
add_defines("BZ_STRICT_ANSI")
|
||||
end
|
||||
|
||||
if has_config("enable_tools") then
|
||||
|
||||
target("bzip2")
|
||||
set_kind("binary")
|
||||
add_deps("bz2")
|
||||
add_files("bzip2.c")
|
||||
|
||||
after_install(function (target)
|
||||
-- copy/link additional executables/scripts (behavior is altered by checking the program name)
|
||||
if target:is_plat("windows", "mingw") then
|
||||
local binarydir = path.join(target:installdir(), "bin")
|
||||
os.vcp(path.join(binarydir, "bzip2.exe"), path.join(binarydir, "bzcat.exe"))
|
||||
os.vcp(path.join(binarydir, "bzip2.exe"), path.join(binarydir, "bunzip2.exe"))
|
||||
else
|
||||
local binarydir = path.join(target:installdir(), "bin")
|
||||
os.ln(path.join(binarydir, "bzip2"), path.join(binarydir, "bzcat"))
|
||||
os.ln(path.join(binarydir, "bzip2"), path.join(binarydir, "bunzip2"))
|
||||
|
||||
-- copy shell scripts
|
||||
os.vcp("bzdiff", binarydir)
|
||||
os.vcp("bzgrep", binarydir)
|
||||
os.vcp("bzmore", binarydir)
|
||||
|
||||
-- and renamed copies
|
||||
os.ln(path.join(binarydir, "bzdiff"), path.join(binarydir, "bzcmp"))
|
||||
|
||||
os.ln(path.join(binarydir, "bzgrep"), path.join(binarydir, "bzegrep"))
|
||||
os.ln(path.join(binarydir, "bzgrep"), path.join(binarydir, "bzfgrep"))
|
||||
|
||||
os.ln(path.join(binarydir, "bzmore"), path.join(binarydir, "bzless"))
|
||||
end
|
||||
end)
|
||||
|
||||
target("bzip2recover")
|
||||
set_kind("binary")
|
||||
add_deps("bz2")
|
||||
add_files("bzip2recover.c")
|
||||
|
||||
end
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package("bzip2")
|
||||
|
||||
set_homepage("https://sourceware.org/bzip2/")
|
||||
set_description("Freely available, patent free, high-quality data compressor.")
|
||||
|
||||
add_urls("https://sourceware.org/pub/bzip2/bzip2-$(version).tar.gz")
|
||||
add_versions("1.0.8", "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269")
|
||||
|
||||
if is_plat("mingw") and is_subhost("msys") then
|
||||
add_extsources("pacman::bzip2")
|
||||
elseif is_plat("linux") then
|
||||
add_extsources("pacman::bzip2", "apt::libbz2-dev")
|
||||
elseif is_plat("macosx") then
|
||||
add_extsources("brew::bzip2")
|
||||
end
|
||||
|
||||
on_install("linux", "macosx", "windows", "android", "iphoneos", "cross", "bsd", "mingw", "wasm", function (package)
|
||||
local configs = {}
|
||||
if not package:is_plat("cross", "iphoneos", "android", "wasm") then
|
||||
configs.enable_tools = true
|
||||
package:addenv("PATH", "bin")
|
||||
end
|
||||
|
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
|
||||
import("package.tools.xmake").install(package, configs)
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
if not package:is_plat("cross", "iphoneos", "android", "wasm") then
|
||||
os.vrun("bunzip2 --help")
|
||||
os.vrun("bzcat --help")
|
||||
os.vrun("bzip2 --help")
|
||||
end
|
||||
|
||||
assert(package:has_cfuncs("BZ2_bzCompressInit", {includes = "bzlib.h"}))
|
||||
end)
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
package("libpng")
|
||||
|
||||
set_homepage("http://www.libpng.org/pub/png/libpng.html")
|
||||
set_description("The official PNG reference library")
|
||||
set_license("libpng-2.0")
|
||||
|
||||
set_urls("https://github.com/glennrp/libpng/archive/$(version).zip",
|
||||
"https://github.com/glennrp/libpng.git")
|
||||
add_versions("v1.6.37", "c2c50c13a727af73ecd3fc0167d78592cf5e0bca9611058ca414b6493339c784")
|
||||
add_versions("v1.6.36", "6274d3f761cc80f7f6e2cde6c07bed10c00bc4ddd24c4f86e25eb51affa1664d")
|
||||
add_versions("v1.6.35", "3d22d46c566b1761a0e15ea397589b3a5f36ac09b7c785382e6470156c04247f")
|
||||
add_versions("v1.6.34", "7ffa5eb8f9f3ed23cf107042e5fec28699718916668bbce48b968600475208d3")
|
||||
|
||||
add_deps("zlib")
|
||||
|
||||
if is_plat("linux") then
|
||||
add_syslinks("m")
|
||||
end
|
||||
|
||||
if is_plat("mingw") and is_subhost("msys") then
|
||||
add_extsources("pacman::libpng")
|
||||
elseif is_plat("linux") then
|
||||
add_extsources("pacman::libpng", "apt::libpng-dev")
|
||||
elseif is_plat("macosx") then
|
||||
add_extsources("brew::libpng")
|
||||
end
|
||||
|
||||
on_install("windows", "mingw", "android", "iphoneos", "cross", "bsd", "wasm", function (package)
|
||||
io.writefile("xmake.lua", [[
|
||||
add_rules("mode.debug", "mode.release")
|
||||
add_requires("zlib")
|
||||
target("png")
|
||||
set_kind("$(kind)")
|
||||
add_files("*.c|example.c|pngtest.c")
|
||||
if is_arch("x86", "x64", "i386", "x86_64") then
|
||||
add_files("intel/*.c")
|
||||
add_defines("PNG_INTEL_SSE_OPT=1")
|
||||
add_vectorexts("sse", "sse2")
|
||||
elseif is_arch("arm.*") then
|
||||
add_files("arm/*.c")
|
||||
if is_plat("windows") then
|
||||
add_defines("PNG_ARM_NEON_OPT=1")
|
||||
add_defines("PNG_ARM_NEON_IMPLEMENTATION=1")
|
||||
else
|
||||
add_files("arm/*.S")
|
||||
add_defines("PNG_ARM_NEON_OPT=2")
|
||||
end
|
||||
elseif is_arch("mips.*") then
|
||||
add_files("mips/*.c")
|
||||
add_defines("PNG_MIPS_MSA_OPT=2")
|
||||
elseif is_arch("ppc.*") then
|
||||
add_files("powerpc/*.c")
|
||||
add_defines("PNG_POWERPC_VSX_OPT=2")
|
||||
end
|
||||
add_headerfiles("*.h")
|
||||
add_packages("zlib")
|
||||
if is_kind("shared") and is_plat("windows") then
|
||||
add_defines("PNG_BUILD_DLL")
|
||||
end
|
||||
]])
|
||||
local configs = {}
|
||||
if package:config("shared") then
|
||||
configs.kind = "shared"
|
||||
elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
|
||||
configs.cxflags = "-fPIC"
|
||||
end
|
||||
if package:is_plat("android") and package:is_arch("armeabi-v7a") then
|
||||
io.replace("arm/filter_neon.S", ".func", ".hidden", {plain = true})
|
||||
io.replace("arm/filter_neon.S", ".endfunc", "", {plain = true})
|
||||
end
|
||||
os.cp("scripts/pnglibconf.h.prebuilt", "pnglibconf.h")
|
||||
import("package.tools.xmake").install(package, configs)
|
||||
end)
|
||||
|
||||
on_install("macosx", "linux", function (package)
|
||||
local configs = {}
|
||||
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
|
||||
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
|
||||
if package:config("pic") ~= false then
|
||||
table.insert(configs, "--with-pic")
|
||||
end
|
||||
local cppflags = {}
|
||||
local ldflags = {}
|
||||
for _, dep in ipairs(package:orderdeps()) do
|
||||
local fetchinfo = dep:fetch()
|
||||
if fetchinfo then
|
||||
for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
|
||||
table.insert(cppflags, "-I" .. includedir)
|
||||
end
|
||||
for _, linkdir in ipairs(fetchinfo.linkdirs) do
|
||||
table.insert(ldflags, "-L" .. linkdir)
|
||||
end
|
||||
end
|
||||
end
|
||||
import("package.tools.autoconf").install(package, configs, {cppflags = cppflags, ldflags = ldflags})
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
assert(package:has_cfuncs("png_create_read_struct", {includes = "png.h"}))
|
||||
end)
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
package("libsdl")
|
||||
|
||||
set_homepage("https://www.libsdl.org/")
|
||||
set_description("Simple DirectMedia Layer")
|
||||
|
||||
if is_plat("mingw") and is_subhost("msys") then
|
||||
add_extsources("pacman::SDL2")
|
||||
elseif is_plat("linux") then
|
||||
add_extsources("pacman::sdl2", "apt::libsdl2-dev")
|
||||
elseif is_plat("macosx") then
|
||||
add_extsources("brew::sdl2")
|
||||
end
|
||||
|
||||
set_license("zlib")
|
||||
|
||||
add_urls("https://www.libsdl.org/release/SDL2-$(version).zip",
|
||||
"https://github.com/libsdl-org/SDL/releases/download/release-$(version)/SDL2-$(version).zip", { alias = "archive" })
|
||||
add_urls("https://github.com/libsdl-org/SDL.git", { alias = "github" })
|
||||
add_versions("archive:2.0.8", "e6a7c71154c3001e318ba7ed4b98582de72ff970aca05abc9f45f7cbdc9088cb")
|
||||
add_versions("archive:2.0.12", "476e84d6fcbc499cd1f4a2d3fd05a924abc165b5d0e0d53522c9604fe5a021aa")
|
||||
add_versions("archive:2.0.14", "2c1e870d74e13dfdae870600bfcb6862a5eab4ea5b915144aff8d75a0f9bf046")
|
||||
add_versions("archive:2.0.16", "010148866e2226e5469f2879425d28ff7c572c736cb3fb65a0604c3cde6bfab9")
|
||||
add_versions("archive:2.0.18", "2d96cc82020341f7f5957c42001ad526e15fbb7056be8a74dab302483e97aa24")
|
||||
add_versions("archive:2.0.20", "cc8b16a326eb082c1f48ca30fdf471acfd2334b69bd7527e65ac58369013a1ba")
|
||||
add_versions("archive:2.0.22", "9a81ab724e6dcef96c61a4a2ebe7758e5b8bb191794650d276a20d5148fbd50c")
|
||||
add_versions("archive:2.24.0", "4b065503d45652d5f65d807fe98c757c73af2968727945b596861995bc3b69c2")
|
||||
add_versions("archive:2.24.2", "7fae98ac4e7b39eb2511fc27c2e84b220ac69b5296ff41f833b967c891f9d2ac")
|
||||
add_versions("archive:2.26.0", "4a181f158f88676816e4993d7e97e7b48ef273aa6f4e2909c6a85497e9af3e9f")
|
||||
add_versions("archive:2.26.1", "c038222fcac6ccc448daaa3febcae93fdac401aed12fd60da3b7939529276b1b")
|
||||
add_versions("github:2.0.8", "release-2.0.8")
|
||||
add_versions("github:2.0.12", "release-2.0.12")
|
||||
add_versions("github:2.0.14", "release-2.0.14")
|
||||
add_versions("github:2.0.16", "release-2.0.16")
|
||||
add_versions("github:2.0.18", "release-2.0.18")
|
||||
add_versions("github:2.0.20", "release-2.0.20")
|
||||
add_versions("github:2.0.22", "release-2.0.22")
|
||||
add_versions("github:2.24.0", "release-2.24.0")
|
||||
add_versions("github:2.24.2", "release-2.24.2")
|
||||
add_versions("github:2.26.0", "release-2.26.0")
|
||||
add_versions("github:2.26.1", "release-2.26.1")
|
||||
|
||||
if is_plat("macosx") then
|
||||
add_frameworks("OpenGL", "CoreVideo", "CoreAudio", "AudioToolbox", "Carbon", "CoreGraphics", "ForceFeedback", "Metal", "AppKit", "IOKit", "CoreFoundation", "Foundation")
|
||||
add_syslinks("iconv")
|
||||
elseif is_plat("linux", "bsd") then
|
||||
if is_plat("bsd") then
|
||||
add_deps("libusb")
|
||||
add_syslinks("usbhid")
|
||||
end
|
||||
add_syslinks("pthread", "dl")
|
||||
elseif is_plat("windows", "mingw") then
|
||||
add_syslinks("gdi32", "user32", "winmm", "shell32")
|
||||
end
|
||||
add_includedirs("include", "include/SDL2")
|
||||
|
||||
add_configs("use_sdlmain", {description = "Use SDL_main entry point", default = true, type = "boolean"})
|
||||
if is_plat("linux") then
|
||||
add_configs("with_x", {description = "Enables X support (requires it on the system)", default = true, type = "boolean"})
|
||||
end
|
||||
|
||||
on_load(function (package)
|
||||
if package.components then
|
||||
if package:config("use_sdlmain") then
|
||||
package:add("components", "main")
|
||||
end
|
||||
package:add("components", "lib")
|
||||
else
|
||||
if package:config("use_sdlmain") then
|
||||
package:add("links", "SDL2main", "SDL2")
|
||||
package:add("defines", "SDL_MAIN_HANDLED")
|
||||
else
|
||||
package:add("links", "SDL2")
|
||||
end
|
||||
end
|
||||
if package:is_plat("linux") and package:config("with_x") then
|
||||
package:add("deps", "libxext", {private = true})
|
||||
end
|
||||
if package:is_plat("macosx") and package:version():ge("2.0.14") then
|
||||
package:add("frameworks", "CoreHaptics", "GameController")
|
||||
end
|
||||
end)
|
||||
|
||||
on_component = on_component or function() end
|
||||
on_component("main", function (package, component)
|
||||
component:add("links", "SDL2main")
|
||||
component:add("defines", "SDL_MAIN_HANDLED")
|
||||
component:add("deps", "lib")
|
||||
end)
|
||||
|
||||
on_component("main", function (package, component)
|
||||
component:add("links", "SDL2")
|
||||
end)
|
||||
|
||||
on_fetch("linux", "macosx", "bsd", function (package, opt)
|
||||
if opt.system then
|
||||
-- use sdl2-config
|
||||
local sdl2conf = try {function() return os.iorunv("sdl2-config", {"--version", "--cflags", "--libs"}) end}
|
||||
if sdl2conf then
|
||||
sdl2conf = os.argv(sdl2conf)
|
||||
local sdl2ver = table.remove(sdl2conf, 1)
|
||||
local result = {version = sdl2ver}
|
||||
for _, flag in ipairs(sdl2conf) do
|
||||
if flag:startswith("-L") and #flag > 2 then
|
||||
-- get linkdirs
|
||||
local linkdir = flag:sub(3)
|
||||
if linkdir and os.isdir(linkdir) then
|
||||
result.linkdirs = result.linkdirs or {}
|
||||
table.insert(result.linkdirs, linkdir)
|
||||
end
|
||||
elseif flag:startswith("-I") and #flag > 2 then
|
||||
-- get includedirs
|
||||
local includedir = flag:sub(3)
|
||||
if includedir and os.isdir(includedir) then
|
||||
result.includedirs = result.includedirs or {}
|
||||
table.insert(result.includedirs, includedir)
|
||||
end
|
||||
elseif flag:startswith("-l") and #flag > 2 then
|
||||
-- get links
|
||||
local link = flag:sub(3)
|
||||
result.links = result.links or {}
|
||||
table.insert(result.links, link)
|
||||
elseif flag:startswith("-D") and #flag > 2 then
|
||||
-- get defines
|
||||
local define = flag:sub(3)
|
||||
result.defines = result.defines or {}
|
||||
table.insert(result.defines, define)
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
-- finding using sdl2-config didn't work, fallback on pkgconfig
|
||||
if package.find_package then
|
||||
return package:find_package("pkgconfig::sdl2", opt)
|
||||
else
|
||||
return find_package("pkgconfig::sdl2", opt)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
on_install(function (package)
|
||||
local configs = {}
|
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
|
||||
table.insert(configs, "-DLIBTYPE=" .. (package:config("shared") and "SHARED" or "STATIC"))
|
||||
local opt
|
||||
if package:is_plat("linux") then
|
||||
local cflags = {}
|
||||
opt = opt or {}
|
||||
opt.cflags = cflags
|
||||
for _, depname in ipairs({"libxext", "libx11", "xorgproto"}) do
|
||||
local dep = package:dep(depname)
|
||||
if dep then
|
||||
local depfetch = dep:fetch()
|
||||
if depfetch then
|
||||
for _, includedir in ipairs(depfetch.includedirs or depfetch.sysincludedirs) do
|
||||
table.join2(cflags, "-I" .. includedir)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif package:is_plat("bsd") then
|
||||
opt = opt or {}
|
||||
opt.packagedeps = "libusb"
|
||||
end
|
||||
import("package.tools.cmake").install(package, configs)
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
assert(package:has_cfuncs("SDL_Init", {includes = "SDL2/SDL.h", configs = {defines = "SDL_MAIN_HANDLED"}}))
|
||||
end)
|
||||
|
|
@ -135,8 +135,9 @@ local modules = {
|
|||
add_defines("SDL_VIDEO_DRIVER_COCOA=1")
|
||||
add_packages("libx11", { links = {} }) -- we only need X11 headers
|
||||
elseif is_plat("wasm") then
|
||||
add_cxflags("-sUSE_SDL=2")
|
||||
add_ldflags("-sUSE_SDL=2", { public = true })
|
||||
-- emscripten enables USE_SDL by default which will conflict with the sdl headers
|
||||
add_cxflags("-sUSE_SDL=0")
|
||||
add_ldflags("-sUSE_SDL=0", { public = true })
|
||||
end
|
||||
end
|
||||
},
|
||||
|
|
@ -190,7 +191,7 @@ option("unitybuild", { description = "Build the engine using unity build", defau
|
|||
set_project("NazaraEngine")
|
||||
set_xmakever("2.7.3")
|
||||
|
||||
add_requires("chipmunk2d", "dr_wav", "entt 3.10.1", "fmt", "frozen", "kiwisolver", "libflac", "minimp3", "ordered_map", "stb")
|
||||
add_requires("chipmunk2d", "dr_wav", "entt 3.11.1", "fmt", "frozen", "kiwisolver", "libflac", "libsdl >=2.26.0", "minimp3", "ordered_map", "stb")
|
||||
add_requires("freetype", { configs = { bzip2 = true, png = true, woff2 = true, zlib = true, debug = is_mode("debug") } })
|
||||
add_requires("libvorbis", { configs = { with_vorbisenc = false } })
|
||||
|
||||
|
|
@ -208,7 +209,6 @@ if is_plat("wasm") then
|
|||
end
|
||||
else
|
||||
-- these libraries have ports in emscripten
|
||||
add_requires("libsdl")
|
||||
add_requires("openal-soft", { configs = { shared = true }})
|
||||
|
||||
-- these libraries aren't supported on emscripten
|
||||
|
|
@ -216,7 +216,6 @@ else
|
|||
add_requires("newtondynamics3", { debug = is_plat("windows") and is_mode("debug") }) -- Newton doesn't like compiling in Debug on Linux
|
||||
end
|
||||
|
||||
add_repositories("local-repo xmake-repo")
|
||||
add_repositories("nazara-engine-repo https://github.com/NazaraEngine/xmake-repo")
|
||||
add_requires("nazarautils")
|
||||
add_requires("nzsl", { debug = is_mode("debug"), configs = { with_symbols = not is_mode("release"), shared = not is_plat("wasm") } })
|
||||
|
|
|
|||
Loading…
Reference in New Issue