Skip to content

Commit

Permalink
don't rely on the "buildtype" option
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed May 1, 2019
1 parent 02afb99 commit 6baf71e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
11 changes: 7 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ if meson.version().version_compare('<@0@'.format(minimum_recommended_meson_versi
warning('Old Meson version detected. Try upgrading to at least @0@ if the build fails.'.format(minimum_recommended_meson_version))
endif

is_debug_build = get_option('debug')
is_developer_build = (get_option('developer') == 'auto' ? is_debug_build : get_option('developer') == 'true')

cc = meson.get_compiler('c')
python3 = import('python3').find_python()
macos_app_bundle = get_option('macos_bundle') and host_machine.system() == 'darwin'
Expand Down Expand Up @@ -249,9 +252,7 @@ else
xdg_path = datadir
endif

is_debug_build = get_option('buildtype').startswith('debug')
is_developer_build = (get_option('developer') == 'auto' ? is_debug_build : get_option('developer') == 'true')

config.set('TAISEI_BUILDCONF_DEBUG', is_debug_build)
config.set('TAISEI_BUILDCONF_DEVELOPER', is_developer_build)
config.set('TAISEI_BUILDCONF_LOG_FATAL_MSGBOX', (
host_machine.system() == 'windows' or
Expand Down Expand Up @@ -334,6 +335,7 @@ Summary:
Taisei version: @0@
System type: @1@
Build type: @2@
Developer mode: @15@
Audio backends: @3@ (default: @4@)
Renderers: @5@ (default: @6@)
Expand Down Expand Up @@ -364,7 +366,8 @@ Summary:
# the $ is intentional
join_paths('$prefix', bindir),
join_paths('$prefix', data_path),
join_paths('$prefix', doc_path)
join_paths('$prefix', doc_path),
is_developer_build
)

message(summary)
Expand Down
13 changes: 8 additions & 5 deletions scripts/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ common_taiseilib_args = [
]

common_taiseilib_defs = [
'-DMESON_BUILD_TYPE=@0@'.format(get_option('buildtype')),
'-DMESON_BUILD_ROOT=@0@'.format(meson.build_root()),
'-DMESON_SOURCE_ROOT=@0@'.format(meson.source_root()),
]
Expand Down Expand Up @@ -45,10 +44,14 @@ eolconv_command = [python_thunk, eolconv_script]

host_eol_style = host_machine.system() == 'windows' ? 'crlf' : 'lf'

if get_option('buildtype').contains('debug')
dist_version_string = '@0@-@1@'.format(taisei_version_string, get_option('buildtype'))
else
dist_version_string = taisei_version_string
dist_version_string = taisei_version_string

if is_developer_build
dist_version_string = '@0@-devbuild'.format(dist_version_string)
endif

if is_debug_build
dist_version_string = '@0@-debug'.format(dist_version_string)
endif

dmg_script = files('macos-gen-dmg.py')
Expand Down
24 changes: 23 additions & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,31 @@

#include "util.h"

#ifdef TAISEI_BUILDCONF_DEBUG
#define TAISEI_VERSION_BUILD_TYPE_0 "debug"
#else
#define TAISEI_VERSION_BUILD_TYPE_0 "release"
#endif

#ifdef TAISEI_BUILDCONF_DEVELOPER
#define TAISEI_VERSION_BUILD_TYPE_1 " devbuild"
#else
#define TAISEI_VERSION_BUILD_TYPE_1 ""
#endif

#ifdef NDEBUG
#define TAISEI_VERSION_BUILD_TYPE_2 ""
#else
#define TAISEI_VERSION_BUILD_TYPE_2 " assert"
#endif

#define TAISEI_VERSION_BUILD_TYPE \
TAISEI_VERSION_BUILD_TYPE_0 \
TAISEI_VERSION_BUILD_TYPE_1 \
TAISEI_VERSION_BUILD_TYPE_2 \

extern const char *const TAISEI_VERSION;
extern const char *const TAISEI_VERSION_FULL;
extern const char *const TAISEI_VERSION_BUILD_TYPE;

extern const uint8_t TAISEI_VERSION_MAJOR;
extern const uint8_t TAISEI_VERSION_MINOR;
Expand Down
1 change: 0 additions & 1 deletion src/version_auto.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

const char *const TAISEI_VERSION = "${VERSION({string})}";
const char *const TAISEI_VERSION_FULL = "${VERSION({full_string})}";
const char *const TAISEI_VERSION_BUILD_TYPE = "${MESON_BUILD_TYPE}";

const uint8_t TAISEI_VERSION_MAJOR = ${VERSION({major})};
const uint8_t TAISEI_VERSION_MINOR = ${VERSION({minor})};
Expand Down

0 comments on commit 6baf71e

Please sign in to comment.