GithubHelp home page GithubHelp logo

jaktnesmonster's Introduction

Jakt NES Monster

Creating a NES emulator in the jakt programming language.

Make sure you have libsdl2+SDL2 headers installed, and build and install the jakt compiler into your PATH.

Building using jakt directly

With jakt in your path and the install location of SDL2 known, you can build like so for Linux:

> jakt src/main.jakt -l SDL2 -I <path to Jakt runtime directory> -O -o jakt_nes

On macOS, you can use (be sure to update versions to match your SDL2 version):

> jakt src/main.jakt -l SDL2 -I /opt/homebrew/Cellar/sdl2/2.0.22/include -L /opt/homebrew/Cellar/sdl2/2.0.22/lib -I ../jakt/runtime -O -o jakt_nes

For Windows, keep reading into the CMake steps :^).

Building using CMake

Instead of installing jakt into somewhere that's in your path, make sure to install jakt via the CMake build by setting CMAKE_INSTALL_PREFIX somewhere interesting, or passing --prefix on the command line . One decent option for prefix is "jakt-install".

jakt> cmake -B build -GNinja -DCMAKE_INSTALL_PREFIX=jakt-install -DCMAKE_CXX_COMPILER=clang++
jakt> cmake --build build
jakt> cmake --install build
# alternative to setting CMAKE_INSTALL_PREFIX
jakt> cmake --install build --prefix jakt-test

After that, you can build jaktnesmonster by passing the location of jakt CMake files to CMake. CMake should find SDL2 automatically, if it's in a standard install location for your platform (Linux, macOS, other Unix).

> cmake -G Ninja -B build -DCMAKE_PREFIX_PATH=../jakt/jakt-install -DCMAKE_CXX_COMPILER=clang++
> cmake --build build
# Alternatively
> ninja -C build

Building on Windows

The easiest way to hook up SDL2 to CMake on windows is via vcpkg

Ensure that you have the VS 2019 or 2022 toolset installed, including clang. MSVC is not supported.

Perform the above jakt install steps from a VS Developer Powershell instance.

Next, install SDL2 via vcpkg from a VS Developer PowerShell instance:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg install sdl2:x64-windows

Finally, configure jaktnesmonster with CMake, passing your Windows install of jakt, the vcpkg toolchain file, and clang++ as the C++ compiler:

cmake -B build -GNinja `
    -DCMAKE_PREFIX_PATH="..\jakt\jakt-install\share" `
    -DCMAKE_TOOLCHAIN_FILE="..\vcpkg\scripts\buildsystems\vcpkg.cmake" `
    -DCMAKE_CXX_COMPILER=clang++

Now you can build jakt_nes.exe via

> cmake --build build

or

> ninja -C build

Alternatively, using Visual Studio directly to build, you can create a CMakeSettings.json similar to:

{
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "clang_cl_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=\"..\\jakt\\jakt-install\\share\" ",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "cmakeToolchain": "..\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
    }
  ]
}

jaktnesmonster's People

Contributors

sophiajt avatar pedro-ximenez avatar adkaster avatar holladiewal avatar haakonnessjoen avatar

Watchers

 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.