Kaynağa Gözat

Test Linux support

Configure environment for Linux.

Server runs ok, the game runs but with no window...
master
TheoryOfNekomata 1 yıl önce
ebeveyn
işleme
09954125ff
9 değiştirilmiş dosya ile 47 ekleme ve 16 silme
  1. +13
    -2
      CMakeLists.txt
  2. +22
    -8
      README.md
  3. +1
    -0
      dependencies.txt
  4. +1
    -0
      src/packages/compat/IZ_windows.h
  5. +4
    -0
      src/packages/game/IZ_app_input.c
  6. +1
    -0
      src/packages/game/output/video/IZ_video.c
  7. +1
    -6
      src/packages/io/IZ_io.c
  8. +3
    -0
      src/packages/io/IZ_io.h
  9. +1
    -0
      src/packages/log/IZ_log.h

+ 13
- 2
CMakeLists.txt Dosyayı Görüntüle

@@ -9,6 +9,8 @@ if (WIN32)
# TODO set arch on target instead of generator
set(IZ_PLATFORM WINDOWS)
set(IZ_CRYPTO_LIBRARIES libcrypto libssl)
set(IZ_GETOPT_DEPENDENCIES dependencies/getopt-for-windows/getopt.h
dependencies/getopt-for-windows/getopt.c)
add_definitions(
-DIZ_WINDOWS
)
@@ -93,6 +95,16 @@ elseif(IZ_PLATFORM STREQUAL "MACOS")
/usr/local/include/openssl
)

link_directories(
/usr/local/lib
)
elseif(IZ_PLATFORM STREQUAL "UNIX")
include_directories(
/usr/local/include
/usr/local/include/SDL2
/usr/local/include/openssl
)

link_directories(
/usr/local/lib
)
@@ -106,8 +118,7 @@ add_executable(
${IZ_EXECUTABLE_TYPE}
dependencies/minIni/dev/minIni.h
dependencies/minIni/dev/minIni.c
dependencies/getopt-for-windows/getopt.h
dependencies/getopt-for-windows/getopt.c
${IZ_GETOPT_DEPENDENCIES}
src/packages/game/output/video/IZ_video.h
src/packages/game/output/video/IZ_video.c
src/packages/common/IZ_common.h


+ 22
- 8
README.md Dosyayı Görüntüle

@@ -20,11 +20,25 @@ A run-and-gun shooter inspired by Metal Slug.

1. Clone this repo.
2. Clone the repositories under `dependencies.txt`, including SDL2.
3. Build the SDL, SDL_image, and SDL_ttf dependencies using the [build instructions for macOS](https://wiki.libsdl.org/SDL2/Installation#macos).
> **Note:** You may need to download other tools to build the libraries.

> **Note:** Clone the submodules under SDL_ttf to download freetype and harfbuzz
4. Build the following dependencies first:
- `portmidi`
- `libwebsockets` (follow the [instructions on building LWS](https://libwebsockets.org/lws-api-doc-master/html/md_README_8build.html))
5. Build via CMake.
3. Build the SDL, SDL_image, and SDL_ttf dependencies using the [build instructions for Linux/UNIX](https://wiki.libsdl.org/SDL2/Installation#linuxunix)
or [build instructions for macOS](https://wiki.libsdl.org/SDL2/Installation#macos).
> **Note:** You may need to download other tools to build the libraries:
> - autoconf
> - make

> **Note:** Clone the submodules under SDL_ttf to download freetype and harfbuzz:
>
> ```shell
> git submodule update --init --recursive
> ```
4. For OpenSSL, simply run:
```shell
./Configure
make
make test
```
5. Build the following dependencies first:
- `portmidi` (Linux needs [ALSA libraries](https://www.alsa-project.org/files/pub/lib/) to be compiled)
- ALSA Lib requires `libtool` to be compiled.
- `libwebsockets` (follow the [instructions on building LWS](https://libwebsockets.org/lws-api-doc-master/html/md_README_8build.html))
6. Build via CMake.

+ 1
- 0
dependencies.txt Dosyayı Görüntüle

@@ -10,3 +10,4 @@ https://libwebsockets.org/repo/libwebsockets
https://github.com/openssl/openssl
https://www.sqlite.org/download.html (use SQLite amalgamated source code, unpack into `sqlite` directory)
https://code.modal.sh/TheoryOfNekomata/bdd-for-c-mocks
git://git.alsa-project.org/alsa-lib.git (linux/unix)

+ 1
- 0
src/packages/compat/IZ_windows.h Dosyayı Görüntüle

@@ -3,6 +3,7 @@

#ifndef IZ_WINDOWS
typedef int errno_t;
typedef unsigned int rsize_t;
#else
#include <io.h>
#include <SDL_syswm.h>


+ 4
- 0
src/packages/game/IZ_app_input.c Dosyayı Görüntüle

@@ -4,6 +4,10 @@
#define IZ_DEBUG_CONNECT SDLK_PAGEUP
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT
#elif IZ_UNIX
#define IZ_DEBUG_CONNECT SDLK_PAGEUP
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT
#elif IZ_MACOS
#define IZ_DEBUG_CONNECT SDLK_EQUALS
#define IZ_DEBUG_DISCONNECT SDLK_MINUS


+ 1
- 0
src/packages/game/output/video/IZ_video.c Dosyayı Görüntüle

@@ -87,6 +87,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con
IZ_LogError("video", "Window could not be created! Reason: %s", SDL_GetError());
return -3;
}
SDL_ShowWindow(window);
state->window = window;
state->renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
return 0;


+ 1
- 6
src/packages/io/IZ_io.c Dosyayı Görüntüle

@@ -47,13 +47,8 @@ bool IZ_isdir(const char* path) {
struct stat s;
int err = stat("/path/to/possible_dir", &s);
if(-1 == err) {
if(ENOENT == errno) {
return false;
}
perror("stat");
exit(1);\
return;
}
return (S_ISDIR(s.st_mode))
return (S_ISDIR(s.st_mode));
#endif
}

+ 3
- 0
src/packages/io/IZ_io.h Dosyayı Görüntüle

@@ -5,6 +5,9 @@
#include <stdbool.h>
#include <stdarg.h>
#include "../compat/IZ_windows.h"
#ifdef IZ_UNIX
#include <sys/stat.h>
#endif

int IZ_sprintf(char*, size_t, const char*, ...);



+ 1
- 0
src/packages/log/IZ_log.h Dosyayı Görüntüle

@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include "../timer/IZ_timer.h"
#include "../io/IZ_io.h"
#include "../stdinc/IZ_string.h"


Yükleniyor…
İptal
Kaydet