Stellarium:Compile with MSVC2012 and Qt5 (OpenGL)

来源:互联网 发布:电脑重启后软件丢失 编辑:程序博客网 时间:2024/04/30 07:05

配置环境变量 最后更新2014年6月

After installing all required libraries and tools you should configure the build environment.

  • Add D:\zlib to PATH variable - you should add string D:\zlib\lib;D:\zlib\include(这两个我没加) to PATH variable[3].
  • Add D:\Qt5 to PATH variable - you should add string D:\Qt5\5.2.1\msvc2012_64_opengl\;D:\Qt5\5.2.1\msvc2012_64_opengl\bin;D:\Qt5\5.2.1\msvc2012_64_opengl\lib;D:\Qt5\5.2.1\msvc2012_64_opengl\include to PATH variable.

Note: After changes the PATH variable you should reboot the computer for apply those changes.

获取源代码

发布版

You can download the source code for the release versions from the sourceforge download area. 保存文件到D:/Stellarium-Source 目录. The file name should be stellarium-0.13.0.tar.gz or similar.

You will need a decompression program installed in Windows, for example 7-Zip.

De-compress the tar file like this:

tar zxvf stellarium-0.13.0.tar.gz

The root of the source tree will be will be D:/Stellarium-Source/stellarium for simplicity.

开发者版 versions from the Bazaar repository

See also Bzr checkout

You can try the latest development code by downloading from the bzr repository using the TortoiseBZR client bzr shell. This program integrates with the Windows file browser. See the TortoiseBZR website for details. Check out the source by entering the folder where you have the stellarium source code and from the Windows menu bar:

The root of the source tree typically will be C:\Stellarium-Source\stellarium.

You will first need to get the source code.

For example you use TortoiseBZR and want get the source code of the Stellarium. Run Explorer and open directory C:\Stellarium-Source, choose directory stellarium and make right click mouse. In opened window select "Bazaar create working copy/branch". Set source as "lp:stellarium", destination directory will be "C:\Stellarium-Source\stellarium". Press OK for getting source code.

This will download the trunk into .bzr (nearly 1GB at the moment), a hidden folder in the stellarium folder, so it may take some time. When this completes the trunk source code will be written into your stellarium folder.

When the source code is loaded into your stellarium folder you can add any updates from the Windows pull down menu. Note: in Windows 7 the menu will appear if you right click the mouse in a vacant area of the stellarium folder.

生成

  1. 源代码根目录, e.g.
    D:\Stellarium-Sources\stellarium
  2. 创建生成目录 build :
    D:\Stellarium-Sources\stellarium\builds\msvc
  3. Run CMake[4] (you can use following configuring build options):
  4. windows-cmake-gui.jpg
  5. Steps on the screenshot above:
    1. Choose directory with source code of Stellarium
    2. Choose directory for building of Stellarium
    3. Configure project (e.g. you should choose version of compiler)
    4. Add special configure options (e.g. you can add CMAKE_INSTALL_PREFIX and set C:\stellarium here)
    5. Generate CMakeLists.txt file

    This will place all the compiled files in C:\stellarium. From where they will be found when you run the installer program stellarium.iss after you install the Inno Setup Compiler.

    测试运行

    If the build was successful, you can run the program without installing it, just to test everything is OK.首先找到所有DLLs Stellarium uses, and 拷贝到源代码树的根目录:

    • From the \Qt5\5.2.1\msvc2012_64_opengl\bin folder: Qt5Core.dllQt5Concurrent.dllQt5Declarative.dllQt5Gui.dllQt5Network.dllQt5OpenGL.dllQt5Widgets.dllQt5Sql.dllQt5XmlPatterns.dllicudt51.dllicuin51.dll, and icuuc51.dll;
    • From the \zlib folder: zlib1.dll[5]
    • From the \Qt5\5.2.1\msvc2012_64_opengl\plugins\platforms folder to the /platforms of the source tree: qwindows.dll
    • From the \Qt5\5.2.1\msvc2012_64_opengl\imports\Qt\labs\shaders folder to the /Qt/labs/shaders of the source tree: qmldirplugins.qmltypes, and qmlshadersplugin.dll

    If you need a language other than English copy the stellarium\translations folder from C:\stellarium\share (or \program files\stellarium\share if you don't set CMAKE_INSTALL_PREFIX variable) to the stellarium source tree root folder.

    Finally run Build for INSTALL solution in Visual Studio.

    This will place all the necessary files in your program files folder stellarium where the installer expects to find them.

    Making the installer

    We use the Inno Setup Compiler to create the installer. These details are for builds source later than 6052

    From http://www.jrsoftware.org download version 5.5.3 (unicode) or better, run it to install.

    If you have followed the above procedure the current bzr build will generate the necessary stellarium.iss file. Double click on it, then from the menu bar "build-compile". It will build the stellarium installer package and place it in a folder of the stellarium source tree root folder "installers"

    Run the program generated and Stellarium will be installed in program files\stellarium or wherever you select and place an icon on the desktop.

    Notes

    1. ↑ This dependency was included in Stellarium's source code since revision 6853 and it's not required a separate library now.
    2. ↑ Those packages was compiled to static library.
    3. ↑ See instructions for adding data to PATH here. Not required since revision 6853.
    4. ↑ If the compile fails with the error "can't find a particular file". Check the CMakeCache.txt file in the ...\builds\msys folder and make sure the variable/path/file is directed to the correct source.
    5. ↑ Required only for dynamic library before revision 6853.
    错误:
  6. CMake Error at D:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:16 (message):
  7. Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE "".在计算机上搜索glu32 查到在C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64位置然后设置Qt 
  8. D:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\lib\cmake\Qt5Gui\Qt5GuiConfigExtras.cmake
  9. 在第一行加入set(CMAKE_LIBRARY_PATH "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Lib\\x64") 

0 0
原创粉丝点击