Giter Site home page Giter Site logo

brucelevis / sokol_cmake Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cedric-h/sokol_cmake

0.0 1.0 0.0 308 KB

some cmake stuff for using sokol and sokol's shader compiler

CMake 0.41% C 93.82% C++ 5.14% GLSL 0.04% HTML 0.13% Objective-C 0.46%

sokol_cmake's Introduction

game

A game written in C99 with minimal dependencies for Windows, macOS, Linux and WASM.

Clone, Build and Run (Linux, macOS, Windows)

On the command line:

git clone https://github.com/usr/repo
cd repo
mkdir build
cd build
cmake ..
cmake --build .

NOTE: on Linux you'll need to install the OpenGL and X11 development packages (e.g. mesa-common-dev and libx11-dev).

On Mac and Linux this will create an executable called 'game' in the build directory:

./game

On Windows, the executable is in a subdirectory:

Debug/game.exe

Build and Run WASM/HTML version via Emscripten

NOTE: You'll run into various problems running the Emscripten SDK tools on Windows, might be better to run this stuff in WSL.

Setup the emscripten SDK as described here:

https://emscripten.org/docs/getting_started/downloads.html#installation-instructions

Don't forget to run source ./emsdk_env.sh after activating the SDK.

And then in the game.c directory:

mkdir build
cd build
emcmake cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=MinSizeRel ..
cmake --build .

To run the compilation result in the system web browser:

> emrun game.html

IDE Support

On Windows, cmake will automatically create a Visual Studio solution file which can be opened with the start command:

cd build
cmake ..
start game.sln

On macOS, the cmake Xcode generator can be used to create an Xcode project which can be opened with the open command:

cd build
cmake -GXcode ..
open game.xcodeproj

On all platforms with Visual Studio Code and the Microsoft C/C++ and CMake Tools extensions, simply open VSCode in the root directory of the project. The CMake Tools extension will detect the CMakeLists.txt file and take over from there:

cd game.c
code .

sokol_cmake's People

Contributors

cedric-h avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.