소스 검색

Got all the dependencies building on Windows with MSVC10, now need to hook everything back up again.

Cameron Hart 14 년 전
부모
커밋
682de74770

+ 2 - 0
BUILD.txt

@@ -6,6 +6,8 @@ zlib
 http://zlib.net/zlib125.zip
 
 PNG
+ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.4.tar.gz
+http://download.sourceforge.net/libpng/libpng-1.5.4.tar.gz
 http://cdnetworks-us-1.dl.sourceforge.net/project/libpng/libpng15/1.5.2/lpng152.zip
 
 Freetype2

+ 23 - 0
Build/CMakeModules/ExternalAssimp.cmake

@@ -0,0 +1,23 @@
+# Build a local version
+INCLUDE(ExternalProject)
+
+SET(assimp_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/Assimp)
+
+#SET(assimp_SVN https://assimp.svn.sourceforge.net/svnroot/assimp/tags/2.0)
+SET(assimp_GIT_REPO git://github.com/assimp/assimp.git)
+SET(assimp_GIT_TAG b12d8be8ca61fc2e7fc1a49b311a5f0d65d77bd1) # TAG 2.0
+
+ExternalProject_Add(assimp
+	PREFIX ${assimp_PREFIX}
+	GIT_REPOSITORY ${assimp_GIT_REPO}
+	GIT_TAG ${assimp_GIT_TAG}
+	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+)
+
+# tell CMake to look for our version
+SET(ASSIMP_FOUND TRUE)
+SET(ASSIMP_INCLUDE_DIR ${assimp_PREFIX}/include)
+#SET(ASSIMP_LIBRARY ${assimp_PREFIX}/lib)
+#SET(ASSIMP_LIBRARIES
+
+#SET(CMAKE_PREFIX_PATH ${assimp_PREFIX})

+ 26 - 0
Build/CMakeModules/ExternalFreetype.cmake

@@ -0,0 +1,26 @@
+# Build a local version
+INCLUDE(ExternalProject)
+
+SET(freetype_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/freetype)
+
+# Set the build target for the appropriate build
+# TODO add other platforms
+IF(MSVC10)
+	# BUILD_COMMAND would be better but it returns a single string which is escaped when it shouldn't be
+	SET(freetype_BUILD msbuild.exe builds/win32/vc2010/freetype.sln /p:Configuration=Release)
+ENDIF(MSVC10)
+
+ExternalProject_Add(freetype
+	PREFIX ${freetype_PREFIX}
+	URL http://download.savannah.gnu.org/releases/freetype/freetype-2.4.5.tar.gz
+	URL_MD5 0e67460b312df905dc1cc1586690e7b2
+	CONFIGURE_COMMAND cmake -E echo "Skipping configure step"
+	BUILD_IN_SOURCE 1
+	BUILD_COMMAND ${freetype_BUILD}
+	INSTALL_COMMAND cmake -E echo "Skipping install step"
+)
+
+# tell CMake to use this version
+SET(FREETYPE_INCLUDE_DIR)
+SET(FREETYPE_LIBRARY)
+

+ 17 - 0
Build/CMakeModules/ExternalOpenAL.cmake

@@ -0,0 +1,17 @@
+# Build a local version
+INCLUDE(ExternalProject)
+
+SET(openal_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/OpenAL)
+
+ExternalProject_Add(openal
+	PREFIX ${openal_PREFIX}
+	#URL http://connect.creativelabs.com/openal/Downloads/oalinst.zip
+	URL http://kcat.strangesoft.net/openal-releases/openal-soft-1.13.tar.bz2
+	URL_MD5 58b7d2809790c70681b825644c5f3614
+	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+)
+
+# tell CMake to use this version
+SET(OPENAL_INCLUDE_DIR)
+SET(OPENAL_LIBRARY)
+SET(OPENAL_FOUND)

+ 32 - 0
Build/CMakeModules/ExternalPNG.cmake

@@ -0,0 +1,32 @@
+# Build a local version of zlib and libpng
+INCLUDE(ExternalProject)
+
+SET(zlib_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/zlib)
+
+EXTERNALPROJECT_ADD(zlib
+	PREFIX ${zlib_PREFIX}
+	URL http://zlib.net/zlib-1.2.5.tar.gz
+	URL_MD5 c735eab2d659a96e5a594c9e8541ad63
+	PATCH_COMMAND ${CMAKE_COMMAND} -E remove <SOURCE_DIR>/zconf.h
+	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+)
+
+SET(png_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/libpng)
+
+EXTERNALPROJECT_ADD(libpng
+	DEPENDS zlib
+	PREFIX ${png_PREFIX}
+	URL ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.4.tar.gz
+	URL_MD5 dea4d1fd671160424923e92ff0cdda78
+	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${zlib_PREFIX} # to find zlib
+)
+
+# tell CMake to use this version
+#  PNG_INCLUDE_DIR, where to find png.h, etc.
+#  PNG_LIBRARIES, the libraries to link against to use PNG.
+#  PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
+#  PNG_FOUND, If false, do not try to use PNG.
+
+SET(PNG_INCLUDE_DIR ${png_PREFIX}/include)
+SET(PNG_LIBRARIES ${png_PREFIX}/lib)
+

+ 16 - 0
Build/CMakeModules/ExternalPhysFS.cmake

@@ -0,0 +1,16 @@
+# Build a local version
+INCLUDE(ExternalProject)
+
+SET(physfs_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/physfs)
+
+ExternalProject_Add(physfs
+	PREFIX ${physfs_PREFIX}
+	URL http://offload1.icculus.org:9090/physfs/downloads/physfs-2.0.2.tar.gz
+	URL_MD5 4e8927c3d30279b03e2592106eb9184a
+	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+)
+
+# tell CMake to use this version
+SET(PHYSFS_INCLUDE_DIR)
+SET(PHYSFS_LIBRARY)
+SET(PHYSFS_FOUND)

+ 51 - 0
Build/CMakeModules/ExternalVorbisFile.cmake

@@ -0,0 +1,51 @@
+# Build a local version of libogg, libvorbis and libvorbisfile
+INCLUDE(ExternalProject)
+
+SET(ogg_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/vorbisfile)
+
+SET(vorbis_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/vorbisfile)
+
+# Set the build target for the appropriate build
+# TODO add other platforms
+IF(MSVC10)
+	# BUILD_COMMAND would be better but it returns a single string which is escaped when it shouldn't be
+	SET(ogg_BUILD msbuild.exe win32/VS2010/libogg_dynamic.sln /p:Configuration=Release)
+ENDIF(MSVC10)
+
+EXTERNALPROJECT_ADD(ogg
+	PREFIX ${ogg_PREFIX}
+	URL http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz
+	URL_MD5 5a9fcabc9a1b7c6f1cd75ddc78f36c56
+	CONFIGURE_COMMAND cmake -E echo "Skipping configure step"
+	BUILD_IN_SOURCE 1
+	BUILD_COMMAND ${ogg_BUILD}
+	INSTALL_COMMAND cmake -E echo "Skipping install step"
+)
+
+
+# Set the build target for the appropriate build
+IF(MSVC10)
+	SET(vorbis_BUILD msbuild.exe win32/VS2010/vorbis_dynamic.sln /p:Configuration=Release)
+ENDIF(MSVC10)
+
+EXTERNALPROJECT_ADD(vorbis
+	DEPENDS ogg
+	PREFIX ${vorbis_PREFIX}
+	URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
+	URL_MD5 c870b9bd5858a0ecb5275c14486d9554
+	PATCH_COMMAND 
+	CONFIGURE_COMMAND cmake -E echo "Skipping configure step"
+	BUILD_IN_SOURCE 1
+	BUILD_COMMAND ${vorbis_BUILD}
+	INSTALL_COMMAND cmake -E echo "Skipping install step"
+)
+
+# tell CMake to use this version
+#  PNG_INCLUDE_DIR, where to find png.h, etc.
+#  PNG_LIBRARIES, the libraries to link against to use PNG.
+#  PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
+#  PNG_FOUND, If false, do not try to use PNG.
+
+SET(VORBISFILE_INCLUDE_DIR ${vorbis_PREFIX}/include)
+SET(VORBISFILE_LIBRARY ${vorbis_PREFIX}/lib)
+

+ 15 - 34
CMakeLists.txt

@@ -16,7 +16,21 @@ OPTION(POLYCODE_BUILD_MODULES "Build Polycode modules" ON)
 OPTION(POLYCODE_BUILD_PLAYER "Build Polycode standalone player" ON)
 OPTION(POLYCODE_BUILD_TOOLS "Build Polycode tools" ON)
 
+# Download and build all dependencies on Windows and Mac
+IF(APPLE OR WIN32)
+	SET(common_externals ON)
+ELSE()
+	SET(common_externals OFF)
+ENDIF()
+
 # Options for what components should be downloaded and built
+OPTION(POLYCODE_EXTERNAL_PHYSFS "Download and build the PhysFS package" ${common_externals})
+#OPTION(OpenGL REQUIRED)
+OPTION(POLYCODE_EXTERNAL_OPENAL "Download and build the OpenAL package" ${common_externals})
+OPTION(POLYCODE_EXTERNAL_FREETYPE "Download and build the Freetype2 package" ${common_externals})
+OPTION(POLYCODE_EXTERNAL_PNG "Download and build the PNG package" ${common_externals})
+OPTION(POLYCODE_EXTERNAL_VORBISFILE "Download and build the Vorbis File package" ${common_externals})
+
 OPTION(POLYCODE_BUILD_BOX2D "Download and build the Box2D package" ON)
 OPTION(POLYCODE_BUILD_BULLET "Download and build the Bullet package" ON)
 OPTION(POLYCODE_BUILD_ASSIMP "Download and build the Assimp package" ON)
@@ -31,41 +45,8 @@ IF(WIN32)
     SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_PREFIX_PATH}/Lib/Release)
 ENDIF(WIN32)
 
-FIND_PACKAGE(PhysFS REQUIRED)
-FIND_PACKAGE(OpenGL REQUIRED)
-FIND_PACKAGE(OpenAL REQUIRED)
-FIND_PACKAGE(Freetype REQUIRED)
-FIND_PACKAGE(PNG REQUIRED)
-FIND_PACKAGE(VorbisFile REQUIRED)
-
-# Use SDL on non-Apple unixes
-IF(UNIX AND NOT APPLE)
-    FIND_PACKAGE(SDL REQUIRED)
-ENDIF(UNIX AND NOT APPLE)
-
-FIND_LIBRARY(VORBISFILE_LIBRARY NAMES vorbisfile)
-
-# platform specific defines and include directories for win and sdl
-IF(MSVC)
-    ADD_DEFINITIONS(/D_UNICODE /DUNICODE)
-    INCLUDE_DIRECTORIES(${PolyCode_SOURCE_DIR}/Core/Build/MSVC/Polycore)
-ELSEIF(APPLE)
-    ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
-ELSE(MSVC)
-    ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
-    INCLUDE_DIRECTORIES(${PolyCode_SOURCE_DIR}/Core/Build/Linux)
-ENDIF(MSVC)
-
-# Set up common include directories
-INCLUDE_DIRECTORIES(
-    ${PolyCode_SOURCE_DIR}/Core/Contents/Include
-    ${OPENGL_INCLUDE_DIR}
-    ${OPENAL_INCLUDE_DIR}
-    ${FREETYPE_INCLUDE_DIRS}
-)
-
 # Process subdirectories
-ADD_SUBDIRECTORY(Core/Contents)
+ADD_SUBDIRECTORY(Core)
 
 IF(POLYCODE_BUILD_BINDINGS)
     FIND_PACKAGE(Lua51 REQUIRED)

+ 57 - 0
Core/CMakeLists.txt

@@ -1,2 +1,59 @@
+FIND_PACKAGE(OpenGL REQUIRED)
 
+IF(POLYCODE_EXTERNAL_PNG)
+	INCLUDE(ExternalPNG)
+ELSE()
+	FIND_PACKAGE(PNG REQUIRED)
+ENDIF(POLYCODE_EXTERNAL_PNG)
 
+IF(POLYCODE_EXTERNAL_PHYSFS)
+	INCLUDE(ExternalPhysFS)
+ELSE()
+	FIND_PACKAGE(PhysFS REQUIRED)
+ENDIF(POLYCODE_EXTERNAL_PHYSFS)
+
+IF(POLYCODE_EXTERNAL_OPENAL)
+	INCLUDE(ExternalOpenAL)
+ELSE()
+	FIND_PACKAGE(OpenAL REQUIRED)
+ENDIF(POLYCODE_EXTERNAL_OPENAL)
+
+IF(POLYCODE_EXTERNAL_FREETYPE)
+	INCLUDE(ExternalFreetype)
+ELSE()
+	FIND_PACKAGE(Freetype REQUIRED)
+ENDIF(POLYCODE_EXTERNAL_FREETYPE)
+
+IF(POLYCODE_EXTERNAL_VORBISFILE)
+	INCLUDE(ExternalVorbisFile)
+ELSE()
+	FIND_PACKAGE(VorbisFile REQUIRED)
+ENDIF(POLYCODE_EXTERNAL_VORBISFILE)
+
+# Use SDL on non-Apple unixes
+IF(UNIX AND NOT APPLE)
+    FIND_PACKAGE(SDL REQUIRED)
+ENDIF(UNIX AND NOT APPLE)
+
+FIND_LIBRARY(VORBISFILE_LIBRARY NAMES vorbisfile)
+
+# platform specific defines and include directories for win and sdl
+IF(MSVC)
+    ADD_DEFINITIONS(/D_UNICODE /DUNICODE)
+    INCLUDE_DIRECTORIES(${PolyCode_SOURCE_DIR}/Core/Build/MSVC/Polycore)
+ELSEIF(APPLE)
+    ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
+ELSE(MSVC)
+    ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
+    INCLUDE_DIRECTORIES(${PolyCode_SOURCE_DIR}/Core/Build/Linux)
+ENDIF(MSVC)
+
+# Set up common include directories
+INCLUDE_DIRECTORIES(
+    ${PolyCode_SOURCE_DIR}/Core/Contents/Include
+    ${OPENGL_INCLUDE_DIR}
+    ${OPENAL_INCLUDE_DIR}
+    ${FREETYPE_INCLUDE_DIRS}
+)
+
+ADD_SUBDIRECTORY(Contents)