diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..9b5277217 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: CI + +on: + pull_request: + branches: [ "main", "master" ] + + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Clone dev2 + run: | + git -C D:\ clone https://github.com/ignite720/dev2.git + + - name: Setup premake5 + uses: abel0b/setup-premake@v2.2 + with: + version: "5.0.0-beta2" + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.1 + with: + vs-version: "latest" + + - name: Build app for release + run: | + premake5 vs2022 + msbuild build\VEngine-wks.sln -nologo -m -p:Configuration=Release -p:Platform=x64 -p:Projects="build\VEngine\VEngine.vcxproj" + + - name: Create artifact + run: | + mkdir -p temp/artifact + cp bin/x64/Release/*.exe temp/artifact/ + #cp -r VEngine/Assets temp/artifact/ + cp -r VEngine/Shaders temp/artifact/ + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: Release-Artifact + path: temp diff --git a/.gitignore b/.gitignore index b56bba0a8..4109bcb9f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,9 @@ VEngine/Code/FbxSdk/ VEngine/Code/Physx/ VEngine/Shaders/Vertex/ VEngine/Shaders/Pixel/ - + +[Bb]uild/ + # User-specific files *.dll *.lib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..0b5be4e89 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "premake5-modules/premake-vspropertysheets"] + path = premake5-modules/premake-vspropertysheets + url = https://github.com/ignite720/premake-vspropertysheets.git +[submodule "premake5-modules/premake-wkslight"] + path = premake5-modules/premake-wkslight + url = https://github.com/ignite720/premake-wkslight.git diff --git a/Editor/premake5.lua b/Editor/premake5.lua new file mode 100644 index 000000000..b33f3a64b --- /dev/null +++ b/Editor/premake5.lua @@ -0,0 +1,18 @@ +project("Editor") + location(g_wkslight.workspacedir .. "/%{prj.name}") + targetdir(g_wkslight.targetdir) + debugdir("") + debugargs({ "" }) + kind("ConsoleApp") + language("C++") + files({ + "src/**.h", + "src/**.cpp", + }) + includedirs({ + "src", + g_wkslight.workspace.libraries.projects.ExampleStaticLib.includedirs, + }) + links({ + "ExampleStaticLib", + }) \ No newline at end of file diff --git a/Editor/src/main.cpp b/Editor/src/main.cpp new file mode 100644 index 000000000..68a0204e8 --- /dev/null +++ b/Editor/src/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + ExampleStaticLib example; + example.Print(); + return 0; +} diff --git a/VEngine/Code/Asset/AssetSystem.cpp b/VEngine/Code/Asset/AssetSystem.cpp index 89f537b96..17f288297 100644 --- a/VEngine/Code/Asset/AssetSystem.cpp +++ b/VEngine/Code/Asset/AssetSystem.cpp @@ -183,12 +183,12 @@ MeshDataProxy AssetSystem::ReadVMeshAssetFromFile(const std::string filename) MeshAssetHeader header; MeshData data; - assert(fread(&header, sizeof(MeshAssetHeader), 1, file)); + fread(&header, sizeof(MeshAssetHeader), 1, file); data.vertices.resize(header.vertexCount); - assert(fread(data.vertices.data(), sizeof(Vertex), header.vertexCount, file)); + fread(data.vertices.data(), sizeof(Vertex), header.vertexCount, file); - assert(fread(&data.boundingBox, sizeof(DirectX::BoundingBox), 1, file)); + fread(&data.boundingBox, sizeof(DirectX::BoundingBox), 1, file); data.skeleton.GetJoints().resize(header.boneCount); //Has to potential to read empty data, don't call assert() @@ -217,22 +217,22 @@ Animation AssetSystem::ReadVAnimAssetFromFile(const std::string filename) AnimationAssetHeader header; - assert(fread(&header, sizeof(AnimationAssetHeader), 1, file)); + fread(&header, sizeof(AnimationAssetHeader), 1, file); Animation anim = Animation(header.name); for (uint64_t i = 0; i < header.frameCount; i++) { int jointIndex = Joint::INVALID_JOINT_INDEX; - assert(fread(&jointIndex, sizeof(int), 1, file)); + fread(&jointIndex, sizeof(int), 1, file); assert(jointIndex != -2); size_t animFrameCount = 0; - assert(fread(&animFrameCount, sizeof(size_t), 1, file)); + fread(&animFrameCount, sizeof(size_t), 1, file); std::vector animFrames; animFrames.resize(animFrameCount); - assert(fread(animFrames.data(), sizeof(AnimFrame) * animFrameCount, 1, file)); + fread(animFrames.data(), sizeof(AnimFrame) * animFrameCount, 1, file); anim.AddFrame(jointIndex, animFrames); } diff --git a/VEngine/premake5.lua b/VEngine/premake5.lua new file mode 100644 index 000000000..257e981e2 --- /dev/null +++ b/VEngine/premake5.lua @@ -0,0 +1,74 @@ +project("VEngine") + location(g_wkslight.workspacedir .. "/%{prj.name}") + targetdir(g_wkslight.targetdir) + debugdir("") + debugargs({ "" }) + kind("ConsoleApp") + language("C++") + pchheader("vpch.h") + pchsource("Code/vpch.cpp") + files({ + "Code/**.h", + "Code/**.cpp", + "Code/**.hlsl", + }) + removefiles({ + "Code/Editor/imgui/backends/**.*", + "Code/Editor/imgui/examples/**.*", + "Code/Editor/imgui/misc/**.*", + "Code/Editor/ImGuizmo/example/**.*", + "Code/Editor/ImGuizmo/vcpkg-example/**.*", + }) + files({ + "Code/Editor/imgui/backends/imgui_impl_dx11.cpp", + "Code/Editor/imgui/backends/imgui_impl_win32.cpp", + }) + includedirs({ + "Code", + "Code/Editor/imgui", + "Code/Editor/ImGuizmo", + }) + links({ + "d3d11.lib", + "dxgi.lib", + "d3dcompiler.lib", + "d2d1.lib", + "dwrite.lib", + }) + defines({ + --"_USE_MATH_DEFINES", + }) + filter("files:Code/Editor/imgui/**.cpp") + flags({ "NoPCH" }) + filter("files:Code/Editor/ImGuizmo/**.cpp") + flags({ "NoPCH" }) + filter("files:Code/SHMath/**.cpp") + flags({ "NoPCH" }) + filter("files:Code/**.hlsl") + flags({ "ExcludeFromBuild" }) + shadermodel("5.0") + shaderobjectfileoutput("%{wks.location}/../%{prj.name}/Shaders/%{file.basename}.cso") + filter("files:Code/Render/Shaders/Vertex/*.hlsl") + removeflags({ "ExcludeFromBuild" }) + shadertype("Vertex") + shaderobjectfileoutput("%{wks.location}/../%{prj.name}/Shaders/Vertex/%{file.basename}.cso") + filter("files:Code/Render/Shaders/Pixel/*.hlsl") + removeflags({ "ExcludeFromBuild" }) + shadertype("Pixel") + shaderobjectfileoutput("%{wks.location}/../%{prj.name}/Shaders/Pixel/%{file.basename}.cso") + filter("files:Code/Render/Shaders/Compute/*CS.hlsl") + removeflags({ "ExcludeFromBuild" }) + shadertype("Compute") + shaderentry("CSFunc") + --shaderoptions({ "/E 'CSFunc'" }) + filter("action:vs*") + debugenvs({ + "$(LocalDebuggerEnvironment)", + "QT_QPA_PLATFORM_PLUGIN_PATH=" .. g_wkslight.extras.qt_qpa_platform_plugin_path, + }) + vspropertysheets({ + "D:\\dev2\\DirectXTK.props", + "D:\\dev2\\fbxsdk.props", + "D:\\dev2\\PhysX-4.1.props", + "D:\\dev2\\qt5.props", + }) \ No newline at end of file diff --git a/libraries/ExampleStaticLib/include/ExampleStaticLib.h b/libraries/ExampleStaticLib/include/ExampleStaticLib.h new file mode 100644 index 000000000..b32a9d150 --- /dev/null +++ b/libraries/ExampleStaticLib/include/ExampleStaticLib.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +class ExampleStaticLib +{ +public: + void Print(); +}; \ No newline at end of file diff --git a/libraries/ExampleStaticLib/premake5.lua b/libraries/ExampleStaticLib/premake5.lua new file mode 100644 index 000000000..c5069bc60 --- /dev/null +++ b/libraries/ExampleStaticLib/premake5.lua @@ -0,0 +1,12 @@ +project("ExampleStaticLib") + location(g_wkslight.workspacedir .. "/%{prj.name}") + targetdir(g_wkslight.targetdir) + kind("StaticLib") + language("C++") + files({ + "include/**.h", + "src/**.cpp", + }) + includedirs({ + g_wkslight.workspace.libraries.projects.ExampleStaticLib.includedirs, + }) \ No newline at end of file diff --git a/libraries/ExampleStaticLib/src/ExampleStaticLib.cpp b/libraries/ExampleStaticLib/src/ExampleStaticLib.cpp new file mode 100644 index 000000000..6986b3673 --- /dev/null +++ b/libraries/ExampleStaticLib/src/ExampleStaticLib.cpp @@ -0,0 +1,6 @@ +#include "ExampleStaticLib.h" + +void ExampleStaticLib::Print() +{ + printf("ExampleStaticLib: Hello\n"); +} \ No newline at end of file diff --git a/premake5-clean.bat b/premake5-clean.bat new file mode 100644 index 000000000..8f6aae86e --- /dev/null +++ b/premake5-clean.bat @@ -0,0 +1,3 @@ +@echo off +call "premake5.exe" clean +timeout /t 2 > nul \ No newline at end of file diff --git a/premake5-generate-gmake.bat b/premake5-generate-gmake.bat new file mode 100644 index 000000000..66643a728 --- /dev/null +++ b/premake5-generate-gmake.bat @@ -0,0 +1,3 @@ +@echo off +call "premake5.exe" gmake +timeout /t 2 > nul \ No newline at end of file diff --git a/premake5-generate.bat b/premake5-generate.bat new file mode 100644 index 000000000..1a063eb40 --- /dev/null +++ b/premake5-generate.bat @@ -0,0 +1,3 @@ +@echo off +call "premake5.exe" vs2022 +timeout /t 2 > nul \ No newline at end of file diff --git a/premake5-modules/premake-vspropertysheets b/premake5-modules/premake-vspropertysheets new file mode 160000 index 000000000..a249dfcfc --- /dev/null +++ b/premake5-modules/premake-vspropertysheets @@ -0,0 +1 @@ +Subproject commit a249dfcfc241f3f0470c58717f266cff1fcb591d diff --git a/premake5-modules/premake-wkslight b/premake5-modules/premake-wkslight new file mode 160000 index 000000000..c7b8e162b --- /dev/null +++ b/premake5-modules/premake-wkslight @@ -0,0 +1 @@ +Subproject commit c7b8e162b44e74df8f9013822c0a46f4f44554e0 diff --git a/premake5-wkslight.lua b/premake5-wkslight.lua new file mode 100644 index 000000000..cd5fe3a08 --- /dev/null +++ b/premake5-wkslight.lua @@ -0,0 +1,25 @@ +g_wkslight = require("premake5-modules.premake-wkslight.wkslight") +g_wkslight.workspace = { + name = "VEngine-wks", + startproject = "VEngine", + platforms = { "x64" }, + cppdialect = "C++20", + libraries = { + name = "libraries", + projects = { + ExampleStaticLib = { + location = "libraries/ExampleStaticLib", + includedirs = { + "%{wks.location}/../libraries/ExampleStaticLib/include", + }, + }, + }, + }, + projects = { + "Editor", + "VEngine", + }, +} +g_wkslight.extras = { + qt_qpa_platform_plugin_path = "D:\\dev2\\qt-5.15.2\\plugins\\platforms", +} \ No newline at end of file diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 000000000..5f5db6d62 --- /dev/null +++ b/premake5.lua @@ -0,0 +1,44 @@ +require("premake5-modules.premake-vspropertysheets.vspropertysheets") +require("premake5-wkslight") +workspace(g_wkslight.workspace.name) + location(path.getbasename(g_wkslight.workspacedir)) + platforms(g_wkslight.workspace.platforms) + configurations({ "Debug", "Release" }) + characterset("Default") + cppdialect(g_wkslight.workspace.cppdialect) + floatingpoint("Default") + rtti("Default") + exceptionhandling("Default") + filter("system:windows") + systemversion("latest") + filter("system:linux") + pic("On") + filter("action:vs*") + startproject(g_wkslight.workspace.startproject) + staticruntime("Off") + characterset("MBCS") + flags({ "MultiProcessorCompile" }) + defines({ + "_CRT_SECURE_NO_WARNINGS", + "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS", + "_HAS_STD_BYTE=0", + }) + --buildoptions({ "/utf-8", "/Zc:char8_t-" }) + filter({ "action:gmake*", "system:not linux", "kind:*App or StaticLib" }) + buildoptions({ "-static" }) + filter("configurations:Debug") + defines({ "_DEBUG" }) + symbols("On") + optimize("Off") + filter("configurations:Release") + defines({ "NDEBUG" }) + symbols("Off") + optimize("Speed") +group(g_wkslight.workspace.libraries.name) + for k, v in pairs(g_wkslight.workspace.libraries.projects) do + include(v.location) + end +group("") + for i, v in ipairs(g_wkslight.workspace.projects) do + include(v) + end \ No newline at end of file