build: Fix opaquetest build on Windows

Create 2 makefile variable to facilitate build on Windows:
GENERATED_SOURCES_FILES to match files created by the code generator,
and GENERATED_SOURCES_OPTION for the corresponding option to be passed
to the compiler.

Also adapt the makefile for the valtest sample to use these variables.
This commit is contained in:
Bertrand Lorentz 2014-05-04 15:10:07 +02:00
parent 3495ca286d
commit a6c9634748
4 changed files with 16 additions and 19 deletions

View file

@ -54,7 +54,7 @@ build_references = $(addprefix -r:, $(references)) $(MONO_CAIRO_LIBS)
$(ASSEMBLY): generated-stamp $(SNK) $(build_sources) $(references) $(ASSEMBLY): generated-stamp $(SNK) $(build_sources) $(references)
@rm -f $(ASSEMBLY).mdb @rm -f $(ASSEMBLY).mdb
$(CSC) $(CSFLAGS) -keyfile:$(SNK) -nowarn:0169,0612,0618 -unsafe -out:$(ASSEMBLY) -target:library $(build_references) $(GENERATED_SOURCES) $(build_sources) $(top_builddir)$(ASSEMBLYINFO) $(CSC) $(CSFLAGS) -keyfile:$(SNK) -nowarn:0169,0612,0618 -unsafe -out:$(ASSEMBLY) -target:library $(build_references) $(GENERATED_SOURCES_OPTION) $(build_sources) $(top_builddir)$(ASSEMBLYINFO)
install-data-local: install-data-local:
@if test -n '$(pkg)'; then \ @if test -n '$(pkg)'; then \

View file

@ -111,7 +111,8 @@ fi
if test "x$has_mono" = "xtrue"; then if test "x$has_mono" = "xtrue"; then
GACUTIL_FLAGS='/package $(PACKAGE_VERSION) /gacdir $(DESTDIR)$(prefix)/lib' GACUTIL_FLAGS='/package $(PACKAGE_VERSION) /gacdir $(DESTDIR)$(prefix)/lib'
GENERATED_SOURCES=generated/*/*.cs GENERATED_SOURCES_FILES=generated/*/*.cs
GENERATED_SOURCES_OPTION=$GENERATED_SOURCES_FILES
ASSEMBLYINFO=/AssemblyInfo.cs ASSEMBLYINFO=/AssemblyInfo.cs
AC_PATH_PROG(RUNTIME, mono, no) AC_PATH_PROG(RUNTIME, mono, no)
@ -144,7 +145,8 @@ dnl Check for .NET Framework
AC_PATH_PROG(CSC, csc.exe, no) AC_PATH_PROG(CSC, csc.exe, no)
CSFLAGS="-nologo -platform:x86" CSFLAGS="-nologo -platform:x86"
GACUTIL_FLAGS= GACUTIL_FLAGS=
GENERATED_SOURCES="-recurse:generated\\\\*.cs" GENERATED_SOURCES_FILES="generated\\\\*.cs"
GENERATED_SOURCES_OPTION="-recurse:$GENERATED_SOURCES_FILES"
ASSEMBLYINFO=\\\\AssemblyInfo.cs ASSEMBLYINFO=\\\\AssemblyInfo.cs
AM_CONDITIONAL(ENABLE_THREADCHECK, false) AM_CONDITIONAL(ENABLE_THREADCHECK, false)
enable_dotnet=yes enable_dotnet=yes
@ -165,7 +167,8 @@ AC_SUBST(GACUTIL)
AC_SUBST(GACUTIL_FLAGS) AC_SUBST(GACUTIL_FLAGS)
AC_SUBST(LIB_PREFIX) AC_SUBST(LIB_PREFIX)
AC_SUBST(LIB_SUFFIX) AC_SUBST(LIB_SUFFIX)
AC_SUBST(GENERATED_SOURCES) AC_SUBST(GENERATED_SOURCES_FILES)
AC_SUBST(GENERATED_SOURCES_OPTION)
AC_SUBST(ASSEMBLYINFO) AC_SUBST(ASSEMBLYINFO)
GTK_REQUIRED_VERSION=3.0.0 GTK_REQUIRED_VERSION=3.0.0

View file

@ -4,8 +4,8 @@ lib_LTLIBRARIES = libopaque.la
assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll
references=$(addprefix -r:, $(assemblies)) references=$(addprefix -r:, $(assemblies))
opaquetest.exe: OpaqueTest.cs $(GENERATED_SOURCES) $(assemblies) opaquetest.exe: OpaqueTest.cs $(GENERATED_SOURCES_FILES) $(assemblies)
$(CSC) $(CSFLAGS) -out:opaquetest.exe $(references) $(srcdir)/OpaqueTest.cs $(GENERATED_SOURCES) $(CSC) $(CSFLAGS) -out:opaquetest.exe $(references) $(srcdir)/OpaqueTest.cs $(GENERATED_SOURCES_OPTION)
libopaque_la_SOURCES = \ libopaque_la_SOURCES = \
opaques.c \ opaques.c \
@ -17,7 +17,7 @@ libopaque_la_LIBADD = $(GTK_LIBS)
AM_CPPFLAGS = $(GTK_CFLAGS) AM_CPPFLAGS = $(GTK_CFLAGS)
$(GENERATED_SOURCES): opaque-api.xml $(GENERATED_SOURCES_FILES): opaque-api.xml
$(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml \ $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml \
--include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \
--outdir=generated --assembly-name=opaque-sharp \ --outdir=generated --assembly-name=opaque-sharp \
@ -32,7 +32,7 @@ install:
CLEANFILES = \ CLEANFILES = \
opaquetest.exe \ opaquetest.exe \
opaquetest.exe.mdb \ opaquetest.exe.mdb \
$(GENERATED_SOURCES) $(GENERATED_SOURCES_FILES)
EXTRA_DIST = \ EXTRA_DIST = \
OpaqueTest.cs \ OpaqueTest.cs \

View file

@ -4,14 +4,8 @@ lib_LTLIBRARIES = libvalobj.la
assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../cairo/cairo-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../cairo/cairo-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll
references=$(addprefix -r:, $(assemblies)) references=$(addprefix -r:, $(assemblies))
if PLATFORM_WIN32 valtest.exe: Valtest.cs $(GENERATED_SOURCES_FILES) $(assemblies)
VALOBJ=Gtksharp\\Valobj.cs $(CSC) $(CSFLAGS) -out:valtest.exe $(references) $(srcdir)/Valtest.cs $(GENERATED_SOURCES_OPTION)
else
VALOBJ=Gtksharp/Valobj.cs
endif
valtest.exe: Valtest.cs $(VALOBJ) $(assemblies)
$(CSC) $(CSFLAGS) -out:valtest.exe $(references) $(srcdir)/Valtest.cs $(VALOBJ)
libvalobj_la_SOURCES = \ libvalobj_la_SOURCES = \
valobj.c \ valobj.c \
@ -23,10 +17,10 @@ libvalobj_la_LIBADD = $(GTK_LIBS)
AM_CPPFLAGS = $(GTK_CFLAGS) AM_CPPFLAGS = $(GTK_CFLAGS)
$(VALOBJ): valobj-api.xml $(GENERATED_SOURCES_FILES): valobj-api.xml
$(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml \ $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml \
--include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \
--outdir=. --assembly-name=valobj-sharp \ --outdir=generated --assembly-name=valobj-sharp \
--schema=$(top_srcdir)/gapi.xsd --schema=$(top_srcdir)/gapi.xsd
api: api:
@ -37,7 +31,7 @@ install:
CLEANFILES = \ CLEANFILES = \
valtest.exe \ valtest.exe \
valtest.exe.mdb \ valtest.exe.mdb \
$(VALOBJ) $(GENERATED_SOURCES_FILES)
EXTRA_DIST = \ EXTRA_DIST = \
Valtest.cs \ Valtest.cs \