]> Dogcows Code - chaz/yoink/commitdiff
better build system support for win32
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 10 Sep 2009 17:34:34 +0000 (11:34 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 10 Sep 2009 17:34:34 +0000 (11:34 -0600)
Makefile.am
configure.ac
doc/cml_parameters.txt [new file with mode: 0644]
doc/yoink.6.in
extra/Makefile.am [new file with mode: 0644]
extra/yoink.ebuild
extra/yoink.spec.in

index b77b1f2b3520bc622f9a6b78d7bb13b0294d22c8..f6bb9c38dfbe4cfee457dee00f15d9bb13a208cc 100644 (file)
@@ -1,7 +1,7 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = yajl src data doc
+SUBDIRS = data doc yajl src extra
 
 EXTRA_DIST = yajl
 
@@ -15,6 +15,6 @@ debug: all
 
 RPMBUILD = rpmbuild
 
-RPM: dist-bzip2
+rpm: dist-bzip2
        $(RPMBUILD) -ba --nodeps extra/yoink.spec 
 
index c5104297add457585353f72bdd3c8eff261c732c..5a7791d518e0a576833437990b10453f56b44e79 100644 (file)
@@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE
 
 #
 # Checks for programs.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 AC_PROG_CXX
 #AC_PROG_AWK
@@ -31,53 +31,110 @@ AC_PROG_LIBTOOL
 
 
 #
-# Checks for configuration arguments.
+# Configure platform-specific stuff.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+case "${host}" in
+       *mingw32*)
+       MINGW32=yes
+       WIN32=yes
+       ;;
+       *cygwin*)
+       CYGWIN=yes
+       WIN32=yes
+       ;;
+       *-apple-darwin*)
+       MACOSX=yes
+       LIBS="$LIBS -Wl,-framework"
+esac
+
+
 #
+# Checks for configuration arguments.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AC_ARG_ENABLE([developer],
+                         [  --enable-developer      use all compiler flags developers need],
+                         [developer=$enableval],
+                         [developer=no])
 
 AC_ARG_ENABLE([debug],
                          [  --enable-debug          include debugging symbols and features],
-                         [debug=$enableval
-                          if test x$debug = xyes
-                          then
-                                  CFLAGS="-O0 -DDEBUG"
-                                  CXXFLAGS="-O0 -DDEBUG"
-                          else
-                                  CFLAGS="-O2 -DNDEBUG"
-                                  CXXFLAGS="-O2 -DNDEBUG"
-                          fi],
-                         [CFLAGS="-O2 -DNDEBUG"
-                          CXXFLAGS="-O2 -DNDEBUG"])
+                         [debug=$enableval],
+                         [debug=no])
 
 AC_ARG_ENABLE([profile],
-                         [  --enable-profile        make a binary for use with gprof],
-                         [profile=$enableval
-                          if test x$profile = xyes
-                          then
-                                  CFLAGS="$CFLAGS -pg"
-                                  CXXFLAGS="$CXXFLAGS -pg"
-                          fi])
+                         [  --enable-profile        make a binary for use with gprof profiler],
+                         [profile=$enableval],
+                         [profile=no])
+
+AC_ARG_ENABLE([extra-warnings],
+                         [  --enable-extra-warnings make the gcc compiler give more warnings],
+                         [extra_warnings=$enableval],
+                         [extra_warnings=no])
+
+AC_ARG_WITH([log-level],
+                       [AS_HELP_STRING([--with-log-level=NUM],
+                                                       [0, none... 1, errors... 4, everything (default: 3)])],
+                       [log_level=$withval],
+                       [log_level=3])
+
+
+if test x$developer = xyes
+then
+       debug=yes
+       profile=yes
+       extra_warnings=yes
+       log_level=4
+fi
+
+if test x$debug = xyes
+then
+   CFLAGS="$CFLAGS -Wall -O0 -g -DDEBUG"
+   CXXFLAGS="$CXXFLAGS -Wall -O0 -g -DDEBUG"
+else
+   CFLAGS="$CFLAGS -O2 -DNDEBUG"
+   CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
+fi
+
+if test x$profile = xyes
+then
+   CFLAGS="$CFLAGS -pg"
+   CXXFLAGS="$CXXFLAGS -pg"
+fi
+
+if test x$extra_warnings = xyes
+then
+   CFLAGS="$CFLAGS -Wextra"
+   CXXFLAGS="$CXXFLAGS -Wextra"
+fi
+
+AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
+                                  [Define to detail level of logging.])
 
 
-if test x$prefix = xNONE
+
+if test "x$prefix" = xNONE
 then
        prefix="$ac_default_prefix"
 fi
 
 AC_ARG_WITH([assetdir],
                        [AS_HELP_STRING([--with-assetdir=DIR],
-                                                       [real path to game assets (default: $datarootdir/yoink)])],
+                                                       [real path to assets (default: $datarootdir/yoink)])],
                        [DATADIR="$withval"],
                        [eval DATADIR="$datarootdir/yoink"])
 
-case "${host}" in
-       *mingw32*)
+if test x$WIN32 = xyes
+then
        DATADIR="data"
-esac
+fi
 
 AC_SUBST([DATADIR])
 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
                                   [Define to path of game asset directory.])
 
+
 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
 
 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
@@ -85,79 +142,116 @@ AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
 
 
 #
-# Checks for libraries.
+# Checks for typedefs, structures, and compiler characteristics.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AC_C_STRINGIZE
+AC_C_INLINE
+
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+
+
 #
+# Checks for system functions.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-AM_PATH_SDL([1.2.10],
-                       [CFLAGS="$CFLAGS $SDL_CFLAGS"
-                        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-                        LIBS="$LIBS $SDL_LIBS"])
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
+
+
+#
+# Checks for header files.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AC_HEADER_STDBOOL
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
 
-#BOOST_REQUIRE([1.35])
-#CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
 BOOST_SMART_PTR
 BOOST_STRING_ALGO
 BOOST_BIND
 BOOST_FUNCTION
 
-AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
-                          [AC_MSG_ERROR([SDL_image is required])])
-
-AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
-                          [AC_MSG_ERROR([SDL_sound is required])])
+AM_PATH_SDL([1.2.10],
+                       [CFLAGS="$CFLAGS $SDL_CFLAGS"
+                        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
+                        LIBS="$LIBS $SDL_LIBS"])
 
-AC_SEARCH_LIBS([glBegin], [GL opengl32],,
-                          [AC_MSG_ERROR([OpenGL is required])])
+AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
+                                [missing="$missing OpenGL"])
 
-AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU glu32],,
-                          [AC_MSG_ERROR([GLU is required])])
+AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
+                                [missing="$missing OpenAL"])
 
-AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
-                          [AC_MSG_ERROR([OpenAL is required])])
+AC_CHECK_HEADERS([SDL/SDL_image.h],,
+                                [missing="$missing SDL_image"])
 
-AC_SEARCH_LIBS([alutInit], [alut],,
-                          [AC_MSG_ERROR([alut is required])])
+AC_CHECK_HEADERS([SDL/SDL_sound.h],,
+                                [missing="$missing SDL_sound"])
 
-AC_SEARCH_LIBS([clock_gettime], [rt],
-                          [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
-                                                 [Define to 1 if you have the 'clock_gettime' function.])])
+if test "x$missing" != x
+then
+       echo "** Required header files from these libraries are missing:"
+       for header in $missing
+       do
+               echo "**   $header"
+       done
+       AC_MSG_ERROR([please install missing dependencies])
+fi
 
 
 #
-# Checks for header files.
-#
-
-AC_HEADER_STDBOOL
-AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
+# Checks for libraries.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
+                          [missing="$missing SDL_image"])
 
-#
-# Checks for typedefs, structures, and compiler characteristics.
-#
+AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
+                          [missing="$missing SDL_sound"])
 
-AC_C_STRINGIZE
-AC_C_INLINE
+if test x$WIN32 == xyes
+then
+# autoconf library search macro doesn't find opengl32 on windows because it uses
+# different name hashing, but it links fine; assume it's there
+       LIBS="$LIBS -lglu32 -lopengl32"
+else
+       AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU],,
+                                  [missing="$missing GLU"])
+
+       AC_SEARCH_LIBS([glBegin], [GL MesaGL],,
+                                  [missing="$missing OpenGL"])
+fi
 
-AC_TYPE_UINT8_T
-AC_TYPE_UINT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_SIZE_T
-AC_TYPE_SSIZE_T
+AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
+                          [missing="$missing OpenAL"])
 
+AC_SEARCH_LIBS([alutInit], [alut],,
+                          [missing="$missing ALUT"])
 
-#
-# Checks for library functions.
-#
+AC_SEARCH_LIBS([clock_gettime], [rt],
+                          [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
+                                                 [Define to 1 if you have the 'clock_gettime' function.])])
 
-AC_FUNC_ERROR_AT_LINE
-AC_FUNC_STRTOD
-AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
+if test "x$missing" != x
+then
+       echo "** One or more required libraries are missing:"
+       for library in $missing
+       do
+               echo "**   $library"
+       done
+       AC_MSG_ERROR([please install missing dependencies])
+fi
 
 
 #
 # Find the data files to install.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 DATA_FILES=$(echo $(cd data; \
                                        find . -name "*.json" \
@@ -170,12 +264,13 @@ AC_SUBST([DATA_FILES])
 
 #
 # Create the build files.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 AC_CONFIG_FILES([Makefile
                                 data/Makefile
                                 doc/Makefile
                                 doc/yoink.6
+                                extra/Makefile
                                 extra/yoink.spec
                  src/Makefile
                                 yajl/Makefile])
@@ -187,30 +282,21 @@ AC_OUTPUT
 
 #
 # Print a friendly little message.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-echo "======================================"
-echo " Configuration complete!"
 echo ""
-
-echo "  Prefix: $prefix"
-echo "    Data: $DATADIR"
+echo " Configuration complete! :-)"
+echo ""
+echo "          Target: $target"
+echo "          Prefix: $prefix"
+echo "  Data Directory: $DATADIR"
+echo "       Log Level: $log_level"
+echo "           Debug: $debug"
+echo "         Profile: $profile"
+echo "  Extra Warnings: $extra_warnings"
 echo ""
-
-if test x$debug = xyes
-then
-       echo " * Debugging enabled."
-       echo ""
-fi
-
-if test x$profile = xyes
-then
-       echo " * Profiling enabled."
-       echo ""
-fi
-
 echo " To finish the installation, execute:"
 echo "  make"
 echo "  make install"
-echo "======================================"
+echo ""
 
diff --git a/doc/cml_parameters.txt b/doc/cml_parameters.txt
new file mode 100644 (file)
index 0000000..d5bb2f2
--- /dev/null
@@ -0,0 +1,87 @@
+CML_ENABLE_MATRIX_BRACES
+- Allow matrices to be accessed as A[row][col] in addition to A(row,col).
+  This is primarily for testing, and is not used anywhere in the library
+  proper since the proxy object mechanism that's used is not guaranteed to
+  produce optimal code.
+
+CML_NO_DEFAULT_EXPR_TRAITS
+- Don't use default expression traits for built-in types.  This is handy
+  for debugging, since no classes or built-in types will have an expression
+  traits class by default (i.e. the expression traits class must be created
+  explicitly).
+
+CML_DEFAULT_BASIS_ORIENTATION
+- Either cml::row_basis or cml::col_basis.  This determines the basis
+  vector orientation for the matrix result of a vector outer product.  The
+  default is cml::col_basis.
+
+CML_DEFAULT_ARRAY_LAYOUT
+- Either cml::row_major or cml::col_major.  This determines the layout of the
+  resulting matrix when promoting matrices with different layouts.  If the
+  matrices have the same layout, the promoted type will also have that layout,
+  unless CML_ALWAYS_PROMOTE_TO_DEFAULT_LAYOUT is defined.  This parameter also
+  determines the default 2D array memory layout.
+
+CML_DEFAULT_ARRAY_ALLOC
+- Defines the default allocator for arrays generated at run-time by the type
+  deduction system.  The default value is std::allocator<void>.
+
+CML_ALWAYS_PROMOTE_TO_DEFAULT_LAYOUT
+- If this is defined, 2D arrays will always be promoted to the default layout.
+  This is useful if matrix expressions should always be handled in
+  a particular orientation for efficiency.
+
+CML_VECTOR_UNROLL_LIMIT=<N>
+- <N> is the maximum vector length that should be automatically unrolled by
+  the expression template engine.  If the vector (expression) is longer,
+  the normal for loop is used.  Note also that unrolling is available only
+  for fixed-size vectors.
+
+CML_2D_UNROLLER
+- Use a 2D unroller for matrix expressions.  This causes very poor code for
+  most of the supported compilers, but with GCC4/G5, it's required for
+  optimal code.  Note that unrolling is available only for fixed-size
+  matrices.
+
+CML_MATRIX_UNROLL_LIMIT=<N>
+- <N> is the maximum number of matrix elements (#rows x #cols) that
+  a matrix (expression) can have before being unrolled.  A 2D loop is used
+  for matrices with more than <N> elements.  When either CML_2D_UNROLLER or
+  CML_2D_TO_1D_UNROLLER is defined, this must also be defined.
+
+CML_NO_2D_UNROLLER
+- Don't unroll at all, just use a loop.  This seems to generate the best
+  code on at least GCC4/x86 and Intel 9/Linux/x86.
+
+CML_RECIPROCAL_OPTIMIZATION
+- Use "*= 1./x" instead of "/= x" for per-element division.  This may generate
+  better code for certain systems, but isn't yet tested for any configuration.
+
+CML_AUTOMATIC_VECTOR_RESIZE_ON_ASSIGNMENT
+- Enable automatic resizing of dynamic vectors on assignment and copy from
+  other vectors and expressions.  This guarantees that vectors have the right
+  size on assignment, but imposes a significant performance penalty when
+  vectors already have the correct size.  Without this option, however,
+  assigned-to vectors must be constructed with the correct size, or must be
+  explicitly resized with the resize() method.  Note that this has no
+  effect when assigning using a scalar operator, since the vector must already
+  have the proper size.  Also note that temporaries will be automatically
+  resized as necessary regardless of the setting of this option.
+
+CML_CHECK_VECTOR_EXPR_SIZES
+- Verify that all arguments in a vector expression have the proper size.  This
+  is particularly handy for debugging when CML_AUTOMATIC_VECTOR_RESIZE is
+  undefined.  Note that the performance penalty for defining this option is
+  dependent upon the number of binary expressions and the compiler.  Also,
+  this has no effect for expressions composed of entirely fixed-size vectors,
+  since the sizes are automatically checked at compile time.
+
+CML_AUTOMATIC_MATRIX_RESIZE_ON_ASSIGNMENT
+CML_CHECK_MATRIX_EXPR_SIZES
+CML_CHECK_MATVEC_EXPR_SIZES
+- Same as CML_AUTOMATIC_VECTOR_RESIZE and CML_CHECK_VECTOR_EXPR_SIZES, but for
+  matrices.
+
+CML_USE_GENERATED_MATRIX_ASSIGN_OP
+- Allow the compiler to generate its own matrix assignment code.  This yields
+  better performance at least on Intel C++ 9/x86 Linux.
index fd6b002be804101d1ce349765f306c5ad4a07c89..03274d04549d112eb7285c07e0bb3db4d0424983 100644 (file)
@@ -93,7 +93,7 @@ file.
 This is a specific user's personal configuration file.
 .TP
 3. /etc/yoinkrc
-This is the system-wide configuration file.
+This is the system-wide configuration file.  Not available on Windows.
 .TP
 4. @DATADIR@/yoinkrc
 This is the base configuration file which should be considered read-only.  Look
diff --git a/extra/Makefile.am b/extra/Makefile.am
new file mode 100644 (file)
index 0000000..36c2e60
--- /dev/null
@@ -0,0 +1,3 @@
+
+EXTRA_DIST = yoink.ebuild
+
index 9ce24644498f23a908323af78f875f3292f14e66..6f7dd364973f1a476223abfd53efd47a7709a369 100644 (file)
@@ -16,12 +16,12 @@ SLOT="0"
 KEYWORDS="amd64 ~ppc x86"
 IUSE="debug profile"
 
-RDEPEND="media-libs/libsdl[opengl]
+RDEPEND="media-libs/freealut
+       media-libs/libsdl[opengl]
        media-libs/sdl-image[png]
-       virtual/opengl
        media-libs/sdl-sound[mikmod,vorbis]
        media-libs/openal
-       media-libs/freealut"
+       virtual/opengl"
 DEPEND="${RDEPEND}
        dev-libs/boost
        dev-util/pkgconfig"
index 030a5dceb6ab965b9addd8eb0c5915a3619c7a38..a1a433da80422686c7bdd3f12785563003fa5a40 100644 (file)
@@ -9,8 +9,13 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: boost-devel
 BuildRequires: SDL-devel
 BuildRequires: SDL_image-devel
+BuildRequires: SDL_sound-devel
+BuildRequires: mesa-libGL-devel
+BuildRequires: openal-devel
 Requires: SDL
 Requires: SDL_image
+Requires: SDL_sound
+Requires: openal
 %description
 Leap tall buildings!  Crush stupid robots beneath your feet!  Wield your
 extra-terrestrial powers in the defence of humanity, and send those alien
This page took 0.044951 seconds and 4 git commands to generate.