Skip to content

Libraries and advanced build configuration

Teufelchen edited this page Mar 4, 2021 · 1 revision

This is part of the Getting Started guide. Please read the full guide if you have trouble.


Introduction

nxdk is build using make, all you have todo is to include nxdks Makefile into yours. This example is taken from the Hello nxdk! sample

XBE_TITLE=hello
GEN_XISO = $(XBE_TITLE).iso
SRCS = $(wildcard $(CURDIR)/*.c)
NXDK_DIR = $(CURDIR)/../..
include $(NXDK_DIR)/Makefile

As you can see, there are multiple flags you must set in order to successfully build the sample. These options are explained below.

Supported inputs

The nxdk makefile will support the following targets:

  • .c
  • .cxx

...

Variables

Environment

include $(NXDK_DIR)/Makefile is the usual way of including the nxdk Makefile

NXDK_DIR must point to the root of your local nxdk installation. It is used to find the Makefile, and nxdk tools and libraries.

You should not set this variable as part of your Makefile. Instead it should be defined in your environment. See the getting started guide for further info.

Compilation

  • SRCS is a list of your source files
  • CFLAGS
  • CXXFLAGS
  • LDFLAGS
  • DEBUG if set, enables the build to include debug symbols

XBE generation

  • XBE_TITLE sets the application title of you Xbox executable(XBE)

Image generation

The nxdk build-system allows you to generate a disc image for quick-testing and distribution.

  • GEN_XISO sets the name of the xiso if given, otherwise the image building is skipped

See the Create-an-XISO.

Enable linking of optional libraries

For some of libraries included with nxdk, linking must be enabled explicitly. This is done by setting a variable.

(If a library is not listed here, it is linked by default)

C++ STL

By setting NXDK_CXX = y linking against LLVM libcxx is enabled. This allows you to access the C++ standard template library as shown in this sample.

Networking

Set NXDK_NET = y to enable support for lwIP. lwIP is a small independent implementation of the TCP/IP protocol suite that also supports BSD sockets as shown in this sample.

SDL2

After setting NXDK_SDL = y you project gets linked against SDL2. The Simple DirectMedia Layer is a commonly used library to enable easy low-level to audio, video, controller and more. Its easy to use as shown in the SDL sample.