[Updated] Devcontainer and dockerfile, [TODO] Make it statically link instead of shared, for standalone executables

This commit is contained in:
Ninjaws
2024-12-04 23:32:42 +01:00
parent 9151243c52
commit 681dcdd029
4 changed files with 38 additions and 22 deletions
+7 -4
View File
@@ -8,11 +8,16 @@
}, },
"runArgs": [ "runArgs": [
"--name=jelly-rescue-dev-cont", "--name=jelly-rescue-dev-cont",
"--net=host" "--net=host",
"--privileged",
"--volume", "/tmp/.X11-unix:/tmp/.X11-unix",
"--env", "DISPLAY=${localEnv:DISPLAY}"
], ],
"workspaceFolder": "/app", "workspaceFolder": "/app",
"mounts": [ "mounts": [
"source=./src,target=/app/src,type=bind" "source=./src,target=/app/src,type=bind",
"source=./scripts,target=/app/scripts,type=bind",
"source=./dist,target=/app/dist,type=bind"
], ],
"customizations": { "customizations": {
"vscode": { "vscode": {
@@ -24,6 +29,4 @@
] ]
} }
}, },
// "postCreateCommand": "/app/scripts/emsdk_setup.sh",
//"postStartCommand": "/app/scripts/emsdk_activate.sh"
} }
+7 -16
View File
@@ -1,13 +1,6 @@
FROM gcc:latest as base FROM gcc:latest as base
# RUN apt-get install cmake \
# && rm -rf /var/cache/apt/*
FROM base as development FROM base as development
# RUN apt-get update \
# && apt-get install -y entr \
# && rm -rf /var/cache/apt/*
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y \ && apt-get install -y \
@@ -28,8 +21,8 @@ RUN chown -R dev:dev /app
RUN echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dev && \ RUN echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dev && \
chmod 0440 /etc/sudoers.d/dev chmod 0440 /etc/sudoers.d/dev
COPY scripts ./scripts # COPY scripts ./scripts
RUN chmod +x /app/scripts/*.sh # RUN chmod +x /app/scripts/*.sh
USER dev USER dev
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
@@ -48,13 +41,11 @@ RUN git clone https://github.com/raysan5/raylib.git raylib \
&& mkdir build && cd build \ && mkdir build && cd build \
&& cmake -DBUILD_SHARED_LIBS=ON .. \ && cmake -DBUILD_SHARED_LIBS=ON .. \
&& make \ && make \
&& sudo make install && sudo make install \
&& cd ..
# RUN git clone https://github.com/raysan5/raylib.git raylib \ # RUN mkdir dist
# && cd raylib \
# && mkdir build && cd build \ ENV LD_LIBRARY_PATH=/app/raylib/build/raylib
# && cmake -DBUILD_SHARED_LIBS=ON .. \
# && make \
# && make install
CMD ["bash"] CMD ["bash"]
+2 -2
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
clear clear
g++ src/main.cpp -o dist/websort_cpp g++ src/main.cpp -o dist/jelly_rescue -L$LD_LIBRARY_PATH -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
./dist/websort_cpp ./dist/jelly_rescue
+22
View File
@@ -0,0 +1,22 @@
#include "raylib.h"
int main() {
// Initialize window
InitWindow(800, 600, "Raylib + Emscripten Test");
// Main game loop
while (!WindowShouldClose()) {
// Update (empty for now)
// Draw
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Hello, Raylib on WebAssembly!", 190, 200, 20, DARKGRAY);
EndDrawing();
}
// Close window
CloseWindow();
return 0;
}