Skip to content

Commit

Permalink
fix: copy config files, +fix compilation of test binary
Browse files Browse the repository at this point in the history
  • Loading branch information
brakmic committed Jan 2, 2023
1 parent 1ddf07b commit dc593fd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
2 changes: 2 additions & 0 deletions buildall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Remove-Item builddir -Force -Recurse
meson setup builddir
Copy-Item -Path .\index.html -Destination .\builddir\index.html -Force
Copy-Item -Path .\cpp_favicon.ico -Destination .\builddir\cpp_favicon.ico -Force
Copy-Item -Path .\config.json -Destination .\builddir\config.json -Force
Copy-Item -Path .\server_config.json -Destination .\builddir\server_config.json -Force
Copy-Item -Path .\styles.css -Destination .\builddir\styles.css -Force
Copy-Item -Path .\vendor -Destination .\builddir\ -Recurse -Force
Copy-Item -Path .\videos -Destination .\builddir\ -Recurse -Force
Expand Down
39 changes: 35 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ videos_dir = 'videos'
# favicon
favicon_path = 'cpp_favicon.ico'

# config files
drogon_config = 'config.json'
server_config = 'server_config.json'

db_dir = src_root / 'database'
controllers_dir = src_root / 'controllers'
models_dir = src_root / 'models'
Expand Down Expand Up @@ -197,14 +201,25 @@ sources += server_src
sources += views_src
sources += dtos_src

#--------------
# test sources
#--------------
# Include those sources that need to be tested.
# Alternatively, create multiple partial tests
# to keep binaries smaller.
test_sources = [test_main_cpp]
#test_sources += controllers_src
#test_sources += db_src
test_sources += server_src
#test_sources += views_src
#test_sources += dtos_src

# includes
incdir = include_directories(
[
project_includes,
db_dir,
server_dir,
models_dir,
views_dir,
dtos_dir,
Expand All @@ -219,7 +234,7 @@ incdir = include_directories(
],
)

test_incdir = [criterion_includes]
test_incdir = [incdir, criterion_includes]

# find libraries
cpp = meson.get_compiler('cpp')
Expand Down Expand Up @@ -419,6 +434,22 @@ if os != 'windows'
join_paths(meson.source_root(), favicon_path),
join_paths(meson.build_root(), favicon_path),
)

# copy Drogon's config.json to build directory
run_command(
copy,
'-r',
join_paths(meson.source_root(), drogon_config),
join_paths(meson.build_root(), drogon_config),
)

# copy server_config.json to build directory
run_command(
copy,
'-r',
join_paths(meson.source_root(), server_config),
join_paths(meson.build_root(), server_config),
)
endif

deps = [
Expand Down Expand Up @@ -460,7 +491,7 @@ executable(
cpp_args: cpp_args,
link_args: link_args,
install: true,
include_directories: [incdir],
include_directories: incdir,
dependencies: deps,
)

Expand All @@ -472,8 +503,8 @@ test_exe = executable(
cpp_args: cpp_args_debug,
link_args: link_args,
install: true,
include_directories: [test_incdir],
dependencies: [test_deps],
include_directories: test_incdir,
dependencies: test_deps,
)

test('basic', test_exe)

0 comments on commit dc593fd

Please sign in to comment.