Skip to content

Commit

Permalink
The hpxcxx script was broken such that it could only compile for _rel…
Browse files Browse the repository at this point in the history
…ease. This modification makes it more robust in finding a compiled hpx installation and changes the 2 character flags to use -- instead of -.
  • Loading branch information
stevenrbrandt committed Jul 20, 2023
1 parent acc763d commit 7fd80e2
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions cmake/templates/hpxcxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pkgconfpath += [
os.path.join("@HPX_CONF_PREFIX@","lib64","pkgconfig"), # install directory
os.path.join(os.path.dirname(sys.argv[0]),"..","lib","pkgconfig"),
os.path.join("opt","hpx","lib","pkgconfig"),
os.path.join("usr","bin","hpx","lib","pkgconfig"),
os.path.join("usr","local","bin","hpx","lib","pkgconfig"),
os.path.join("/usr","bin","hpx","lib","pkgconfig"),
os.path.join("/usr","local","bin","hpx","lib","pkgconfig"),
os.path.join(os.environ["HOME"],"install","hpx","lib","pkgconfig"),
os.path.join(os.environ["HOME"],"hpx","lib","pkgconfig")
]
Expand All @@ -54,14 +54,14 @@ Usage: hpxcxx -c flags files
The hpxcxx command requires that you build either
a component, an application, or that you specify
the -c flag. If you are building against a debug
build, you need to specify -g.
If release-with-debug-info, specify -rd
If minsize-release specify -mr. All other flags
build, you need to specify --db.
If release-with-debug-info, specify --rd
If minsize-release specify --mr. All other flags
are passed through to the underlying C++ compiler.
""")
sys.exit(2)

pkgconf_suffix = ['_release', '_relwithdebuginfo', '_debug', '_minsizerel']
pkgconf_suffix = '_release'
i = 1
while i < len(sys.argv):

Expand All @@ -76,6 +76,7 @@ while i < len(sys.argv):
elif sys.argv[i].startswith('--exe='):
output=sys.argv[i][6:]
app = output
#args += ['-o',app+'.exe']
application = True
elif sys.argv[i].startswith('--comp='):
app_name = sys.argv[i][7:]
Expand All @@ -93,28 +94,24 @@ while i < len(sys.argv):
elif sys.argv[i] == '-c':
minusc = True
pass
elif sys.argv[i].startswith('-g'):
pkgconf_suffix = ['_debug']
args += [sys.argv[i]]
elif sys.argv[i] == '--rd':
pkgconf_suffix = ['_relwithdebuginfo']
elif sys.argv[i] == '--mr':
pkgconf_suffix = ['_minsizerel']
elif sys.argv[i] == '-r':
pkgconf_suffix = ['_release']
elif sys.argv[i].startswith('-db'):
pkgconf_suffix = '_debug'
elif sys.argv[i].startswith('--rd'):
pkgconf_suffix = '_relwithdebuginfo'
elif sys.argv[i].startswith('--mr'):
pkgconf_suffix = '_minsizerel'
else:
args += [sys.argv[i]]

i += 1

pkgconf = None
for path in pkgconfpath:
if pkgconf is not None:
break
for suffix in pkgconf_suffix:
for suffix in [pkgconf_suffix, "_release", "_relwithdebuginfo","_debug"]:
hpath = os.path.join(path,"hpx_application")+suffix+".pc"
if os.path.exists(hpath):
pkgconf = path
pkgconf_suffix = suffix
break

if pkgconf == None:
Expand All @@ -128,11 +125,11 @@ else:
os.environ[pkg] = pkgconf

if application:
args += ["`pkg-config --cflags --libs hpx_application" + suffix + "`"]
args += ["`pkg-config --cflags --libs hpx_application" + pkgconf_suffix + "`"]
elif component:
args += ["`pkg-config --cflags --libs hpx_component" + suffix + "`"]
args += ["`pkg-config --cflags --libs hpx_component" + pkgconf_suffix + "`"]
else:
args += ["`pkg-config --cflags hpx_application" + suffix + "`"]
args += ["`pkg-config --cflags hpx_application" + pkgconf_suffix + "`"]

if not component and not application and not minusc:
usage()
Expand Down

0 comments on commit 7fd80e2

Please sign in to comment.