More tweaks to the install target

When you code, you should probably configure with
-Dscript_path=$HOME/your/code/dir, and doing this
now prevents the script files from being copied over
to the install dir. This is correct because in this
case source dir == dest dir.
If you want to really install the program, you
should set script_path to a relative path or a
different directory than the source. For example
-Dscript_path=duckticker/script. ninja install will
copy the script files to the install directory in
this case.

Note that the path to the script directory that
gets compiled into the binary is an absolute path
in either case. This means that "roaming app" mode
is not currently supported. The reason for this is
that I need code to detect the binary directory so
that relative script paths can work, but I don't have
that code right now.
This commit is contained in:
King_DuckZ 2022-05-14 20:02:34 +02:00
parent 8ce0e362bb
commit 27a5f00ea4
2 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ project('duckticker', 'cpp',
compiler_opts = ['-DWRENPP_WITH_NAME_GUESSING']
full_data_dir = get_option('prefix') / get_option('datadir')
full_script_dir = full_data_dir / get_option('script_path') / ''
global_config = configuration_data()
global_config.set_quoted('PROJECT_NAME', meson.project_name())
@ -15,10 +16,10 @@ version_arr = meson.project_version().split('.')
global_config.set('PROJECT_VERSION_MAJOR', version_arr[0])
global_config.set('PROJECT_VERSION_MINOR', version_arr[1])
global_config.set('PROJECT_VERSION_PATCH', version_arr[2])
global_config.set_quoted('SCRIPT_PATH', full_data_dir / get_option('script_path') / '')
global_config.set_quoted('SCRIPT_PATH', full_script_dir)
subdir('src')
if meson.project_source_root() != full_data_dir
install_data(sources: 'script/main.wren', install_dir: full_data_dir)
if not get_option('script_path').startswith(meson.project_source_root())
install_data(sources: 'script/main.wren', install_dir: get_option('script_path'))
endif

@ -1 +1 @@
Subproject commit 036dd57524083f9d196f06a553aaeaaf1a17492d
Subproject commit d3ad818b8e7654fc2f3ff5d58880842db54af1ea