From 0f0d149ad21e2efbd176c4ce2f2c8bb5c18d714d Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Thu, 30 Apr 2020 22:50:46 +0200 Subject: [PATCH] Move public headers to a separate directory, make a library --- {src/wren => include/wrenpp}/configuration.hpp | 0 .../wren => include/wrenpp}/def_configuration.hpp | 0 {src/wren => include/wrenpp}/error_type.hpp | 0 {src/wren => include/wrenpp}/handle.hpp | 0 {src/wren => include/wrenpp}/has_method.hpp | 0 {src/wren => include/wrenpp}/string_bt.hpp | 0 {src/wren => include/wrenpp}/vm.hpp | 0 {src/wren => include/wrenpp}/vm_fun.hpp | 0 meson.build | 15 +++++++++++++-- src/main.cpp | 4 ++-- src/wren/configuration.cpp | 2 +- src/wren/def_configuration.cpp | 2 +- src/wren/handle.cpp | 4 ++-- src/wren/vm.cpp | 4 ++-- src/wren/vm_fun.cpp | 2 +- 15 files changed, 22 insertions(+), 11 deletions(-) rename {src/wren => include/wrenpp}/configuration.hpp (100%) rename {src/wren => include/wrenpp}/def_configuration.hpp (100%) rename {src/wren => include/wrenpp}/error_type.hpp (100%) rename {src/wren => include/wrenpp}/handle.hpp (100%) rename {src/wren => include/wrenpp}/has_method.hpp (100%) rename {src/wren => include/wrenpp}/string_bt.hpp (100%) rename {src/wren => include/wrenpp}/vm.hpp (100%) rename {src/wren => include/wrenpp}/vm_fun.hpp (100%) diff --git a/src/wren/configuration.hpp b/include/wrenpp/configuration.hpp similarity index 100% rename from src/wren/configuration.hpp rename to include/wrenpp/configuration.hpp diff --git a/src/wren/def_configuration.hpp b/include/wrenpp/def_configuration.hpp similarity index 100% rename from src/wren/def_configuration.hpp rename to include/wrenpp/def_configuration.hpp diff --git a/src/wren/error_type.hpp b/include/wrenpp/error_type.hpp similarity index 100% rename from src/wren/error_type.hpp rename to include/wrenpp/error_type.hpp diff --git a/src/wren/handle.hpp b/include/wrenpp/handle.hpp similarity index 100% rename from src/wren/handle.hpp rename to include/wrenpp/handle.hpp diff --git a/src/wren/has_method.hpp b/include/wrenpp/has_method.hpp similarity index 100% rename from src/wren/has_method.hpp rename to include/wrenpp/has_method.hpp diff --git a/src/wren/string_bt.hpp b/include/wrenpp/string_bt.hpp similarity index 100% rename from src/wren/string_bt.hpp rename to include/wrenpp/string_bt.hpp diff --git a/src/wren/vm.hpp b/include/wrenpp/vm.hpp similarity index 100% rename from src/wren/vm.hpp rename to include/wrenpp/vm.hpp diff --git a/src/wren/vm_fun.hpp b/include/wrenpp/vm_fun.hpp similarity index 100% rename from src/wren/vm_fun.hpp rename to include/wrenpp/vm_fun.hpp diff --git a/meson.build b/meson.build index b20adb8..fd57319 100644 --- a/meson.build +++ b/meson.build @@ -5,6 +5,7 @@ project('wrentest', 'cpp', ) wren_dep = dependency('wren', version: '>=0.2.0', fallback: ['wren', 'wren_dep']) +public_incl = include_directories('include') os = host_machine.system() if os == 'gnu' @@ -36,9 +37,8 @@ project_config_file = configure_file( configuration: conf ) -executable(meson.project_name(), +wrenpp = library(meson.project_name(), project_config_file, - 'src/main.cpp', 'src/wren/vm.cpp', 'src/wren/configuration.cpp', 'src/wren/def_configuration.cpp', @@ -47,5 +47,16 @@ executable(meson.project_name(), 'src/wren/handle.cpp', 'src/wren/vm_fun.cpp', dependencies: [wren_dep], + include_directories: public_incl, install: true, ) +wrenpp_dep = declare_dependency( + link_with: wrenpp, + include_directories: public_incl, +) + +executable(meson.project_name(), + 'src/main.cpp', + dependencies: wrenpp_dep, + install: false, +) diff --git a/src/main.cpp b/src/main.cpp index 9208309..507fa8f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ -#include "wren/vm_fun.hpp" -#include "wren/def_configuration.hpp" +#include "wrenpp/vm_fun.hpp" +#include "wrenpp/def_configuration.hpp" #include #include #include diff --git a/src/wren/configuration.cpp b/src/wren/configuration.cpp index 50eb074..21b27fe 100644 --- a/src/wren/configuration.cpp +++ b/src/wren/configuration.cpp @@ -1,4 +1,4 @@ -#include "configuration.hpp" +#include "wrenpp/configuration.hpp" #include namespace wren { diff --git a/src/wren/def_configuration.cpp b/src/wren/def_configuration.cpp index dddfc27..bcfa68b 100644 --- a/src/wren/def_configuration.cpp +++ b/src/wren/def_configuration.cpp @@ -1,4 +1,4 @@ -#include "def_configuration.hpp" +#include "wrenpp/def_configuration.hpp" #include namespace wren { diff --git a/src/wren/handle.cpp b/src/wren/handle.cpp index 97d09a7..9fa0dbe 100644 --- a/src/wren/handle.cpp +++ b/src/wren/handle.cpp @@ -1,5 +1,5 @@ -#include "handle.hpp" -#include "vm.hpp" +#include "wrenpp/handle.hpp" +#include "wrenpp/vm.hpp" #include namespace wren { diff --git a/src/wren/vm.cpp b/src/wren/vm.cpp index 5b953eb..6b7df64 100644 --- a/src/wren/vm.cpp +++ b/src/wren/vm.cpp @@ -1,5 +1,5 @@ -#include "vm.hpp" -#include "configuration.hpp" +#include "wrenpp/vm.hpp" +#include "wrenpp/configuration.hpp" #include "dynafunc_maker.hpp" #include #include diff --git a/src/wren/vm_fun.cpp b/src/wren/vm_fun.cpp index 494e2a3..4b89787 100644 --- a/src/wren/vm_fun.cpp +++ b/src/wren/vm_fun.cpp @@ -1,4 +1,4 @@ -#include "vm_fun.hpp" +#include "wrenpp/vm_fun.hpp" #include #include #include