Im loosing my fucking mind
:^)
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
/cmake-build-debug/
|
/cmake-build-debug/
|
||||||
|
/vcpkg_installed/
|
||||||
|
/build/
|
||||||
|
|||||||
+30
-16
@@ -1,38 +1,52 @@
|
|||||||
|
# Use an official Ubuntu as a parent image
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
|
# Prevent interactive prompts
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
cmake \
|
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
zip \
|
zip \
|
||||||
unzip \
|
unzip \
|
||||||
tar \
|
tar \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
libx11-dev \
|
software-properties-common \
|
||||||
libxrandr-dev \
|
tzdata
|
||||||
libxinerama-dev \
|
|
||||||
libxcursor-dev \
|
# Set timezone to UTC
|
||||||
libxi-dev \
|
RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
|
||||||
libgl1-mesa-dev \
|
dpkg-reconfigure --frontend noninteractive tzdata
|
||||||
libglu1-mesa-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
# Install CMake
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y wget \
|
||||||
|
&& wget https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-x86_64.sh \
|
||||||
|
&& sh cmake-3.28.0-linux-x86_64.sh --prefix=/usr/local --skip-license \
|
||||||
|
&& rm cmake-3.28.0-linux-x86_64.sh
|
||||||
|
|
||||||
# Install vcpkg
|
# Install vcpkg
|
||||||
RUN git clone https://github.com/Microsoft/vcpkg.git /vcpkg \
|
RUN git clone https://github.com/Microsoft/vcpkg.git /vcpkg \
|
||||||
&& /vcpkg/bootstrap-vcpkg.sh \
|
&& cd /vcpkg \
|
||||||
&& /vcpkg/vcpkg integrate install
|
&& git pull \
|
||||||
|
&& ./bootstrap-vcpkg.sh \
|
||||||
|
&& ./vcpkg integrate install
|
||||||
|
|
||||||
|
# Set environment variables for vcpkg
|
||||||
|
ENV VCPKG_ROOT=/vcpkg
|
||||||
|
ENV VCPKG_DEFAULT_TRIPLET=x64-linux
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the project files
|
# Copy the current directory contents into the container at /app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Install dependencies using vcpkg
|
# Install project dependencies using vcpkg
|
||||||
RUN /vcpkg/vcpkg install $(cat vcpkg.json | jq -r '.dependencies[]')
|
RUN /vcpkg/vcpkg update \
|
||||||
|
&& /vcpkg/vcpkg install $(cat vcpkg.json | jq -r '.dependencies[]')
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
RUN mkdir build \
|
RUN mkdir build \
|
||||||
@@ -40,5 +54,5 @@ RUN mkdir build \
|
|||||||
&& cmake .. -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
&& cmake .. -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||||
&& cmake --build .
|
&& cmake --build .
|
||||||
|
|
||||||
# Set the entrypoint
|
# Specify the command to run the executable
|
||||||
CMD ["./build/gravity"]
|
CMD ["./build/gravity"]
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ The program uses OpenGL to render the 3D scene:
|
|||||||
|
|
||||||
# How to Use & Installation
|
# How to Use & Installation
|
||||||
|
|
||||||
### Prerequisites
|
## Prerequisites
|
||||||
- C++ compiler with C++17 support
|
- C++ compiler with C++17 support
|
||||||
- CMake (version 3.10 or higher)
|
- CMake (version 3.28 or higher)
|
||||||
- OpenGL libraries
|
- OpenGL libraries
|
||||||
- GLFW3
|
- GLFW3
|
||||||
- GLM (OpenGL Mathematics)
|
- GLM (OpenGL Mathematics)
|
||||||
@@ -78,34 +78,37 @@ The program uses OpenGL to render the 3D scene:
|
|||||||
|
|
||||||
### Building from Source
|
### Building from Source
|
||||||
1. Clone the repository:
|
1. Clone the repository:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/Quinta0/gravity.git
|
git clone https://github.com/Quinta0/gravity.git
|
||||||
cd gravity
|
cd gravity
|
||||||
```
|
```
|
||||||
2. Install vcpkg and dependencies:
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/Microsoft/vcpkg.git
|
|
||||||
./vcpkg/bootstrap-vcpkg.sh # On Windows, use bootstrap-vcpkg.bat
|
|
||||||
./vcpkg/vcpkg install
|
|
||||||
```
|
|
||||||
3. Create a build directory and navigate to it:
|
|
||||||
```bash
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
```
|
|
||||||
4. Generate the build files with CMake:
|
|
||||||
```bash
|
|
||||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
```
|
|
||||||
5. Build the project:
|
|
||||||
```bash
|
|
||||||
cmake --build .
|
|
||||||
```
|
|
||||||
6. Run the simulator:
|
|
||||||
```bash
|
|
||||||
./gravity
|
|
||||||
```
|
|
||||||
|
|
||||||
|
2. Install vcpkg:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/Microsoft/vcpkg.git
|
||||||
|
cd vcpkg
|
||||||
|
./bootstrap-vcpkg.sh # On Windows, use bootstrap-vcpkg.bat
|
||||||
|
./vcpkg integrate install
|
||||||
|
cd ..
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install dependencies using vcpkg:
|
||||||
|
```bash
|
||||||
|
./vcpkg/vcpkg install freeglut glew glm vcpkg-cmake opengl glfw3
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Create a build directory and run CMake:
|
||||||
|
```bash
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run the simulator:
|
||||||
|
```bash
|
||||||
|
./gravity
|
||||||
|
```
|
||||||
|
|
||||||
### Using Docker
|
### Using Docker
|
||||||
If you prefer to use Docker, follow these steps:
|
If you prefer to use Docker, follow these steps:
|
||||||
@@ -113,3 +116,11 @@ If you prefer to use Docker, follow these steps:
|
|||||||
1. Ensure Docker is installed on your system.
|
1. Ensure Docker is installed on your system.
|
||||||
|
|
||||||
2. Build the Docker image:
|
2. Build the Docker image:
|
||||||
|
```bash
|
||||||
|
docker build -t gravity-simulator .
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run the Docker container:
|
||||||
|
```bash
|
||||||
|
docker run --rm gravity-simulator
|
||||||
|
```
|
||||||
+3
-3
@@ -2,9 +2,9 @@
|
|||||||
"dependencies": [
|
"dependencies": [
|
||||||
"freeglut",
|
"freeglut",
|
||||||
"glew",
|
"glew",
|
||||||
|
"glfw3",
|
||||||
"glm",
|
"glm",
|
||||||
"vcpkg-cmake",
|
|
||||||
"opengl",
|
"opengl",
|
||||||
"glfw3"
|
"vcpkg-cmake"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user