Browse Source

mesonize

master
Daniel Kolesa 1 month ago
parent
commit
fa80b2c710
7 changed files with 201 additions and 1 deletions
  1. +2
    -1
      .gitignore
  2. +9
    -0
      meson.build
  3. +72
    -0
      src/client/meson.build
  4. +62
    -0
      src/enet/meson.build
  5. +21
    -0
      src/master/meson.build
  6. +11
    -0
      src/meson.build
  7. +24
    -0
      src/server/meson.build

+ 2
- 1
.gitignore View File

@@ -1,2 +1,3 @@
*.o
src/build
build
bin_unix/native_*

+ 9
- 0
meson.build View File

@@ -0,0 +1,9 @@
project('octacore', ['cpp'],
version: '0.0.1',
default_options: ['buildtype=debugoptimized', 'cpp_std=c++17'],
meson_version: '>=0.46'
)

bin_path = join_paths(meson.source_root(), 'bin_unix')

subdir('src')

+ 72
- 0
src/client/meson.build View File

@@ -0,0 +1,72 @@
client_src = [
'../shared/crypto.cpp',
'../shared/geom.cpp',
'../shared/glemu.cpp',
'../shared/stream.cpp',
'../shared/tools.cpp',
'../shared/zip.cpp',
'../engine/aa.cpp',
'../engine/bih.cpp',
'../engine/blend.cpp',
'../engine/client.cpp',
'../engine/command.cpp',
'../engine/console.cpp',
'../engine/dynlight.cpp',
'../engine/grass.cpp',
'../engine/light.cpp',
'../engine/main.cpp',
'../engine/material.cpp',
'../engine/menus.cpp',
'../engine/movie.cpp',
'../engine/normal.cpp',
'../engine/octa.cpp',
'../engine/octaedit.cpp',
'../engine/octarender.cpp',
'../engine/physics.cpp',
'../engine/pvs.cpp',
'../engine/rendergl.cpp',
'../engine/renderlights.cpp',
'../engine/rendermodel.cpp',
'../engine/renderparticles.cpp',
'../engine/rendersky.cpp',
'../engine/rendertext.cpp',
'../engine/renderva.cpp',
'../engine/server.cpp',
'../engine/serverbrowser.cpp',
'../engine/shader.cpp',
'../engine/sound.cpp',
'../engine/stain.cpp',
'../engine/texture.cpp',
'../engine/ui.cpp',
'../engine/water.cpp',
'../engine/world.cpp',
'../engine/worldio.cpp',
'../game/ai.cpp',
'../game/client.cpp',
'../game/entities.cpp',
'../game/game.cpp',
'../game/render.cpp',
'../game/scoreboard.cpp',
'../game/server.cpp',
'../game/waypoint.cpp',
'../game/weapon.cpp'
]

threads_dep = dependency('threads')
sdl2_dep = dependency('sdl2')
sdl2_image_dep = dependency('SDL2_image')
sdl2_mixer_dep = dependency('SDL2_mixer')
zlib_dep = dependency('zlib')
gl_dep = dependency('gl')
rt_dep = cc.find_library('rt', required: false)

executable('native_client',
client_src,
dependencies: [
threads_dep, libenet, sdl2_dep, sdl2_image_dep,
sdl2_mixer_dep, zlib_dep, gl_dep, rt_dep
],
include_directories: octacore_includes,
install: true,
install_dir: join_paths(meson.source_root(), 'bin_unix')
)

+ 62
- 0
src/enet/meson.build View File

@@ -0,0 +1,62 @@
add_languages('c')

libenet_src = [
'callbacks.c',
'compress.c',
'host.c',
'list.c',
'packet.c',
'peer.c',
'protocol.c',
'unix.c',
'win32.c'
]

cc = meson.get_compiler('c')

libenet_cflags = []

if target_machine.system() != 'windows'
if cc.has_function('getaddrinfo', prefix: '#include <netdb.h>')
libenet_cflags += ['-DHAS_GETADDRINFO']
endif
if cc.has_function('getnameinfo', prefix: '#include <netdb.h>')
libenet_cflags += ['-DHAS_GETNAMEINFO']
endif
if cc.has_function('gethostbyaddr_r', prefix: '#include <netdb.h>')
libenet_cflags += ['-DHAS_GETHOSTBYADDR_R']
endif
if cc.has_function('gethostbyname_r', prefix: '#include <netdb.h>')
libenet_cflags += ['-DHAS_GETHOSTBYNAME_R']
endif
if cc.has_function('poll', prefix: '#include <poll.h>')
libenet_cflags += ['-DHAS_POLL']
endif
if cc.has_function('fcntl', prefix: '#include <fcntl.h>')
libenet_cflags += ['-DHAS_FCNTL']
endif
if cc.has_function('inet_pton', prefix: '#include <arpa/inet.h>')
libenet_cflags += ['-DHAS_INET_PTON']
endif
if cc.has_function('inet_ntop', prefix: '#include <arpa/inet.h>')
libenet_cflags += ['-DHAS_INET_NTOP']
endif
if cc.has_member('struct msghdr', 'msg_flags', prefix: '#include <sys/socket.h>')
libenet_cflags += ['-DHAS_MSGHDR_FLAGS']
endif
if cc.has_type('socklen_t', prefix: '#include <sys/socket.h>')
libenet_cflags += ['-DHAS_SOCKLEN_T']
endif
endif

libenet_lib = static_library('enet',
libenet_src,
include_directories: include_directories('include'),
c_args: libenet_cflags,
install: false
)

libenet = declare_dependency(
include_directories: include_directories('include'),
link_with: libenet_lib
)

+ 21
- 0
src/master/meson.build View File

@@ -0,0 +1,21 @@
client_src = [
'../shared/crypto.cpp',
'../shared/stream.cpp',
'../shared/tools.cpp',
'../engine/command.cpp',
'../engine/master.cpp'
]

threads_dep = dependency('threads')
zlib_dep = dependency('zlib')

executable('native_master',
client_src,
dependencies: [
threads_dep, libenet, zlib_dep
],
include_directories: octacore_includes,
cpp_args: ['-DSTANDALONE'],
install: true,
install_dir: join_paths(meson.source_root(), 'bin_unix')
)

+ 11
- 0
src/meson.build View File

@@ -0,0 +1,11 @@
octacore_includes = [
include_directories('shared', 'engine', 'game', 'enet/include')
]

# FIXME: remove, for now without this the engine behaves wonky
add_global_arguments('-fsigned-char', language: 'cpp')

subdir('enet')
subdir('client')
subdir('server')
subdir('master')

+ 24
- 0
src/server/meson.build View File

@@ -0,0 +1,24 @@
client_src = [
'../shared/crypto.cpp',
'../shared/stream.cpp',
'../shared/tools.cpp',
'../engine/command.cpp',
'../engine/server.cpp',
'../engine/worldio.cpp',
'../game/entities.cpp',
'../game/server.cpp'
]

threads_dep = dependency('threads')
zlib_dep = dependency('zlib')

executable('native_server',
client_src,
dependencies: [
threads_dep, libenet, zlib_dep
],
include_directories: octacore_includes,
cpp_args: ['-DSTANDALONE'],
install: true,
install_dir: join_paths(meson.source_root(), 'bin_unix')
)

Loading…
Cancel
Save