Skip to content

Commit

Permalink
update configure
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Nov 22, 2023
1 parent 059f19e commit 4e5d720
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -686,15 +686,15 @@ _target_kind_default="static"

# set the default project generator and build program
if is_host "freebsd" "bsd"; then
_project_generator="gmake"
project_generator="gmake"
_make_program_default="gmake"
_ninja_program_default="ninja"
elif is_host "msys" "cygwin"; then
_project_generator="gmake"
project_generator="gmake"
_make_program_default="make.exe"
_ninja_program_default="ninja.exe"
else
_project_generator="gmake"
project_generator="gmake"
_make_program_default="make"
_ninja_program_default="ninja"
fi
Expand Down Expand Up @@ -2531,6 +2531,24 @@ add_options() {
done
}

# before_install in target
before_install() {
if ! ${_loading_targets}; then
return
fi
local funcname="${1}"
_add_target_item "${_xmake_sh_target_current}" "before_install" "${funcname}"
}

# after_install in target
after_install() {
if ! ${_loading_targets}; then
return
fi
local funcname="${1}"
_add_target_item "${_xmake_sh_target_current}" "after_install" "${funcname}"
}

#-----------------------------------------------------------------------------
# toolchain configuration apis
#
Expand Down Expand Up @@ -2686,7 +2704,7 @@ Common options:
--verbose Display more information.
--diagnosis Display lots of diagnosis information.
--generator=GENERATOR Set the project generator. (default: '"${_project_generator}"')
--generator=GENERATOR Set the project generator. (default: '"${project_generator}"')
- gmake
- ninja
--make=MAKE Set the make program. (default: '"${_make_program_default}"')
Expand Down Expand Up @@ -2791,7 +2809,7 @@ _handle_option() {
_target_toolchain=${value}
return 0
elif test_eq "${name}" "generator"; then
_project_generator=${value}
project_generator=${value}
return 0
elif test_eq "${name}" "make"; then
_make_program=${value}
Expand Down Expand Up @@ -3310,9 +3328,9 @@ _toolchain_detect_ninja() {

# detect build backend
_toolchain_detect_backend() {
if test "x${_project_generator}" = "xgmake"; then
if test "x${project_generator}" = "xgmake"; then
_toolchain_detect_make
elif test "x${_project_generator}" = "xninja"; then
elif test "x${project_generator}" = "xninja"; then
_toolchain_detect_ninja
fi
}
Expand Down Expand Up @@ -4190,6 +4208,12 @@ _gmake_add_install_target() {
installdir="\$(INSTALLDIR)"
fi

# before install
_get_target_item "${target}" "before_install"; local before_install="${_ret}"
if test_nz "${before_install}"; then
eval ${before_install} "\${target}" "\${installdir}"
fi

# @see https://github.com/tboox/tbox/issues/214
install_for_soname=false
if test_eq "${targetkind}" "shared"; then
Expand Down Expand Up @@ -4287,6 +4311,12 @@ _gmake_add_install_target() {
print "\t@cp -p ${srcinstallfile} ${dstinstallfile}" >> "${xmake_sh_makefile}"
done
fi

# after install
_get_target_item "${target}" "after_install"; local after_install="${_ret}"
if test_nz "${after_install}"; then
eval ${after_install} "\${target}" "\${installdir}"
fi
}

_gmake_add_install_targets() {
Expand Down Expand Up @@ -4343,12 +4373,12 @@ _generate_for_ninja() {
#

_generate_build_file() {
if test_eq "${_project_generator}" "gmake"; then
if test_eq "${project_generator}" "gmake"; then
_generate_for_gmake
elif test_eq "${_project_generator}" "ninja"; then
elif test_eq "${project_generator}" "ninja"; then
_generate_for_ninja
else
raise "unknown generator: ${_project_generator}"
raise "unknown generator: ${project_generator}"
fi
}
_generate_build_file
Expand Down

0 comments on commit 4e5d720

Please sign in to comment.