diff --git a/README.md b/README.md index b560110..a03d513 100644 --- a/README.md +++ b/README.md @@ -2,56 +2,30 @@ A game engine or something, idk. ## Installation -1. Clone the repository. +1. **Clone the repository.** ```sh git clone --recurse-submodules https://timerix.ddns.net/git/Timerix/ougge.git ``` -2. Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild). -3. Install [SDL2](https://github.com/libsdl-org/SDL) and [SDL2_image](https://github.com/libsdl-org/SDL_image). +2. **Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild).** +3. **Install [SDL2](https://github.com/libsdl-org/SDL) and [SDL2_image](https://github.com/libsdl-org/SDL_image).** - On **Linux** install shared libraries from a package manager or compile them from source. - On **Windows** download pre-built dll's from github releases and put them into `dependencies/precompiled/`. -4. Symlink SDL headers directory to `dependencies/include`. +4. **Symlink SDL headers directory** to `dependencies/include`. ```sh ln -s SDL2_HEADERS_DIRECTORY_ABSOLUTE_PATH -T dependencies/include/SDL2 ``` Location of the headers can be found by `pkg-config --cflags --libs sdl2`. Mingw installs SDL2 headers to `/mingw64/include/SDL2`. -5. Install [mono](https://github.com/mono/mono). - - **Windows:** - 1. Install mono from official website - 2. Copy `*.dll` files from `C:\Program Files\Mono\bin` to `dependencies/precompiled/` - 3. Copy `config` from `C:\Program Files\Mono\etc\mono` to `dependencies/precompiled/mono-libs` and rename to `config.xml` - 4. Copy `mscorlib.dll` from `C:\Program Files\Mono\lib\mono\4.5\` to `dependencies/precompiled/mono-libs` - - **Linux:** - 1. Download and extract [sources](https://download.mono-project.com/sources/mono/index.html) +5. **Download mono runtime** ([source is here](https://github.com/dotnet/runtime/tree/main/src/mono)). + - default version ```sh - mkdir mono - cd mono - wget https://download.mono-project.com/sources/mono/mono-6.12.0.199.tar.xz - tar xJf mono-6.12.0.199.tar.xz - mv mono-6.12.0.199/* ./ - rm -r mono-6.12.0.199 - rm mono-6.12.0.199.tar.xz + cbuild download_mono_from_nuget ``` - 2. Install `libz autoconf automake libtool gettext cmake python3 curl` and - 3. Build mono. If something doesn't work, read [documentation](https://www.mono-project.com/docs/compiling-mono/) + - or some specific version ```sh - mkdir -p mono_prefix - ./autogen.sh --prefix=$(realpath mono_prefix) --disable-boehm - make get-monolite-latest - make -j8 - make install + cbuild download_mono_from_nuget=x.y.z ``` - 3. Install `patchelf` - 4. Install mono files in project. - ```sh - cd .. - cbuild get_mono_files_from=mono/mono_prefix - ``` - 5. Now you can delete `mono` directory and save 3 gigabytes of disk space :3 -7. Compile the program +7. **Compile the program** ```sh cbuild build_exec_dbg ``` diff --git a/dependencies/precompiled.config b/dependencies/precompiled.config index 6591c2e..1d60df6 100755 --- a/dependencies/precompiled.config +++ b/dependencies/precompiled.config @@ -1,23 +1,31 @@ #!/usr/bin/env bash -mkdir -p 'dependencies/precompiled' -DEP_WORKING_DIR='dependencies/precompiled' +if [ -z $ARCH ]; then + ARCH='x64' +fi +DEP_WORKING_DIR="dependencies/precompiled/$OS-$ARCH" +mkdir -p "dependencies/precompiled" +mkdir -p "$DEP_WORKING_DIR" DEP_PRE_BUILD_COMMAND='' DEP_BUILD_COMMAND='' DEP_POST_BUILD_COMMAND='' DEP_CLEAN_COMMAND='' + # won't be copied to project $OUTDIR -DEP_STATIC_OUT_FILES=$(find dependencies/precompiled -name '*.a' | sed 's,dependencies/precompiled/,,') -PRESERVE_OUT_DIRECTORY_STRUCTURE=true +DEP_STATIC_OUT_FILES=$(find "$DEP_WORKING_DIR" -name '*.a' | sed "s,$DEP_WORKING_DIR/,,") + +mkdir -p "$DEP_WORKING_DIR/mono-libs" +mono_libs=$(find "$DEP_WORKING_DIR/mono-libs" -type f | sed "s,$DEP_WORKING_DIR/,,") + # will be copied tp project $OUTDIR +PRESERVE_OUT_DIRECTORY_STRUCTURE=true case $OS in WINDOWS) - DEP_DYNAMIC_OUT_FILES=$(find dependencies/precompiled -maxdepth 1 -name '*.dll' | sed 's,dependencies/precompiled/,,') - DEP_OTHER_OUT_FILES="mono-libs/mscorlib.dll mono-libs/config.xml" - # DEP_STATIC_OUT_FILES+=" mono-libs/libmono-static-sgen.lib" + DEP_DYNAMIC_OUT_FILES=$(find "$DEP_WORKING_DIR" -maxdepth 1 -name '*.dll' | sed "s,$DEP_WORKING_DIR/,,") + DEP_OTHER_OUT_FILES="$mono_libs" ;; LINUX) - DEP_DYNAMIC_OUT_FILES=$(find dependencies/precompiled -name '*.so' | sed 's,dependencies/precompiled/,,') - DEP_OTHER_OUT_FILES="mono-libs/mscorlib.dll mono-libs/config.xml" + DEP_DYNAMIC_OUT_FILES=$(find "$DEP_WORKING_DIR" -name '*.so' | sed "s,$DEP_WORKING_DIR/,,") + DEP_OTHER_OUT_FILES="$mono_libs" ;; *) error "operating system $OS has no configuration variants" diff --git a/project.config b/project.config index 22a5a2a..f24a082 100755 --- a/project.config +++ b/project.config @@ -176,8 +176,8 @@ case "$TASK" in rebuild_dependencies) TASK_SCRIPT=cbuild/default_tasks/rebuild_dependencies.sh ;; - get_mono_files_from) - TASK_SCRIPT=tasks/get_mono_files_from.sh + download_mono_from_nuget) + TASK_SCRIPT=tasks/download_mono_from_nuget.sh ;; # deletes generated files clean) diff --git a/src/Mono/Mono.hpp b/src/Mono/Mono.hpp index 2824f1a..7a37834 100644 --- a/src/Mono/Mono.hpp +++ b/src/Mono/Mono.hpp @@ -5,7 +5,7 @@ #include "../format.hpp" #include #include -#include +#include #include #include diff --git a/src/Mono/Runtime.cpp b/src/Mono/Runtime.cpp index ee6ad64..4a32990 100644 --- a/src/Mono/Runtime.cpp +++ b/src/Mono/Runtime.cpp @@ -1,6 +1,7 @@ #include "Mono.hpp" #include #include +#include namespace Mono { diff --git a/src/main.cpp b/src/main.cpp index b10de9b..cc3e551 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,9 +59,8 @@ int main(int argc, const char** argv){ Mono::Bool created = tryCreateComponent(exampleObjectHandle.getObject(), componentNameManaged); if(!created.wide_bool) throw UsefulException("couldn't create ExampleComponent"); + std::cout<<"created ExampleObject"<