Skip to content

Commit

Permalink
Fix build on MSVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
PatZim committed Mar 22, 2019
1 parent 787d5bf commit 787596d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
9 changes: 7 additions & 2 deletions Configure.pl
Expand Up @@ -318,7 +318,9 @@
$config{ldflags} =~ s/\Q$nqp_config{'moar::ldrpath'}\E ?//;
$config{ldflags} =~ s/\Q$nqp_config{'moar::ldrpath_relocatable'}\E ?//;
$config{ldflags} .= ' ' . ($options{'no-relocatable'} ? $nqp_config{'moar::ldrpath'} : $nqp_config{'moar::ldrpath_relocatable'});


my @c_runner_libs;

if ($win) {
if ($prefix . $slash . 'bin' ne $nqp_config{'moar::libdir'}) {
$config{'m_install'} = "\t" . '$(CP) ' . $nqp_config{'moar::libdir'} . $slash . $nqp_config{'moar::moar'} . ' $(PREFIX)' . $slash . 'bin';
Expand All @@ -327,14 +329,17 @@
if ($nqp_config{'moar::os'} eq 'mingw32') {
$config{'mingw_unicode'} = '-municode';
}
$config{'c_runner_libs'} = '-lShlwapi';
push @c_runner_libs, 'Shlwapi';
} else {
$config{'m_cleanups'} = " \$(M_GDB_RUNNER) \\\n \$(M_LLDB_RUNNER) \\\n \$(M_VALGRIND_RUNNER)";
$config{'m_all'} = '$(M_GDB_RUNNER) $(M_LLDB_RUNNER) $(M_VALGRIND_RUNNER)';
$config{'m_install'} = "\t" . '$(M_RUN_PERL6) tools/build/create-moar-runner.p6 perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)/bin/perl6-gdb-m "gdb" "" "" ""' . "\n"
. "\t" . '$(M_RUN_PERL6) tools/build/create-moar-runner.p6 perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)/bin/perl6-lldb-m "lldb" "" "" ""' . "\n"
. "\t" . '$(M_RUN_PERL6) tools/build/create-moar-runner.p6 perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)/bin/perl6-valgrind-m "valgrind" "" "" ""';
}
$config{'c_runner_libs'} = join ' ',
(map { sprintf $nqp_config{'moar::ldusr'}, $_; } @c_runner_libs),
$nqp_config{'moar::sharedlib'};

unless (@errors) {
print "Using $config{'m_nqp'} (version $nqp_config{'nqp::version'} / MoarVM $nqp_config{'moar::version'}).\n";
Expand Down
15 changes: 9 additions & 6 deletions tools/build/Makefile-Moar.in
@@ -1,5 +1,6 @@
M_CC = @moar::cc@
M_LD = @moar::ld@
M_CCINC = @moar::ccinc@
M_CFLAGS = @moar::cflags@ @moar::ccmiscflags@ @moar::ccoptiflags@ @moar::ccwarnflags@
M_LDFLAGS = @ldflags@
M_C_RUNNER_LIBS = @c_runner_libs@
Expand Down Expand Up @@ -226,16 +227,18 @@ $(M_VALGRIND_RUNNER): tools/build/create-moar-runner.p6 $(M_C_RUNNER) $(PERL6_MO
$(M_C_RUNNER): src/vm/moar/runner/main.c
$(RM_F) $(M_C_RUNNER)
# Using only the pkgconfig moar includes does not work, because moar.h assumes all the specific includes below.
$(M_CC) @moar::ccshared@ @static_nqp_home_define@ @static_perl6_home_define@ $(M_CFLAGS) $(M_LDFLAGS) -I$(M_INCPATH) -I$(M_INCPATH)/moar \
-I$(M_INCPATH)/libatomic_ops -I$(M_INCPATH)/dyncall -I$(M_INCPATH)/sha1 -I$(M_INCPATH)/tinymt -I$(M_INCPATH)/libtommath -I$(M_INCPATH)/libuv \
-L@moar::libdir@ $(M_MINGW_UNICODE) @moar::ccout@$@ src/vm/moar/runner/main.c -lmoar $(M_C_RUNNER_LIBS)
$(M_CC) @moar::ccswitch@ @static_nqp_home_define@ @static_perl6_home_define@ $(M_CFLAGS) $(M_CCINC)$(M_INCPATH) $(M_CCINC)$(M_INCPATH)/moar \
$(M_CCINC)$(M_INCPATH)/libatomic_ops $(M_CCINC)$(M_INCPATH)/dyncall $(M_CCINC)$(M_INCPATH)/moar $(M_CCINC)$(M_INCPATH)/sha1 $(M_CCINC)$(M_INCPATH)/tinymt $(M_CCINC)$(M_INCPATH)/libtommath $(M_CCINC)$(M_INCPATH)/libuv \
$(M_MINGW_UNICODE) @moar::ccout@main@moar::obj@ src/vm/moar/runner/main.c
$(M_LD) @moar::ldout@$@ $(M_LDFLAGS) main@moar::obj@ @moar::lddir@@moar::libdir@ $(M_C_RUNNER_LIBS)

$(M_C_DEBUG_RUNNER): src/vm/moar/runner/main.c
$(RM_F) $(M_C_DEBUG_RUNNER)
# Using only the pkgconfig moar includes does not work, because moar.h assumes all the specific includes below.
$(M_CC) @moar::ccshared@ @static_nqp_home_define@ @static_perl6_home_define@ -DMOAR_PERL6_RUNNER_DEBUG $(M_CFLAGS) $(M_LDFLAGS) -I$(M_INCPATH) -I$(M_INCPATH)/moar \
-I$(M_INCPATH)/libatomic_ops -I$(M_INCPATH)/dyncall -I$(M_INCPATH)/moar -I$(M_INCPATH)/sha1 -I$(M_INCPATH)/tinymt -I$(M_INCPATH)/libtommath -I$(M_INCPATH)/libuv \
-L@moar::libdir@ $(M_MINGW_UNICODE) @moar::ccout@$@ src/vm/moar/runner/main.c -lmoar $(M_C_RUNNER_LIBS)
$(M_CC) @moar::ccswitch@ @static_nqp_home_define@ @static_perl6_home_define@ -DMOAR_PERL6_RUNNER_DEBUG $(M_CFLAGS) $(M_CCINC)$(M_INCPATH) $(M_CCINC)$(M_INCPATH)/moar \
$(M_CCINC)$(M_INCPATH)/libatomic_ops $(M_CCINC)$(M_INCPATH)/dyncall $(M_CCINC)$(M_INCPATH)/moar $(M_CCINC)$(M_INCPATH)/sha1 $(M_CCINC)$(M_INCPATH)/tinymt $(M_CCINC)$(M_INCPATH)/libtommath $(M_CCINC)$(M_INCPATH)/libuv \
$(M_MINGW_UNICODE) @moar::ccout@main@moar::obj@ src/vm/moar/runner/main.c
$(M_LD) @moar::ldout@$@ $(M_LDFLAGS) main@moar::obj@ @moar::lddir@@moar::libdir@ $(M_C_RUNNER_LIBS)


## testing targets
Expand Down

0 comments on commit 787596d

Please sign in to comment.