AFSIM入门教程03.01:Windows下编译

系列索引:AFSIM入门教程索引

我下载的是发行版,其中包含官方已经编译好的可执行程序,为了了解编译流程以便在其他平台进行编译,先试试在Windows下的编译流程。

环境

  • Windows 10 Pro Workstation 22H2
  • CMake 3.30.5
  • Visual Studio 2022 17.14.6

目录结构

要想完整的编译,需要包含以下目录结构

1
2
3
4
5
6
7
8
9
├─demos

├─resources

├─swdev

├─tools

└─training

工程生成

打开源码所在目录swdev/src/,目录中要包含CMakeLists.txt。在当前目录创建一个build目录,并在build目录中生成VS工程

1
2
3
4
cmake -B .\build -D CPACK_BINARY_NSIS=OFF -D CPACK_BINARY_INNOSETUP=OFF -D CPACK_BINARY_IFW=ON \
-D WSF_INSTALL_DEMOS=ON -D WSF_INSTALL_DEPENDENCIES=ON -D WSF_INSTALL_DOCUMENTATION=ON \
-D WSF_INSTALL_SCENARIOS=ON -D WSF_INSTALL_SOURCE=OFF -D WSF_INSTALL_TOOLS=ON \
-D WSF_INSTALL_TRAINING=ON
  • CPACK是CMake框架中的打包工具,可以将可执行程序、源码、文档、资源、示例等制作为安装包,方便开发者分发程序,支持用户双击安装使用。
    • NSIS
    • INNOSETUP
    • IFW 基于Qt的打包工具。也是本文使用的打包工具
  • WSF_INSTALL_DEMOS 自动复制示例到安装目录中。
  • WSF_INSTALL_DEPENDENCIES 自动复制官方提供的第三方库到安装目录中。
  • WSF_INSTALL_DOCUMENTATION 自动复制文档到安装目录中。
  • WSF_INSTALL_SCENARIOS
  • WSF_INSTALL_SOURCE 自动复制源码到安装目录中。比较耗时。
  • WSF_INSTALL_TOOLS 自动复制工具到安装目录中。
  • WSF_INSTALL_TRAINING 自动复制训练文件到安装目录中。
我的输出为-- Building for: Visual Studio 17 2022 -- CMAKE_VERSION: 3.30.5 -- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.19045. -- The C compiler identification is MSVC 19.44.35211.0 -- The CXX compiler identification is MSVC 19.44.35211.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.50.0.windows.1") -- AFSIM Version: 2.9.0 -- AFSIM Release Version: 2.9.0 02-25-2022 -- Could NOT find Sphinx (missing: Sphinx-build_EXECUTABLE Sphinx-apidoc_EXECUTABLE) CMake Warning at cmake/Modules/wsf_documentation.cmake:71 (message): Sphinx install selected but Sphinx exe not available for generation. Call Stack (most recent call first): CMakeLists.txt:186 (include)

– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - not found
– Found Threads: TRUE
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/gtest/gtest-1.8.0-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
CMake Warning (dev) at cmake/Modules/ConfigureUnitTests.cmake:24 (find_package):
Policy CMP0144 is not set: find_package uses upper-case_ROOT
variables. Run “cmake --help-policy CMP0144” for policy details. Use the
cmake_policy command to set the policy and suppress this warning.

CMake variable GTEST_ROOT is set to:

D:/AFSIM/trunk/swdev/src/build/3rd_party/gtest-1.8.0-x64-vs2017

For compatibility, find_package is ignoring the variable, but code in a
.cmake module might still use it.
Call Stack (most recent call first):
CMakeLists.txt:362 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

– Found GTest: D:/AFSIM/trunk/swdev/src/build/3rd_party/gtest-1.8.0-x64-vs2017/lib/gtest.lib
– Performing Test COMPILER_HAS_DEPRECATED_ATTR
– Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
– Performing Test COMPILER_HAS_DEPRECATED
– Performing Test COMPILER_HAS_DEPRECATED - Success
– Configuring sensor_plot_lib
– Configuring wsf_cyber
– Configuring wsf_grammar_check

– Configuring wsf_sosm
– Found GMock: D:/AFSIM/trunk/swdev/src/build/3rd_party/gtest-1.8.0-x64-vs2017/lib/gmock.lib
CMake Warning (dev) at cmake/Modules/FindGMock.cmake:131 (find_package):
Policy CMP0144 is not set: find_package uses upper-case_ROOT
variables. Run “cmake --help-policy CMP0144” for policy details. Use the
cmake_policy command to set the policy and suppress this warning.

CMake variable GTEST_ROOT is set to:

D:/AFSIM/trunk/swdev/src/build/3rd_party/gtest-1.8.0-x64-vs2017

For compatibility, find_package is ignoring the variable, but code in a
.cmake module might still use it.
Call Stack (most recent call first):
core/wsf_parser/test/CMakeLists.txt:15 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

Skipping missing data directory: WSF_SCENARIOS_ROOT-NOTFOUND/argo8
Skipping missing data directory: WSF_SCENARIOS_ROOT-NOTFOUND/argo8_types
Skipping missing data directory: D:/AFSIM/trunk/swdev/src/wsf_plugins/wsf_iads_c2_lib/demos/
– Found Python3: C:/Users/xuhua/AppData/Local/Programs/Python/Python38/python.exe (found version “3.8.10”) found components: Interpreter
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/qt/qt-5.12.11-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
– Found OpenGL: opengl32
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/gdal/gdal-3.3.2-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/geos/geos-3.5.1-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/osgEarth/osgEarth-2.10.1-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/osg/osg-3.6.3-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/proj/proj-8.1.1-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/tiff/tiff-4.3.0-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
– Using resource files from directory D:/AFSIM/trunk/swdev/dependencies/resources
– Configuring WKF Plugin CoverageOverlay
– Configuring WKF Plugin MapDisplay
– Configuring WKF Plugin MapHoverInfo
– Configuring WKF Plugin ModelBrowser
– Configuring WKF Plugin Performance
– Configuring WKF Plugin PositionConverterTool
– Configuring WKF Plugin TerrainTools
– Configuring WKF Plugin TetherView
– Configuring WKF Plugin UnitConverterTool
– Configuring WKF Plugin VideoCapture
– Configuring WKF Plugin Visibility
– Configuring MYSTIC Plugin ResultAcesDisplay
– Configuring MYSTIC Plugin ResultAirCombatVisualization
– Configuring MYSTIC Plugin ResultAnnotation

– Configuring WIZARD Plugin WizTypeBrowser
– Configuring WIZARD Plugin WizUnitConversion
– Configuring WIZARD Plugin WizZoneEditor
Installing package: D:/AFSIM/trunk/swdev/dependencies/3rd_party/tinyxml2/tinyxml2-7.1.0-x64-vs2017.tar.gz to D:/AFSIM/trunk/swdev/src/build/3rd_party
– Configuring done (30.4s)
– Generating done (14.9s)
– Build files have been written to: D:/AFSIM/trunk/swdev/src/build

可以看出生成工程耗时45秒。

编译

编译Release版,并安装到指定目录

1
cmake --build .\build --config Release
我的输出为适用于 .NET Framework MSBuild 版本 17.14.10+8b8e13593

1>Checking Build System
Building Custom Rule D:/AFSIM/trunk/swdev/src/tools/util/source/CMakeLists.txt
UtAirspeed.cpp
UtAngle.cpp
UtAngleR.cpp

UtVec3dX.cpp
UtWallClock.cpp
UtTable_RegularTable.cpp
正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Release/util.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Release/util.exp
util.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\util.dll
Building Custom Rule D:/AFSIM/trunk/swdev/src/wsf_plugins/wsf_brawler/brawler/CMakeLists.txt
BrawlerCoordinateConversion.cpp
BrawlerEvaluation.cpp
BrawlerMIND.cpp
BrawlerMover.cpp
BrawlerPlatform.cpp
BrawlerUtil.cpp
正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Release/brawler.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Release/brawler
.exp
brawler.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\brawler.dll
Building Custom Rule D:/AFSIM/trunk/swdev/src/tools/genio/source/CMakeLists.txt
GenBuf.cpp
GenBufIManaged.cpp
GenBufIO.cpp

D:\AFSIM\trunk\swdev\src\wsf_plugins\wsf_oms_uci\source\uci\factory\StrikeCommandTypeFactory.h(1,1): warning C4819: 该文件
包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_oms_uci\source\wsf_oms_uci.v
cxproj]
(编译源文件“…/…/…/wsf_plugins/wsf_oms_uci/source/script/WsfScriptUCI_SystemStatusMessage.cpp”)

D:\AFSIM\trunk\swdev\src\wsf_plugins\wsf_oms_uci\source\uci\factory\StrikeWeaponCommandTypeFactory.h(1,1): warning C481
9: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_oms_uci\source\wsf_oms
_uci.vcxproj]
(编译源文件“…/…/…/wsf_plugins/wsf_oms_uci/source/script/WsfScriptUCI_SystemStatusMessage.cpp”)

D:\AFSIM\trunk\swdev\src\wsf_plugins\wsf_oms_uci\source\uci\factory\SystemID_TypeFactory.h(1,1): warning C4819: 该文件包含不能
在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_oms_uci\source\wsf_oms_uci.vcxpr
oj]
(编译源文件“…/…/…/wsf_plugins/wsf_oms_uci/source/script/WsfScriptUCI_SystemStatusMessage.cpp”)

D:\AFSIM\trunk\swdev\src\wsf_plugins\wsf_oms_uci\source\uci\factory\SubCapabilityDetailsTypeFactory.h(1,1): warning C48
19: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_oms_uci\source\wsf_om
s_uci.vcxproj]
(编译源文件“…/…/…/wsf_plugins/wsf_oms_uci/source/script/WsfScriptUCI_SystemStatusMessage.cpp”)

D:\AFSIM\trunk\swdev\src\wsf_plugins\wsf_oms_uci\source\uci\factory\SubCapabilitySelectionTypeFactory.h(1,1): warning C
4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_oms_uci\source\wsf_
oms_uci.vcxproj]
(编译源文件“…/…/…/wsf_plugins/wsf_oms_uci/source/script/WsfScriptUCI_SystemStatusMessage.cpp”)

正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Release/wsf_oms_uci.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Release/wsf

_oms_uci.exp
wsf_oms_uci.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wsf_oms_uci.dll
Building Custom Rule D:/AFSIM/trunk/swdev/src/wsf_plugins/wsf_scenario_analyzer/source/CMakeLists.txt
ScenarioAnalyzerPluginRegistration.cpp
D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Uni
code 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_scenario_analyzer\source\wsf_scenario_analyzer.vcxproj]
(编译源文件“…/…/…/wsf_plugins/wsf_scenario_analyzer/source/ScenarioAnalyzerPluginRegistration.cpp”)

正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Release/wsf_scenario_analyzer.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/R

elease/wsf_scenario_analyzer.exp
wsf_scenario_analyzer.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wsf_scenario_analyzer.dll
Building Custom Rule D:/AFSIM/trunk/swdev/src/wsf_plugins/wsf_scenario_analyzer_iads_c2/source/CMakeLists.txt
ScenarioAnalyzerIADSC2.cpp
D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Uni
code 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_scenario_analyzer_iads_c2\source\wsf_scenario_analyzer_iads_c2
.vcxproj]
(编译源文件“…/…/…/wsf_plugins/wsf_scenario_analyzer_iads_c2/source/ScenarioAnalyzerIADSC2.cpp”)

正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Release/wsf_scenario_analyzer_iads_c2.lib 和对象 D:/AFSIM/trunk/swdev/src/bui

ld/lib/Release/wsf_scenario_analyzer_iads_c2.exp
wsf_scenario_analyzer_iads_c2.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wsf_scenario_analyzer_iads_c2.dll
Generating …/grammar/wsf_sosm.ag
Building Custom Rule D:/AFSIM/trunk/swdev/src/wsf_plugins/wsf_sosm/CMakeLists.txt
WsfSOSM_Interaction.cpp
WsfSOSM_Interface.cpp
WsfSOSM_Sensor.cpp
D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Uni
code 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_sosm\wsf_sosm.vcxproj]
(编译源文件“…/…/wsf_plugins/wsf_sosm/source/WsfSOSM_Interface.cpp”)

D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Uni
code 格式以防止数据丢失 [D:\AFSIM\trunk\swdev\src\build\build_wsf_sosm\wsf_sosm.vcxproj]
(编译源文件“…/…/wsf_plugins/wsf_sosm/source/WsfSOSM_Sensor.cpp”)

正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Release/wsf_sosm.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Release/wsf_so

sm.exp
wsf_sosm.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wsf_sosm.dll
Building Custom Rule D:/AFSIM/trunk/swdev/src/CMakeLists.txt

耗时31分钟。

安装

基于编译结果,链接最后的可执行程序,并复制程序到指定为止。

1
cmake --build .\build --config Release --target install
我的输出为适用于 .NET Framework MSBuild 版本 17.14.10+8b8e13593

util.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\util.dll
brawler.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\brawler.dll
genio.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\genio.dll
util_script.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\util_script.dll
dis.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\dis.dll
geodata.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\geodata.dll
Automatic MOC for target osgdb_osgearth_dted_tms
osgdb_osgearth_dted_tms.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\osgdb_osgearth_dted_tms.dll
p6dof.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\p6dof.dll
packetio.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\packetio.dll
afperf.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\afperf.dll
profiling.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\profiling.dll
tracking_filters.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\tracking_filters.dll
Automatic MOC for target utilosg
utilosg.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\utilosg.dll
Automatic MOC for target utilqt
utilqt.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\utilqt.dll
Automatic MOC for target vespatk
vespatk.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\vespatk.dll
Automatic MOC for target vespatk_qt
vespatk_qt.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\vespatk_qt.dll
pack_to_cpp.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\pack_to_cpp.exe
Automatic MOC for target wkf
wkf.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wkf.dll
Automatic MOC for target wkf_common
wkf_common.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wkf_common.dll
wsf_util.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Release\wsf_util.dll

– Up-to-date: D:/AFSIM/trunk/swdev/src/build/wsf_install/./resources/models/mil-std2525d/10065300000000000000.png
– Up-to-date: D:/AFSIM/trunk/swdev/src/build/wsf_install/./resources/models/mil-std2525d/10065400000000000000.png
– Up-to-date: D:/AFSIM/trunk/swdev/src/build/wsf_install/./resources/models/mil-std2525d/10066000000000000000.png
– Up-to-date: D:/AFSIM/trunk/swdev/src/build/wsf_install/./resources/models/mil-std2525d/LICENSE.txt
– Up-to-date: D:/AFSIM/trunk/swdev/src/build/wsf_install/./resources/models/milStdIconMappings.csv
– Up-to-date: D:/AFSIM/trunk/swdev/src/build/wsf_install/./resources/models/models.txt

耗时3分钟。

安装的文件在D:\AFSIM\trunk\swdev\src\build\wsf_install目录下。

打包

使用VS2022打开afsim.sln解决方案。打开CMakeTargets目录,生成PACKAGE工程。

解决方案

我的输出为生成开始于 10:54:13 PM... 1>------ 已启动生成: 项目: ZERO_CHECK, 配置: Debug x64 ------ 1>1>Checking Build System 2>------ 已启动生成: 项目: util, 配置: Debug x64 ------ 3>------ 已启动生成: 项目: scene_gen_sample_project, 配置: Debug x64 ------ 4>------ 已启动生成: 项目: pack_to_cpp, 配置: Debug x64 ------ 5>------ 已启动生成: 项目: osgdb_osgearth_dted_tms, 配置: Debug x64 ------ 6>------ 已启动生成: 项目: osgdb_ogl, 配置: Debug x64 ------ 7>------ 已启动生成: 项目: osgdb_mod, 配置: Debug x64 ------ 8>------ 已启动生成: 项目: iadsLib, 配置: Debug x64 ------ 2>Building Custom Rule D:/AFSIM/trunk/swdev/src/tools/util/source/CMakeLists.txt 5>Automatic MOC for target osgdb_osgearth_dted_tms 6>Automatic MOC for target osgdb_ogl 4>Building Custom Rule D:/AFSIM/trunk/swdev/src/core/wsf_util/ut_pack/pack_to_cpp/CMakeLists.txt 3>Building Custom Rule D:/AFSIM/trunk/swdev/src/tools/scene_gen/source/CMakeLists.txt 7>Automatic MOC for target osgdb_mod 2>UtAirspeed.cpp 2>UtAngle.cpp 5>Building Custom Rule D:/AFSIM/trunk/swdev/src/tools/utilosg/source/osgdb_osgearth_dted_tms/CMakeLists.txt 6>Building Custom Rule D:/AFSIM/trunk/swdev/src/tools/utilosg/source/ReaderWriterOGL/CMakeLists.txt 2>UtAngleR.cpp 2>UtAngleRate.cpp 2>UtAtmosphere.cpp 2>UtAttributeBase.cpp 2>UtAttributeContainer.cpp 2>UtAzElAzElTable.cpp 2>UtAzElLookup.cpp 2>UtAzElTable.cpp 2>UtAzElTableLoader.cpp 2>UtAzElUtil.cpp 2>UtBinarySearch.cpp 2>UtBitmapImage.cpp 2>UtBlackBody.cpp 2>UtBuildInfo.cpp 4>pack_to_cpp.cpp 4>UtTextDocument.cpp 4>UtStringUtil.cpp ... 248>已完成生成项目“Chat.vcxproj”的操作。 247>已完成生成项目“CommVis.vcxproj”的操作。 250>D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 250>(编译源文件“../../../../../warlock/plugins/Astrolabe/source/AstrolabeDockWidget.cpp”) 249>已完成生成项目“BattleManagement.vcxproj”的操作。 255>D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 255>(编译源文件“../../../../../warlock/plugins/AcesDisplay/source/AcesDisplaySimInterface.cpp”) 251> 正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Debug/ApplicationLauncher_d.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Debug/ApplicationLauncher_d.exp 251>ApplicationLauncher.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Debug\ApplicationLauncher_d.dll 251>已完成生成项目“ApplicationLauncher.vcxproj”的操作。 252>D:\AFSIM\trunk\swdev\src\tools\dis\source\DisEntityState.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 252>(编译源文件“../../../../../warlock/plugins/Annotation/source/AnnotationSimInterface.cpp”) 253> 正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Debug/AirCombatVisualization_d.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Debug/AirCombatVisualization_d.exp 253>AirCombatVisualization.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Debug\AirCombatVisualization_d.dll 250> 正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Debug/Astrolabe_d.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Debug/Astrolabe_d.exp 253>已完成生成项目“AirCombatVisualization.vcxproj”的操作。 250>Astrolabe.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Debug\Astrolabe_d.dll 250>已完成生成项目“Astrolabe.vcxproj”的操作。 254> 正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Debug/AdHocScriptBrowser_d.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Debug/AdHocScriptBrowser_d.exp 254>AdHocScriptBrowser.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Debug\AdHocScriptBrowser_d.dll 255> 正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Debug/AcesDisplay_d.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Debug/AcesDisplay_d.exp 255>AcesDisplay.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Debug\AcesDisplay_d.dll 255>已完成生成项目“AcesDisplay.vcxproj”的操作。 252> 正在创建库 D:/AFSIM/trunk/swdev/src/build/lib/Debug/Annotation_d.lib 和对象 D:/AFSIM/trunk/swdev/src/build/lib/Debug/Annotation_d.exp 252>Annotation.vcxproj -> D:\AFSIM\trunk\swdev\src\build\Debug\Annotation_d.dll 252>已完成生成项目“Annotation.vcxproj”的操作。 256>------ 已启动生成: 项目: ALL_BUILD, 配置: Debug x64 ------ 256>Building Custom Rule D:/AFSIM/trunk/swdev/src/CMakeLists.txt 257>------ 已启动生成: 项目: PACKAGE, 配置: Debug x64 ------ 257>1> 257>CPack: Create package using IFW 257>CPack: Install projects 257>CPack: - Install project: afsim [Debug] 257>CPack: - Install component: Archive 257>CPack: - Install component: Demo 257>CPack: - Install component: MSVC_LIBS 257>CPack: - Install component: Resource 257>CPack: - Install component: Runtime 257>CPack: - Install component: Tool 257>CPack: - Install component: Training 257>CPack: - Install component: Unspecified 257>CPack: Create package 257>CPack: - Configuration 257>CPack: - Generate package 257>CPack: - package: D:/AFSIM/trunk/swdev/src/build/AFSIM-2.9.0-win64.exe generated. 257>CPack: - checksum file: D:/AFSIM/trunk/swdev/src/build/AFSIM-2.9.0-win64.exe.sha512 generated. ========== 生成: 257 成功,0 失败,0 最新,0 已跳过 ========== ========== 生成 于 11:53:14 PM 完成,耗时 59:01.325 分钟 ==========

耗时59分钟。在swdev/src/build目录中有生成的exe安装包文件,大小为956MB。

安装包

如果使用nsis/innosetup需要先安装独立的程序,并把程序位置添加到系统环境变量。

安装

测试生成的安装包。双击AFSIM-2.9.0-win64.exe

安装界面

能打开就表示没问题。

错误

QFocusEvent未定义

还包括

1
2
error C2039: "now": 不是 "std::chrono" 的成员
error C3536: “now”: 初始化之前无法使用

这一类的错误是头文件未包含,提示什么未定义就把对应头文件包含上就可以了。

error C3861: “resetiosflags”: 找不到标识符

改为std::resetiosflags

C2766: 显式专用化;已定义“std::hash

Qt5.14.0起引入了QString的hash函数,Qt版本过高会产生此编译错误。添加一个判断,Qt>5.14.0就注释掉。

1
2
3
4
5
6
7
8
9
10
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
namespace std {
template<>
struct hash<QString> {
inline size_t operator()(const QString& s) const {
return std::hash<string>()(s.toStdString());
}
};
}
#endif

AFSIM入门教程03.01:Windows下编译
https://blog.jackeylea.com/afsim/how-to-build-afsim-in-windows/
作者
JackeyLea
发布于
2025年6月27日
许可协议