switched to mono continued fork
This commit is contained in:
parent
51259e72fe
commit
366dd1214c
46
README.md
46
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
|
||||
```
|
||||
|
||||
26
dependencies/precompiled.config
vendored
26
dependencies/precompiled.config
vendored
@ -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"
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "../format.hpp"
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
#include <mono/metadata/metadata.h>
|
||||
#include <mono/metadata/class.h>
|
||||
#include <mono/metadata/assembly.h>
|
||||
#include <mono/metadata/object.h>
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "Mono.hpp"
|
||||
#include <mono/jit/jit.h>
|
||||
#include <mono/metadata/mono-config.h>
|
||||
#include <mono/metadata/appdomain.h>
|
||||
|
||||
namespace Mono {
|
||||
|
||||
|
||||
@ -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"<<std::endl;
|
||||
|
||||
std::cout<<"OK!"<<std::endl;
|
||||
return 0;
|
||||
GUI::MainWindow w;
|
||||
w.open("ougge", update);
|
||||
std::cout<<"created sdl window"<<std::endl;
|
||||
|
||||
73
tasks/download_mono_from_nuget.sh
Normal file
73
tasks/download_mono_from_nuget.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
package_version="$TASK_ARGS"
|
||||
if [ -z "$package_version" ]; then
|
||||
package_version="8.0.15"
|
||||
myprint "${YELLOW}You can choose package version manually: cbuild get_mono_files_from=x.y.z"
|
||||
fi
|
||||
myprint "${BLUE}package_version: ${CYAN}$package_version"
|
||||
|
||||
if [ -z $ARCH ]; then
|
||||
ARCH='x64'
|
||||
fi
|
||||
|
||||
case "$OS" in
|
||||
LINUX)
|
||||
package_platform="linux-$ARCH"
|
||||
;;
|
||||
WINDOWS)
|
||||
package_platform="win-$ARCH"
|
||||
;;
|
||||
esac
|
||||
|
||||
package_name="Microsoft.NETCore.App.Runtime.Mono.$package_platform"
|
||||
package_dir="$package_name.$package_version"
|
||||
package_file="$package_name.$package_version.nupkg"
|
||||
package_url="https://www.nuget.org/api/v2/package/$package_name/$package_version"
|
||||
|
||||
mkdir -p "$OBJDIR/downloads"
|
||||
myprint "${BLUE}downloading nuget package: ${WHITE}$package_name ${BLUE}to $OBJDIR/downloads"
|
||||
cd "$OBJDIR/downloads"
|
||||
wget -q $package_url -O $package_file
|
||||
clean_dir $package_dir
|
||||
cd $package_dir
|
||||
|
||||
myprint "${BLUE}extracting nuget package"
|
||||
unzip -oq "../$package_file"
|
||||
|
||||
# copy headers
|
||||
myprint "${BLUE}copying headers"
|
||||
mkdir -p "../../../dependencies/include"
|
||||
delete_dir "../../../dependencies/include/mono"
|
||||
cp -r "runtimes/$package_platform/native/include/mono-2.0/mono" "../../../dependencies/include/"
|
||||
|
||||
precompiled_dir="../../../dependencies/precompiled/$OS-$ARCH"
|
||||
mkdir -p "$precompiled_dir"
|
||||
clean_dir "$precompiled_dir/mono-libs"
|
||||
|
||||
# copy mono native libraries
|
||||
myprint "${BLUE}copying mono native libraries"
|
||||
shared_libs=$(find "runtimes/$package_platform/native" -maxdepth 1 \( -not -name "System.Private.CoreLib.dll" -a \( -name '*.so*' -o -name '*.dll' \) \) -type f)
|
||||
if [ -z "$shared_libs" ]; then
|
||||
error "can't find mono shared libraries"
|
||||
fi
|
||||
for l in $shared_libs ; do
|
||||
cp -v "$l" "$precompiled_dir"
|
||||
done
|
||||
|
||||
# copy mono c# libraries
|
||||
myprint "${BLUE}copying mono managed libraries"
|
||||
managed_libraries="runtimes/$package_platform/native/System.Private.CoreLib.dll"
|
||||
|
||||
_subdirs=(runtimes/$package_platform/lib/*)
|
||||
_managed_lib_dir="${_subdirs[0]}"
|
||||
for l in $(find $_managed_lib_dir -type f); do
|
||||
managed_libraries+=" $l"
|
||||
done
|
||||
|
||||
for l in $managed_libraries; do
|
||||
cp -v "$l" "$precompiled_dir/mono-libs"
|
||||
done
|
||||
|
||||
myprint "${GREEN}mono files have been copied successfully!"
|
||||
cd ../../..
|
||||
clean_dir "$OBJDIR/downloads"
|
||||
@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
mono_prefix_path="$TASK_ARGS"
|
||||
if [ -z "$mono_prefix_path" ]; then
|
||||
error "required argument 'mono_prefix_path'
|
||||
Usage: cbuild get_mono_files_from=mono_prefix_path"
|
||||
fi
|
||||
myprint "${BLUE}mono prefix: ${WHITE}$mono_prefix_path"
|
||||
|
||||
# copy headers
|
||||
rm -rf 'dependencies/include/mono'
|
||||
mkdir -p 'dependencies/include'
|
||||
cp -r "$mono_prefix_path/include/mono-2.0/mono" 'dependencies/include/'
|
||||
rm -rf "dependencies/precompiled/mono-libs"
|
||||
mkdir -p "dependencies/precompiled"
|
||||
mkdir -p "dependencies/precompiled/mono-libs"
|
||||
|
||||
case "$OS" in
|
||||
LINUX)
|
||||
# copy mono dynamic libraries
|
||||
shared_libs=$(find "$mono_prefix_path/lib" -maxdepth 1 \( -name '*.so*' -a -not -name '*-profiler*' \) -type f)
|
||||
if [ -z "$shared_libs" ]; then
|
||||
error "can't find mono shared libraries"
|
||||
fi
|
||||
for l in $shared_libs ; do
|
||||
cp -v "$l" "dependencies/precompiled/mono-libs/"
|
||||
done
|
||||
so_v_libs=$(find "dependencies/precompiled/mono-libs" -name '*.so.*')
|
||||
for l in $so_v_libs ; do
|
||||
l_basename=$(basename "$l")
|
||||
soname_without_version=$(safeprint "$l_basename" | sed 's,.so.*,.so,')
|
||||
myprint "${BLUE}patching ${WHITE}$l_basename${BLUE}: replacing soname with ${CYAN}$soname_without_version"
|
||||
patchelf --set-soname "$soname_without_version" "$l"
|
||||
mv -v "$l" "dependencies/precompiled/mono-libs/$soname_without_version"
|
||||
done
|
||||
|
||||
# myprint "${BLUE}stripping debug symbols from mono shared libraries"
|
||||
# for l in $(find "dependencies/precompiled/mono-libs" -name '*.so') ; do
|
||||
# strip -g "$l"
|
||||
# done
|
||||
|
||||
# copy mono c# libraries
|
||||
managed_libraries="mscorlib.dll"
|
||||
myprint "${BLUE}copying mono managed libraries"
|
||||
for l in $managed_libraries ; do
|
||||
cp -v "$mono_prefix_path/lib/mono/4.5/$l" "dependencies/precompiled/mono-libs/"
|
||||
done
|
||||
|
||||
# copy config
|
||||
myprint "${BLUE}copying mono config"
|
||||
cp "$mono_prefix_path/etc/mono/config" "dependencies/precompiled/mono-libs/config.xml"
|
||||
myprint "${BLUE}removing '$mono_libdir/' from mono config"
|
||||
sed 's,$mono_libdir/,,g' -i "dependencies/precompiled/mono-libs/config.xml"
|
||||
;;
|
||||
*)
|
||||
error "operating system $OS has no configuration variants"
|
||||
;;
|
||||
esac
|
||||
|
||||
myprint "${GREEN}mono files were copied successfully!"
|
||||
Loading…
Reference in New Issue
Block a user