Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ jobs:
- uses: actions/checkout@v4
- run: git submodule update --init --recursive
- uses: cachix/install-nix-action@v31
- run: nix build ".?submodules=1#" -L
- run: nix flake check ".?submodules=1#"
- name: Check flake
run: nix flake check ".?submodules=1#"
- name: build BeeEngineEditor
run: nix build ".?submodules=1#BeeEngineEditor" -L
- name: build BeeLocalization
run: nix build ".?submodules=1#BeeLocalization" -L
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
path = src/Engine/vendor/ImGui/imgui
url = https://github.com/ocornut/imgui.git
branch = docking
[submodule "src/Engine/vendor/ImGuizmo/imguizmo"]
path = src/Engine/vendor/ImGuizmo/imguizmo
url = https://github.com/CedricGuillemet/ImGuizmo
[submodule "src/Engine/vendor/Box2D/box2d"]
path = src/Engine/vendor/Box2D/box2d
url = https://github.com/erincatto/Box2D
[submodule "src/Engine/vendor/msdfgen/msdf-atlas-gen"]
path = src/Engine/vendor/msdfgen/msdf-atlas-gen
url = https://github.com/Chlumsky/msdf-atlas-gen
[submodule "src/Editor/vendor/ImGuizmo/imguizmo"]
path = src/Editor/vendor/ImGuizmo/imguizmo
url = https://github.com/CedricGuillemet/ImGuizmo
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ include(cmake/StandardProjectSettings.cmake)

# Link project_warnings as "library" to use the warnings
# specified in CompilerWarnings.cmake.
add_library(project_warnings INTERFACE)
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
#add_library(project_warnings INTERFACE)
#include(cmake/CompilerWarnings.cmake)
#set_project_warnings(project_warnings)

add_subdirectory(src/Engine)
if(${BEE_BUILD_SANDBOX})
Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"BEE_USE_VCPKG": "OFF",
"NETHOST_LIB": "$env{NETHOST_LIB}",
"BEE_BUILD_EDITOR": "ON",
"BEE_BUILD_LOC_TOOL": "ON",
"BEE_USE_SYSTEM_SDL3": "ON"
},
"vendor": {},
Expand Down
17 changes: 12 additions & 5 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,21 @@ cmake --preset Release
**** Linux (Nix)
To build BeeEngine with nix package manager on Linux you need to:
1. Enter the directory with cloned repo and build the Editor with submodules:
#+begin_src shell
nix build ".?submodules=1#BeeEngineEditor"
#+end_src
2. The binaries can be found inside result/BeeEngineEditor
***** Runnin without installing and cloning
- For the editor:
#+begin_src shell
nix build ".?submodules=1#BeeEngineEditor"
#+end_src
- For the localization tool:
#+begin_src shell
nix build ".?submodules=1#BeeLocalization"
#+end_src
2. The files can be found inside ~result~ folder
***** Running without installing and cloning
#+begin_src shell
nix run 'git+https://github.com/KyleKrein/BeeEngine?submodules=1#BeeEngineEditor'
#+end_src
***** Including in your Nix flake
WIP
**** Linux (Without Nix)
Building on Linux without Nix package manager is possible, but it's not a priority.
1. Install all the dependencies depending on your distro:
Expand Down
36 changes: 1 addition & 35 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 38 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,55 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
utils.url = "github:numtide/flake-utils";
#self.submodules = true; for nix 2.26
};

outputs = { self, nixpkgs, ... }@inputs: inputs.utils.lib.eachSystem [
# Add the system/architecture you would like to support here. Note that not
# all packages in the official nixpkgs support all platforms.
"x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin"
] (system: let
pkgs = import nixpkgs {
inherit system;
};
buildInputsFile = (import ./nix/buildInputs.nix {inherit pkgs;});
outputs = { self, nixpkgs, ... }@inputs: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem = system;
overlays = with self.overlays; [
];
});
pkgsCrossFor = eachSystem (system: crossSystem:
import nixpkgs {
localSystem = system;
inherit crossSystem;
overlays = with self.overlays; [
];
});
src = self;
in {
devShells.default = pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; } rec {
overlays = eachSystem (system:
final: _prev: {
beeengineeditor = self.packages.${system}.BeeEngineEditor;
beelocalization = self.packages.${system}.BeeLocalization;
});
devShells = eachSystem (system: let
pkgs = pkgsFor.${system};
buildInputsFile = (import ./nix/buildInputs.nix {inherit pkgs;});
in { default = pkgsFor.${system}.mkShell.override { stdenv = pkgs.gcc14Stdenv; } rec {
# Update the name to something that suites your project.
name = "BeeEngine";
name = "BeeEngine-shell";

nativeBuildInputs = buildInputsFile.nativeBuildInputs ++ [pkgs.ccache];
buildInputs = buildInputsFile.buildInputs ++ [pkgs.dotnet-sdk];
NETHOST_LIB = (import ./nix/unofficial-nethost.nix {inherit pkgs; inherit (pkgs) lib;}).nethost-lib-path;
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
};
};});

packages.default = self.packages.${system}.BeeEngineEditor;
packages.BeeEngineEditor = pkgs.callPackage ./nix/editor.nix { inherit src; inherit buildInputsFile; };
packages.BeeEngineEditor-Debug = pkgs.callPackage ./nix/editor.nix { inherit src; inherit buildInputsFile; cmakeBuildType = "Debug"; };
packages = eachSystem(system:
let
pkgs = pkgsFor.${system};
buildInputsFile = (import ./nix/buildInputs.nix {inherit pkgs;});
in {
default = self.packages.${system}.BeeEngineEditor;
BeeEngineEditor = pkgs.callPackage ./nix/editor.nix { inherit src; inherit buildInputsFile; };
BeeEngineEditor-Debug = pkgs.callPackage ./nix/editor.nix { inherit src; inherit buildInputsFile; cmakeBuildType = "Debug"; };
BeeLocalization = pkgs.callPackage ./nix/localizationtool.nix { inherit src; inherit buildInputsFile; };
BeeLocalization-Debug = pkgs.callPackage ./nix/localizationtool.nix { inherit src; inherit buildInputsFile; cmakeBuildType = "Debug"; };
});
};
}
38 changes: 34 additions & 4 deletions nix/buildInputs.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
{ pkgs }:
{
# nativeBuildInputs is usually what you want -- tools you need to run
let
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = with pkgs.buildPackages; [
cmake
ninja
python3
makeWrapper
dotnet-sdk
];
wrapperPath = pkgs.lib.makeBinPath ([ pkgs.dotnet-sdk ]);
in
{
#https://discourse.nixos.org/t/generate-and-install-a-desktop-file-along-with-an-executable/42744/2
makeDesktopApp = { name, app, icon }: pkgs.stdenvNoCC.mkDerivation rec{
inherit name;
buildCommand = let
inherit app;
desktopEntry = pkgs.makeDesktopItem {
name = name;
desktopName = name;
exec = "${app}/bin/${name} %f";
icon = icon; #https://discourse.nixos.org/t/what-is-the-recommended-use-of-makedesktopitem-how-to-setup-the-icon-correctly/13388/7
#terminal = true;
};
in ''
mkdir -p $out/bin
cp ${app}/bin/${name} $out/bin
mkdir -p $out/share/applications
cp ${desktopEntry}/share/applications/${name}.desktop $out/share/applications/${name}.desktop
'';
dontBuild = true;
};

inherit nativeBuildInputs;

dotnetNativeBuildInputs = nativeBuildInputs ++ [ pkgs.dotnet-sdk pkgs.makeWrapper ];
dotnetPostFixup = binary: ''
# Ensure all dependencies are in PATH
wrapProgram $out/bin/${binary} \
--prefix PATH : "${wrapperPath}"
'';
# libraries
buildInputs = with pkgs; [
freetype
Expand Down
20 changes: 7 additions & 13 deletions nix/editor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,17 @@ assert pkgs.lib.assertMsg (src.submodules == true)
"Unable to build without submodules. Append '?submodules=1#' to the URL.";
let
nethost-lib-path = (import ./unofficial-nethost.nix {inherit pkgs; inherit lib;}).nethost-lib-path;
in
pkgs.gcc14Stdenv.mkDerivation rec {
icon = ../src/Engine/Assets/Textures/BeeEngineLogo.png;
editor = pkgs.gcc14Stdenv.mkDerivation rec {
pname = "BeeEngineEditor";
version = "1.0.0-alpha.1.2";

inherit src;

nativeBuildInputs = buildInputsFile.nativeBuildInputs;
nativeBuildInputs = buildInputsFile.dotnetNativeBuildInputs;
buildInputs = buildInputsFile.buildInputs;

wrapperPath = with lib; makeBinPath ([
pkgs.dotnet-sdk
]);
postFixup = ''
# Ensure all dependencies are in PATH
wrapProgram $out/bin/BeeEngineEditor \
--prefix PATH : "${wrapperPath}"
'';
postFixup = buildInputsFile.dotnetPostFixup pname;


cmakeFlags = [
Expand All @@ -36,7 +29,6 @@ in
"-DBEE_BUILD_EDITOR=ON"
"-DNETHOST_LIB=${nethost-lib-path}"
"-DBEE_USE_SYSTEM_SDL3=ON"
#"-DICU_INCLUDE_DIR=${pkgs.icu.dev}/include"
];
meta = with lib; {
homepage = "https://github.com/KyleKrein/BeeEngine";
Expand All @@ -47,4 +39,6 @@ in
platforms = with platforms; linux ++ darwin;
maintainers = [ maintainers.KyleKrein ];
};
}
};
in
buildInputsFile.makeDesktopApp { app = editor; name = "BeeEngineEditor"; inherit icon; }
41 changes: 41 additions & 0 deletions nix/localizationtool.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
lib,
pkgs,
src,
buildInputsFile,
cmakeBuildType ? "Release"
}:
assert pkgs.lib.assertMsg (src.submodules == true)
"Unable to build without submodules. Append '?submodules=1#' to the URL.";
let
icon = ../src/Engine/Assets/Textures/BeeEngineLogo.png;
tool = pkgs.gcc14Stdenv.mkDerivation rec {
pname = "BeeLocalization";
version = "1.0.0-alpha.1.2";

inherit src;

nativeBuildInputs = buildInputsFile.nativeBuildInputs;
buildInputs = buildInputsFile.buildInputs;


cmakeFlags = [
"-DCMAKE_BUILD_TYPE=${cmakeBuildType}"
"-DBEE_USE_VCPKG=OFF"
"-DBEE_BUILD_TESTS=OFF"
"-DBEE_BUILD_LOC_TOOL=ON"
"-DBEE_USE_SYSTEM_SDL3=ON"
"-DBEE_NO_DOTNET=ON"
];
meta = with lib; {
homepage = "https://github.com/KyleKrein/BeeEngine";
description = ''
A GUI App for easy management of localization files, powered by BeeEngine
'';
licencse = licenses.mit;
platforms = with platforms; linux ++ darwin;
maintainers = [ maintainers.KyleKrein ];
};
};
in
buildInputsFile.makeDesktopApp { app = tool; name = "BeeLocalization"; inherit icon; }
14 changes: 7 additions & 7 deletions src/Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ add_executable(BeeEngineEditor Start.cpp src/EditorApplication.cpp src/EditorApp
src/Panels/ImGuiUIEditor.cpp
src/Panels/ProjectSettings.h
src/Panels/ProjectSettings.cpp)
# files for native scripting: src/NativeScripting/ScriptParser.cpp src/NativeScripting/ScriptParser.h src/NativeScripting/ScriptScanner.cpp src/NativeScripting/ScriptScanner.h src/NativeScripting/CodeGenerators.cpp src/NativeScripting/CodeGenerators.h src/NativeScripting/GameBuilder.cpp src/NativeScripting/GameBuilder.h src/NativeScripting/StdioLogSystem.cpp
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 23)

add_subdirectory(vendor/ImGuizmo)
target_include_directories(BeeEngineEditor
PUBLIC ../Engine/include/
PRIVATE ../Engine/vendor/
PRIVATE vendor/FileWatcher
PUBLIC src
PUBLIC ${ImGuizmo_SOURCE_DIR}
)
target_link_libraries(BeeEngineEditor PUBLIC BeeEngine::WithScripting)

target_link_libraries(BeeEngineEditor
PUBLIC BeeEngine::WithScripting
PUBLIC ImGuizmo
)
add_compile_definitions(BEE_ENABLE_CHECKS)
add_compile_definitions($<$<CONFIG:Debug>:BEE_ENABLE_PROFILING>)
add_compile_definitions($<$<CONFIG:Release>:BEE_ENABLE_PROFILING>)
#file(COPY Assets DESTINATION ${CMAKE_BINARY_DIR}/src/${PROJECT_NAME})
file(COPY ../Engine/Assets/Shaders DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
#file(COPY ../Engine/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/EngineInclude) #this is for NativeScripting
#file(COPY libs DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) #this is for NativeScripting

#file(COPY ../Engine/vendor/mono/dotnet-libs/4.5 DESTINATION ../lib/mono)
configure_file(${BEE_CSHARP_LIBRARY_PATH}/BeeEngine.Core.dll ${CMAKE_CURRENT_BINARY_DIR}/libs/BeeEngine.Core.dll COPYONLY)
configure_file(${BEE_CSHARP_LIBRARY_PATH}/BeeEngine.NativeBridge.runtimeconfig.json ${CMAKE_CURRENT_BINARY_DIR}/libs/BeeEngine.NativeBridge.runtimeconfig.json COPYONLY)
configure_file(${BEE_CSHARP_LIBRARY_PATH}/BeeEngine.NativeBridge.dll ${CMAKE_CURRENT_BINARY_DIR}/libs/BeeEngine.NativeBridge.dll COPYONLY)
Expand All @@ -47,5 +48,4 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libs/ DESTINATION ${BEE_EDITOR_INS
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/Localization/ DESTINATION ${BEE_EDITOR_INSTALL_PATH}/Localization)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/Platforms/ DESTINATION ${BEE_EDITOR_INSTALL_PATH}/Platforms)

# Установка шейдеров
install(DIRECTORY ../Engine/Assets/Shaders/ DESTINATION ${BEE_EDITOR_INSTALL_PATH}/Shaders)
Binary file removed src/Editor/libs/libBeeEngine.a
Binary file not shown.
11 changes: 0 additions & 11 deletions src/Editor/src/NativeScripting/CodeGenerators.cpp

This file was deleted.

Loading