diff --git a/Makefile b/Makefile index ca71ab6..ef4b2fc 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ endif %.cpp : %.rl ragel -o $@ $< -build: lel_parser.cpp +build: src/lel_parser.cpp meson compile -j 10 -C builddir release_build: diff --git a/config.hpp b/include/config.hpp similarity index 100% rename from config.hpp rename to include/config.hpp diff --git a/constants.hpp b/include/constants.hpp similarity index 100% rename from constants.hpp rename to include/constants.hpp diff --git a/dbc.hpp b/include/dbc.hpp similarity index 100% rename from dbc.hpp rename to include/dbc.hpp diff --git a/guecs.hpp b/include/guecs.hpp similarity index 100% rename from guecs.hpp rename to include/guecs.hpp diff --git a/lel.hpp b/include/lel.hpp similarity index 100% rename from lel.hpp rename to include/lel.hpp diff --git a/sfml/color.hpp b/include/sfml/color.hpp similarity index 100% rename from sfml/color.hpp rename to include/sfml/color.hpp diff --git a/sfml/components.hpp b/include/sfml/components.hpp similarity index 100% rename from sfml/components.hpp rename to include/sfml/components.hpp diff --git a/sfml/shaders.hpp b/include/sfml/shaders.hpp similarity index 100% rename from sfml/shaders.hpp rename to include/sfml/shaders.hpp diff --git a/sfml/sound.hpp b/include/sfml/sound.hpp similarity index 100% rename from sfml/sound.hpp rename to include/sfml/sound.hpp diff --git a/sfml/textures.hpp b/include/sfml/textures.hpp similarity index 100% rename from sfml/textures.hpp rename to include/sfml/textures.hpp diff --git a/meson.build b/meson.build index 2bc1eef..2d20223 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,10 @@ # clang might need _LIBCPP_ENABLE_CXX26_REMOVED_CODECVT project('lel-guecs', 'cpp', - version: '0.1.0', + version: '0.2.0', default_options: [ 'cpp_std=c++20', - 'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1', + 'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1' ]) # use this for common options only for our executables @@ -17,13 +17,6 @@ cc = meson.get_compiler('cpp') dependencies = [] if build_machine.system() == 'windows' - add_global_link_arguments( - '-static-libgcc', - '-static-libstdc++', - '-static', - language: 'cpp', - ) - sfml_main = dependency('sfml_main') opengl32 = cc.find_library('opengl32', required: true) winmm = cc.find_library('winmm', required: true) @@ -65,7 +58,6 @@ vorbisfile = subproject('vorbis').get_variable('vorbisfile_dep') vorbisenc = subproject('vorbis').get_variable('vorbisenc_dep') sfml_audio = subproject('sfml').get_variable('sfml_audio_dep') sfml_graphics = subproject('sfml').get_variable('sfml_graphics_dep') -sfml_network = subproject('sfml').get_variable('sfml_network_dep') sfml_system = subproject('sfml').get_variable('sfml_system_dep') sfml_window = subproject('sfml').get_variable('sfml_window_dep') @@ -73,22 +65,36 @@ dependencies += [ fmt, json, freetype2, flac, ogg, vorbis, vorbisfile, vorbisenc, sfml_audio, sfml_graphics, - sfml_network, sfml_system, - sfml_window + sfml_system, sfml_window ] sources = [ - 'config.cpp', - 'dbc.cpp', - 'guecs.cpp', - 'lel.cpp', - 'sfml/shaders.cpp', - 'sfml/sound.cpp', - 'sfml/textures.cpp', - 'sfml/components.cpp', + 'src/config.cpp', + 'src/dbc.cpp', + 'src/guecs.cpp', + 'src/lel.cpp', + 'src/sfml/shaders.cpp', + 'src/sfml/sound.cpp', + 'src/sfml/textures.cpp', + 'src/sfml/components.cpp', ] -executable('runtests', sources + [ +lel_guecs_inc = include_directories('include') + +lel_guecs_lib = both_libraries('lel-guecs', + sources, + version: '0.2.0', + soversion: '1', + cpp_args: cpp_args, + include_directories: lel_guecs_inc, + override_options: exe_defaults, + dependencies: dependencies) + +lel_guecs_dep = declare_dependency( + link_with: lel_guecs_lib, + include_directories: lel_guecs_inc) + +executable('runtests', [ 'tests/lel.cpp', 'tests/guecs.cpp', 'tests/shaders.cpp', @@ -98,12 +104,16 @@ executable('runtests', sources + [ cpp_args: cpp_args, link_args: link_args, override_options: exe_defaults, + include_directories: lel_guecs_inc, + link_with: [lel_guecs_lib.get_static_lib()], dependencies: dependencies + [catch2]) -executable('calc', sources + [ +executable('calc', [ 'demos/calc.cpp', ], cpp_args: cpp_args, link_args: link_args, override_options: exe_defaults, + include_directories: lel_guecs_inc, + link_with: [lel_guecs_lib.get_static_lib()], dependencies: dependencies) diff --git a/config.cpp b/src/config.cpp similarity index 100% rename from config.cpp rename to src/config.cpp diff --git a/dbc.cpp b/src/dbc.cpp similarity index 100% rename from dbc.cpp rename to src/dbc.cpp diff --git a/guecs.cpp b/src/guecs.cpp similarity index 100% rename from guecs.cpp rename to src/guecs.cpp diff --git a/lel.cpp b/src/lel.cpp similarity index 100% rename from lel.cpp rename to src/lel.cpp diff --git a/lel_parser.cpp b/src/lel_parser.cpp similarity index 100% rename from lel_parser.cpp rename to src/lel_parser.cpp diff --git a/lel_parser.rl b/src/lel_parser.rl similarity index 100% rename from lel_parser.rl rename to src/lel_parser.rl diff --git a/sfml/components.cpp b/src/sfml/components.cpp similarity index 100% rename from sfml/components.cpp rename to src/sfml/components.cpp diff --git a/sfml/shaders.cpp b/src/sfml/shaders.cpp similarity index 98% rename from sfml/shaders.cpp rename to src/sfml/shaders.cpp index dbc161f..f58b567 100644 --- a/sfml/shaders.cpp +++ b/src/sfml/shaders.cpp @@ -1,4 +1,4 @@ -#include "shaders.hpp" +#include "sfml/shaders.hpp" #include #include "dbc.hpp" #include diff --git a/sfml/sound.cpp b/src/sfml/sound.cpp similarity index 98% rename from sfml/sound.cpp rename to src/sfml/sound.cpp index cf8c48a..bc5deb9 100644 --- a/sfml/sound.cpp +++ b/src/sfml/sound.cpp @@ -1,4 +1,4 @@ -#include "sound.hpp" +#include "sfml/sound.hpp" #include "dbc.hpp" #include #include "config.hpp" diff --git a/sfml/textures.cpp b/src/sfml/textures.cpp similarity index 98% rename from sfml/textures.cpp rename to src/sfml/textures.cpp index 7ee1ded..7e8544a 100644 --- a/sfml/textures.cpp +++ b/src/sfml/textures.cpp @@ -1,4 +1,4 @@ -#include "textures.hpp" +#include "sfml/textures.hpp" #include #include "dbc.hpp" #include