From b4b5f665c11e834c0e1add29cced822566149bc3 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 1 Mar 2013 16:26:38 +0000 Subject: [PATCH] Metabuild starting to work on Windows --- CMakeLists.txt | 90 ++++++++++++++++++++++++++++++++++------------ installWinDeps.bat | 11 ++++++ simgear | 2 +- 3 files changed, 80 insertions(+), 23 deletions(-) create mode 100644 installWinDeps.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index cb88be7..028eca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,12 +10,7 @@ else() set(BOOST_BOOTSTRAP "bootstrap.bat") endif() -if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux") - ExternalProject_Add(Archive - PREFIX ${CMAKE_BINARY_DIR} - URL http://www.libarchive.org/downloads/libarchive-3.1.2.tar.gz - BINARY_DIR archivebuild - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) +if(APPLE) set(BOOST_ARGS link=static stage --with-system) ExternalProject_Add(Boost @@ -26,7 +21,9 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux") BUILD_COMMAND ./bjam ${BOOST_ARGS} BUILD_IN_SOURCE 1 INSTALL_COMMAND ./b2 install ${BOOST_ARGS}) -endif() # of Linux +endif() # of Apple + +set (OSG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) if (APPLE) SET(SDKROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk) @@ -42,56 +39,105 @@ if (APPLE) # SET(OSG_SOURCE GIT_REPOSITORY git://gitorious.org/+flightgear-developers/openscenegraph/mac-release-osg.git) SET(OSG_SOURCE URL http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.1.4.zip) +elseif(MSVC) + set( OSG_MSVC "msvc" ) + if (${MSVC_VERSION} EQUAL 1700) + set( OSG_MSVC ${OSG_MSVC}110 ) + elseif (${MSVC_VERSION} EQUAL 1600) + set( OSG_MSVC ${OSG_MSVC}100 ) + else (${MSVC_VERSION} EQUAL 1700) + set( OSG_MSVC ${OSG_MSVC}90 ) + endif (${MSVC_VERSION} EQUAL 1700) + + SET(OSG_CMAKE_ARGS + -DACTUAL_3RDPARTY_DIR:PATH=${CMAKE_BINARY_DIR}/3rdParty + -DBUILD_OSG_APPLICATIONS:BOOL=ON + -DCMAKE_INSTALL_PREFIX:PATH= + -DOSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS:BOOL=OFF + -DFREETYPE_LIBRARY:FILEPATH=${CMAKE_BINARY_DIR}/3rdParty/lib/freetype243.lib + -DGDAL_INCLUDE_DIR:PATH= + -DGDAL_LIBRARY:FILEPATH= + ) + + # for compatability with MSVC directory layout + set(OSG_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install/${OSG_MSVC}/OpenSceneGraph) + SET(OSG_SOURCE URL http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.1.4.zip) else() # normal OSG SET(OSG_SOURCE URL http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.1.4.zip) endif() -if (WIN32) -# ExternalProject_Add(OpenAL ) +if (MSVC) +# download 3rdpart dependeancies zip, including boost + ExternalProject_Add(WinDeps + DOWNLOAD_COMMAND URL http://files.goneabitbursar.com/fg/fgfs-win32-VS100-3rdParty+OSG-20120411.zip +# extract to current root + SOURCE_DIR ${CMAKE_BINARY_DIR}/winDeps + BINARY_DIR ${CMAKE_BINARY_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_SOURCE_DIR}/installWinDeps.bat + INSTALL_COMMAND "" + ) endif() # of Windows ExternalProject_Add(OSG + DEPENDS WinDeps PREFIX ${CMAKE_BINARY_DIR} ${OSG_SOURCE} BINARY_DIR osgbuild - CMAKE_ARGS ${OSG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + CMAKE_ARGS ${OSG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${OSG_INSTALL_PREFIX} +# force Release build of OpenSceneGraph +# BUILD_COMMAND "cmake --build . --config Release" ) +set(SG_CMAKE_ARGS -DENABLE_PACKAGE=1) +set(FG_CMAKE_ARGS "") + +if (FALSE) ExternalProject_Add(OpenRTI PREFIX ${CMAKE_BINARY_DIR} DOWNLOAD_COMMAND GIT_REPOSITORY git://gitorious.org/openrti/openrti.git BINARY_DIR rtibuild CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) + + list(APPEND SG_CMAKE_ARGS -DENABLE_RTI=1) + list(APPEND FG_CMAKE_ARGS -DENABLE_RTI=1) +endif() -set(SG_CMAKE_ARGS -DENABLE_RTI=1 -DENABLE_PACKAGE=1) -set(FG_CMAKE_ARGS -DENABLE_RTI=1) + + +if (WIN32) + list(APPEND SG_CMAKE_ARGS -DBOOST_ROOT=${CMAKE_BINARY_DIR}) + list(APPEND FG_CMAKE_ARGS -DBOOST_ROOT=${CMAKE_BINARY_DIR}) +endif() ExternalProject_Add(SimGear PREFIX ${CMAKE_BINARY_DIR} - DEPENDS OSG Boost Archive OpenRTI + DEPENDS OSG DOWNLOAD_COMMAND "" # no need to download UPDATE_COMMAND "" # or update. SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/simgear BINARY_DIR sgbuild CMAKE_ARGS ${SG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) -SET(PLIB_ARGS --disable-pw --disable-sl --disable-psl --disable-ssg --disable-ssgaux) +# on Windows, PLIB is in the 3rd-party dependancies zip +if (NOT WIN32) + SET(PLIB_ARGS --disable-pw --disable-sl --disable-psl --disable-ssg --disable-ssgaux) -ExternalProject_Add(PLIB - PREFIX ${CMAKE_BINARY_DIR} - URL http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz - CONFIGURE_COMMAND /configure --prefix=${CMAKE_INSTALL_PREFIX} ${PLIB_ARGS} - BUILD_IN_SOURCE 1 -) + ExternalProject_Add(PLIB + PREFIX ${CMAKE_BINARY_DIR} + URL http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz + CONFIGURE_COMMAND /configure --prefix=${CMAKE_INSTALL_PREFIX} ${PLIB_ARGS} + BUILD_IN_SOURCE 1 + ) +endif() ExternalProject_Add(FlightGear PREFIX ${CMAKE_BINARY_DIR} - DEPENDS SimGear PLIB + DEPENDS SimGear OSG DOWNLOAD_COMMAND "" # no need to download UPDATE_COMMAND "" # or update. SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/flightgear BINARY_DIR fgbuild CMAKE_ARGS ${FG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) - diff --git a/installWinDeps.bat b/installWinDeps.bat new file mode 100644 index 0000000..945562d --- /dev/null +++ b/installWinDeps.bat @@ -0,0 +1,11 @@ + + +REM ExternalProject can't cleanly extract a zip into an existing directory +REM Instead we extract to a subdir, and then move the directories we want +REM using this bat file. + +echo %CD% + +xcopy /Y /E winDeps . + +echo "Done copying Windows deps" diff --git a/simgear b/simgear index 06bfa4f..5e45bde 160000 --- a/simgear +++ b/simgear @@ -1 +1 @@ -Subproject commit 06bfa4f1a1ef13ce8e52b8b610fa05786ecbe5a6 +Subproject commit 5e45bdeeda7d149b30a550733121b8e34876343f