diff --git a/build.sh b/build.sh index 717044e..768ee9a 100755 --- a/build.sh +++ b/build.sh @@ -1,13 +1,8 @@ #!/bin/bash set -eu -if [ -z "$1" ]; then - echo "No output parameter named, please pass the build directory to this script." - exit 1 -fi - script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) -build="$1" +build="$script_dir/build" if [ -x "$(command -v g++)" ]; then cpp_compiler="g++"; c_compiler="gcc"; elif [ -x "$(command -v clang++)" ]; then cpp_compiler="clang++"; c_compiler="clang"; diff --git a/dlib-test-library b/dlib-test-library new file mode 100755 index 0000000..0dc0697 Binary files /dev/null and b/dlib-test-library differ diff --git a/dlib/platform.d b/dlib/platform.d index 170a35b..7541d6a 100644 --- a/dlib/platform.d +++ b/dlib/platform.d @@ -1945,10 +1945,10 @@ version(DLIB_TEST) unittest u8[] data_valid, data_test; - File f = File("../dlib/platform.d", "rb"); + File f = File("dlib/platform.d", "rb"); data_valid = f.rawRead(new u8[f.size()]); - data_test = LoadFile(&arena, "../dlib/platform.d"); + data_test = LoadFile(&arena, "dlib/platform.d"); assert(data_valid == data_test); } diff --git a/dub.json b/dub.json new file mode 100644 index 0000000..8af49e4 --- /dev/null +++ b/dub.json @@ -0,0 +1,78 @@ +{ + "name": "dlib", + "description": "General purpose library", + "targetType": "sourceLibrary", + "sourcePaths": ["dlib"], + "importPaths": ["dlib"], + "sourceFiles-linux": ["build/libstb.a"], + "sourceFiles-windows": [], + "libs-linux": [ + "X11", + "Xfixes", + "SDL3" + ], + "dflags-webassembly": [ + "-mtriple=wasm32-unknown-unknown-wasm", + "-betterC", + "-vgc", + "-fvisibility=hidden", + "-i=.", + "-i=core", + "-i=std", + "--real-precision=double", + "--Xcc=-DBUILD_WASM", + "-gcc=clang" + ], + "libs-windows": [], + "preGenerateCommands-linux": ["./build.sh"], + "subPackages": [ + { + "name": "dlib-vulkan", + "description": "Vulkan library for rendering and compute", + "targetType": "sourceLibrary", + "sourcePaths": ["vulkan"], + "importPaths": ["vulkan"], + "sourceFiles-linux": ["build/libvma.a"], + "sourceFiles-windows": [], + "dflags-ldc": ["--Xcc=-DBUILD_VULKAN"], + "dflags-dmd": ["-Xcc=-DBUILD_VULKAN"], + "libs-linux": [ + "vulkan", + "stdc++" + ], + "libs-windows": [], + "versions": ["BUILD_VULKAN"], + "debugVersions": ["VULKAN_DEBUG"], + "buildTypes": { + "unittest": { + "buildOptions": ["unittests", "debugMode", "debugInfo"], + "versions": ["VULKAN_RENDERER_TEST"] + } + } + }, + { + "name": "dlib-assets", + "description": "Asset loading utilities", + "targetType": "sourceLibrary", + "sourceFiles-linux": ["build/libcgltf.a"], + "sourceFiles-windows": [], + "versions": ["BUILD_ASSETS"] + }, + { + "name": "dlib-opengl", + "description": "OpenGL bindings/set up utilities", + "targetType": "sourceLibrary", + "sourcePaths": ["opengl"], + "importPaths": ["opengl"], + "libs-linux": ["GL"], + "libs-windows": [], + "versions": ["BUILD_GL"] + } + ], + "buildTypes": { + "unittest": { + "buildOptions": ["unittests", "debugMode", "debugInfo"], + "versions": ["DLIB_TEST", "VULKAN_RENDERER_TEST"] + } + } +} diff --git a/opengl/opengl_native.d b/opengl/opengl_native.d index d4eb044..fd7df62 100644 --- a/opengl/opengl_native.d +++ b/opengl/opengl_native.d @@ -2,9 +2,6 @@ import dlibincludes; // TODO: fix on js side -alias PFNGLXCREATECONTEXTATTRIBSARBPROC = extern(C) GLXContext function(Display*, GLXFBConfig, GLXContext, int, const int*); - -PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB; PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers; PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers; PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; diff --git a/test.sh b/test.sh index 19a9f7c..a6a685e 100755 --- a/test.sh +++ b/test.sh @@ -35,7 +35,7 @@ if [ "$1" == "wasm" ]; then -i=std -i=. --real-precision=double - -Xcc=-DBUILD_WASM + --Xcc=-DBUILD_WASM -gcc=clang "--of=$out" ) @@ -94,9 +94,9 @@ else -d-version=VULKAN_RENDERER_TEST -d-version=DLIB_ASSETS -d-version=BUILD_GL - -Xcc=-DBUILD_VULKAN - -Xcc=-DBUILD_ASSETS - -Xcc=-DBUILD_GL + --Xcc=-DBUILD_VULKAN + --Xcc=-DBUILD_ASSETS + --Xcc=-DBUILD_GL ) # Test for compilation