diff --git a/.gitignore b/.gitignore index d772625..fa94c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.o -src/build \ No newline at end of file +build +bin_unix/native_* diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..dce8c35 --- /dev/null +++ b/meson.build @@ -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') diff --git a/src/client/meson.build b/src/client/meson.build new file mode 100644 index 0000000..82d53d7 --- /dev/null +++ b/src/client/meson.build @@ -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') +) diff --git a/src/enet/meson.build b/src/enet/meson.build new file mode 100644 index 0000000..54fef50 --- /dev/null +++ b/src/enet/meson.build @@ -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 ') + libenet_cflags += ['-DHAS_GETADDRINFO'] + endif + if cc.has_function('getnameinfo', prefix: '#include ') + libenet_cflags += ['-DHAS_GETNAMEINFO'] + endif + if cc.has_function('gethostbyaddr_r', prefix: '#include ') + libenet_cflags += ['-DHAS_GETHOSTBYADDR_R'] + endif + if cc.has_function('gethostbyname_r', prefix: '#include ') + libenet_cflags += ['-DHAS_GETHOSTBYNAME_R'] + endif + if cc.has_function('poll', prefix: '#include ') + libenet_cflags += ['-DHAS_POLL'] + endif + if cc.has_function('fcntl', prefix: '#include ') + libenet_cflags += ['-DHAS_FCNTL'] + endif + if cc.has_function('inet_pton', prefix: '#include ') + libenet_cflags += ['-DHAS_INET_PTON'] + endif + if cc.has_function('inet_ntop', prefix: '#include ') + libenet_cflags += ['-DHAS_INET_NTOP'] + endif + if cc.has_member('struct msghdr', 'msg_flags', prefix: '#include ') + libenet_cflags += ['-DHAS_MSGHDR_FLAGS'] + endif + if cc.has_type('socklen_t', prefix: '#include ') + 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 +) \ No newline at end of file diff --git a/src/master/meson.build b/src/master/meson.build new file mode 100644 index 0000000..ca2f375 --- /dev/null +++ b/src/master/meson.build @@ -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') +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..e31e894 --- /dev/null +++ b/src/meson.build @@ -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') diff --git a/src/server/meson.build b/src/server/meson.build new file mode 100644 index 0000000..40b5ddc --- /dev/null +++ b/src/server/meson.build @@ -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') +)