Repository: li9chuan/BaseService
Branch: master
Commit: ad24dd61a3d7
Files: 1194
Total size: 8.3 MB
Directory structure:
gitextract_0_cdghvg/
├── .github/
│ └── workflows/
│ └── ccpp.yml
├── LICENSE
├── README.md
├── code/
│ ├── CMakeLists.txt
│ ├── CMakeModules/
│ │ ├── AndroidToolChain.cmake
│ │ ├── CheckDepends.cmake
│ │ ├── ConfigureChecks.cmake
│ │ ├── Find3dsMaxSDK.cmake
│ │ ├── FindCEGUI.cmake
│ │ ├── FindCppTest.cmake
│ │ ├── FindCrashRpt.cmake
│ │ ├── FindCurl.cmake
│ │ ├── FindCustomMFC.cmake
│ │ ├── FindDInput.cmake
│ │ ├── FindDSound.cmake
│ │ ├── FindDirectXSDK.cmake
│ │ ├── FindEFXUtil.cmake
│ │ ├── FindExternal.cmake
│ │ ├── FindFMOD.cmake
│ │ ├── FindFreeType.cmake
│ │ ├── FindGTK2.cmake
│ │ ├── FindIconv.cmake
│ │ ├── FindJpeg.cmake
│ │ ├── FindLibEvent.cmake
│ │ ├── FindLibOVR.cmake
│ │ ├── FindLibVR.cmake
│ │ ├── FindLibwww.cmake
│ │ ├── FindLua51.cmake
│ │ ├── FindLua52.cmake
│ │ ├── FindLua53.cmake
│ │ ├── FindLuabind.cmake
│ │ ├── FindMSVC.cmake
│ │ ├── FindMercurial.cmake
│ │ ├── FindMySQL.cmake
│ │ ├── FindMysqlConnector.cmake
│ │ ├── FindOgg.cmake
│ │ ├── FindOpenGLES.cmake
│ │ ├── FindOpenSSL.cmake
│ │ ├── FindPBC.cmake
│ │ ├── FindProtoBuf.cmake
│ │ ├── FindS3TC.cmake
│ │ ├── FindSTLport.cmake
│ │ ├── FindSquish.cmake
│ │ ├── FindTinyXml.cmake
│ │ ├── FindToLua.cmake
│ │ ├── FindVorbis.cmake
│ │ ├── FindWindowsSDK.cmake
│ │ ├── FindXF86VidMode.cmake
│ │ ├── GetRevision.cmake
│ │ ├── PCHSupport.cmake
│ │ ├── iOSToolChain.cmake
│ │ └── nel.cmake
│ ├── CMakePackaging.txt
│ ├── COPYING
│ ├── CTestConfig.cmake
│ ├── EVA/
│ │ ├── CMakeLists.txt
│ │ ├── server/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── _del_log.bat
│ │ │ ├── _robot_start .bat
│ │ │ ├── _robot_stop .bat
│ │ │ ├── _shard_start.bat
│ │ │ ├── _shard_stop.bat
│ │ │ ├── admin_executor_service.cfg
│ │ │ ├── admin_modules/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── admin_modules.cpp
│ │ │ │ ├── admin_modules_itf.cpp
│ │ │ │ ├── admin_modules_itf.h
│ │ │ │ ├── admin_modules_itf.xml
│ │ │ │ ├── aes_client_module.cpp
│ │ │ │ ├── aes_module.cpp
│ │ │ │ └── as_module.cpp
│ │ │ ├── admin_service/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── admin_service.cpp
│ │ │ ├── admin_service.cfg
│ │ │ ├── client_robot/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── client_robot.cpp
│ │ │ ├── client_robot.cfg
│ │ │ ├── common.cfg
│ │ │ ├── frontend_service/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── frontend_service.cpp
│ │ │ │ ├── frontend_service.h
│ │ │ │ ├── stdpch.cpp
│ │ │ │ └── stdpch.h
│ │ │ ├── frontend_service.cfg
│ │ │ ├── msg.xml
│ │ │ ├── naming_service/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── naming_service.cpp
│ │ │ ├── naming_service.cfg
│ │ │ ├── player_logic_service/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── player_logic_service.cpp
│ │ │ │ ├── player_logic_service.h
│ │ │ │ ├── stdpch.cpp
│ │ │ │ └── stdpch.h
│ │ │ ├── player_logic_service.cfg
│ │ │ ├── save_shard/
│ │ │ │ └── rrd_graphs/
│ │ │ │ ├── aes.ProcessUsedMemory.rrd
│ │ │ │ ├── egs.ProcessUsedMemory.rrd
│ │ │ │ ├── fes.ProcessUsedMemory.rrd
│ │ │ │ ├── fes_0.FPSProcessMsg.rrd
│ │ │ │ ├── fes_0.ProcessUsedMemory.rrd
│ │ │ │ ├── hold_dir
│ │ │ │ ├── lgc.ProcessUsedMemory.rrd
│ │ │ │ ├── lgc_0.ProcessUsedMemory.rrd
│ │ │ │ ├── pds.ProcessUsedMemory.rrd
│ │ │ │ ├── ras.ProcessUsedMemory.rrd
│ │ │ │ └── rns.ProcessUsedMemory.rrd
│ │ │ ├── schedule_service/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── schedule_service.cpp
│ │ │ ├── schedule_service.cfg
│ │ │ ├── script/
│ │ │ │ ├── .vs/
│ │ │ │ │ ├── ProjectSettings.json
│ │ │ │ │ ├── VSWorkspaceState.json
│ │ │ │ │ └── script/
│ │ │ │ │ └── v15/
│ │ │ │ │ └── .suo
│ │ │ │ ├── BaseService.luaprj
│ │ │ │ ├── DataTable/
│ │ │ │ │ ├── ProtoMsg.pb
│ │ │ │ │ ├── RoomConfig.json
│ │ │ │ │ ├── RoomCreateCost.json
│ │ │ │ │ ├── SpecialConfig.json
│ │ │ │ │ ├── proto/
│ │ │ │ │ │ ├── define_attrib.proto
│ │ │ │ │ │ ├── define_pro.proto
│ │ │ │ │ │ ├── msg_client.proto
│ │ │ │ │ │ ├── msg_doudizhu.proto
│ │ │ │ │ │ └── msg_service.proto
│ │ │ │ │ └── ssl/
│ │ │ │ │ ├── 1_root_bundle.crt
│ │ │ │ │ ├── 2_ssl.ranatune.com.crt
│ │ │ │ │ └── 3_ssl.ranatune.com.key
│ │ │ │ ├── Framework/
│ │ │ │ │ ├── CJsonUtil.lua
│ │ │ │ │ ├── Class.lua
│ │ │ │ │ ├── Event/
│ │ │ │ │ │ ├── EventController.lua
│ │ │ │ │ │ ├── EventRegister.lua
│ │ │ │ │ │ └── EventTrigger.lua
│ │ │ │ │ ├── Hotfix/
│ │ │ │ │ │ ├── HotfixHelper.lua
│ │ │ │ │ │ ├── hotfix.lua
│ │ │ │ │ │ └── internal/
│ │ │ │ │ │ ├── functions_replacer.lua
│ │ │ │ │ │ └── module_updater.lua
│ │ │ │ │ ├── InitFramework.lua
│ │ │ │ │ ├── List.lua
│ │ │ │ │ ├── Map.lua
│ │ │ │ │ ├── MapMap.lua
│ │ │ │ │ ├── MemoryReferenceInfo.lua
│ │ │ │ │ ├── MiddleClass.lua
│ │ │ │ │ ├── Net/
│ │ │ │ │ │ ├── BaseService.lua
│ │ │ │ │ │ ├── CallbackServer.lua
│ │ │ │ │ │ ├── NetWorkHandler.lua
│ │ │ │ │ │ └── protobuf.lua
│ │ │ │ │ ├── Queue.lua
│ │ │ │ │ ├── SimpleStateMachine.lua
│ │ │ │ │ ├── Stack.lua
│ │ │ │ │ ├── StateFul.lua
│ │ │ │ │ ├── Test/
│ │ │ │ │ │ ├── FSMClass.lua
│ │ │ │ │ │ ├── MainTest.lua
│ │ │ │ │ │ └── TimerTest.lua
│ │ │ │ │ ├── TimerMgr.lua
│ │ │ │ │ ├── Utils.lua
│ │ │ │ │ └── functions.lua
│ │ │ │ ├── Robot.luaprj
│ │ │ │ ├── SharedLib/
│ │ │ │ │ ├── Event/
│ │ │ │ │ │ └── EventType.lua
│ │ │ │ │ ├── InitSharedLib.lua
│ │ │ │ │ └── StaticTableMgr.lua
│ │ │ │ ├── _FES/
│ │ │ │ │ ├── Client/
│ │ │ │ │ │ ├── Client.lua
│ │ │ │ │ │ └── ClientMgr.lua
│ │ │ │ │ ├── FrontEndService.lua
│ │ │ │ │ ├── Msg/
│ │ │ │ │ │ └── MsgLogin.lua
│ │ │ │ │ ├── Player/
│ │ │ │ │ │ ├── PlayerInfo.lua
│ │ │ │ │ │ └── PlayerInfoMgr.lua
│ │ │ │ │ └── _FESMain.lua
│ │ │ │ ├── _FES.luaprj
│ │ │ │ ├── _PLS/
│ │ │ │ │ ├── DB/
│ │ │ │ │ │ ├── DBMgr.lua
│ │ │ │ │ │ ├── DBProc.lua
│ │ │ │ │ │ ├── DBSubProc.lua
│ │ │ │ │ │ └── DBSubStart.lua
│ │ │ │ │ ├── Games/
│ │ │ │ │ │ ├── Common/
│ │ │ │ │ │ │ ├── CardsAnalyseRes.lua
│ │ │ │ │ │ │ ├── CommonDef.lua
│ │ │ │ │ │ │ └── PokerDef.lua
│ │ │ │ │ │ └── PokerDdz/
│ │ │ │ │ │ ├── DDZOutCardData.lua
│ │ │ │ │ │ ├── DdzCardTypes.lua
│ │ │ │ │ │ ├── DdzFSM.lua
│ │ │ │ │ │ ├── DdzPlayerInfo.lua
│ │ │ │ │ │ ├── MsgRoomDdz.lua
│ │ │ │ │ │ └── RoomDdz.lua
│ │ │ │ │ ├── Msg/
│ │ │ │ │ │ ├── MsgLogin.lua
│ │ │ │ │ │ └── MsgRoom.lua
│ │ │ │ │ ├── Player/
│ │ │ │ │ │ ├── PlayerDataHelper.lua
│ │ │ │ │ │ ├── PlayerHelper.lua
│ │ │ │ │ │ └── PlayerMgr.lua
│ │ │ │ │ ├── PlayerLogicService.lua
│ │ │ │ │ ├── Room/
│ │ │ │ │ │ ├── RoomBase.lua
│ │ │ │ │ │ ├── RoomFactory.lua
│ │ │ │ │ │ ├── RoomMgr.lua
│ │ │ │ │ │ └── RoomPlayerBase.lua
│ │ │ │ │ ├── _PLSConfig.lua
│ │ │ │ │ ├── _PLSMain.lua
│ │ │ │ │ └── hotfix_module_names.lua
│ │ │ │ ├── _PLS.luaprj
│ │ │ │ ├── _SCH/
│ │ │ │ │ ├── Msg/
│ │ │ │ │ │ ├── MsgLogin.lua
│ │ │ │ │ │ └── MsgRoom.lua
│ │ │ │ │ ├── PLSInfo/
│ │ │ │ │ │ ├── PLSGameInfo.lua
│ │ │ │ │ │ ├── PLSInfo.lua
│ │ │ │ │ │ └── PLSInfoMgr.lua
│ │ │ │ │ ├── Player/
│ │ │ │ │ │ ├── PlayerInfo.lua
│ │ │ │ │ │ └── PlayerInfoMgr.lua
│ │ │ │ │ ├── Room/
│ │ │ │ │ │ ├── RoomIDAlloter.lua
│ │ │ │ │ │ ├── RoomInfo.lua
│ │ │ │ │ │ └── RoomMgr.lua
│ │ │ │ │ ├── ScheduleService.lua
│ │ │ │ │ └── _SCHMain.lua
│ │ │ │ ├── _SCH.luaprj
│ │ │ │ └── __Robot/
│ │ │ │ ├── RobotSub/
│ │ │ │ │ ├── FSMRobot.lua
│ │ │ │ │ ├── GameDdz/
│ │ │ │ │ │ ├── FSMDdz.lua
│ │ │ │ │ │ └── RobotGameDdz.lua
│ │ │ │ │ ├── PublicRoomInfo.lua
│ │ │ │ │ ├── PublicRoomInfoMgr.lua
│ │ │ │ │ ├── Robot.lua
│ │ │ │ │ ├── RobotData.lua
│ │ │ │ │ ├── RobotGameBase.lua
│ │ │ │ │ ├── RobotMgr.lua
│ │ │ │ │ └── RobotSubStart.lua
│ │ │ │ ├── Test/
│ │ │ │ │ ├── CppTimerBase.lua
│ │ │ │ │ └── CppTimerTest.lua
│ │ │ │ ├── ThreadMgr.lua
│ │ │ │ └── _ClientRobotMain.lua
│ │ │ ├── server_share/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── base_object.h
│ │ │ │ ├── bin_luabind/
│ │ │ │ │ ├── Public.h
│ │ │ │ │ ├── Public.hpp
│ │ │ │ │ ├── ScriptBase.cpp
│ │ │ │ │ ├── ScriptBase.h
│ │ │ │ │ ├── ScriptExporter.cpp
│ │ │ │ │ ├── ScriptExporter.h
│ │ │ │ │ ├── ScriptHandle.cpp
│ │ │ │ │ ├── ScriptHandle.h
│ │ │ │ │ ├── ScriptObject.h
│ │ │ │ │ ├── ScriptProxy.cpp
│ │ │ │ │ └── ScriptProxy.h
│ │ │ │ ├── bit_set_ext2.h
│ │ │ │ ├── buf_fifo2.h
│ │ │ │ ├── buf_fifo_ring.h
│ │ │ │ ├── callback_adaptor.h
│ │ │ │ ├── cjson/
│ │ │ │ │ ├── dtoa.cpp
│ │ │ │ │ ├── dtoa_config.h
│ │ │ │ │ ├── fpconv.cpp
│ │ │ │ │ ├── fpconv.h
│ │ │ │ │ ├── g_fmt.cpp
│ │ │ │ │ ├── lua_cjson.cpp
│ │ │ │ │ ├── strbuf.cpp
│ │ │ │ │ └── strbuf.h
│ │ │ │ ├── client_msg_desc.cpp
│ │ │ │ ├── client_msg_desc.h
│ │ │ │ ├── game_def.h
│ │ │ │ ├── i18n_def.cpp
│ │ │ │ ├── i18n_def.h
│ │ │ │ ├── id_generate.cpp
│ │ │ │ ├── id_generate.h
│ │ │ │ ├── lua/
│ │ │ │ │ ├── lua_base_function.cpp
│ │ │ │ │ ├── lua_engine.cpp
│ │ │ │ │ ├── lua_engine.h
│ │ │ │ │ ├── lua_param.cpp
│ │ │ │ │ ├── lua_param.h
│ │ │ │ │ ├── lua_thread.cpp
│ │ │ │ │ ├── lua_thread.h
│ │ │ │ │ ├── script_mgr.cpp
│ │ │ │ │ └── script_mgr.h
│ │ │ │ ├── lua_mysql/
│ │ │ │ │ ├── mysql_conn.cpp
│ │ │ │ │ ├── mysql_conn.h
│ │ │ │ │ ├── mysql_result.cpp
│ │ │ │ │ ├── mysql_result.h
│ │ │ │ │ ├── mysql_stmt.cpp
│ │ │ │ │ ├── mysql_stmt.h
│ │ │ │ │ ├── mysql_string.cpp
│ │ │ │ │ └── mysql_string.h
│ │ │ │ ├── lua_net/
│ │ │ │ │ ├── lua_callback_client.cpp
│ │ │ │ │ ├── lua_callback_client.h
│ │ │ │ │ ├── lua_callback_server.cpp
│ │ │ │ │ ├── lua_callback_server.h
│ │ │ │ │ ├── lua_message.cpp
│ │ │ │ │ ├── lua_message.h
│ │ │ │ │ ├── lua_network.cpp
│ │ │ │ │ └── lua_network.h
│ │ │ │ ├── msg_leaf.cpp
│ │ │ │ ├── msg_leaf.h
│ │ │ │ ├── object_pool.h
│ │ │ │ ├── pbc/
│ │ │ │ │ ├── alloc.cpp
│ │ │ │ │ ├── alloc.h
│ │ │ │ │ ├── array.cpp
│ │ │ │ │ ├── array.h
│ │ │ │ │ ├── bootstrap.cpp
│ │ │ │ │ ├── bootstrap.h
│ │ │ │ │ ├── context.cpp
│ │ │ │ │ ├── context.h
│ │ │ │ │ ├── decode.cpp
│ │ │ │ │ ├── descriptor.pbc.h
│ │ │ │ │ ├── map.cpp
│ │ │ │ │ ├── map.h
│ │ │ │ │ ├── pattern.cpp
│ │ │ │ │ ├── pattern.h
│ │ │ │ │ ├── pbc-lua53.cpp
│ │ │ │ │ ├── pbc.h
│ │ │ │ │ ├── proto.cpp
│ │ │ │ │ ├── proto.h
│ │ │ │ │ ├── register.cpp
│ │ │ │ │ ├── rmessage.cpp
│ │ │ │ │ ├── stringpool.cpp
│ │ │ │ │ ├── stringpool.h
│ │ │ │ │ ├── varint.cpp
│ │ │ │ │ ├── varint.h
│ │ │ │ │ └── wmessage.cpp
│ │ │ │ ├── ranking_change_near.h
│ │ │ │ ├── ranking_slot.h
│ │ │ │ ├── server_def.cpp
│ │ │ │ ├── server_def.h
│ │ │ │ ├── sigslot.h
│ │ │ │ ├── singleton_registry.h
│ │ │ │ ├── stdpch.cpp
│ │ │ │ ├── stdpch.h
│ │ │ │ ├── timer.cpp
│ │ │ │ ├── timer.h
│ │ │ │ ├── tools.cpp
│ │ │ │ ├── tools.h
│ │ │ │ ├── utils.cpp
│ │ │ │ └── utils.h
│ │ │ └── shard.screen.rc
│ │ └── tools/
│ │ └── scripts/
│ │ └── linux/
│ │ ├── clean_log.sh
│ │ ├── generate_packed_sheets.sh
│ │ ├── loop_aes.sh
│ │ ├── mt_domain_screen_wrapper.sh
│ │ ├── service_launcher.sh
│ │ ├── shard
│ │ └── utilities
│ ├── README
│ ├── changelog.template
│ ├── config.h.cmake
│ ├── nel/
│ │ ├── AUTHORS
│ │ ├── CMakeLists.txt
│ │ ├── COPYING
│ │ ├── ChangeLog
│ │ ├── INSTALL
│ │ ├── NEWS
│ │ ├── README
│ │ ├── include/
│ │ │ ├── CMakeLists.txt
│ │ │ └── nel/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── georges/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── form.h
│ │ │ │ ├── form_dfn.h
│ │ │ │ ├── form_elm.h
│ │ │ │ ├── form_loader.h
│ │ │ │ ├── header.h
│ │ │ │ ├── load_form.h
│ │ │ │ ├── type.h
│ │ │ │ ├── u_form.h
│ │ │ │ ├── u_form_dfn.h
│ │ │ │ ├── u_form_elm.h
│ │ │ │ ├── u_form_loader.h
│ │ │ │ └── u_type.h
│ │ │ ├── ligo/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── ligo_config.h
│ │ │ │ ├── primitive.h
│ │ │ │ ├── primitive_class.h
│ │ │ │ ├── primitive_configuration.h
│ │ │ │ ├── primitive_utils.h
│ │ │ │ ├── zone_bank.h
│ │ │ │ └── zone_region.h
│ │ │ ├── logic/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── logic_condition.h
│ │ │ │ ├── logic_event.h
│ │ │ │ ├── logic_state.h
│ │ │ │ ├── logic_state_machine.h
│ │ │ │ └── logic_variable.h
│ │ │ ├── misc/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── aabbox.h
│ │ │ │ ├── algo.h
│ │ │ │ ├── app_context.h
│ │ │ │ ├── array_2d.h
│ │ │ │ ├── async_file_manager.h
│ │ │ │ ├── base64.h
│ │ │ │ ├── big_file.h
│ │ │ │ ├── bit_mem_stream.h
│ │ │ │ ├── bit_set.h
│ │ │ │ ├── bitmap.h
│ │ │ │ ├── block_memory.h
│ │ │ │ ├── bsphere.h
│ │ │ │ ├── buf_fifo.h
│ │ │ │ ├── callback.h
│ │ │ │ ├── cdb.h
│ │ │ │ ├── cdb_bank_handler.h
│ │ │ │ ├── cdb_branch.h
│ │ │ │ ├── cdb_branch_observing_handler.h
│ │ │ │ ├── cdb_check_sum.h
│ │ │ │ ├── cdb_leaf.h
│ │ │ │ ├── cdb_manager.h
│ │ │ │ ├── check_fpu.h
│ │ │ │ ├── class_id.h
│ │ │ │ ├── class_registry.h
│ │ │ │ ├── cmd_args.h
│ │ │ │ ├── co_task.h
│ │ │ │ ├── command.h
│ │ │ │ ├── common.h
│ │ │ │ ├── config_file.h
│ │ │ │ ├── contiguous_block_allocator.h
│ │ │ │ ├── cpu_time_stat.h
│ │ │ │ ├── debug.h
│ │ │ │ ├── di_event_emitter.h
│ │ │ │ ├── diff_tool.h
│ │ │ │ ├── displayer.h
│ │ │ │ ├── dummy_window.h
│ │ │ │ ├── dynloadlib.h
│ │ │ │ ├── eid_translator.h
│ │ │ │ ├── entity_id.h
│ │ │ │ ├── enum_bitset.h
│ │ │ │ ├── eval_num_expr.h
│ │ │ │ ├── event_emitter.h
│ │ │ │ ├── event_emitter_multi.h
│ │ │ │ ├── event_listener.h
│ │ │ │ ├── event_server.h
│ │ │ │ ├── events.h
│ │ │ │ ├── factory.h
│ │ │ │ ├── fast_floor.h
│ │ │ │ ├── fast_id_map.h
│ │ │ │ ├── fast_mem.h
│ │ │ │ ├── file.h
│ │ │ │ ├── fixed_size_allocator.h
│ │ │ │ ├── game_device.h
│ │ │ │ ├── game_device_events.h
│ │ │ │ ├── geom_ext.h
│ │ │ │ ├── grid_traversal.h
│ │ │ │ ├── gtk_displayer.h
│ │ │ │ ├── heap_memory.h
│ │ │ │ ├── hierarchical_timer.h
│ │ │ │ ├── historic.h
│ │ │ │ ├── i18n.h
│ │ │ │ ├── i_xml.h
│ │ │ │ ├── input_device.h
│ │ │ │ ├── input_device_manager.h
│ │ │ │ ├── input_device_server.h
│ │ │ │ ├── inter_window_msg_queue.h
│ │ │ │ ├── keyboard_device.h
│ │ │ │ ├── line.h
│ │ │ │ ├── log.h
│ │ │ │ ├── matrix.h
│ │ │ │ ├── md5.h
│ │ │ │ ├── mem_displayer.h
│ │ │ │ ├── mem_stream.h
│ │ │ │ ├── mouse_device.h
│ │ │ │ ├── mouse_smoother.h
│ │ │ │ ├── mutable_container.h
│ │ │ │ ├── mutex.h
│ │ │ │ ├── noise_value.h
│ │ │ │ ├── o_xml.h
│ │ │ │ ├── object_arena_allocator.h
│ │ │ │ ├── object_vector.h
│ │ │ │ ├── p_thread.h
│ │ │ │ ├── path.h
│ │ │ │ ├── plane.h
│ │ │ │ ├── plane_inline.h
│ │ │ │ ├── polygon.h
│ │ │ │ ├── pool_memory.h
│ │ │ │ ├── progress_callback.h
│ │ │ │ ├── quad.h
│ │ │ │ ├── quat.h
│ │ │ │ ├── random.h
│ │ │ │ ├── reader_writer.h
│ │ │ │ ├── rect.h
│ │ │ │ ├── report.h
│ │ │ │ ├── resource_ptr.h
│ │ │ │ ├── resource_ptr_inline.h
│ │ │ │ ├── rgba.h
│ │ │ │ ├── sha1.h
│ │ │ │ ├── shared_memory.h
│ │ │ │ ├── sheet_id.h
│ │ │ │ ├── singleton.h
│ │ │ │ ├── smart_ptr.h
│ │ │ │ ├── smart_ptr_inline.h
│ │ │ │ ├── speaker_listener.h
│ │ │ │ ├── sstring.h
│ │ │ │ ├── static_map.h
│ │ │ │ ├── stl_block_allocator.h
│ │ │ │ ├── stl_block_list.h
│ │ │ │ ├── stop_watch.h
│ │ │ │ ├── stream.h
│ │ │ │ ├── stream_inline.h
│ │ │ │ ├── string_common.h
│ │ │ │ ├── string_conversion.h
│ │ │ │ ├── string_id_array.h
│ │ │ │ ├── string_mapper.h
│ │ │ │ ├── string_stream.h
│ │ │ │ ├── system_info.h
│ │ │ │ ├── system_utils.h
│ │ │ │ ├── task_manager.h
│ │ │ │ ├── tds.h
│ │ │ │ ├── thread.h
│ │ │ │ ├── time_nl.h
│ │ │ │ ├── timeout_assertion_thread.h
│ │ │ │ ├── traits_nl.h
│ │ │ │ ├── triangle.h
│ │ │ │ ├── twin_map.h
│ │ │ │ ├── types_nl.h
│ │ │ │ ├── ucstring.h
│ │ │ │ ├── uv.h
│ │ │ │ ├── value_smoother.h
│ │ │ │ ├── variable.h
│ │ │ │ ├── vector.h
│ │ │ │ ├── vector_2d.h
│ │ │ │ ├── vector_2f.h
│ │ │ │ ├── vector_h.h
│ │ │ │ ├── vector_inline.h
│ │ │ │ ├── vectord.h
│ │ │ │ ├── vectord_inline.h
│ │ │ │ ├── voter.h
│ │ │ │ ├── win32_util.h
│ │ │ │ ├── win_displayer.h
│ │ │ │ ├── win_event_emitter.h
│ │ │ │ ├── win_thread.h
│ │ │ │ ├── win_tray.h
│ │ │ │ ├── window_displayer.h
│ │ │ │ ├── words_dictionary.h
│ │ │ │ ├── xml_auto_ptr.h
│ │ │ │ └── xml_pack.h
│ │ │ └── net/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── admin.h
│ │ │ ├── buf_client.h
│ │ │ ├── buf_net_base.h
│ │ │ ├── buf_server.h
│ │ │ ├── buf_server_tcp.h
│ │ │ ├── buf_server_tcp_func.h
│ │ │ ├── buf_server_websocket.h
│ │ │ ├── buf_server_websocket_func.h
│ │ │ ├── buf_sock.h
│ │ │ ├── callback_client.h
│ │ │ ├── callback_net_base.h
│ │ │ ├── callback_server.h
│ │ │ ├── callback_server_tcp.h
│ │ │ ├── callback_server_websocket.h
│ │ │ ├── cvar_log_filter.h
│ │ │ ├── dummy_tcp_sock.h
│ │ │ ├── email.h
│ │ │ ├── inet_address.h
│ │ │ ├── listen_sock.h
│ │ │ ├── login_client.h
│ │ │ ├── login_cookie.h
│ │ │ ├── login_server.h
│ │ │ ├── message.h
│ │ │ ├── message_recorder.h
│ │ │ ├── module.h
│ │ │ ├── module_builder_parts.h
│ │ │ ├── module_common.h
│ │ │ ├── module_gateway.h
│ │ │ ├── module_manager.h
│ │ │ ├── module_message.h
│ │ │ ├── module_socket.h
│ │ │ ├── naming_client.h
│ │ │ ├── net_displayer.h
│ │ │ ├── net_log.h
│ │ │ ├── net_manager.h
│ │ │ ├── pacs_client.h
│ │ │ ├── service.h
│ │ │ ├── sock.h
│ │ │ ├── tcp_sock.h
│ │ │ ├── transport_class.h
│ │ │ ├── udp_sim_sock.h
│ │ │ ├── udp_sock.h
│ │ │ ├── unified_network.h
│ │ │ ├── unitime.h
│ │ │ └── varpath.h
│ │ ├── nel-config.in
│ │ ├── samples/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── georges/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── boolean.typ
│ │ │ │ ├── coolfilesinfo.dfn
│ │ │ │ ├── default.sample_config
│ │ │ │ ├── int.typ
│ │ │ │ ├── log.log
│ │ │ │ ├── main.cpp
│ │ │ │ ├── positiondata.dfn
│ │ │ │ ├── sample_config.dfn
│ │ │ │ ├── sample_configs_sheets.packed_sheets
│ │ │ │ └── string.typ
│ │ │ ├── misc/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── command/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── main.cpp
│ │ │ │ ├── configfile/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── main.cpp
│ │ │ │ │ └── simpletest.txt
│ │ │ │ ├── debug/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── main.cpp
│ │ │ │ ├── i18n/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── de.uxt
│ │ │ │ │ ├── en.uxt
│ │ │ │ │ ├── fr.uxt
│ │ │ │ │ └── main.cpp
│ │ │ │ ├── log/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── main.cpp
│ │ │ │ ├── strings/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── main.cpp
│ │ │ │ └── types_check/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── main.cpp
│ │ │ └── net/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── chat/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── chat_service.cfg
│ │ │ │ ├── client.cfg
│ │ │ │ ├── client.cpp
│ │ │ │ ├── kbhit.cpp
│ │ │ │ ├── kbhit.h
│ │ │ │ └── server.cpp
│ │ │ ├── class_transport/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── ai_service.cfg
│ │ │ │ ├── ai_service.cpp
│ │ │ │ ├── gd_service.cfg
│ │ │ │ └── gd_service.cpp
│ │ │ ├── login_system/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── client.cfg
│ │ │ │ ├── client.cpp
│ │ │ │ ├── frontend_service.cfg
│ │ │ │ └── frontend_service.cpp
│ │ │ ├── multi_shards/
│ │ │ │ ├── client.cpp
│ │ │ │ ├── frontend_service.cpp
│ │ │ │ └── shard_config/
│ │ │ │ ├── 01_admin_executor_service.lnk
│ │ │ │ ├── 02_login_service.lnk
│ │ │ │ ├── 03_naming_service_shard1.lnk
│ │ │ │ ├── 04_welcome_service_shard1.lnk
│ │ │ │ ├── 05_frontend_service_shard1.lnk
│ │ │ │ ├── 06_naming_service_shard2.lnk
│ │ │ │ ├── 07_welcome_service_shard2.lnk
│ │ │ │ ├── 08_frontend_service_shard2.lnk
│ │ │ │ ├── 09_naming_service_shard3.lnk
│ │ │ │ ├── 10_frontend_service_shard3.lnk
│ │ │ │ ├── 11_welcome_service_shard3.lnk
│ │ │ │ ├── 12_client.lnk
│ │ │ │ ├── admin_executor_service.cfg
│ │ │ │ ├── client.cfg
│ │ │ │ ├── login_service.cfg
│ │ │ │ ├── login_service_database.cfg
│ │ │ │ ├── shard1_config/
│ │ │ │ │ ├── frontend_service.cfg
│ │ │ │ │ ├── naming_service.cfg
│ │ │ │ │ └── welcome_service.cfg
│ │ │ │ ├── shard2_config/
│ │ │ │ │ ├── frontend_service.cfg
│ │ │ │ │ ├── naming_service.cfg
│ │ │ │ │ └── welcome_service.cfg
│ │ │ │ └── shard3_config/
│ │ │ │ ├── frontend_service.cfg
│ │ │ │ ├── naming_service.cfg
│ │ │ │ └── welcome_service.cfg
│ │ │ ├── net_layer3/
│ │ │ │ ├── client.cpp
│ │ │ │ ├── frontend_service.cfg
│ │ │ │ ├── frontend_service.cpp
│ │ │ │ ├── ping_service.cfg
│ │ │ │ └── ping_service.cpp
│ │ │ ├── net_layer4/
│ │ │ │ ├── client.cpp
│ │ │ │ ├── frontend_service.cfg
│ │ │ │ ├── frontend_service.cpp
│ │ │ │ ├── ping_service.cfg
│ │ │ │ └── ping_service.cpp
│ │ │ ├── net_layer5/
│ │ │ │ ├── flood_service.cfg
│ │ │ │ ├── flood_service.cpp
│ │ │ │ ├── frontend_service.cfg
│ │ │ │ ├── frontend_service.cpp
│ │ │ │ ├── gpm_service.cfg
│ │ │ │ ├── gpm_service.cpp
│ │ │ │ ├── ping_service.cfg
│ │ │ │ ├── ping_service.cpp
│ │ │ │ ├── player_service.cfg
│ │ │ │ └── player_service.cpp
│ │ │ ├── service/
│ │ │ │ ├── chat_service.cfg
│ │ │ │ └── chat_service.cpp
│ │ │ ├── udp/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── bench_service.cfg
│ │ │ │ ├── bench_service.cpp
│ │ │ │ ├── client.cfg
│ │ │ │ ├── client.cpp
│ │ │ │ ├── graph.cpp
│ │ │ │ ├── graph.h
│ │ │ │ ├── n019003l.pfb
│ │ │ │ ├── readme.txt
│ │ │ │ ├── receive_task.cpp
│ │ │ │ ├── receive_task.h
│ │ │ │ ├── simlag.cpp
│ │ │ │ └── simlag.h
│ │ │ └── udp_ping/
│ │ │ ├── client.cpp
│ │ │ ├── udp_service.cfg
│ │ │ └── udp_service.cpp
│ │ ├── src/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── georges/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── form.cpp
│ │ │ │ ├── form_dfn.cpp
│ │ │ │ ├── form_elm.cpp
│ │ │ │ ├── form_loader.cpp
│ │ │ │ ├── georges_file_format.txt
│ │ │ │ ├── header.cpp
│ │ │ │ ├── load_form.cpp
│ │ │ │ ├── nel-georges.pc.in
│ │ │ │ ├── stdgeorges.cpp
│ │ │ │ ├── stdgeorges.h
│ │ │ │ └── type.cpp
│ │ │ ├── ligo/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── ligo_config.cpp
│ │ │ │ ├── ligo_error.cpp
│ │ │ │ ├── ligo_error.h
│ │ │ │ ├── ligo_material.cpp
│ │ │ │ ├── ligo_material.h
│ │ │ │ ├── nel-ligo.pc.in
│ │ │ │ ├── primitive.cpp
│ │ │ │ ├── primitive_class.cpp
│ │ │ │ ├── primitive_configuration.cpp
│ │ │ │ ├── primitive_utils.cpp
│ │ │ │ ├── stdligo.cpp
│ │ │ │ ├── stdligo.h
│ │ │ │ ├── transition.cpp
│ │ │ │ ├── transition.h
│ │ │ │ ├── zone_bank.cpp
│ │ │ │ ├── zone_edge.cpp
│ │ │ │ ├── zone_edge.h
│ │ │ │ ├── zone_region.cpp
│ │ │ │ ├── zone_template.cpp
│ │ │ │ └── zone_template.h
│ │ │ ├── logic/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── logic_condition.cpp
│ │ │ │ ├── logic_event.cpp
│ │ │ │ ├── logic_state.cpp
│ │ │ │ ├── logic_state_machine.cpp
│ │ │ │ └── logic_variable.cpp
│ │ │ ├── misc/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── aabbox.cpp
│ │ │ │ ├── algo.cpp
│ │ │ │ ├── app_context.cpp
│ │ │ │ ├── async_file_manager.cpp
│ │ │ │ ├── base64.cpp
│ │ │ │ ├── big_file.cpp
│ │ │ │ ├── bit_mem_stream.cpp
│ │ │ │ ├── bit_set.cpp
│ │ │ │ ├── bitmap.cpp
│ │ │ │ ├── bitmap_jpeg.cpp
│ │ │ │ ├── bitmap_png.cpp
│ │ │ │ ├── block_memory.cpp
│ │ │ │ ├── bsphere.cpp
│ │ │ │ ├── buf_fifo.cpp
│ │ │ │ ├── cdb.cpp
│ │ │ │ ├── cdb_bank_handler.cpp
│ │ │ │ ├── cdb_branch.cpp
│ │ │ │ ├── cdb_branch_observing_handler.cpp
│ │ │ │ ├── cdb_check_sum.cpp
│ │ │ │ ├── cdb_leaf.cpp
│ │ │ │ ├── cdb_manager.cpp
│ │ │ │ ├── check_fpu.cpp
│ │ │ │ ├── class_id.cpp
│ │ │ │ ├── class_registry.cpp
│ │ │ │ ├── cmd_args.cpp
│ │ │ │ ├── co_task.cpp
│ │ │ │ ├── command.cpp
│ │ │ │ ├── common.cpp
│ │ │ │ ├── config_file/
│ │ │ │ │ ├── cf_bison.simple
│ │ │ │ │ ├── cf_flex.skl
│ │ │ │ │ ├── cf_gramatical.cpp
│ │ │ │ │ ├── cf_gramatical.h
│ │ │ │ │ ├── cf_gramatical.ypp
│ │ │ │ │ ├── cf_lexical.cpp
│ │ │ │ │ ├── cf_lexical.lpp
│ │ │ │ │ ├── config_file.cpp
│ │ │ │ │ └── do.bat
│ │ │ │ ├── contiguous_block_allocator.cpp
│ │ │ │ ├── cpu_time_stat.cpp
│ │ │ │ ├── debug.cpp
│ │ │ │ ├── diff_tool.cpp
│ │ │ │ ├── displayer.cpp
│ │ │ │ ├── dummy_window.cpp
│ │ │ │ ├── dynloadlib.cpp
│ │ │ │ ├── eid_translator.cpp
│ │ │ │ ├── entity_id.cpp
│ │ │ │ ├── eval_num_expr.cpp
│ │ │ │ ├── event_emitter.cpp
│ │ │ │ ├── event_emitter_multi.cpp
│ │ │ │ ├── event_listener.cpp
│ │ │ │ ├── event_server.cpp
│ │ │ │ ├── events.cpp
│ │ │ │ ├── fast_floor.cpp
│ │ │ │ ├── fast_id_map.cpp
│ │ │ │ ├── fast_mem.cpp
│ │ │ │ ├── file.cpp
│ │ │ │ ├── fixed_size_allocator.cpp
│ │ │ │ ├── game_device.cpp
│ │ │ │ ├── game_device_events.cpp
│ │ │ │ ├── geom_ext.cpp
│ │ │ │ ├── grid_traversal.cpp
│ │ │ │ ├── gtk_displayer.cpp
│ │ │ │ ├── heap_memory.cpp
│ │ │ │ ├── hierarchical_timer.cpp
│ │ │ │ ├── i18n.cpp
│ │ │ │ ├── i_xml.cpp
│ │ │ │ ├── input_device.cpp
│ │ │ │ ├── input_device_server.cpp
│ │ │ │ ├── inter_window_msg_queue.cpp
│ │ │ │ ├── keyboard_device.cpp
│ │ │ │ ├── line.cpp
│ │ │ │ ├── log.cpp
│ │ │ │ ├── matrix.cpp
│ │ │ │ ├── md5.cpp
│ │ │ │ ├── mem_displayer.cpp
│ │ │ │ ├── mem_stream.cpp
│ │ │ │ ├── mouse_smoother.cpp
│ │ │ │ ├── mutex.cpp
│ │ │ │ ├── nel-misc.pc
│ │ │ │ ├── nel-misc.pc.in
│ │ │ │ ├── noise_value.cpp
│ │ │ │ ├── o_xml.cpp
│ │ │ │ ├── object_arena_allocator.cpp
│ │ │ │ ├── object_vector.cpp
│ │ │ │ ├── p_thread.cpp
│ │ │ │ ├── path.cpp
│ │ │ │ ├── plane.cpp
│ │ │ │ ├── polygon.cpp
│ │ │ │ ├── progress_callback.cpp
│ │ │ │ ├── quad.cpp
│ │ │ │ ├── quat.cpp
│ │ │ │ ├── reader_writer.cpp
│ │ │ │ ├── rect.cpp
│ │ │ │ ├── report.cpp
│ │ │ │ ├── rgba.cpp
│ │ │ │ ├── sha1.cpp
│ │ │ │ ├── shared_memory.cpp
│ │ │ │ ├── sheet_id.cpp
│ │ │ │ ├── smart_ptr.cpp
│ │ │ │ ├── sstring.cpp
│ │ │ │ ├── stdmisc.cpp
│ │ │ │ ├── stdmisc.h
│ │ │ │ ├── stl_block_allocator.cpp
│ │ │ │ ├── stl_block_list.cpp
│ │ │ │ ├── stop_watch.cpp
│ │ │ │ ├── stream.cpp
│ │ │ │ ├── string_common.cpp
│ │ │ │ ├── string_id_array.cpp
│ │ │ │ ├── string_mapper.cpp
│ │ │ │ ├── system_info.cpp
│ │ │ │ ├── system_utils.cpp
│ │ │ │ ├── task_manager.cpp
│ │ │ │ ├── tds.cpp
│ │ │ │ ├── time_nl.cpp
│ │ │ │ ├── triangle.cpp
│ │ │ │ ├── unicode.cpp
│ │ │ │ ├── uv.cpp
│ │ │ │ ├── value_smoother.cpp
│ │ │ │ ├── variable.cpp
│ │ │ │ ├── vector.cpp
│ │ │ │ ├── vector_2d.cpp
│ │ │ │ ├── vector_2f.cpp
│ │ │ │ ├── vector_h.cpp
│ │ │ │ ├── vectord.cpp
│ │ │ │ ├── win32_util.cpp
│ │ │ │ ├── win_displayer.cpp
│ │ │ │ ├── win_event_emitter.cpp
│ │ │ │ ├── win_thread.cpp
│ │ │ │ ├── win_tray.cpp
│ │ │ │ ├── window_displayer.cpp
│ │ │ │ ├── words_dictionary.cpp
│ │ │ │ └── xml_pack.cpp
│ │ │ └── net/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── admin.cpp
│ │ │ ├── buf_client.cpp
│ │ │ ├── buf_net_base.cpp
│ │ │ ├── buf_server.cpp
│ │ │ ├── buf_server_tcp.cpp
│ │ │ ├── buf_server_tcp_func.cpp
│ │ │ ├── buf_server_websocket.cpp
│ │ │ ├── buf_server_websocket_func.cpp
│ │ │ ├── buf_sock.cpp
│ │ │ ├── callback_client.cpp
│ │ │ ├── callback_net_base.cpp
│ │ │ ├── callback_server.cpp
│ │ │ ├── callback_server_tcp.cpp
│ │ │ ├── callback_server_websocket.cpp
│ │ │ ├── define_sys.pb.cc
│ │ │ ├── dummy_tcp_sock.cpp
│ │ │ ├── email.cpp
│ │ │ ├── inet_address.cpp
│ │ │ ├── listen_sock.cpp
│ │ │ ├── login_client.cpp
│ │ │ ├── login_cookie.cpp
│ │ │ ├── login_server.cpp
│ │ │ ├── message.cpp
│ │ │ ├── message_recorder.cpp
│ │ │ ├── module.cpp
│ │ │ ├── module_common.cpp
│ │ │ ├── module_gateway.cpp
│ │ │ ├── module_gateway_transport.cpp
│ │ │ ├── module_l5_transport.cpp
│ │ │ ├── module_local_gateway.cpp
│ │ │ ├── module_manager.cpp
│ │ │ ├── module_message.cpp
│ │ │ ├── module_socket.cpp
│ │ │ ├── naming_client.cpp
│ │ │ ├── nel-net.pc.in
│ │ │ ├── net_displayer.cpp
│ │ │ ├── net_log.cpp
│ │ │ ├── net_manager.cpp
│ │ │ ├── service.cpp
│ │ │ ├── sock.cpp
│ │ │ ├── stdin_monitor_thread.cpp
│ │ │ ├── stdin_monitor_thread.h
│ │ │ ├── stdnet.cpp
│ │ │ ├── stdnet.h
│ │ │ ├── tcp_sock.cpp
│ │ │ ├── transport_class.cpp
│ │ │ ├── udp_sim_sock.cpp
│ │ │ ├── udp_sock.cpp
│ │ │ ├── unified_network.cpp
│ │ │ ├── unitime.cpp
│ │ │ └── varpath.cpp
│ │ └── tools/
│ │ ├── CMakeLists.txt
│ │ └── nel_unit_test/
│ │ ├── CMakeLists.txt
│ │ ├── __copy_file_dst.foo
│ │ ├── __ligo_class.xml
│ │ ├── __test_prim.primitive
│ │ ├── debug_cfg_with_error_main.cfg
│ │ ├── nel_unit_test.cpp
│ │ ├── nel_unit_test.exp
│ │ ├── result.html
│ │ ├── run_test.bat
│ │ ├── ut_ligo.h
│ │ ├── ut_ligo_primitive.h
│ │ ├── ut_misc.h
│ │ ├── ut_misc_co_task.h
│ │ ├── ut_misc_command.h
│ │ ├── ut_misc_config_file.h
│ │ ├── ut_misc_debug.h
│ │ ├── ut_misc_dynlibload.h
│ │ ├── ut_misc_file.h
│ │ ├── ut_misc_files/
│ │ │ ├── cfg_with_bad_test.cfg
│ │ │ ├── cfg_with_define.cfg
│ │ │ ├── cfg_with_error.cfg
│ │ │ ├── cfg_with_error_main.cfg
│ │ │ ├── cfg_with_include.cfg
│ │ │ ├── cfg_with_include_and_optional.cfg
│ │ │ ├── cfg_with_optional.cfg
│ │ │ ├── file1_in_bnp.txt
│ │ │ ├── file2_in_bnp.txt
│ │ │ ├── files.bnp
│ │ │ ├── files.xml_pack
│ │ │ ├── files_for_xml_subpack/
│ │ │ │ ├── same_subfolder_1/
│ │ │ │ │ └── samename/
│ │ │ │ │ ├── .xml_pack_index
│ │ │ │ │ ├── file1_in_sub_1.xml
│ │ │ │ │ ├── file2_in_sub_1.xml
│ │ │ │ │ └── samename.xml_pack
│ │ │ │ └── same_subfolder_2/
│ │ │ │ └── samename/
│ │ │ │ ├── .xml_pack_index
│ │ │ │ ├── file1_in_sub_2.xml
│ │ │ │ ├── file2_in_sub_2.xml
│ │ │ │ └── samename.xml_pack
│ │ │ ├── included_cfg.cfg
│ │ │ └── xml_files/
│ │ │ ├── file1_in_xml_pack.xml
│ │ │ ├── file2_in_xml_pack.xml
│ │ │ ├── same_subfolder_1/
│ │ │ │ └── samename/
│ │ │ │ └── samename.xml_pack
│ │ │ ├── same_subfolder_2/
│ │ │ │ └── samename/
│ │ │ │ └── samename.xml_pack
│ │ │ └── xml_files.xml_pack
│ │ ├── ut_misc_pack_file.h
│ │ ├── ut_misc_singleton.h
│ │ ├── ut_misc_sstring.h
│ │ ├── ut_misc_stream.h
│ │ ├── ut_misc_string_common.h
│ │ ├── ut_misc_types.h
│ │ ├── ut_misc_variable.h
│ │ ├── ut_net.h
│ │ ├── ut_net_layer3.h
│ │ ├── ut_net_message.h
│ │ └── ut_net_module.h
│ ├── nelDashBuild.cmd
│ ├── nelDashBuild.sh
│ └── revision.h.in
└── tools/
├── protobuf/
│ ├── JS/
│ │ ├── README.md
│ │ ├── protobuf/
│ │ │ └── protofile/
│ │ │ └── hold
│ │ └── protobuf_gen_js.bat
│ ├── define_attrib.proto
│ ├── define_pro.proto
│ ├── lua/
│ │ └── protobuf_gen_lua.bat
│ ├── msg_client.proto
│ ├── msg_doudizhu.proto
│ └── msg_service.proto
├── server/
│ ├── admin/
│ │ ├── common.php
│ │ ├── config.php
│ │ ├── crons/
│ │ │ ├── cron_harddisk.php
│ │ │ ├── cron_harddisk.sh
│ │ │ └── index.html
│ │ ├── docs/
│ │ │ └── shard_restart/
│ │ │ ├── Filelist.xml
│ │ │ ├── H38.css
│ │ │ ├── H70_2.htm
│ │ │ ├── HOWTO_Restarting_Ryzom_Game_Shards.htm
│ │ │ ├── Hd36.xml
│ │ │ ├── Hf69.htm
│ │ │ ├── Hg39_1.htm
│ │ │ ├── Hg41_2.htm
│ │ │ ├── Hg43_3.htm
│ │ │ ├── Hg45_4.htm
│ │ │ ├── Hg47_5.htm
│ │ │ ├── Hg49_6.htm
│ │ │ ├── Hg51_7.htm
│ │ │ ├── Hg53_8.htm
│ │ │ ├── Hg55_9.htm
│ │ │ ├── Hg57_10.htm
│ │ │ ├── Hg59_11.htm
│ │ │ ├── Hg61_12.htm
│ │ │ ├── Hn68.htm
│ │ │ ├── Hu37.js
│ │ │ └── Hz63.htm
│ │ ├── functions_auth.php
│ │ ├── functions_common.php
│ │ ├── functions_mysql.php
│ │ ├── functions_mysqli.php
│ │ ├── functions_tool_administration.php
│ │ ├── functions_tool_applications.php
│ │ ├── functions_tool_event_entities.php
│ │ ├── functions_tool_graphs.php
│ │ ├── functions_tool_guild_locator.php
│ │ ├── functions_tool_log_analyser.php
│ │ ├── functions_tool_main.php
│ │ ├── functions_tool_mfs.php
│ │ ├── functions_tool_notes.php
│ │ ├── functions_tool_player_locator.php
│ │ ├── functions_tool_preferences.php
│ │ ├── functions_tool_shop.php
│ │ ├── graphs_output/
│ │ │ └── placeholder
│ │ ├── index.php
│ │ ├── jpgraph/
│ │ │ ├── imgdata_balls.inc
│ │ │ ├── imgdata_bevels.inc
│ │ │ ├── imgdata_diamonds.inc
│ │ │ ├── imgdata_pushpins.inc
│ │ │ ├── imgdata_squares.inc
│ │ │ ├── imgdata_stars.inc
│ │ │ ├── jpg-config.inc
│ │ │ ├── jpgraph.php
│ │ │ ├── jpgraph_antispam-digits.php
│ │ │ ├── jpgraph_antispam.php
│ │ │ ├── jpgraph_bar.php
│ │ │ ├── jpgraph_canvas.php
│ │ │ ├── jpgraph_canvtools.php
│ │ │ ├── jpgraph_date.php
│ │ │ ├── jpgraph_error.php
│ │ │ ├── jpgraph_flags.php
│ │ │ ├── jpgraph_gantt.php
│ │ │ ├── jpgraph_gb2312.php
│ │ │ ├── jpgraph_gradient.php
│ │ │ ├── jpgraph_iconplot.php
│ │ │ ├── jpgraph_imgtrans.php
│ │ │ ├── jpgraph_line.php
│ │ │ ├── jpgraph_log.php
│ │ │ ├── jpgraph_pie.php
│ │ │ ├── jpgraph_pie3d.php
│ │ │ ├── jpgraph_plotband.php
│ │ │ ├── jpgraph_plotmark.inc
│ │ │ ├── jpgraph_polar.php
│ │ │ ├── jpgraph_radar.php
│ │ │ ├── jpgraph_regstat.php
│ │ │ ├── jpgraph_scatter.php
│ │ │ ├── jpgraph_stock.php
│ │ │ ├── jpgraph_utils.inc
│ │ │ └── lang/
│ │ │ └── en.inc.php
│ │ ├── logs/
│ │ │ └── empty.txt
│ │ ├── nel/
│ │ │ ├── admin_modules_itf.php
│ │ │ └── nel_message.php
│ │ ├── neltool.css
│ │ ├── overlib/
│ │ │ ├── makemini.pl
│ │ │ ├── overlib.js
│ │ │ ├── overlib_anchor.js
│ │ │ ├── overlib_anchor_mini.js
│ │ │ ├── overlib_draggable.js
│ │ │ ├── overlib_draggable_mini.js
│ │ │ └── overlib_mini.js
│ │ ├── scripts/
│ │ │ ├── index.html
│ │ │ ├── restart_sequence.php
│ │ │ └── run_script.sh
│ │ ├── smarty/
│ │ │ ├── Config_File.class.php
│ │ │ ├── Smarty.class.php
│ │ │ ├── Smarty_Compiler.class.php
│ │ │ ├── debug.tpl
│ │ │ ├── internals/
│ │ │ │ ├── core.assemble_plugin_filepath.php
│ │ │ │ ├── core.assign_smarty_interface.php
│ │ │ │ ├── core.create_dir_structure.php
│ │ │ │ ├── core.display_debug_console.php
│ │ │ │ ├── core.get_include_path.php
│ │ │ │ ├── core.get_microtime.php
│ │ │ │ ├── core.get_php_resource.php
│ │ │ │ ├── core.is_secure.php
│ │ │ │ ├── core.is_trusted.php
│ │ │ │ ├── core.load_plugins.php
│ │ │ │ ├── core.load_resource_plugin.php
│ │ │ │ ├── core.process_cached_inserts.php
│ │ │ │ ├── core.process_compiled_include.php
│ │ │ │ ├── core.read_cache_file.php
│ │ │ │ ├── core.rm_auto.php
│ │ │ │ ├── core.rmdir.php
│ │ │ │ ├── core.run_insert_handler.php
│ │ │ │ ├── core.smarty_include_php.php
│ │ │ │ ├── core.write_cache_file.php
│ │ │ │ ├── core.write_compiled_include.php
│ │ │ │ ├── core.write_compiled_resource.php
│ │ │ │ └── core.write_file.php
│ │ │ └── plugins/
│ │ │ ├── block.textformat.php
│ │ │ ├── compiler.assign.php
│ │ │ ├── function.assign_debug_info.php
│ │ │ ├── function.config_load.php
│ │ │ ├── function.counter.php
│ │ │ ├── function.cycle.php
│ │ │ ├── function.debug.php
│ │ │ ├── function.eval.php
│ │ │ ├── function.fetch.php
│ │ │ ├── function.html_checkboxes.php
│ │ │ ├── function.html_image.php
│ │ │ ├── function.html_options.php
│ │ │ ├── function.html_radios.php
│ │ │ ├── function.html_select_date.php
│ │ │ ├── function.html_select_time.php
│ │ │ ├── function.html_table.php
│ │ │ ├── function.mailto.php
│ │ │ ├── function.math.php
│ │ │ ├── function.popup.php
│ │ │ ├── function.popup_init.php
│ │ │ ├── function.substr.php
│ │ │ ├── modifier.capitalize.php
│ │ │ ├── modifier.cat.php
│ │ │ ├── modifier.count_characters.php
│ │ │ ├── modifier.count_paragraphs.php
│ │ │ ├── modifier.count_sentences.php
│ │ │ ├── modifier.count_words.php
│ │ │ ├── modifier.date_format.php
│ │ │ ├── modifier.debug_print_var.php
│ │ │ ├── modifier.default.php
│ │ │ ├── modifier.escape.php
│ │ │ ├── modifier.indent.php
│ │ │ ├── modifier.lower.php
│ │ │ ├── modifier.nl2br.php
│ │ │ ├── modifier.regex_replace.php
│ │ │ ├── modifier.replace.php
│ │ │ ├── modifier.spacify.php
│ │ │ ├── modifier.string_format.php
│ │ │ ├── modifier.strip.php
│ │ │ ├── modifier.strip_tags.php
│ │ │ ├── modifier.truncate.php
│ │ │ ├── modifier.upper.php
│ │ │ ├── modifier.wordwrap.php
│ │ │ ├── outputfilter.trimwhitespace.php
│ │ │ ├── shared.escape_special_chars.php
│ │ │ └── shared.make_timestamp.php
│ │ ├── templates/
│ │ │ ├── default/
│ │ │ │ ├── _index.tpl
│ │ │ │ ├── index.tpl
│ │ │ │ ├── index_login.tpl
│ │ │ │ ├── index_restart_sequence.tpl
│ │ │ │ ├── page_footer.tpl
│ │ │ │ ├── page_footer_light.tpl
│ │ │ │ ├── page_header.tpl
│ │ │ │ ├── page_header_light.tpl
│ │ │ │ ├── tool_actions.tpl
│ │ │ │ ├── tool_administration.tpl
│ │ │ │ ├── tool_administration_applications.tpl
│ │ │ │ ├── tool_administration_domains.tpl
│ │ │ │ ├── tool_administration_groups.tpl
│ │ │ │ ├── tool_administration_logs.tpl
│ │ │ │ ├── tool_administration_restarts.tpl
│ │ │ │ ├── tool_administration_shards.tpl
│ │ │ │ ├── tool_administration_users.tpl
│ │ │ │ ├── tool_administration_users.tpl.backup
│ │ │ │ ├── tool_event_entities.tpl
│ │ │ │ ├── tool_graphs.tpl
│ │ │ │ ├── tool_graphs_ccu.tpl
│ │ │ │ ├── tool_graphs_hires.tpl
│ │ │ │ ├── tool_graphs_tech.tpl
│ │ │ │ ├── tool_guild_locator.tpl
│ │ │ │ ├── tool_log_analyser.tpl
│ │ │ │ ├── tool_log_analyser_file_view.tpl
│ │ │ │ ├── tool_mfs.tpl
│ │ │ │ ├── tool_notes.tpl
│ │ │ │ ├── tool_player_locator.tpl
│ │ │ │ ├── tool_preferences.tpl
│ │ │ │ └── tool_shop.tpl
│ │ │ └── default_c/
│ │ │ └── placeholder
│ │ ├── tool_actions.php
│ │ ├── tool_administration.php
│ │ ├── tool_event_entities.php
│ │ ├── tool_graphs.php
│ │ ├── tool_guild_locator.php
│ │ ├── tool_log_analyser.php
│ │ ├── tool_mfs.php
│ │ ├── tool_notes.php
│ │ ├── tool_player_locator.php
│ │ ├── tool_preferences.php
│ │ └── tool_shop.php
│ ├── sql/
│ │ ├── d_mt_account.sql
│ │ ├── d_mt_player_procedure.sql
│ │ ├── d_mt_player_table.sql
│ │ └── nel_tool.sql
│ └── www/
│ ├── login/
│ │ ├── code2accesstoken.php
│ │ ├── config.php
│ │ ├── login_test.php
│ │ ├── logs/
│ │ │ └── placeholder
│ │ ├── pay_service_itf.php
│ │ └── public_func.php
│ └── tools/
│ └── nel_message.php
└── xlsx2json/
├── LICENSE
├── README.md
├── config.json
├── excel/
│ └── GameConfig.xlsx
├── export.bat
├── export.sh
├── index.js
├── lib/
│ └── xlsx-to-json.js
└── package.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/ccpp.yml
================================================
name: C/C++ CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- path: ./BaseService/build
run: ./cmake ../code
- name: make
run: make
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================
# BaseService
微信小游戏服务器,房间及卡牌类游戏服务器。支持websocket及tcp连接,lua编写游戏逻辑,运行于C++服务器,跨平台。C++底层已支持多款线上产品。
使用lua编写游戏逻辑,不需要编写C++代码。函数支持不停机热更新。
# 依赖库
https://gitee.com/li9chuan/ExternalLib
# Wiki
https://gitee.com/li9chuan/EQipaiServer/wikis
# QQ: 9703021
================================================
FILE: code/CMakeLists.txt
================================================
#-----------------------------------------------------------------------------
#
# NeL
# Authors: Nevrax and the NeL Community
# Version: 0.8.0
#
# Notes:
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
# * Changing specific install location variables:
# * NL_ETC_PREFIX (default: $CMAKE_INSTALL_PREFIX/etc)
# * NL_SHARE_PREFIX (default: $CMAKE_INSTALL_PREFIX/share)
# * NL_BIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/bin)
# * NL_SBIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/sbin)
# * NL_LIB_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib)
# * NL_DRIVER_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib (windows) or $CMAKE_INSTALL_PREFIX/lib/nel)
# * Enable building of documentation: add -DBUILD_DOCUMENTATION:BOOL=ON - new make target: DoxygenDoc
# * Updating version: update header (above) but also update NL_VERSION below.
# * To build binary archive, use the 'package' target.
# To build source archive, use the 'package_source' target.
#-----------------------------------------------------------------------------
# Load some macros.
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
#-----------------------------------------------------------------------------
# Set CMake 2.6 Policies.
IF(COMMAND cmake_policy)
# Works around warnings libraries linked against that don't
# have absolute paths (e.g. -lpthread)
cmake_policy(SET CMP0003 NEW)
# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements
cmake_policy(SET CMP0005 OLD)
ENDIF(COMMAND cmake_policy)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/nel.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/ConfigureChecks.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/CheckDepends.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds.
CHECK_OUT_OF_SOURCE()
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(BaseService CXX C)
SET(NL_VERSION_MAJOR 0)
SET(NL_VERSION_MINOR 8)
SET(NL_VERSION_PATCH 0)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
#-----------------------------------------------------------------------------
# Redirect output files
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# DLL should be in the same directory as EXE under Windows
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
ENDIF(WIN32)
IF(WIN32)
IF(WITH_MFC)
FIND_PACKAGE(MFC QUIET)
ENDIF(WITH_MFC)
IF(NOT DEFINED ENV{QTDIR})
SET(ENV{QTDIR} "c:/qt/4.6.3")
ENDIF(NOT DEFINED ENV{QTDIR})
ENDIF(WIN32)
# set platfrom defind
IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
SET(FreeBSD ON)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
#-----------------------------------------------------------------------------
# Set default config options
#
NL_SETUP_DEFAULT_OPTIONS()
NL_SETUP_NEL_DEFAULT_OPTIONS()
NL_SETUP_NELNS_DEFAULT_OPTIONS()
NL_SETUP_PREFIX_PATHS()
EVA_SETUP_PREFIX_PATHS()
NL_CONFIGURE_CHECKS()
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
#-----------------------------------------------------------------------------
#Platform specifics
SETUP_EXTERNAL()
NL_GEN_REVISION_H()
IF(WIN32)
SET(WINSOCK2_LIB ws2_32.lib)
SET(WINLDAP_LIB wldap32.lib)
IF(WITH_MFC)
FIND_PACKAGE(CustomMFC REQUIRED)
ENDIF(WITH_MFC)
ENDIF(WIN32)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(ProtoBuf REQUIRED)
FIND_PACKAGE(Lua53 REQUIRED)
#FIND_PACKAGE(PBC REQUIRED)
FIND_PACKAGE(LibEvent REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
#SET(OPENSSL_USE_STATIC_LIBS TRUE) # openssl使用静态库
FIND_PACKAGE(ZLIB REQUIRED)
ADD_DEFINITIONS(-DLUA_COMPAT_MODULE) # for lua_bind
#FIND_PACKAGE(TinyXml REQUIRED)
#FIND_PACKAGE(PNG REQUIRED)
#FIND_PACKAGE(Jpeg)
IF(WITH_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB} ${WINLDAP_LIB})
# on Mac OS X libxml2 requieres iconv
IF(FREEBSD OR APPLE)
FIND_PACKAGE(Iconv REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
MESSAGE(STATUS "ICONV: ${ICONV_INCLUDE_DIR} ${ICONV_LIBRARIES}")
ENDIF(FREEBSD OR APPLE)
ENDIF(WITH_STATIC)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
IF(FINAL_VERSION)
ADD_DEFINITIONS(-DFINAL_VERSION=1)
ENDIF(FINAL_VERSION)
ADD_DEFINITIONS(-DNL_MAP_ASSERT)
IF(WITH_SSE2)
ADD_DEFINITIONS(-DNL_HAS_SSE2)
IF(WITH_SSE3)
ADD_DEFINITIONS(-DNL_HAS_SSE3)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
IF(WITH_EVA)
ADD_DEFINITIONS(-DEVA)
ENDIF(WITH_EVA)
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)
ENDIF(WITH_NEL_TESTS)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
ADD_SUBDIRECTORY(nel)
ENDIF(WITH_NEL)
IF(WITH_NELNS)
ADD_SUBDIRECTORY(nelns)
ENDIF(WITH_NELNS)
IF(WITH_EVA)
ADD_SUBDIRECTORY(EVA)
ENDIF(WITH_EVA)
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION)
IF(DOT)
SET(HAVE_DOT YES)
ELSE(DOT)
SET(HAVE_DOT NO)
ENDIF(DOT)
# This processes our Doxyfile.in and substitutes paths to generate
# a final Doxyfile
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile)
ENDIF(BUILD_DOCUMENTATION)
IF(WITH_NEL_TESTS)
ENABLE_TESTING()
ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
IF(BUILD_DASHBOARD)
INCLUDE(Dart)
SET(SVNCOMMAND svn)
SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
SET(GENERATELOGS svn2cl)
ENDIF(BUILD_DASHBOARD)
ENDIF(WITH_NEL_TESTS)
# packaging information
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "NeL")
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
SET(CPACK_PACKAGE_EXECUTABLES "nel${NL_VERSION}" "nel")
# NSIS Specific Packing Setup
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "NeL")
SET(CPACK_NSIS_MODIFY_PATH "ON")
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeL")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
## Source Packages
SET(CPACK_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
IF(WIN32)
#SET(CPACK_GENERATOR "NSIS")
SET(CPACK_GENERATOR "NSIS;ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
ELSE(WIN32)
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
ENDIF(WIN32)
set(CPACK_SOURCE_IGNORE_FILES
"~$"
"\\\\.cvsignore$"
"^${CMAKE_SOURCE_DIR}.*/CVS/"
"^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
"^${CMAKE_SOURCE_DIR}/debian/"
"^${CMAKE_SOURCE_DIR}/old/")
IF(WIN32)
IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
# Only the tools require MFC.
IF(WITH_TOOLS)
SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
ENDIF(WITH_TOOLS)
INCLUDE(InstallRequiredSystemLibraries)
ENDIF(WIN32)
INCLUDE(CPack)
INCLUDE(CMakePackaging.txt)
## Debian Packages
#INCLUDE(UseDebian)
#IF(DEBIAN_FOUND)
# ADD_DEBIAN_TARGETS(nel)
#ENDIF(DEBIAN_FOUND)
================================================
FILE: code/CMakeModules/AndroidToolChain.cmake
================================================
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Standard settings
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version
SET(UNIX ON)
SET(LINUX ON)
SET(ANDROID ON)
IF(NOT NDK_ROOT)
SET(NDK_ROOT $ENV{NDK_ROOT})
IF(CMAKE_HOST_WIN32)
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
ENDIF(CMAKE_HOST_WIN32)
ENDIF(NOT NDK_ROOT)
IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7")
ENDIF(NOT TARGET_CPU)
IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86")
SET(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
ENDIF()
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
ELSEIF(CMAKE_HOST_APPLE)
SET(TOOLCHAIN_HOST "apple")
SET(TOOLCHAIN_BIN_SUFFIX "")
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF()
ENDMACRO()
IF(CLANG)
SEARCH_TOOLCHAIN(CLANG)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}")
ENDIF()
SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
IF("${_BINARY}" MATCHES "clang")
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ELSE()
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF()
ENDMACRO(SET_TOOLCHAIN_BINARY)
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
MESSAGE(STATUS "Using clang compiler")
ELSE()
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
MESSAGE(STATUS "Using GCC compiler")
ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)
================================================
FILE: code/CMakeModules/CheckDepends.cmake
================================================
# Macros to check if a library needs to be manually linked to another one
# because it's using a symbol from it but it's not linked to
# CHECK_UNDEFINED_SYMBOL
# Macro to check if a library is calling an undefined symbol
#
# Syntax:
# CHECK_UNDEFINED_SYMBOL(MYLIBRARY SYMBOL SYMBOL_FOUND)
# SYMBOL_FOUND will be set to TRUE if UNDEFINED
#
# Example:
# CHECK_UNDEFINED_SYMBOL(PNG_LIBRARY inflate INFLATE_FOUND)
#
MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
SET(${SYMBOL_FOUND} TRUE)
IF(WIN32)
# Always TRUE under Windows because we are using static libraries
ELSEIF(APPLE)
SET(CMAKE_NM nm)
IF(CMAKE_NM)
# Use nm to check if a library is using an external symbol
EXEC_PROGRAM(${CMAKE_NM} ARGS "-gu ${${MYLIBRARY}} | grep ${SYMBOL}" OUTPUT_VARIABLE NM_SYMBOL)
# MESSAGE(STATUS "Checking for undefined symbol ${SYMBOL} in ${${MYLIBRARY}}")
IF(NOT NM_SYMBOL MATCHES ${SYMBOL})
SET(${SYMBOL_FOUND} FALSE)
# MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}")
ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL})
ENDIF(CMAKE_NM)
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
# Use objdump to check if a library is using an external symbol
#MESSAGE(STATUS "exec ${CMAKE_OBJDUMP} -T ${${MYLIBRARY}} | grep ${SYMBOL}")
EXEC_PROGRAM(${CMAKE_OBJDUMP} ARGS "-T ${${MYLIBRARY}} | grep ${SYMBOL}" OUTPUT_VARIABLE OBJDUMP_SYMBOL)
IF(NOT OBJDUMP_SYMBOL MATCHES "UND")
#MESSAGE(STATUS "${${MYLIBRARY}} does not use symbol ${SYMBOL}")
SET(${SYMBOL_FOUND} FALSE)
ELSE(NOT OBJDUMP_SYMBOL MATCHES "UND")
#MESSAGE(STATUS "${${MYLIBRARY}} uses symbol ${SYMBOL}")
ENDIF(NOT OBJDUMP_SYMBOL MATCHES "UND")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDMACRO(CHECK_UNDEFINED_SYMBOL)
# CHECK_LINKED_LIBRARY
# Macro to check if a library is linked to another one
#
# Syntax:
# CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
# LIBRARY_FOUND will be set to TRUE if LINKED
#
# Example:
# CHECK_LINKED_LIBRARY(PNG_LIBRARY ZLIB_LIBRARY ZLIB_FOUND)
#
MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
SET(${LIBRARY_FOUND} FALSE)
IF(WIN32)
# Always FALSE under Windows because we are using static libraries
ELSEIF(APPLE)
SET(CMAKE_OTOOL otool)
IF(CMAKE_OTOOL)
# Use otool to check if a library is linked to another library
GET_FILENAME_COMPONENT(LIBNAME "${${OTHERLIBRARY}}" NAME_WE)
EXEC_PROGRAM(${CMAKE_OTOOL} ARGS "-L ${${MYLIBRARY}} | grep ${LIBNAME}" OUTPUT_VARIABLE OTOOL_LIBRARY)
# MESSAGE(STATUS "Checking if ${LIBNAME} is linked to ${${MYLIBRARY}}")
IF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
SET(${LIBRARY_FOUND} TRUE)
# MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}")
ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
ENDIF(CMAKE_OTOOL)
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
GET_FILENAME_COMPONENT(LIBNAME "${${OTHERLIBRARY}}" NAME)
# TODO: under Solaris use dump -Lv
# Use objdump to check if a library is linked to another library
#MESSAGE(STATUS "exec ${CMAKE_OBJDUMP} -p ${${MYLIBRARY}} | grep ${LIBNAME}")
EXEC_PROGRAM(${CMAKE_OBJDUMP} ARGS "-p ${${MYLIBRARY}} | grep ${LIBNAME}" OUTPUT_VARIABLE OBJDUMP_LIBRARY)
IF(OBJDUMP_LIBRARY MATCHES "NEEDED")
#MESSAGE(STATUS "${${MYLIBRARY}} references to ${LIBNAME}.")
SET(${LIBRARY_FOUND} TRUE)
ELSE(OBJDUMP_LIBRARY MATCHES "NEEDED")
#MESSAGE(STATUS "${${MYLIBRARY}} does not reference to ${LIBNAME}!")
ENDIF(OBJDUMP_LIBRARY MATCHES "NEEDED")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDMACRO(CHECK_LINKED_LIBRARY)
MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK)
CHECK_UNDEFINED_SYMBOL(MYLIBRARY SYMBOL SYMBOL_FOUND)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
SET(${MUSTLINK} YES)
ELSE(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
SET(${MUSTLINK} NO)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDMACRO(CHECK_DEPENDS)
# LINK_DEPENDS
# Macro to link a library if a symbol is used but is not already linked to it
#
# Syntax:
# LINK_DEPENDS(LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
# OTHERLIBRARY_LINKED will be set to TRUE or FALSE
#
# Example:
# LINK_DEPENDS(PNG_LIBRARIES PNG_LIBRARY ZLIB_LIBRARY inflate)
#
MACRO(LINK_DEPENDS LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
SET(MUST_LINK FALSE)
IF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED)
IF(WIN32 OR WITH_STATIC)
# In static, we link all libraries because it will keep only used symbols
SET(MUST_LINK TRUE)
ELSE(WIN32 OR WITH_STATIC)
CHECK_UNDEFINED_SYMBOL(${MYLIBRARY} ${SYMBOL} SYMBOL_FOUND)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(${MYLIBRARY} ${OTHERLIBRARY} LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
MESSAGE(STATUS "Underlinking found: ${${MYLIBRARY}} needs ${${OTHERLIBRARY}} but is not linked to, manually linking...")
SET(MUST_LINK TRUE)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDIF(WIN32 OR WITH_STATIC)
ENDIF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED)
IF(MUST_LINK)
MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}")
SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}})
SET(${OTHERLIBRARY}_LINKED TRUE)
ENDIF(MUST_LINK)
ENDMACRO(LINK_DEPENDS)
================================================
FILE: code/CMakeModules/ConfigureChecks.cmake
================================================
MACRO(NL_CONFIGURE_CHECKS)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckTypeSize)
CHECK_INCLUDE_FILES ("execinfo.h" HAVE_EXECINFO_H)
CHECK_INCLUDE_FILES ("stdint.h" HAVE_STDINT_H)
CHECK_INCLUDE_FILES ("sys/types.h" HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES ("inttypes.h" HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES ("unistd.h" HAVE_UNISTD_H)
CHECK_INCLUDE_FILES ("utime.h" HAVE_UTIME_H)
CHECK_INCLUDE_FILES ("dl.h" HAVE_DL_H)
CHECK_INCLUDE_FILES ("limits.h" HAVE_LIMITS_H)
CHECK_INCLUDE_FILES ("malloc.h" HAVE_MALLOC_H)
CHECK_INCLUDE_FILES ("sys/param.h" HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILES ("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H)
CHECK_INCLUDE_FILES ("sys/statvfs.h" HAVE_SYS_STATVFS_H)
CHECK_INCLUDE_FILES ("pthread.h" HAVE_PTHREAD)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
#if (NOT HAVE_SIZEOF_SIZE_T)
# MESSAGE(FATAL_ERROR "size_t is not present on this architecture - aborting")
#endif (NOT HAVE_SIZEOF_SIZE_T)
MESSAGE(STATUS "DEBUG size_t is ${SIZEOF_SIZE_T}")
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
MESSAGE(STATUS "DEBUG off_t is ${SIZEOF_OFF_T}")
CHECK_FUNCTION_EXISTS("backtrace" HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS("getsockname" HAVE_GETSOCKNAME)
CHECK_FUNCTION_EXISTS("inet_ntoa" HAVE_INET_NTOA)
CHECK_FUNCTION_EXISTS("inet_ntop" HAVE_INET_NTOP)
CHECK_FUNCTION_EXISTS("inet_pton" HAVE_INET_PTON)
CHECK_FUNCTION_EXISTS("regcomp" HAVE_REGCOMP)
CHECK_FUNCTION_EXISTS("strerror" HAVE_STRERROR)
CHECK_FUNCTION_EXISTS("strlcat" HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS("strptime" HAVE_STRPTIME)
CHECK_FUNCTION_EXISTS("strtok_r" HAVE_STRTOK_R)
CHECK_FUNCTION_EXISTS("strtoull" HAVE_STRTOULL)
CHECK_FUNCTION_EXISTS("statvfs" HAVE_STATVFS)
CHECK_FUNCTION_EXISTS("stat64" HAVE_STAT64)
# 3D drivers
IF(WITH_DRIVER_OPENGL)
SET(NL_OPENGL_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENGL)
IF(WITH_DRIVER_OPENGLES)
SET(NL_OPENGLES_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENGLES)
IF(WITH_DRIVER_DIRECT3D)
SET(NL_DIRECT3D_AVAILABLE 1)
ENDIF(WITH_DRIVER_DIRECT3D)
# sound drivers
IF(WITH_DRIVER_FMOD)
SET(NL_FMOD_AVAILABLE 1)
ENDIF(WITH_DRIVER_FMOD)
IF(WITH_DRIVER_OPENAL)
SET(NL_OPENAL_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENAL)
IF(WITH_DRIVER_DSOUND)
SET(NL_DSOUND_AVAILABLE 1)
ENDIF(WITH_DRIVER_DSOUND)
IF(WITH_DRIVER_XAUDIO2)
SET(NL_XAUDIO2_AVAILABLE 1)
ENDIF(WITH_DRIVER_XAUDIO2)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
ENDMACRO(NL_CONFIGURE_CHECKS)
================================================
FILE: code/CMakeModules/Find3dsMaxSDK.cmake
================================================
# - Find DirectInput
# Find the DirectSound includes and libraries
#
# MAXSDK_DIR - 3DSMAX SDK root directory
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
# MAXSDK_FOUND - True if MAX SDK found.
if(MAXSDK_INCLUDE_DIR)
# Already in cache, be silent
SET(MAXSDK_FIND_QUIETLY TRUE)
endif(MAXSDK_INCLUDE_DIR)
FIND_PATH(MAXSDK_DIR
"include/maxversion.h"
HINTS
"$ENV{MAXSDK_DIR}"
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
)
FIND_PATH(MAXSDK_INCLUDE_DIR
max.h
HINTS
${MAXSDK_DIR}/include
)
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
HINTS
${MAXSDK_DIR}/include/CS
)
IF(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
ELSE(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
ENDIF(TARGET_X64)
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
HINTS
${MAXSDK_LIBRARY_DIRS}
)
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
FIND_3DS_LIBRARY(MAXSDK_GFX_LIBRARY gfx)
FIND_3DS_LIBRARY(MAXSDK_MESH_LIBRARY mesh)
FIND_3DS_LIBRARY(MAXSDK_MAXUTIL_LIBRARY maxutil)
FIND_3DS_LIBRARY(MAXSDK_MAXSCRIPT_LIBRARY maxscrpt)
FIND_3DS_LIBRARY(MAXSDK_PARAMBLK2_LIBRARY paramblk2)
FIND_3DS_LIBRARY(MAXSDK_BMM_LIBRARY bmm)
# Handle the QUIETLY and REQUIRED arguments and set MAXSDK_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MAXSDK DEFAULT_MSG
MAXSDK_INCLUDE_DIR MAXSDK_CORE_LIBRARY)
if(MAXSDK_FOUND)
SET(MAXSDK_LIBRARIES
${MAXSDK_CORE_LIBRARY}
${MAXSDK_GEOM_LIBRARY}
${MAXSDK_GFX_LIBRARY}
${MAXSDK_MESH_LIBRARY}
${MAXSDK_MAXUTIL_LIBRARY}
${MAXSDK_MAXSCRIPT_LIBRARY}
${MAXSDK_PARAMBLK2_LIBRARY}
${MAXSDK_BMM_LIBRARY} )
else(MAXSDK_FOUND)
set(MAXSDK_LIBRARIES)
endif(MAXSDK_FOUND)
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)
================================================
FILE: code/CMakeModules/FindCEGUI.cmake
================================================
# - Locate CEGUI library
# This module defines
# CEGUI_LIBRARY, the library to link against
# CEGUI_FOUND, if false, do not try to link to CEGUI
# CEGUI_INCLUDE_DIRS, where to find headers.
IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
# in cache already
SET(CEGUI_FIND_QUIETLY TRUE)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
FIND_PATH(CEGUI_INCLUDE_DIRS
CEGUI
PATHS
$ENV{CEGUI_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cegui CEGUI
)
FIND_LIBRARY(CEGUI_LIBRARY
NAMES CEGUIBase
PATHS
$ENV{CEGUI_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
GET_FILENAME_COMPONENT(CEGUI_LIB_DIR ${CEGUI_LIBRARY} PATH CACHE)
IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
SET(CEGUI_FOUND "YES")
SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI")
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Found CEGUI: ${CEGUI_LIBRARY}")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ELSE(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CEGUI!")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
================================================
FILE: code/CMakeModules/FindCppTest.cmake
================================================
#
# Find the CppTest includes and library
#
# This module defines
# CPPTEST_INCLUDE_DIR, where to find tiff.h, etc.
# CPPTEST_LIBRARIES, where to find the CppTest libraries.
# CPPTEST_FOUND, If false, do not try to use CppTest.
# also defined, but not for general use are
IF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
# in cache already
SET(CPPTEST_FIND_QUIETLY TRUE)
ENDIF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
FIND_PATH(CPPTEST_INCLUDE_DIR
cpptest.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cppunit cpptest
)
SET(LIBRARY_NAME_RELEASE cpptest)
SET(LIBRARY_NAME_DEBUG cpptestd)
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE cpptest_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG cpptest_stlportd ${LIBRARY_NAME_DEBUG})
ENDIF(WITH_STLPORT)
FIND_LIBRARY(CPPTEST_LIBRARY_RELEASE
${LIBRARY_NAME_RELEASE}
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(CPPTEST_LIBRARY_DEBUG
${LIBRARY_NAME_DEBUG}
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(CPPTEST_INCLUDE_DIR)
IF(CPPTEST_LIBRARY_RELEASE)
SET(CPPTEST_FOUND TRUE)
SET(CPPTEST_LIBRARIES "optimized;${CPPTEST_LIBRARY_RELEASE}")
IF(CPPTEST_LIBRARY_DEBUG)
SET(CPPTEST_LIBRARIES "${CPPTEST_LIBRARIES};debug;${CPPTEST_LIBRARY_DEBUG}")
ENDIF(CPPTEST_LIBRARY_DEBUG)
ENDIF(CPPTEST_LIBRARY_RELEASE)
ENDIF(CPPTEST_INCLUDE_DIR)
IF(CPPTEST_FOUND)
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARIES}")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ELSE(CPPTEST_FOUND)
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CppTest!")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ENDIF(CPPTEST_FOUND)
MARK_AS_ADVANCED(CPPTEST_LIBRARY_RELEASE CPPTEST_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindCrashRpt.cmake
================================================
# - Locate CrashRpt library
# This module defines
# CrashRpt_LIBRARIES, the libraries to link against
# CrashRpt_FOUND, if false, do not try to link to CrashRpt
# CrashRpt_INCLUDE_DIR, where to find headers.
IF(CrashRpt_LIBRARIES AND CrashRpt_INCLUDE_DIR)
# in cache already
SET(CrashRpt_FIND_QUIETLY TRUE)
ENDIF(CrashRpt_LIBRARIES AND CrashRpt_INCLUDE_DIR)
FIND_PATH(CrashRpt_INCLUDE_DIR CrashRpt.h
PATH_SUFFIXES crashrpt CrashRpt
$ENV{CrashRpt_DIR}/include
)
FIND_LIBRARY(CrashRpt_LIBRARIES
NAMES CrashRpt1402
PATHS
$ENV{CrashRpt_DIR}/lib
)
IF(CrashRpt_INCLUDE_DIR)
IF(CrashRpt_LIBRARIES)
SET(CrashRpt_FOUND TRUE)
ENDIF(CrashRpt_LIBRARIES)
ENDIF(CrashRpt_INCLUDE_DIR)
IF(CrashRpt_FOUND)
IF(NOT CrashRpt_FIND_QUIETLY)
MESSAGE(STATUS "Found CrashRpt: ${CrashRpt_INCLUDE_DIR} ${CrashRpt_LIBRARIES}")
ENDIF(NOT CrashRpt_FIND_QUIETLY)
ELSE(CrashRpt_FOUND)
IF(NOT CrashRpt_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CrashRpt!")
ENDIF(NOT CrashRpt_FIND_QUIETLY)
ENDIF(CrashRpt_FOUND)
MARK_AS_ADVANCED(CrashRpt_LIBRARIES)
================================================
FILE: code/CMakeModules/FindCurl.cmake
================================================
# - Locate Curl library
# This module defines
# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
# CURL_LIBRARIES - List of libraries when using curl.
# CURL_FOUND - True if curl found.
# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
IF(CURL_LIBRARY AND CURL_INCLUDE_DIR)
# in cache already
SET(CURL_FIND_QUIETLY TRUE)
ENDIF(CURL_LIBRARY AND CURL_INCLUDE_DIR)
FIND_PATH(CURL_INCLUDE_DIR curl.h
PATH_SUFFIXES curl
$ENV{CURL_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
/usr/local/include/curl
/mingw/include
)
SET(LIBRARY_NAME_RELEASE curl libcurl)
SET(LIBRARY_NAME_DEBUG curl libcurl)
FIND_LIBRARY(CURL_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{CURL_DIR}/lib
/usr/local/lib
/usr/lib
/usr/lib64
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/curl
/mingw/lib
)
FIND_LIBRARY(CURL_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{CURL_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/curl
/mingw/lib
)
IF(CURL_INCLUDE_DIR)
IF(CURL_LIBRARY_RELEASE AND CURL_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(CURL_FOUND TRUE)
SET(CURL_LIBRARY optimized ${CURL_LIBRARY_RELEASE} debug ${CURL_LIBRARY_DEBUG})
ELSEIF(CURL_LIBRARY_RELEASE)
# Normal case
SET(CURL_FOUND TRUE)
SET(CURL_LIBRARY ${CURL_LIBRARY_RELEASE})
ELSEIF(CURL_LIBRARY_DEBUG)
# Case where Curl is compiled from sources (debug version is compiled by default)
SET(CURL_FOUND TRUE)
SET(CURL_LIBRARY ${CURL_LIBRARY_DEBUG})
ENDIF(CURL_LIBRARY_RELEASE AND CURL_LIBRARY_DEBUG)
ENDIF(CURL_INCLUDE_DIR)
IF(CURL_FOUND)
IF(NOT CURL_FIND_QUIETLY)
MESSAGE(STATUS "Found Curl: ${CURL_INCLUDE_DIR} ${CURL_LIBRARY}")
ENDIF(NOT CURL_FIND_QUIETLY)
ELSE(CURL_FOUND)
IF(NOT CURL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Curl! INCLUDE: ${CURL_INCLUDE_DIR} LIB:${CURL_LIBRARY} ")
ENDIF(NOT CURL_FIND_QUIETLY)
ENDIF(CURL_FOUND)
MARK_AS_ADVANCED(CURL_LIBRARY_RELEASE CURL_LIBRARY_DEBUG)
IF(WIN32)
ADD_DEFINITIONS(-DCURL_STATICLIB)
ENDIF(WIN32)
================================================
FILE: code/CMakeModules/FindCustomMFC.cmake
================================================
# - Locate MFC libraries
# This module defines
# MFC_FOUND, if false, do not try to link to MFC
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(VC_DIR)
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF(NOT MFC_DIR)
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF(TARGET_X64)
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL)
# Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2)
ENDIF(MFC_FOUND)
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project
================================================
FILE: code/CMakeModules/FindDInput.cmake
================================================
# - Find DirectInput
# Find the DirectSound includes and libraries
#
# DINPUT_INCLUDE_DIR - where to find dinput.h
# DINPUT_LIBRARIES - List of libraries when using DirectInput.
# DINPUT_FOUND - True if DirectInput found.
if(DINPUT_INCLUDE_DIR)
# Already in cache, be silent
set(DINPUT_FIND_QUIETLY TRUE)
endif(DINPUT_INCLUDE_DIR)
find_path(DINPUT_INCLUDE_DIR dinput.h
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Include"
)
find_library(DINPUT_LIBRARY
NAMES dinput dinput8
PATHS
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Lib"
"$ENV{DXSDK_DIR}/Lib/x86"
)
# Handle the QUIETLY and REQUIRED arguments and set DINPUT_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DINPUT DEFAULT_MSG
DINPUT_INCLUDE_DIR DINPUT_LIBRARY)
if(DINPUT_FOUND)
set(DINPUT_LIBRARIES ${DINPUT_LIBRARY})
else(DINPUT_FOUND)
set(DINPUT_LIBRARIES)
endif(DINPUT_FOUND)
mark_as_advanced(DINPUT_INCLUDE_DIR DINPUT_LIBRARY)
================================================
FILE: code/CMakeModules/FindDSound.cmake
================================================
# - Find DirectSound
# Find the DirectSound includes and libraries
#
# DSOUND_INCLUDE_DIR - where to find dsound.h
# DSOUND_LIBRARIES - List of libraries when using dsound.
# DSOUND_FOUND - True if dsound found.
if(DSOUND_INCLUDE_DIR)
# Already in cache, be silent
set(DSOUND_FIND_QUIETLY TRUE)
endif(DSOUND_INCLUDE_DIR)
find_path(DSOUND_INCLUDE_DIR dsound.h
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Include"
)
find_library(DSOUND_LIBRARY dsound
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Lib"
"$ENV{DXSDK_DIR}/Lib/x86"
)
# Handle the QUIETLY and REQUIRED arguments and set DSOUND_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DSOUND DEFAULT_MSG
DSOUND_INCLUDE_DIR DSOUND_LIBRARY)
if(DSOUND_FOUND)
set(DSOUND_LIBRARIES ${DSOUND_LIBRARY})
else(DSOUND_FOUND)
set(DSOUND_LIBRARIES)
endif(DSOUND_FOUND)
mark_as_advanced(DSOUND_INCLUDE_DIR DSOUND_LIBRARY)
================================================
FILE: code/CMakeModules/FindDirectXSDK.cmake
================================================
# - Find DirectX
# Find the DirectX includes and libraries
#
# DXSDK_INCLUDE_DIR - where to find baseinterface.h
# DXSDK_LIBRARIES - List of libraries when using 3DSMAX.
# DXSDK_FOUND - True if MAX SDK found.
IF(DXSDK_DIR)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
ENDIF(DXSDK_DIR)
FIND_PATH(DXSDK_DIR
"Include/dxsdkver.h"
PATHS
"$ENV{DXSDK_DIR}"
"C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)"
"C:/Program Files/Microsoft DirectX SDK (June 2010)"
"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)"
"C:/Program Files/Microsoft DirectX SDK (February 2010)"
"C:/Program Files (x86)/Microsoft DirectX SDK (November 2007)"
"C:/Program Files/Microsoft DirectX SDK (November 2007)"
"C:/Program Files (x86)/Microsoft DirectX SDK"
"C:/Program Files/Microsoft DirectX SDK"
)
MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
HINTS
"${DXSDK_LIBRARY_DIR}"
)
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
IF(DXSDK_DIR)
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
IF(TARGET_X64)
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64)
ELSE(TARGET_X64)
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib)
ENDIF(TARGET_X64)
FIND_PATH(DXSDK_LIBRARY_DIR
dxguid.lib
PATHS
${DXSDK_LIBRARY_DIRS})
FIND_DXSDK_LIBRARY(DXSDK_GUID_LIBRARY dxguid)
FIND_DXSDK_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8)
FIND_DXSDK_LIBRARY(DXSDK_DSOUND_LIBRARY dsound)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
ENDIF(DXSDK_DIR)
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
# all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY)
MARK_AS_ADVANCED(DXSDK_INCLUDE_DIR
DXSDK_GUID_LIBRARY
DXSDK_DINPUT_LIBRARY
DXSDK_DSOUND_LIBRARY
DXSDK_XAUDIO_LIBRARY
DXSDK_D3DX9_LIBRARY
DXSDK_D3D9_LIBRARY)
================================================
FILE: code/CMakeModules/FindEFXUtil.cmake
================================================
# - Locate EFX-Util library
# This module defines
# EFXUTIL_LIBRARY, the library to link against
# EFXUTIL_FOUND, if false, do not try to link to EFX-Util
# EFXUTIL_INCLUDE_DIR, where to find headers.
IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
# in cache already
SET(EFXUTIL_FIND_QUIETLY TRUE)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
FIND_PATH(EFXUTIL_INCLUDE_DIR
EFX-Util.h
PATHS
$ENV{EFXUTIL_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES AL
)
FIND_LIBRARY(EFXUTIL_LIBRARY
NAMES EFX-Util efxutil libefxutil
PATHS
$ENV{EFXUTIL_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
SET(EFXUTIL_FOUND "YES")
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Found EFX-Util: ${EFXUTIL_LIBRARY}")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ELSE(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find EFX-Util!")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindExternal.cmake
================================================
# Look for a directory containing external libraries.
#
# The following values are defined
# EXTERNAL_PATH - where to find external
# EXTERNAL_INCLUDE_PATH - where to find external includes
# EXTERNAL_BINARY_PATH - where to find external binaries
# EXTERNAL_LIBRARY_PATH - where to find external libraries
# EXTERNAL_FOUND - True if the external libraries are available
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
SET(EXTERNAL_TEMP_FILE "include/libwww/wwwconf.h")
SET(EXTERNAL_NAME "external")
# If using STLport preprend external_stlport
IF(WITH_STLPORT)
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH})
SET(EXTERNAL_TEMP_FILE "include/stlport/string")
SET(EXTERNAL_NAME "external with STLport")
ENDIF(WITH_STLPORT)
FIND_PATH(EXTERNAL_PATH
${EXTERNAL_TEMP_FILE}
PATHS
$ENV{EXTERNAL_PATH}
${EXTERNAL_TEMP_PATH}
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
IF(EXTERNAL_PATH)
SET(EXTERNAL_FOUND TRUE)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
# Using 32 or 64 bits binaries
IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
ELSE(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
ENDIF(TARGET_X64 AND WIN32)
# Using 32 or 64 bits libraries
IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(TARGET_X64 AND WIN32)
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
# Stupid hack for FindOpenAL.cmake
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
ENDIF(EXTERNAL_PATH)
IF(EXTERNAL_FOUND)
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")
ENDIF(NOT External_FIND_QUIETLY)
ELSE(EXTERNAL_FOUND)
IF(External_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")
ELSE(External_FIND_REQUIRED)
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")
ENDIF(NOT External_FIND_QUIETLY)
ENDIF(External_FIND_REQUIRED)
ENDIF(EXTERNAL_FOUND)
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)
================================================
FILE: code/CMakeModules/FindFMOD.cmake
================================================
# - Locate FMOD library
# This module defines
# FMOD_LIBRARY, the library to link against
# FMOD_FOUND, if false, do not try to link to FMOD
# FMOD_INCLUDE_DIR, where to find headers.
IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
# in cache already
SET(FMOD_FIND_QUIETLY TRUE)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
FIND_PATH(FMOD_INCLUDE_DIR
fmod.h
PATHS
$ENV{FMOD_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES fmod fmod3
)
IF(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmod64 fmod)
ELSE(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmodvc fmod)
ENDIF(TARGET_X64)
FIND_LIBRARY(FMOD_LIBRARY
NAMES
${FMOD_LIBRARY_NAMES}
PATHS
$ENV{FMOD_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
SET(FMOD_FOUND "YES")
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARY}")
ENDIF(NOT FMOD_FIND_QUIETLY)
ELSE(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FMOD!")
ENDIF(NOT FMOD_FIND_QUIETLY)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindFreeType.cmake
================================================
# - Locate FreeType library
# This module defines
# FREETYPE_LIBRARIES, libraries to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
# in cache already
SET(Freetype_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype
PATHS
$ENV{FREETYPE_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES freetype2
)
IF(NOT FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_INCLUDE_DIRS "")
ENDIF(NOT FREETYPE_INCLUDE_DIRS)
# ft2build.h does not reside in the freetype include dir
FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
ft2build.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES freetype2
)
# combine both include directories into one variable
IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
NAMES freetype libfreetype freetype219 freetype246
PATHS
$ENV{FREETYPE_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
)
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
NAMES freetyped libfreetyped freetype219d freetype246d
PATHS
$ENV{FREETYPE_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
)
IF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG})
ELSEIF(FREETYPE_LIBRARY_RELEASE)
# Normal case
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE})
ELSEIF(FREETYPE_LIBRARY_DEBUG)
# Case where Freetype is compiled from sources (debug version is compiled by default)
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
ENDIF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_FOUND)
IF(WITH_STATIC_EXTERNAL AND APPLE)
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
ENDIF(WITH_STATIC_EXTERNAL AND APPLE)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
ENDIF(NOT Freetype_FIND_QUIETLY)
ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FreeType!")
ENDIF(NOT Freetype_FIND_QUIETLY)
ENDIF(FREETYPE_FOUND)
================================================
FILE: code/CMakeModules/FindGTK2.cmake
================================================
# - Try to find GTK2
# Once done this will define
#
# GTK2_FOUND - System has GTK2
# GTK2_INCLUDE_DIRS - GTK2 include directory
# GTK2_LIBRARIES - Link these to use GTK2
# GTK2_LIBRARY_DIRS - The path to where the GTK2 library files are.
# GTK2_DEFINITIONS - Compiler switches required for using GTK2
#
# Copyright (c) 2007 Andreas Schneider
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
set(GTK2_DEBUG ON)
macro(GTK2_DEBUG_MESSAGE _message)
if (GTK2_DEBUG)
message(STATUS "(DEBUG) ${_message}")
endif (GTK2_DEBUG)
endmacro(GTK2_DEBUG_MESSAGE _message)
if (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
# in cache already
set(GTK2_FOUND TRUE)
else (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
if (UNIX)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
include(UsePkgConfig)
pkgconfig(gtk+-2.0 _GTK2IncDir _GTK2LinkDir _GTK2LinkFlags _GTK2Cflags)
find_path(GTK2_GTK_INCLUDE_DIR
NAMES
gtk/gtk.h
PATHS
$ENV{GTK2_HOME}
${_GTK2IncDir}
/usr/include/gtk-2.0
/usr/local/include/gtk-2.0
/opt/include/gtk-2.0
/opt/gnome/include/gtk-2.0
/sw/include/gtk-2.0
)
gtk2_debug_message("GTK2_GTK_INCLUDE_DIR is ${GTK2_GTK_INCLUDE_DIR}")
# Some Linux distributions (e.g. Red Hat) have glibconfig.h
# and glib.h in different directories, so we need to look
# for both.
# - Atanas Georgiev
pkgconfig(glib-2.0 _GLIB2IncDir _GLIB2LinkDir _GLIB2LinkFlags _GLIB2Cflags)
pkgconfig(gmodule-2.0 _GMODULE2IncDir _GMODULE2LinkDir _GMODULE2LinkFlags _GMODULE2Cflags)
find_path(GTK2_GLIBCONFIG_INCLUDE_DIR
NAMES
glibconfig.h
PATHS
${_GLIB2IncDir}
${_GMODULE2IncDir}
/opt/gnome/lib64/glib-2.0/include
/opt/gnome/lib/glib-2.0/include
/opt/lib/glib-2.0/include
/usr/lib64/glib-2.0/include
/usr/lib/glib-2.0/include
/sw/lib/glib-2.0/include
/usr/lib/x86_64-linux-gnu/glib-2.0/include
/usr/lib/arm-linux-gnueabihf/glib-2.0/include
)
gtk2_debug_message("GTK2_GLIBCONFIG_INCLUDE_DIR is ${GTK2_GLIBCONFIG_INCLUDE_DIR}")
find_path(GTK2_GLIB_INCLUDE_DIR
NAMES
glib.h
PATHS
${_GLIB2IncDir}
${_GMODULE2IncDir}
/opt/include/glib-2.0
/opt/gnome/include/glib-2.0
/usr/include/glib-2.0
/sw/include/glib-2.0
)
gtk2_debug_message("GTK2_GLIB_INCLUDE_DIR is ${GTK2_GLIB_INCLUDE_DIR}")
pkgconfig(gdk-2.0 _GDK2IncDir _GDK2LinkDir _GDK2LinkFlags _GDK2Cflags)
find_path(GTK2_GDK_INCLUDE_DIR
NAMES
gdkconfig.h
PATHS
${_GDK2IncDir}
/opt/gnome/lib/gtk-2.0/include
/opt/gnome/lib64/gtk-2.0/include
/opt/lib/gtk-2.0/include
/usr/lib/gtk-2.0/include
/usr/lib64/gtk-2.0/include
/sw/lib/gtk-2.0/include
/usr/lib/x86_64-linux-gnu/gtk-2.0/include
/usr/lib/arm-linux-gnueabihf/gtk-2.0/include
)
gtk2_debug_message("GTK2_GDK_INCLUDE_DIR is ${GTK2_GDK_INCLUDE_DIR}")
find_path(GTK2_GDK_PIXBUF_INCLUDE_DIR
NAMES
gdk-pixbuf/gdk-pixbuf.h
PATHS
${_GDK2IncDir}
/opt/gnome/lib/gtk-2.0/include
/opt/gnome/lib64/gtk-2.0/include
/opt/lib/gtk-2.0/include
/usr/lib/gtk-2.0/include
/usr/lib64/gtk-2.0/include
/sw/lib/gtk-2.0/include
/usr/include/gdk-pixbuf-2.0
)
gtk2_debug_message("GTK2_GDK_PIXBUF_INCLUDE_DIR is ${GTK2_GDK_PIXBUF_INCLUDE_DIR}")
find_path(GTK2_GTKGL_INCLUDE_DIR
NAMES
gtkgl/gtkglarea.h
PATHS
${_GLIB2IncDir}
/usr/include
/usr/include/gtkgl-2.0
/usr/local/include
/usr/openwin/share/include
/opt/gnome/include
/opt/include
/sw/include
)
gtk2_debug_message("GTK2_GTKGL_INCLUDE_DIR is ${GTK2_GTKGL_INCLUDE_DIR}")
pkgconfig(libglade-2.0 _GLADEIncDir _GLADELinkDir _GLADELinkFlags _GLADECflags)
find_path(GTK2_GLADE_INCLUDE_DIR
NAMES
glade/glade.h
PATHS
${_GLADEIncDir}
/opt/gnome/include/libglade-2.0
/usr/include/libglade-2.0
/opt/include/libglade-2.0
/sw/include/libglade-2.0
)
gtk2_debug_message("GTK2_GLADE_INCLUDE_DIR is ${GTK2_GLADE_INCLUDE_DIR}")
pkgconfig(pango _PANGOIncDir _PANGOLinkDir _PANGOLinkFlags _PANGOCflags)
find_path(GTK2_PANGO_INCLUDE_DIR
NAMES
pango/pango.h
PATHS
${_PANGOIncDir}
/usr/include/pango-1.0
/opt/gnome/include/pango-1.0
/opt/include/pango-1.0
/sw/include/pango-1.0
)
gtk2_debug_message("GTK2_PANGO_INCLUDE_DIR is ${GTK2_PANGO_INCLUDE_DIR}")
pkgconfig(cairo _CAIROIncDir _CAIROLinkDir _CAIROLinkFlags _CAIROCflags)
find_path(GTK2_CAIRO_INCLUDE_DIR
NAMES
cairo.h
PATHS
${_CAIROIncDir}
/opt/gnome/include/cairo
/usr/include
/usr/include/cairo
/opt/include
/opt/include/cairo
/sw/include
/sw/include/cairo
)
gtk2_debug_message("GTK2_CAIRO_INCLUDE_DIR is ${GTK2_CAIRO_INCLUDE_DIR}")
pkgconfig(atk _ATKIncDir _ATKLinkDir _ATKLinkFlags _ATKCflags)
find_path(GTK2_ATK_INCLUDE_DIR
NAMES
atk/atk.h
PATHS
${_ATKIncDir}
/opt/gnome/include/atk-1.0
/usr/include/atk-1.0
/opt/include/atk-1.0
/sw/include/atk-1.0
)
gtk2_debug_message("GTK2_ATK_INCLUDE_DIR is ${GTK2_ATK_INCLUDE_DIR}")
find_library(GTK2_GTK_LIBRARY
NAMES
gtk-x11-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTK_LIBRARY is ${GTK2_GTK_LIBRARY}")
find_library(GTK2_GDK_LIBRARY
NAMES
gdk-x11-2.0
PATHS
${_GDK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GDK_LIBRARY is ${GTK2_GDK_LIBRARY}")
find_library(GTK2_GDK_PIXBUF_LIBRARY
NAMES
gdk_pixbuf-2.0
PATHS
${_GDK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GDK_PIXBUF_LIBRARY is ${GTK2_GDK_PIXBUF_LIBRARY}")
find_library(GTK2_GMODULE_LIBRARY
NAMES
gmodule-2.0
PATHS
${_GMODULE2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GMODULE_LIBRARY is ${GTK2_GMODULE_LIBRARY}")
find_library(GTK2_GTHREAD_LIBRARY
NAMES
gthread-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTHREAD_LIBRARY is ${GTK2_GTHREAD_LIBRARY}")
find_library(GTK2_GOBJECT_LIBRARY
NAMES
gobject-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GOBJECT_LIBRARY is ${GTK2_GOBJECT_LIBRARY}")
find_library(GTK2_GLIB_LIBRARY
NAMES
glib-2.0
PATHS
${_GLIB2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GLIB_LIBRARY is ${GTK2_GLIB_LIBRARY}")
find_library(GTK2_GTKGL_LIBRARY
NAMES
gtkgl-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTKGL_LIBRARY is ${GTK2_GTKGL_LIBRARY}")
find_library(GTK2_GLADE_LIBRARY
NAMES
glade-2.0
PATHS
${_GLADELinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GLADE_LIBRARY is ${GTK2_GLADE_LIBRARY}")
find_library(GTK2_PANGO_LIBRARY
NAMES
pango-1.0
PATHS
${_PANGOLinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_PANGO_LIBRARY}")
find_library(GTK2_CAIRO_LIBRARY
NAMES
pangocairo-1.0
PATHS
${_CAIROLinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_CAIRO_LIBRARY}")
find_library(GTK2_ATK_LIBRARY
NAMES
atk-1.0
PATHS
${_ATKinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_ATK_LIBRARY is ${GTK2_ATK_LIBRARY}")
set(GTK2_INCLUDE_DIRS
${GTK2_GTK_INCLUDE_DIR}
${GTK2_GLIBCONFIG_INCLUDE_DIR}
${GTK2_GLIB_INCLUDE_DIR}
${GTK2_GDK_INCLUDE_DIR}
${GTK2_GDK_PIXBUF_INCLUDE_DIR}
${GTK2_GLADE_INCLUDE_DIR}
${GTK2_PANGO_INCLUDE_DIR}
${GTK2_CAIRO_INCLUDE_DIR}
${GTK2_ATK_INCLUDE_DIR}
)
if (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
if (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR AND GTK2_GDK_PIXBUF_INCLUDE_DIR)
if (GTK2_GMODULE_LIBRARY)
if (GTK2_GTHREAD_LIBRARY)
if (GTK2_GOBJECT_LIBRARY)
if (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
if (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
if (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
if (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
# set GTK2 libraries
set (GTK2_LIBRARIES
${GTK2_GTK_LIBRARY}
${GTK2_GDK_LIBRARY}
${GTK2_GDK_PIXBUF_LIBRARY}
${GTK2_GMODULE_LIBRARY}
${GTK2_GTHREAD_LIBRARY}
${GTK2_GOBJECT_LIBRARY}
${GTK2_GLADE_LIBRARY}
${GTK2_PANGO_LIBRARY}
${GTK2_CAIRO_LIBRARY}
${GTK2_ATK_LIBRARY}
)
# check for gtkgl support
if (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR)
set(GTK2_GTKGL_FOUND TRUE)
set(GTK2_INCLUDE_DIRS
${GTK2_INCLUDE_DIRS}
${GTK2_GTKGL_INCLUDE_DIR}
)
set(GTK2_LIBRARIES
${GTK2_LIBRARIES}
${GTK2_GTKGL_LIBRARY}
)
endif (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR)
else (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
message(SEND_ERROR "Could not find ATK")
endif (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
else (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
message(SEND_ERROR "Could not find CAIRO")
endif (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
else (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
message(SEND_ERROR "Could not find PANGO")
endif (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
else (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
message(SEND_ERROR "Could not find GLADE")
endif (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
else (GTK2_GOBJECT_LIBRARY)
message(SEND_ERROR "Could not find GOBJECT")
endif (GTK2_GOBJECT_LIBRARY)
else (GTK2_GTHREAD_LIBRARY)
message(SEND_ERROR "Could not find GTHREAD")
endif (GTK2_GTHREAD_LIBRARY)
else (GTK2_GMODULE_LIBRARY)
message(SEND_ERROR "Could not find GMODULE")
endif (GTK2_GMODULE_LIBRARY)
else (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR AND GTK2_GDK_PIXBUF_INCLUDE_DIR)
message(SEND_ERROR "Could not find GDK (GDK_PIXBUF)")
endif (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR AND GTK2_GDK_PIXBUF_INCLUDE_DIR)
else (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
message(SEND_ERROR "Could not find GTK2-X11")
endif (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
if (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
set(GTK2_FOUND TRUE)
endif (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
if (GTK2_FOUND)
if (NOT GTK2_FIND_QUIETLY)
message(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
endif (NOT GTK2_FIND_QUIETLY)
else (GTK2_FOUND)
if (GTK2_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GTK2")
endif (GTK2_FIND_REQUIRED)
endif (GTK2_FOUND)
# show the GTK2_INCLUDE_DIRS and GTK2_LIBRARIES variables only in the advanced view
mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES)
endif (UNIX)
endif (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
================================================
FILE: code/CMakeModules/FindIconv.cmake
================================================
# - Try to find Iconv
# Once done this will define
#
# ICONV_FOUND - system has Iconv
# ICONV_INCLUDE_DIR - the Iconv include directory
# ICONV_LIBRARIES - Link these to use Iconv
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
#
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
SET(ICONV_FIND_QUIETLY TRUE)
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h HINTS /sw/include/ PATHS /opt/local)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
IF(ICONV_FOUND)
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
check_c_source_compiles("
#include
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF(NOT ICONV_FIND_QUIETLY)
ELSE(ICONV_FOUND)
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_SECOND_ARGUMENT_IS_CONST
)
================================================
FILE: code/CMakeModules/FindJpeg.cmake
================================================
# - Locate Jpeg library
# This module defines
# JPEG_LIBRARY, the library to link against
# JPEG_FOUND, if false, do not try to link to JPEG
# JPEG_INCLUDE_DIR, where to find headers.
IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
# in cache already
SET(JPEG_FIND_QUIETLY TRUE)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
FIND_PATH(JPEG_INCLUDE_DIR
jpeglib.h
PATHS
$ENV{JPEG_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES jpeg
)
FIND_LIBRARY(JPEG_LIBRARY
NAMES jpeg libjpeg
PATHS
$ENV{JPEG_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
SET(JPEG_FOUND "YES")
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Found Jpeg: ${JPEG_LIBRARY}")
ENDIF(NOT JPEG_FIND_QUIETLY)
ELSE(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Jpeg!")
ENDIF(NOT JPEG_FIND_QUIETLY)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindLibEvent.cmake
================================================
# - Locate LibEvent library
# This module defines
# LIBEVENT_INCLUDE_DIRS - where to find libevent/libevent.h, etc.
# LIBEVENT_LIBRARIES - List of libraries when using libevent.
# LIBEVENT_FOUND - True if libevent found.
# LIBEVENT_VERSION_STRING - the version of libevent found (since CMake 2.8.8)
IF(LIBEVENT_LIBRARY AND LIBEVENT_INCLUDE_DIR)
# in cache already
SET(LIBEVENT_FIND_QUIETLY TRUE)
ENDIF(LIBEVENT_LIBRARY AND LIBEVENT_INCLUDE_DIR)
FIND_PATH(LIBEVENT_INCLUDE_DIR evutil.h
PATH_SUFFIXES libevent
$ENV{LIBEVENT_DIR}/include
/usr/local/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
/usr/local/include/libevent
/mingw/include
)
SET(LIBRARY_NAME_RELEASE libevent libevent.a)
SET(LIBRARY_NAME_DEBUG libevent libevent.a)
FIND_LIBRARY(LIBEVENT_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{LIBEVENT_DIR}/lib
/usr/local/lib
/usr/lib
/usr/lib64
/usr/local/X11R6/lib
/usr/local/lib/libevent
)
FIND_LIBRARY(LIBEVENT_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{LIBEVENT_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/lib/libevent
)
IF(NOT WIN32)
SET(LIBRARY_NAME_PTHREADS libevent_pthreads libevent_pthreads.a)
FIND_LIBRARY(PTHREADS_LIBRARIE_RELEASE
NAMES ${LIBRARY_NAME_PTHREADS}
PATHS
$ENV{LIBEVENT_DIR}/lib
/usr/local/lib
)
ADD_DEFINITIONS(-DEVENT__HAVE_PTHREADS)
ENDIF()
IF(LIBEVENT_INCLUDE_DIR)
IF(LIBEVENT_LIBRARY_RELEASE AND LIBEVENT_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(LIBEVENT_FOUND TRUE)
IF(WIN32)
SET(LIBEVENT_LIBRARY optimized ${LIBEVENT_LIBRARY_RELEASE} debug ${LIBEVENT_LIBRARY_DEBUG})
ELSE()
#SET(LIBEVENT_LIBRARY "${LIBEVENT_LIBRARY_RELEASE};${PTHREADS_LIBRARIE_RELEASE}" CACHE STRING "LibEvent Libraries")
SET(LIBEVENT_LIBRARY "${LIBEVENT_LIBRARY_RELEASE};${PTHREADS_LIBRARIE_RELEASE}")
ENDIF()
ELSEIF(LIBEVENT_LIBRARY_RELEASE)
# Normal case
SET(LIBEVENT_FOUND TRUE)
SET(LIBEVENT_LIBRARY ${LIBEVENT_LIBRARY_RELEASE})
ELSEIF(LIBEVENT_LIBRARY_DEBUG)
# Case where LibEvent is compiled from sources (debug version is compiled by default)
SET(LIBEVENT_FOUND TRUE)
SET(LIBEVENT_LIBRARY ${LIBEVENT_LIBRARY_DEBUG})
ENDIF(LIBEVENT_LIBRARY_RELEASE AND LIBEVENT_LIBRARY_DEBUG)
ENDIF(LIBEVENT_INCLUDE_DIR)
IF(LIBEVENT_FOUND)
IF(NOT LIBEVENT_FIND_QUIETLY)
MESSAGE(STATUS "Found LibEvent: ${LIBEVENT_INCLUDE_DIR} ${LIBEVENT_LIBRARY}")
ENDIF(NOT LIBEVENT_FIND_QUIETLY)
ELSE(LIBEVENT_FOUND)
IF(NOT LIBEVENT_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibEvent! INCLUDE: ${LIBEVENT_INCLUDE_DIR} LIB:${LIBEVENT_LIBRARY} ")
ENDIF(NOT LIBEVENT_FIND_QUIETLY)
ENDIF(LIBEVENT_FOUND)
MARK_AS_ADVANCED(LIBEVENT_LIBRARY_RELEASE LIBEVENT_LIBRARY_DEBUG)
# libevent_openssl
FIND_LIBRARY(LIBEVENT_OPENSSL_LIBRARY
NAMES libevent_openssl libevent_openssl.a
PATHS
$ENV{LIBEVENT_DIR}/lib
/usr/local/lib
/usr/lib
/usr/lib64
/usr/local/lib/libevent
)
ADD_DEFINITIONS(-DEVENT__HAVE_OPENSSL)
MESSAGE(STATUS "LIBEVENT_OPENSSL_LIBRARY: ${LIBEVENT_OPENSSL_LIBRARY}")
================================================
FILE: code/CMakeModules/FindLibOVR.cmake
================================================
# - Locate LibOVR library
# This module defines
# LIBOVR_LIBRARIES, the libraries to link against
# LIBOVR_FOUND, if false, do not try to link to LIBOVR
# LIBOVR_INCLUDE_DIR, where to find headers.
IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
# in cache already
SET(LIBOVR_FIND_QUIETLY TRUE)
ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
FIND_PATH(LIBOVR_INCLUDE_DIR
OVR.h
PATHS
$ENV{LIBOVR_DIR}/Include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
IF(UNIX)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64")
ELSE(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386")
ENDIF(TARGET_X64)
ELSEIF(APPLE)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release")
ELSEIF(WIN32)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64")
ELSE(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32")
ENDIF(TARGET_X64)
ENDIF(UNIX)
FIND_LIBRARY(LIBOVR_LIBRARY
NAMES ovr libovr
PATHS
$ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH}
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
SET(LIBOVR_FOUND "YES")
SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
IF(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
ELSE(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY})
ENDIF(UNIX)
ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibOVR!")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindLibVR.cmake
================================================
# - Locate LibVR library
# This module defines
# LIBVR_LIBRARIES, the libraries to link against
# LIBVR_FOUND, if false, do not try to link to LIBVR
# LIBVR_INCLUDE_DIR, where to find headers.
IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
# in cache already
SET(LIBVR_FIND_QUIETLY TRUE)
ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
FIND_PATH(LIBVR_INCLUDE_DIR hmd.h
PATH_SUFFIXES include/LibVR
)
FIND_LIBRARY(LIBVR_LIBRARY
NAMES vr
PATH_SUFFIXES lib
PATHS
)
IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}")
ENDIF(NOT LIBVR_FIND_QUIETLY)
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindLibwww.cmake
================================================
#
# Find the W3C libwww includes and library
#
# This module defines
# LIBWWW_INCLUDE_DIR, where to find tiff.h, etc.
# LIBWWW_LIBRARY, where to find the Libwww library.
# LIBWWW_FOUND, If false, do not try to use Libwww.
OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF)
# also defined, but not for general use are
IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
# in cache already
SET(Libwww_FIND_QUIETLY TRUE)
ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
FIND_PATH(LIBWWW_INCLUDE_DIR
WWWInit.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES libwww w3c-libwww
)
# when installing libwww on mac os x using macports the file wwwconf.h resides
# in /opt/local/include and not in the real libwww include dir :/
FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR
wwwconf.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# combine both include directories into one variable
IF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR})
ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
# helper to find all the libwww sub libraries
MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE)
IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
FIND_LIBRARY(${MYLIBRARY}_RELEASE
NAMES ${FILE}
PATHS
/usr/local/lib
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(${MYLIBRARY}_DEBUG
NAMES ${FILE}d
PATHS
/usr/local/lib
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSEIF(${MYLIBRARY}_RELEASE)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSEIF(${MYLIBRARY}_DEBUG)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32)
MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}")
ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32)
ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG)
ENDMACRO(FIND_WWW_LIBRARY)
MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL)
IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL})
ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
ENDMACRO(LINK_WWW_LIBRARY)
# Find and link required libs for static or dynamic
FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY REQUIRED wwwapp) # cache core file ftp gopher html http mime news stream telnet trans utils zip xml xmlparse
FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY REQUIRED wwwcore) # utils
FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY REQUIRED wwwfile) # core trans utils html
FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY REQUIRED wwwhtml) # core utils
FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY REQUIRED wwwhttp) # md5 core mime stream utils
FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY REQUIRED wwwmime) # core cache stream utils
# Required for static or if underlinking
FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY OPTIONAL wwwcache) # core trans utils
FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY OPTIONAL wwwstream) # core file utils
FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY REQUIRED wwwtrans) # core utils
FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY REQUIRED wwwutils)
# Required only if underlinking
# Unused protocols
FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY OPTIONAL wwwftp) # core file utils
FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY OPTIONAL wwwgopher) # core html utils file
FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY OPTIONAL wwwnews) # core html mime stream utils
FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY OPTIONAL wwwtelnet) # core utils
# Other used by app
FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY OPTIONAL wwwdir) # file
FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY OPTIONAL wwwinit) # app cache core file html utils
FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY OPTIONAL wwwmux) # core stream trans utils
FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY OPTIONAL wwwxml) # core utils xmlparse
FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY OPTIONAL wwwzip) # core utils
FIND_WWW_LIBRARY(LIBXMLPARSE_LIBRARY OPTIONAL xmlparse) # xmltok
# Other used by other
FIND_WWW_LIBRARY(LIBXMLTOK_LIBRARY OPTIONAL xmltok)
FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY OPTIONAL wwwssl)
FIND_WWW_LIBRARY(LIBMD5_LIBRARY OPTIONAL md5)
FIND_WWW_LIBRARY(LIBPICS_LIBRARY OPTIONAL pics)
# Other external libraries
FIND_PACKAGE(EXPAT QUIET)
FIND_PACKAGE(OpenSSL QUIET)
FIND_WWW_LIBRARY(LIBREGEX_LIBRARY OPTIONAL gnu_regex)
# Now link all libs together
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTLoadCache)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTCacheAppend)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWFTP_LIBRARY HTLoadFTP)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWGOPHER_LIBRARY HTLoadGopher)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWNEWS_LIBRARY HTLoadNews)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWTELNET_LIBRARY HTLoadTelnet)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTStreamToChunk)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTGuess_new)
LINK_WWW_LIBRARY(LIBWWWFILE_LIBRARY LIBWWWDIR_LIBRARY HTDir_new)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWINIT_LIBRARY HTProtocolInit)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWXML_LIBRARY HTXML_new)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWZIP_LIBRARY HTZLib_inflate)
# libwwwxml can be linked to xmlparse or expat
LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY LIBXMLPARSE_LIBRARY XML_ParserCreate)
IF(LIBXMLPARSE_LIBRARY_LINKED)
LINK_WWW_LIBRARY(LIBXMLPARSE_LIBRARY EXPAT_LIBRARY XmlInitEncoding)
ELSE(LIBXMLPARSE_LIBRARY_LINKED)
LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY EXPAT_LIBRARY XML_ParserCreate)
ENDIF(LIBXMLPARSE_LIBRARY_LINKED)
LINK_WWW_LIBRARY(LIBWWWHTTP_LIBRARY LIBMD5_LIBRARY MD5Init)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG
LIBWWW_LIBRARIES
LIBWWW_INCLUDE_DIR
)
================================================
FILE: code/CMakeModules/FindLua51.cmake
================================================
# Locate Lua library
# This module defines
# LUA51_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
/usr/lib/x86_64-linux-gnu
/usr/lib/arm-linux-gnueabihf
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
================================================
FILE: code/CMakeModules/FindLua52.cmake
================================================
# Locate Lua library
# This module defines
# LUA52_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua52 lua5.2 lua-5.2 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
================================================
FILE: code/CMakeModules/FindLua53.cmake
================================================
# Locate Lua library
# This module defines
# LUA51_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
PATH_SUFFIXES lua53
PATHS
/usr/local/include
~/Library/Frameworks
)
find_library(LUA_LIBRARY
NAMES lua53 liblua.a
PATH_SUFFIXES lib
PATHS
/usr/local/lib
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua53
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
================================================
FILE: code/CMakeModules/FindLuabind.cmake
================================================
# - Locate Luabind library
# This module defines
# LUABIND_LIBRARIES, the libraries to link against
# LUABIND_FOUND, if false, do not try to link to LUABIND
# LUABIND_INCLUDE_DIR, where to find headers.
MACRO(FIND_CORRECT_LUA_VERSION)
# Check Lua version linked to Luabind under Linux
IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
INCLUDE(CheckDepends)
SET(LUA52_LIBRARY "liblua5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
IF(NOT LUALIB_FOUND)
# fedora (v20)
SET(LUA52_LIBRARY "liblua-5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
ENDIF(NOT LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2")
FIND_PACKAGE(Lua52 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA51_LIBRARY "liblua5.1")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.1")
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA50_LIBRARY "liblua5.0")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.0")
FIND_PACKAGE(Lua50 REQUIRED)
ELSE(LUALIB_FOUND)
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
ENDIF(LUALIB_FOUND)
ENDIF(LUALIB_FOUND)
ENDIF(LUALIB_FOUND)
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
# TODO: find a way to detect Lua version
IF(WITH_LUA52)
FIND_PACKAGE(Lua52 REQUIRED)
ELSEIF(WITH_LUA51)
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(WITH_LUA52)
FIND_PACKAGE(Lua50 REQUIRED)
ENDIF(WITH_LUA52)
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
ENDMACRO(FIND_CORRECT_LUA_VERSION)
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
# in cache already
SET(Luabind_FIND_QUIETLY TRUE)
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
FIND_PATH(LUABIND_INCLUDE_DIR
luabind/luabind.hpp
PATHS
$ENV{LUABIND_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
SET(LIBRARY_NAME_RELEASE)
SET(LIBRARY_NAME_DEBUG)
IF(WITH_LUA52)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
ENDIF()
IF(WITH_LUA51)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
ENDIF()
IF(WITH_LUA50)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
ENDIF()
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
ENDIF(WITH_STLPORT)
# generic libraries names
LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
FIND_LIBRARY(LUABIND_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{LUABIND_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(LUABIND_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{LUABIND_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_PACKAGE(Boost REQUIRED)
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
ELSEIF(LUABIND_LIBRARY_RELEASE)
# Normal case
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
ELSEIF(LUABIND_LIBRARY_DEBUG)
# Case where Luabind is compiled from sources (debug version is compiled by default)
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
IF(LUABIND_FOUND)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
# Check if luabind/version.hpp exists
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
IF(LUABIND_VERSION_FILE)
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
ENDIF(LUABIND_VERSION_FILE)
FIND_CORRECT_LUA_VERSION()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT Luabind_FIND_QUIETLY)
ELSE(LUABIND_FOUND)
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Luabind!")
ENDIF(NOT Luabind_FIND_QUIETLY)
ENDIF(LUABIND_FOUND)
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)
================================================
FILE: code/CMakeModules/FindMSVC.cmake
================================================
# - Find MS Visual C++
#
# VC_INCLUDE_DIR - where to find headers
# VC_INCLUDE_DIRS - where to find headers
# VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found.
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND ON)
DETECT_EXPRESS_VERSION(${_VERSION})
IF(NOT MSVC_FIND_QUIETLY)
SET(_VERSION_STR ${_VERSION})
IF(MSVC_EXPRESS)
SET(_VERSION_STR "${_VERSION_STR} Express")
ENDIF(MSVC_EXPRESS)
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
ENDIF(NOT MSVC_FIND_QUIETLY)
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND OFF)
SET(VC${_VERSION}_DIR "")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_VC_VERSION_HELPER)
MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND)
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(VC${_VERSION}_FOUND)
ENDMACRO(DETECT_VC_VERSION)
MACRO(DETECT_EXPRESS_VERSION _VERSION)
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
SET(MSVC_EXPRESS ON)
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
ENDMACRO(DETECT_EXPRESS_VERSION)
IF(MSVC12)
DETECT_VC_VERSION("12.0")
SET(MSVC_TOOLSET "120")
IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC12_REDIST_DIR)
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
SET(MSVC_TOOLSET "110")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80")
ENDIF(MSVC12)
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR)
IF(NOT VC_DIR)
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(NOT VC_DIR)
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR})
================================================
FILE: code/CMakeModules/FindMercurial.cmake
================================================
# - Extract information from a subversion working copy
# The module defines the following variables:
# Mercurial_HG_EXECUTABLE - path to hg command line client
# Mercurial_VERSION_HG - version of hg command line client
# Mercurial_FOUND - true if the command line client was found
# MERCURIAL_FOUND - same as Mercurial_FOUND, set for compatiblity reasons
#
# The minimum required version of Mercurial can be specified using the
# standard syntax, e.g. FIND_PACKAGE(Mercurial 1.4)
#
# If the command line client executable is found two macros are defined:
# Mercurial_WC_INFO( )
# Mercurial_WC_LOG( )
# Mercurial_WC_INFO extracts information of a subversion working copy at
# a given location. This macro defines the following variables:
# _WC_URL - url of the repository (at )
# _WC_ROOT - root url of the repository
# _WC_REVISION - current revision
# _WC_LAST_CHANGED_AUTHOR - author of last commit
# _WC_LAST_CHANGED_DATE - date of last commit
# _WC_LAST_CHANGED_REV - revision of last commit
# _WC_INFO - output of command `hg info '
# Mercurial_WC_LOG retrieves the log message of the base revision of a
# subversion working copy at a given location. This macro defines the
# variable:
# _LAST_CHANGED_LOG - last log of base revision
# Example usage:
# FIND_PACKAGE(Mercurial)
# IF(MERCURIAL_FOUND)
# Mercurial_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
# ENDIF(MERCURIAL_FOUND)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
FIND_PROGRAM(Mercurial_HG_EXECUTABLE hg
DOC "mercurial command line client"
PATHS
/opt/local/bin
"C:/Program Files/TortoiseHg"
"C:/Program Files (x86)/TortoiseHg"
)
MARK_AS_ADVANCED(Mercurial_HG_EXECUTABLE)
IF(Mercurial_HG_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} --version
OUTPUT_VARIABLE Mercurial_VERSION_HG
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE ".*version ([\\.0-9]+).*"
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
MACRO(Mercurial_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Mercurial_hg_info_error
RESULT_VARIABLE Mercurial_hg_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0)
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
IF(_COUNT EQUAL 4)
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
ELSE(_COUNT EQUAL 4)
MESSAGE(STATUS "Bad output from HG")
SET(${prefix}_WC_REVISION "unknown")
SET(${prefix}_WC_CHANGESET "unknown")
SET(${prefix}_WC_BRANCH "unknown")
ENDIF(_COUNT EQUAL 4)
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
ENDMACRO(Mercurial_WC_INFO)
MACRO(Mercurial_WC_LOG dir prefix)
# This macro can block if the certificate is not signed:
# hg ask you to accept the certificate and wait for your answer
# This macro requires a hg server network access (Internet most of the time)
# and can also be slow since it access the hg server
EXECUTE_PROCESS(COMMAND
${Mercurial_HG_EXECUTABLE} --non-interactive log -r BASE ${dir}
OUTPUT_VARIABLE ${prefix}_LAST_CHANGED_LOG
ERROR_VARIABLE Mercurial_hg_log_error
RESULT_VARIABLE Mercurial_hg_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${Mercurial_hg_log_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}")
ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0)
ENDMACRO(Mercurial_WC_LOG)
ENDIF(Mercurial_HG_EXECUTABLE)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)
================================================
FILE: code/CMakeModules/FindMySQL.cmake
================================================
# - Find MySQL
# Find the MySQL includes and client library
# This module defines
# MYSQL_INCLUDE_DIR, where to find mysql.h
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
# MYSQL_FOUND, If false, do not try to use MySQL.
#
# Copyright (c) 2006, Jaroslaw Staniek,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql
/usr/include/mysql
/usr/local/include/mysql
/opt/local/include/mysql5/mysql
$ENV{ProgramFiles}/MySQL/*/include
$ENV{SystemDrive}/MySQL/*/include)
IF(WIN32 AND MSVC)
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysqlclient mysqlclient
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
ENDIF()
IF(MYSQL_INCLUDE_DIR)
IF(MYSQL_LIBRARY_RELEASE)
IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
ELSE()
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
ENDIF()
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF()
ENDIF()
ENDIF()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
ELSE()
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")
ENDIF()
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
ENDIF()
================================================
FILE: code/CMakeModules/FindMysqlConnector.cmake
================================================
# - Find MySQL
# Find the MySQL includes and client library
# This module defines
# MYSQL_INCLUDE_DIR, where to find mysql.h
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
# MYSQL_FOUND, If false, do not try to use MySQL.
#
# Copyright (c) 2006, Jaroslaw Staniek,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF(MYSQLCONNECTOR_INCLUDE_DIR AND MYSQLCONNECTOR_LIBRARIES)
SET(MYSQLCONNECTOR_FOUND TRUE)
ELSE(MYSQLCONNECTOR_INCLUDE_DIR AND MYSQLCONNECTOR_LIBRARIES)
FIND_PATH(MYSQLCONNECTOR_INCLUDE_DIR mysql_connection.h
PATH_SUFFIXES mysqlconnector
/usr/include/mysqlcppconn-static)
# mysqlcppconn-static.lib
IF(WIN32 AND MSVC)
FIND_LIBRARY(MYSQLCONNECTOR_STATIC_LIBRARY_RELEASE NAMES mysqlcppconn-static
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
FIND_LIBRARY(MYSQLCONNECTOR_STATIC_LIBRARY_DEBUG NAMES mysqlcppconn-static
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE(WIN32 AND MSVC)
FIND_LIBRARY(MYSQLCONNECTOR_STATIC_LIBRARY_RELEASE NAMES mysqlcppconn-static
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
FIND_LIBRARY(MYSQLCONNECTOR_STATIC_LIBRARY_DEBUG NAMES mysqlcppconn-static
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
ENDIF(WIN32 AND MSVC)
# mysqlcppconn.lib
IF(WIN32 AND MSVC)
FIND_LIBRARY(MYSQLCONNECTOR_LIBRARY_RELEASE NAMES "mysqlcppconn.lib"
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
FIND_LIBRARY(MYSQLCONNECTOR_LIBRARY_DEBUG NAMES "mysqlcppconn.lib"
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE(WIN32 AND MSVC)
FIND_LIBRARY(MYSQLCONNECTOR_LIBRARY_RELEASE NAMES "mysqlcppconn.lib"
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
FIND_LIBRARY(MYSQLCONNECTOR_LIBRARY_DEBUG NAMES "mysqlcppconn.lib"
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
ENDIF(WIN32 AND MSVC)
IF(MYSQLCONNECTOR_INCLUDE_DIR)
IF(MYSQLCONNECTOR_STATIC_LIBRARY_RELEASE AND MYSQLCONNECTOR_LIBRARY_RELEASE)
SET(MYSQLCONNECTOR_LIBRARIES optimized ${MYSQLCONNECTOR_STATIC_LIBRARY_RELEASE} ${MYSQLCONNECTOR_LIBRARY_RELEASE})
IF(MYSQLCONNECTOR_STATIC_LIBRARY_DEBUG AND MYSQLCONNECTOR_LIBRARY_DEBUG)
SET(MYSQLCONNECTOR_LIBRARIES ${MYSQLCONNECTOR_LIBRARIES} debug ${MYSQLCONNECTOR_STATIC_LIBRARY_DEBUG} ${MYSQLCONNECTOR_LIBRARY_DEBUG})
ENDIF(MYSQLCONNECTOR_STATIC_LIBRARY_DEBUG AND MYSQLCONNECTOR_LIBRARY_DEBUG)
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(MYSQLCONNECTOR_LIBRARIES ${MYSQLCONNECTOR_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
ENDIF(MYSQLCONNECTOR_STATIC_LIBRARY_RELEASE AND MYSQLCONNECTOR_LIBRARY_RELEASE)
ENDIF(MYSQLCONNECTOR_INCLUDE_DIR)
IF(MYSQLCONNECTOR_INCLUDE_DIR AND MYSQLCONNECTOR_LIBRARIES)
SET(MYSQLCONNECTOR_INCLUDE_DIR ${MYSQLCONNECTOR_INCLUDE_DIR})
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL Connector: ${MYSQLCONNECTOR_INCLUDE_DIR}, ${MYSQLCONNECTOR_LIBRARIES}")
ELSE(MYSQLCONNECTOR_INCLUDE_DIR AND MYSQLCONNECTOR_LIBRARIES)
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")
ENDIF(MYSQLCONNECTOR_INCLUDE_DIR AND MYSQLCONNECTOR_LIBRARIES)
MARK_AS_ADVANCED(MYSQLCONNECTOR_STATIC_LIBRARY_RELEASE MYSQLCONNECTOR_STATIC_LIBRARY_DEBUG MYSQLCONNECTOR_LIBRARY_RELEASE MYSQLCONNECTOR_LIBRARY_DEBUG)
ENDIF(MYSQLCONNECTOR_INCLUDE_DIR AND MYSQLCONNECTOR_LIBRARIES)
================================================
FILE: code/CMakeModules/FindOgg.cmake
================================================
# - Locate Ogg library
# This module defines
# OGG_LIBRARY, the library to link against
# OGG_FOUND, if false, do not try to link to OGG
# OGG_INCLUDE_DIR, where to find headers.
IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
# in cache already
SET(OGG_FIND_QUIETLY TRUE)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
FIND_PATH(OGG_INCLUDE_DIR
ogg/ogg.h
PATHS
$ENV{OGG_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
FIND_LIBRARY(OGG_LIBRARY
NAMES ogg libogg
PATHS
$ENV{OGG_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
SET(OGG_FOUND "YES")
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Found Ogg: ${OGG_LIBRARY}")
ENDIF(NOT OGG_FIND_QUIETLY)
ELSE(OGG_LIBRARY AND OGG_INCLUDE_DIR)
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Ogg!")
ENDIF(NOT OGG_FIND_QUIETLY)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindOpenGLES.cmake
================================================
# - Try to find OpenGL ES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGL ES
# OPENGLES_EGL_FOUND - system has EGL
# OPENGLES_LIBRARIES - Link these to use OpenGL ES and EGL
#
# If you want to use just GL ES you can use these values
# OPENGLES_GLES_LIBRARY - Path to OpenGL ES Library
# OPENGLES_EGL_LIBRARY - Path to EGL Library
FIND_LIBRARY(OPENGLES_GLES_LIBRARY
NAMES GLESv1_CM libGLESv1_CM gles_cm libgles_cm
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(OPENGLES_EGL_LIBRARY
NAMES EGL libEGL
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(OPENGLES_GLES_LIBRARY)
SET(OPENGLES_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_GLES_LIBRARY} ${OPENGLES_LIBRARIES})
IF(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES})
ELSE(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "NO")
ENDIF(OPENGLES_EGL_LIBRARY)
ENDIF(OPENGLES_GLES_LIBRARY)
================================================
FILE: code/CMakeModules/FindOpenSSL.cmake
================================================
# - Locate OpenSSL library
# This module defines
# OPENSSL_INCLUDE_DIRS - where to find openssl/ssl.h, etc.
# OPENSSL_LIBRARIES - List of libraries when using openssl.
# OPENSSL_FOUND - True if openssl found.
# OPENSSL_VERSION_STRING - the version of openssl found (since CMake 2.8.8)
IF(OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIR)
# in cache already
SET(OPENSSL_FIND_QUIETLY TRUE)
ENDIF(OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIR)
FIND_PATH(OPENSSL_INCLUDE_DIR ssl.h
PATH_SUFFIXES openssl
$ENV{OPENSSL_DIR}/include
/usr/local/include
/usr/local/include/openssl
)
SET(LIBRARY_NAME_RELEASE libssl libssl.a)
SET(LIBRARY_NAME_DEBUG libssl libssl.a)
FIND_LIBRARY(OPENSSL_LIBRARIE_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{OPENSSL_DIR}/lib
/usr/local/lib64
)
FIND_LIBRARY(OPENSSL_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{OPENSSL_DIR}/lib
/usr/local/lib64
)
SET(LIBRARY_NAME_CRYPTO libcrypto libcrypto.a)
FIND_LIBRARY(CRYPTO_LIBRARIE_RELEASE
NAMES ${LIBRARY_NAME_CRYPTO}
PATHS
$ENV{OPENSSL_DIR}/lib
/usr/local/lib64
)
IF(OPENSSL_INCLUDE_DIR)
IF(OPENSSL_LIBRARIE_RELEASE AND CRYPTO_LIBRARIE_RELEASE)
# Case where both Release and Debug versions are provided
SET(OPENSSL_FOUND TRUE)
#SET(OPENSSL_LIBRARIES optimized ${OPENSSL_LIBRARIE_RELEASE} debug ${OPENSSL_LIBRARY_DEBUG})
SET(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIE_RELEASE};${CRYPTO_LIBRARIE_RELEASE}" CACHE STRING "OpenSSL Libraries")
ENDIF(OPENSSL_LIBRARIE_RELEASE AND CRYPTO_LIBRARIE_RELEASE)
ENDIF(OPENSSL_INCLUDE_DIR)
IF(OPENSSL_FOUND)
IF(NOT OPENSSL_FIND_QUIETLY)
MESSAGE(STATUS "Found OpenSSL: ${OPENSSL_INCLUDE_DIR} ${OPENSSL_LIBRARIES}")
ENDIF(NOT OPENSSL_FIND_QUIETLY)
ELSE(OPENSSL_FOUND)
IF(NOT OPENSSL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find OpenSSL! INCLUDE: ${OPENSSL_INCLUDE_DIR} LIB:${OPENSSL_LIBRARIES} ")
ENDIF(NOT OPENSSL_FIND_QUIETLY)
ENDIF(OPENSSL_FOUND)
MARK_AS_ADVANCED(OPENSSL_LIBRARIE_RELEASE OPENSSL_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindPBC.cmake
================================================
# - Locate PBC library
# This module defines
# PBC_INCLUDE_DIRS - where to find pbc/pbc.h, etc.
# PBC_LIBRARIES - List of libraries when using pbc.
# PBC_FOUND - True if pbc found.
# PBC_VERSION_STRING - the version of pbc found (since CMake 2.8.8)
FIND_PATH(PBC_INCLUDE_DIR pbc.h
PATH_SUFFIXES pbc
$ENV{PBC_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
/usr/local/include/pbc
/mingw/include
)
SET(LIBRARY_NAME_RELEASE pbc)
SET(LIBRARY_NAME_DEBUG pbc)
FIND_LIBRARY(PBC_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{PBC_DIR}/lib
/usr/local/lib
/usr/lib
/usr/lib64
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/pbc
/mingw/lib
)
FIND_LIBRARY(PBC_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{PBC_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/pbc
/mingw/lib
)
IF(PBC_INCLUDE_DIR)
IF(PBC_LIBRARY_RELEASE AND PBC_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(PBC_FOUND TRUE)
SET(PBC_LIBRARY optimized ${PBC_LIBRARY_RELEASE} debug ${PBC_LIBRARY_DEBUG})
ELSEIF(PBC_LIBRARY_RELEASE)
# Normal case
SET(PBC_FOUND TRUE)
SET(PBC_LIBRARY ${PBC_LIBRARY_RELEASE})
ELSEIF(PBC_LIBRARY_DEBUG)
# Case where PBC is compiled from sources (debug version is compiled by default)
SET(PBC_FOUND TRUE)
SET(PBC_LIBRARY ${PBC_LIBRARY_DEBUG})
ENDIF(PBC_LIBRARY_RELEASE AND PBC_LIBRARY_DEBUG)
ENDIF(PBC_INCLUDE_DIR)
IF(PBC_FOUND)
MESSAGE(STATUS "Found PBC: ${PBC_INCLUDE_DIR} ${PBC_LIBRARY}")
ELSE(PBC_FOUND)
MESSAGE(STATUS "Warning: Unable to find PBC! INCLUDE: ${PBC_INCLUDE_DIR} LIB:${PBC_LIBRARY} ")
ENDIF(PBC_FOUND)
MARK_AS_ADVANCED(PBC_LIBRARY_RELEASE PBC_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindProtoBuf.cmake
================================================
# - Locate ProtoBuf library
# This module defines
# PROTOBUF_LIBRARIES, the libraries to link against
# PROTOBUF_FOUND, if false, do not try to link to PROTO_BUF
# PROTOBUF_INCLUDE_DIR, where to find headers.
IF(PROTOBUF_LIBRARIES AND PROTOBUF_INCLUDE_DIR)
# in cache already
SET(PROTOBUF_FIND_QUIETLY TRUE)
ENDIF(PROTOBUF_LIBRARIES AND PROTOBUF_INCLUDE_DIR)
FIND_PATH(PROTOBUF_INCLUDE_DIR generated_message_util.h
PATH_SUFFIXES google/protobuf
$ENV{PROTOBUF_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
/usr/local/include/google/protobuf
/usr/local/include/google-protobuf
)
SET(LIBRARY_NAME_RELEASE protobuf libprotobuf)
SET(LIBRARY_NAME_DEBUG protobufd libprotobufd)
IF(WITH_STLPORT AND WIN32)
SET(LIBRARY_NAME_RELEASE libprotobuf_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG libprotobuf_stlportd ${LIBRARY_NAME_RELEASE})
ENDIF(WITH_STLPORT AND WIN32)
SET(PROTOBUF_LIBRARY_RELEASE NOTFOUND)
SET(PROTOBUF_LIBRARY_DEBUG NOTFOUND)
FIND_LIBRARY(PROTOBUF_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{PROTOBUF_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/google-protobuf
)
FIND_LIBRARY(PROTOBUF_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{PROTOBUF_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/google-protobuf
)
IF(PROTOBUF_INCLUDE_DIR)
IF(PROTOBUF_LIBRARY_RELEASE AND PROTOBUF_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(PROTOBUF_FOUND TRUE)
SET(PROTOBUF_LIBRARIES optimized ${PROTOBUF_LIBRARY_RELEASE} debug ${PROTOBUF_LIBRARY_DEBUG})
ELSEIF(PROTOBUF_LIBRARY_RELEASE)
# Normal case
SET(PROTOBUF_FOUND TRUE)
SET(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY_RELEASE})
ELSEIF(PROTOBUF_LIBRARY_DEBUG)
# Case where ProtoBuf is compiled from sources (debug version is compiled by default)
SET(PROTOBUF_FOUND TRUE)
SET(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY_DEBUG})
ENDIF(PROTOBUF_LIBRARY_RELEASE AND PROTOBUF_LIBRARY_DEBUG)
ENDIF(PROTOBUF_INCLUDE_DIR)
IF(PROTOBUF_FOUND)
IF(NOT PROTOBUF_FIND_QUIETLY)
MESSAGE(STATUS "Found ProtoBuf: ${PROTOBUF_INCLUDE_DIR} ${PROTOBUF_LIBRARIES}")
ENDIF(NOT PROTOBUF_FIND_QUIETLY)
ELSE(PROTOBUF_FOUND)
IF(NOT PROTOBUF_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ProtoBuf!")
ENDIF(NOT PROTOBUF_FIND_QUIETLY)
ENDIF(PROTOBUF_FOUND)
MARK_AS_ADVANCED(PROTOBUF_LIBRARY_RELEASE PROTOBUF_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindS3TC.cmake
================================================
# - Locate S3TC library
# This module defines
# S3TC_LIBRARY, the library to link against
# S3TC_FOUND, if false, do not try to link to S3TC
# S3TC_INCLUDE_DIR, where to find headers.
IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
# in cache already
SET(S3TC_FIND_QUIETLY TRUE)
ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
FIND_PATH(S3TC_INCLUDE_DIR
s3_intrf.h
PATHS
$ENV{S3TC_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES S3TC
)
FIND_LIBRARY(S3TC_LIBRARY
NAMES s3tc libs3tc
PATHS
$ENV{S3TC_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
SET(S3TC_FOUND "YES")
IF(NOT S3TC_FIND_QUIETLY)
MESSAGE(STATUS "Found S3TC: ${S3TC_LIBRARY}")
ENDIF(NOT S3TC_FIND_QUIETLY)
ELSE(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
IF(NOT S3TC_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find S3TC!")
ENDIF(NOT S3TC_FIND_QUIETLY)
ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindSTLport.cmake
================================================
# Look for a directory containing STLport.
#
# The following values are defined
# STLPORT_INCLUDE_DIR - where to find vector, etc.
# STLPORT_LIBRARIES - link against these to use STLport
# STLPORT_FOUND - True if the STLport is available.
# also defined, but not for general use are
IF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
# in cache already
SET(STLPORT_FIND_QUIETLY TRUE)
ENDIF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
FIND_PATH(STLPORT_INCLUDE_DIR
iostream
PATHS
/usr/local/include/stlport
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES stlport
)
FIND_LIBRARY(STLPORT_LIBRARY_DEBUG
NAMES
stlport_cygwin_debug
stlport_cygwin_stldebug
stlport_gcc_debug
stlport_gcc_stldebug
stlportstld_x
stlportstld_x.5.2
stlportd
stlportd.5.2
stlportd_statix
stlportd_static
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(STLPORT_LIBRARY_RELEASE
NAMES
stlport_cygwin
stlport_gcc
stlport
stlport_x
stlport_x.5.2
stlport.5.2
stlport_statix
stlport_static
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(STLPORT_INCLUDE_DIR)
IF(STLPORT_LIBRARY_RELEASE)
SET(STLPORT_FOUND TRUE)
SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE})
IF(STLPORT_LIBRARY_DEBUG)
SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG})
ENDIF(STLPORT_LIBRARY_DEBUG)
ENDIF(STLPORT_LIBRARY_RELEASE)
ENDIF(STLPORT_INCLUDE_DIR)
IF(STLPORT_FOUND)
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Found STLport: ${STLPORT_INCLUDE_DIR} ${STLPORT_LIBRARIES}")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ELSE(STLPORT_FOUND)
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find STLport!")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ENDIF(STLPORT_FOUND)
MARK_AS_ADVANCED(STLPORT_LIBRARY_RELEASE STLPORT_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindSquish.cmake
================================================
#
# Find the LibSquish includes and library
#
# This module defines
# SQUISH_INCLUDE_DIR, where to find squish.h
# SQUISH_LIBRARIES, where to find the Squish libraries.
# SQUISH_FOUND, If false, do not try to use Squish.
# also defined, but not for general use are
IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
# in cache already
SET(SQUISH_FIND_QUIETLY TRUE)
ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
FIND_PATH(SQUISH_INCLUDE_DIR
squish.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cppunit
)
FIND_LIBRARY(SQUISH_LIBRARY_RELEASE
squish
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(SQUISH_LIBRARY_DEBUG
squishd
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(SQUISH_INCLUDE_DIR)
IF(SQUISH_LIBRARY_RELEASE)
SET(SQUISH_FOUND "YES")
SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}")
IF(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}")
ELSE(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}")
MESSAGE("Debug Squish NOT found, using the release version!")
ENDIF(SQUISH_LIBRARY_DEBUG)
ENDIF(SQUISH_LIBRARY_RELEASE)
ENDIF(SQUISH_INCLUDE_DIR)
IF(SQUISH_FOUND)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}")
ENDIF(NOT SQUISH_FIND_QUIETLY)
FILE(STRINGS ${SQUISH_INCLUDE_DIR}/squish.h METRIC REGEX "metric = 0")
IF(METRIC)
SET(SQUISH_COMPRESS_HAS_METRIC ON)
SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC)
ENDIF(METRIC)
ELSE(SQUISH_FOUND)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Squish!")
ENDIF(NOT SQUISH_FIND_QUIETLY)
ENDIF(SQUISH_FOUND)
MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindTinyXml.cmake
================================================
# - Locate TinyXml library
# This module defines
# TINYXML_LIBRARIES, the libraries to link against
# TINYXML_FOUND, if false, do not try to link to TINYXML
# TINYXML_INCLUDE_DIR, where to find headers.
IF(TINYXML_LIBRARIES AND TINYXML_INCLUDE_DIR)
# in cache already
SET(TINYXML_FIND_QUIETLY TRUE)
ENDIF(TINYXML_LIBRARIES AND TINYXML_INCLUDE_DIR)
FIND_PATH(TINYXML_INCLUDE_DIR tinyxml.h
PATH_SUFFIXES tinyxml
$ENV{TINYXML_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
SET(LIBRARY_NAME_RELEASE tinyxml libtinyxml)
SET(LIBRARY_NAME_DEBUG tinyxml_d tinyxmld libtinyxml_d libtinyxmld)
FIND_LIBRARY(TINYXML_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{TINYXML_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(TINYXML_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{TINYXML_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(TINYXML_INCLUDE_DIR)
IF(TINYXML_LIBRARY_RELEASE AND TINYXML_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(TINYXML_FOUND TRUE)
SET(TINYXML_LIBRARIES optimized ${TINYXML_LIBRARY_RELEASE} debug ${TINYXML_LIBRARY_DEBUG})
ELSEIF(TINYXML_LIBRARY_RELEASE)
# Normal case
SET(TINYXML_FOUND TRUE)
SET(TINYXML_LIBRARIES ${TINYXML_LIBRARY_RELEASE})
ELSEIF(TINYXML_LIBRARY_DEBUG)
# Case where TinyXml is compiled from sources (debug version is compiled by default)
SET(TINYXML_FOUND TRUE)
SET(TINYXML_LIBRARIES ${TINYXML_LIBRARY_DEBUG})
ENDIF(TINYXML_LIBRARY_RELEASE AND TINYXML_LIBRARY_DEBUG)
ENDIF(TINYXML_INCLUDE_DIR)
IF(TINYXML_FOUND)
IF(NOT TINYXML_FIND_QUIETLY)
MESSAGE(STATUS "Found TinyXml: ${TINYXML_INCLUDE_DIR} ${TINYXML_LIBRARIES}")
ENDIF(NOT TINYXML_FIND_QUIETLY)
ELSE(TINYXML_FOUND)
IF(NOT TINYXML_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find TinyXml!")
ENDIF(NOT TINYXML_FIND_QUIETLY)
ENDIF(TINYXML_FOUND)
MARK_AS_ADVANCED(TINYXML_LIBRARY_RELEASE TINYXML_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindToLua.cmake
================================================
# - Locate ToLua library
# This module defines
# TOLUA_LIBRARIES, the libraries to link against
# TOLUA_FOUND, if false, do not try to link to TOLUA
# TOLUA_INCLUDE_DIR, where to find headers.
IF(TOLUA_LIBRARIES AND TOLUA_INCLUDE_DIR)
# in cache already
SET(TOLUA_FIND_QUIETLY TRUE)
ENDIF(TOLUA_LIBRARIES AND TOLUA_INCLUDE_DIR)
FIND_PACKAGE(Lua51 REQUIRED)
FIND_PATH(TOLUA_INCLUDE_DIR tolua++.h
PATH_SUFFIXES tolua lua51
$ENV{TOLUA_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
/usr/local/include/lua51
/mingw/include
)
SET(LIBRARY_NAME_RELEASE tolua++5.1 libtolua++.a libtolua++5.1.a libtolua++.so)
SET(LIBRARY_NAME_DEBUG tolua++5.1 libtolua++.a libtolua++5.1.a libtolua++.so)
FIND_LIBRARY(TOLUA_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS
$ENV{TOLUA_DIR}/lib
/usr/local/lib
/usr/lib
/usr/lib64
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/lua51
/mingw/lib
)
FIND_LIBRARY(TOLUA_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{TOLUA_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/lib/lua51
/mingw/lib
)
IF(TOLUA_INCLUDE_DIR)
IF(TOLUA_LIBRARY_RELEASE AND TOLUA_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(TOLUA_FOUND TRUE)
SET(TOLUA_LIBRARIES optimized ${TOLUA_LIBRARY_RELEASE} debug ${TOLUA_LIBRARY_DEBUG})
ELSEIF(TOLUA_LIBRARY_RELEASE)
# Normal case
SET(TOLUA_FOUND TRUE)
SET(TOLUA_LIBRARIES ${TOLUA_LIBRARY_RELEASE})
ELSEIF(TOLUA_LIBRARY_DEBUG)
# Case where ToLua is compiled from sources (debug version is compiled by default)
SET(TOLUA_FOUND TRUE)
SET(TOLUA_LIBRARIES ${TOLUA_LIBRARY_DEBUG})
ENDIF(TOLUA_LIBRARY_RELEASE AND TOLUA_LIBRARY_DEBUG)
ENDIF(TOLUA_INCLUDE_DIR)
IF(TOLUA_FOUND)
IF(NOT TOLUA_FIND_QUIETLY)
MESSAGE(STATUS "Found ToLua: ${TOLUA_INCLUDE_DIR} ${TOLUA_LIBRARIES}")
ENDIF(NOT TOLUA_FIND_QUIETLY)
ELSE(TOLUA_FOUND)
IF(NOT TOLUA_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ToLua! INCLUDE: ${TOLUA_INCLUDE_DIR} LIB:${TOLUA_LIBRARIES} ")
ENDIF(NOT TOLUA_FIND_QUIETLY)
ENDIF(TOLUA_FOUND)
MARK_AS_ADVANCED(TOLUA_LIBRARY_RELEASE TOLUA_LIBRARY_DEBUG)
================================================
FILE: code/CMakeModules/FindVorbis.cmake
================================================
# - Locate Vorbis library
# This module defines
# VORBIS_LIBRARY, the library to link against
# VORBIS_FOUND, if false, do not try to link to VORBIS
# VORBIS_INCLUDE_DIR, where to find headers.
IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
# in cache already
SET(VORBIS_FIND_QUIETLY TRUE)
ENDIF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
FIND_PATH(VORBIS_INCLUDE_DIR
vorbis/vorbisfile.h
PATHS
$ENV{VORBIS_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
FIND_LIBRARY(VORBIS_LIBRARY
NAMES vorbis libvorbis
PATHS
$ENV{VORBIS_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(VORBISFILE_LIBRARY
NAMES vorbisfile libvorbisfile
PATHS
$ENV{VORBIS_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
SET(VORBIS_FOUND "YES")
SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
IF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Found Vorbis: ${VORBIS_LIBRARY}")
ENDIF(NOT VORBIS_FIND_QUIETLY)
ELSE(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
IF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Vorbis!")
ENDIF(NOT VORBIS_FIND_QUIETLY)
ENDIF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/FindWindowsSDK.cmake
================================================
# - Find Windows Platform SDK
# Find the Windows includes
#
# WINSDK_INCLUDE_DIR - where to find Windows.h
# WINSDK_INCLUDE_DIRS - where to find all Windows headers
# WINSDK_LIBRARY_DIR - where to find libraries
# WINSDK_FOUND - True if Windows SDK found.
IF(WINSDK_FOUND)
# If Windows SDK already found, skip it
RETURN()
ENDIF()
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry" AND EXISTS "${WINSDK${_VERSION}_DIR}/Include")
SET(WINSDK${_VERSION}_FOUND ON)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_VERSION_FULL "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};ProductVersion]" NAME)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF()
ELSE()
SET(WINSDK${_VERSION}_DIR "")
ENDIF()
ENDMACRO()
MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot${_SUFFIX}]" ABSOLUTE)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_FOUND ON)
SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}")
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows Kit ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF()
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ELSE()
SET(WINSDK${_VERSION}_DIR "")
ENDIF()
ENDMACRO()
MACRO(DETECT_WINSDK_VERSION _VERSION)
SET(WINSDK${_VERSION}_FOUND OFF)
DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT WINSDK${_VERSION}_FOUND)
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF()
ENDMACRO()
SET(WINSDK_DETECTED_VERSIONS)
# Fixed versions for Windows Kits (VC++ from 2012)
DETECT_WINKIT_VERSION("10.0" "10")
DETECT_WINKIT_VERSION("8.1" "81")
DETECT_WINKIT_VERSION("8.0" "")
# For VC++ up to 2010
SET(WINSDK_VERSIONS "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
# Search all supported Windows SDKs
FOREACH(_VERSION ${WINSDK_VERSIONS})
DETECT_WINSDK_VERSION(${_VERSION})
IF(WINSDK${_VERSION}_FOUND)
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ENDIF()
ENDFOREACH()
SET(WINSDK_SUFFIXES)
IF(TARGET_ARM64)
SET(WINSDK8_SUFFIX "arm64")
ELSEIF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
SET(WINSDK_SUFFIXES "x64" "amd64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF()
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
IF(WINSDKCURRENT_VERSION_INCLUDE)
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
ENDIF()
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF()
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
FIND_FILE(_MSI_FILE Msi.h
PATHS
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
IF(_MSI_FILE)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 8.1
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINBLUE")
IF(_CONTENT)
SET(WINSDK_VERSION "8.1")
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
IF(_CONTENT)
SET(WINSDK_VERSION "8.0")
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 7.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7")
IF(_CONTENT)
FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h
PATHS
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
IF(_WINSDKVER_FILE)
# Load WinSDKVer.h content
FILE(STRINGS ${_WINSDKVER_FILE} _CONTENT REGEX "^#define NTDDI_MAXVER")
# Get NTDDI_MAXVER value
STRING(REGEX REPLACE "^.*0x([0-9A-Fa-f]+).*$" "\\1" _WINSDKVER "${_CONTENT}")
# In Windows SDK 7.1, NTDDI_MAXVER is wrong
IF(_WINSDKVER STREQUAL "06010000")
SET(WINSDK_VERSION "7.1")
ELSEIF(_WINSDKVER STREQUAL "0601")
SET(WINSDK_VERSION "7.0A")
ELSE()
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
ENDIF()
ELSE()
SET(WINSDK_VERSION "7.0")
ENDIF()
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 6.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA")
IF(_CONTENT)
SET(WINSDK_VERSION "6.0")
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.2
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WS03SP1")
IF(_CONTENT)
SET(WINSDK_VERSION "5.2")
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.1
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINXP")
IF(_CONTENT)
SET(WINSDK_VERSION "5.1")
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN2K")
IF(_CONTENT)
SET(WINSDK_VERSION "5.0")
ENDIF()
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
ENDIF()
ENDIF()
ENDMACRO()
MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_DIR "")
SET(WINSDK_VERSION "")
SET(WINSDK_VERSION_FULL "")
# Use WINSDK environment variable
IF(WINSDKENV_DIR)
FIND_PATH(WINSDK_DIR Windows.h
HINTS
${WINSDKENV_DIR}/Include/um
${WINSDKENV_DIR}/Include
)
ENDIF()
# Use INCLUDE environment variable
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
FOREACH(_INCLUDE ${WINSDKCURRENT_VERSION_INCLUDE})
FILE(TO_CMAKE_PATH ${_INCLUDE} _INCLUDE)
# Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
IF(WINSDK_DIR)
# Compare WINSDK_DIR with registered Windows SDKs
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
IF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
SET(WINSDK_VERSION ${_VERSION})
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
BREAK()
ENDIF()
ENDFOREACH()
FIND_WINSDK_VERSION_HEADERS()
ENDIF()
IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible
IF(MSVC_VERSION GREATER 1909)
# Special case, use Kits for SDK
SET(WINSDK_VERSION "10.0")
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
ELSEIF(MSVC14)
SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC12)
SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC11)
SET(WINSDK_VERSION "8.0")
ELSEIF(MSVC10)
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "7.0A")
ENDIF()
ELSEIF(MSVC90)
IF(NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "6.0A")
ENDIF()
ELSEIF(MSVC80)
SET(WINSDK_MSVC80_COMPATIBLES "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A" "5.2A")
# look for each Windows SDK supported by VC++ 2005 (7.1 is the latest)
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
# look if this version of Windows SDK is installed
LIST(FIND WINSDK_MSVC80_COMPATIBLES ${_VERSION} _FOUND)
IF(NOT _FOUND EQUAL -1)
SET(WINSDK_VERSION "${_VERSION}")
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT MSVC_EXPRESS AND NOT WINSDK_VERSION)
SET(WINSDK_VERSION "5.2A")
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
ENDIF()
# Use installed Windows SDK
IF(NOT WINSDK_VERSION)
IF(WINSDK8.1_FOUND)
SET(WINSDK_VERSION "8.1")
ELSEIF(WINSDK8.0_FOUND)
SET(WINSDK_VERSION "8.0")
ELSEIF(WINSDK7.1_FOUND)
SET(WINSDK_VERSION "7.1")
ELSEIF(WINSDK7.0_FOUND)
SET(WINSDK_VERSION "7.0")
ELSEIF(WINSDK6.1_FOUND)
SET(WINSDK_VERSION "6.1")
ELSEIF(WINSDK6.0_FOUND)
SET(WINSDK_VERSION "6.0")
ELSE()
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
ENDIF()
ENDIF()
# Look for correct registered Windows SDK version
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
IF(WINSDK_VERSION STREQUAL _VERSION)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
ENDMACRO()
IF(MSVC14)
# Under VC++ 2015 and 2017, stdio.h, stdlib.h, etc... are part of UCRT
SET(WINSDK_UCRT_VERSION "10.0")
ENDIF()
# Look for correct UCRT
IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND)
SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}")
ENDIF()
IF(WINSDK_UCRT_DIR)
# determine exact UCRT version
SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include)
SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib)
FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*)
SET(UCRT_VERSION)
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS})
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION)
SET(UCRT_VERSION ${UCRT_SUBDIR})
ENDIF()
ENDFOREACH()
IF(UCRT_VERSION)
MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}")
SET(WINSDK10_INCLUDE_DIR ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION})
SET(WINSDK10_LIBRARY_DIR ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION})
# directory where UCRT headers are found
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
HINTS
${WINSDK10_INCLUDE_DIR}/ucrt
)
# directory where UCRT libraries are found
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
HINTS
${WINSDK10_LIBRARY_DIR}/ucrt/${WINSDK8_SUFFIX}
)
ENDIF()
ENDIF()
IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK()
ELSE()
IF(WINSDK${WINSDK_VERSION}_FOUND)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
ELSE()
USE_CURRENT_WINSDK()
ENDIF()
ENDIF()
IF(WINSDK_DIR)
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
ENDIF()
# directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/um
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}")
# directory where WinRT headers are found
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt
${WINSDK_DIR}/Include/winrt
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}")
# directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/shared
${WINSDK_DIR}/Include/shared
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}")
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_INCLUDE_DIR}/gl
${WINSDK_DIR}/Include/um/gl
${WINSDK_DIR}/Include/gl
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}")
SET(WINSDK_LIBRARY_DIRS
${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
)
IF(WINSDK_SUFFIXES)
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX})
ENDFOREACH()
ELSE()
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib)
ENDIF()
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
${WINSDK_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_DIR}")
SET(WINSDK_BINARY_DIRS
${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
# signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS
${WINSDK_BINARY_DIRS}
NO_DEFAULT_PATH
)
# midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl
HINTS
${WINSDK_BINARY_DIRS}
NO_DEFAULT_PATH
)
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND ON)
IF(WINSDK_UCRT_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_UCRT_INCLUDE_DIR})
ENDIF()
IF(WINSDK_SHARED_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_SHARED_INCLUDE_DIR})
ENDIF()
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_INCLUDE_DIR})
IF(WINSDK_OPENGL_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_OPENGL_INCLUDE_DIR})
ENDIF()
IF(WINSDK_WINRT_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR})
ENDIF()
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
IF(WINSDK_UCRT_LIBRARY_DIR)
SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
ENDIF()
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
# Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013, 2015 and 2017
IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14))
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
ENDIF()
ELSE()
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
ENDIF()
ENDIF()
================================================
FILE: code/CMakeModules/FindXF86VidMode.cmake
================================================
# - Locate Jpeg library
# This module defines
# XF86VidMode_LIBRARY, the library to link against
# XF86VidMode_FOUND, if false, do not try to link to XF86VidMode
# XF86VidMode_INCLUDE_DIR, where to find headers.
IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
# in cache already
SET(XF86VidMode_FIND_QUIETLY TRUE)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
FIND_PATH(XF86VidMode_INCLUDE_DIR
xf86vmode.h
PATHS
$ENV{XF86VidMode_DIR}/include
/usr/include/X11/
/usr/X11R6/include/
PATH_SUFFIXES extensions
)
FIND_LIBRARY(XF86VidMode_LIBRARY
Xxf86vm
PATHS
$ENV{XF86VidMode_DIR}/lib
/usr/X11R6/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
SET(XF86VidMode_FOUND "YES")
SET(XF86VidMode_DEFINITIONS -DXF86VIDMODE)
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Found XF86VidMode: ${XF86VidMode_LIBRARY}")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ELSE(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find XF86VidMode!")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
================================================
FILE: code/CMakeModules/GetRevision.cmake
================================================
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory)
# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt)
IF(SOURCE_DIR)
# Replace spaces by semi-columns
IF(CMAKE_MODULE_PATH)
STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
ENDIF(CMAKE_MODULE_PATH)
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
IF(NOT ROOT_DIR AND SOURCE_DIR)
SET(ROOT_DIR ${SOURCE_DIR})
ENDIF()
IF(NOT SOURCE_DIR AND ROOT_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF()
ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF()
MACRO(NOW RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF()
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE()
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF()
ENDMACRO(NOW)
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion QUIET)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND)
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF(TORTOISESVN_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
IF(EXISTS "${ROOT_DIR}/.hg/")
FIND_PACKAGE(Mercurial)
IF(MERCURIAL_FOUND)
Mercurial_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
SET(CHANGESET ${ER_WC_CHANGESET})
SET(BRANCH ${ER_WC_BRANCH})
ENDIF()
ENDIF()
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
SET(REVISION_FILE ${SOURCE_DIR}/revision)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF()
ENDIF()
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF()
ENDIF()
================================================
FILE: code/CMakeModules/PCHSupport.cmake
================================================
# - Try to find precompiled headers support for GCC 3.4 and 4.x (and MSVC)
# Once done this will define:
#
# Variable:
# PCHSupport_FOUND
#
# ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp
# ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use
# ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp
IF(MSVC)
SET(PCHSupport_FOUND TRUE)
ELSE(MSVC)
IF(CMAKE_COMPILER_IS_GNUCXX)
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
OUTPUT_VARIABLE gcc_compiler_version)
IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
SET(PCHSupport_FOUND FALSE)
ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?")
SET(PCHSupport_FOUND TRUE)
ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
# TODO: make tests for other compilers than GCC
SET(PCHSupport_FOUND TRUE)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(MSVC)
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
MACRO(PCH_SET_COMPILE_FLAGS _target)
SET(PCH_FLAGS)
SET(PCH_ARCHS)
SET(_FLAGS)
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
IF(_pic)
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
ENDIF(_pic)
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
LIST(APPEND _FLAGS " ${oldProps}")
ENDIF(oldProps)
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild)
LIST(APPEND _FLAGS " ${oldPropsBuild}")
ENDIF(oldPropsBuild)
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
ENDIF(DIRINC)
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
LIST(APPEND _FLAGS " ${_directory_flags}")
LIST(APPEND _FLAGS " ${_directory_definitions}")
# Format definitions
IF(MSVC)
# Fix path with space
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
ELSE(MSVC)
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
ENDIF(MSVC)
IF(CLANG)
# Determining all architectures and get common flags
SET(_ARCH_NEXT)
SET(_XARCH_NEXT)
FOREACH(item ${_FLAGS})
IF(_ARCH_NEXT)
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
IF(ITEM_FOUND EQUAL -1)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF(ITEM_FOUND EQUAL -1)
SET(_ARCH_NEXT OFF)
ELSEIF(_XARCH_NEXT)
SET(_XARCH_NEXT OFF)
ELSE(_ARCH_NEXT)
IF(item MATCHES "^-arch")
SET(_ARCH_NEXT ON)
ELSEIF(item MATCHES "^-Xarch_")
STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item})
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
IF(ITEM_FOUND EQUAL -1)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF(ITEM_FOUND EQUAL -1)
SET(_XARCH_NEXT ON)
ELSE(item MATCHES "^-arch")
LIST(APPEND PCH_FLAGS ${item})
ENDIF(item MATCHES "^-arch")
ENDIF(_ARCH_NEXT)
ENDFOREACH(item)
# Get architcture specific flags
SET(_XARCH_NEXT)
FOREACH(item ${_FLAGS})
IF(_XARCH_NEXT)
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
SET(_XARCH_NEXT OFF)
ELSE(_XARCH_NEXT)
IF(item MATCHES "^-Xarch_")
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
ENDIF(item MATCHES "^-Xarch_")
ENDIF(_XARCH_NEXT)
ENDFOREACH(item)
# Remove duplicated architectures
IF(_ARCHS AND PCH_ARCHS)
LIST(REMOVE_DUPLICATES PCH_ARCHS)
ENDIF(_ARCHS AND PCH_ARCHS)
ELSE(CLANG)
SET(PCH_FLAGS ${_FLAGS})
ENDIF(CLANG)
IF(PCH_FLAGS)
LIST(REMOVE_DUPLICATES PCH_FLAGS)
ENDIF(PCH_FLAGS)
ENDMACRO(PCH_SET_COMPILE_FLAGS)
MACRO(GET_PDB_FILENAME _out_filename _target)
# determine output directory based on target type
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL EXECUTABLE)
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
ELSE(${_targetType} STREQUAL EXECUTABLE)
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
ENDIF(${_targetType} STREQUAL EXECUTABLE)
# determine target postfix
STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name)
GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name})
IF(${_targetPostfix} MATCHES NOTFOUND)
SET(_targetPostfix "")
ENDIF(${_targetPostfix} MATCHES NOTFOUND)
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
ENDMACRO(GET_PDB_FILENAME)
MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
IF(CMAKE_CXX_COMPILER_ARG1)
# remove leading space in compiler argument
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
ELSE(CMAKE_CXX_COMPILER_ARG1)
SET(pchsupport_compiler_cxx_arg1 "")
ENDIF(CMAKE_CXX_COMPILER_ARG1)
IF(MSVC)
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
ELSE(MSVC)
SET(HEADER_FORMAT "c++-header")
SET(_FLAGS "")
IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
ENDIF(APPLE)
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
ENDIF(MSVC)
ENDMACRO(PCH_SET_COMPILE_COMMAND)
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
IF(MSVC)
FILE(MAKE_DIRECTORY ${_OUTPUT_DIR})
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
SET(PCH_INPUT ${_input})
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
ELSE(MSVC)
IF(NOT "${_arch}" STREQUAL "")
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
ENDIF(NOT "${_arch}" STREQUAL "")
IF(NOT "${_language}" STREQUAL "")
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
ENDIF(NOT "${_language}" STREQUAL "")
GET_FILENAME_COMPONENT(_name ${_input} NAME)
# Copy .h to output dir
SET(PCH_INPUT "${_OUTPUT_DIR}/${_name}")
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_INPUT}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_input} ${PCH_INPUT}
DEPENDS ${_input}
COMMENT "[${_targetName}] Update precompiled header - done"
)
IF(CLANG)
SET(PCH_EXT "pth")
ELSE(CLANG)
SET(PCH_EXT "gch")
ENDIF(CLANG)
# For GCC and Clang, PCH needs to be in the same directory as .h
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
ENDIF(MSVC)
ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT)
# Add common flags
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
IF(MSVC)
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}")
# NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain)
# we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
IF(NOT _STATIC_LIBRARY_FLAGS)
SET(_STATIC_LIBRARY_FLAGS)
ENDIF(NOT _STATIC_LIBRARY_FLAGS)
SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}")
GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS)
IF(NOT _LINK_FLAGS)
SET(_LINK_FLAGS)
ENDIF(NOT _LINK_FLAGS)
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
ELSE(MSVC)
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
# on all remote machines set
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
SET(PCH_ADDITIONAL_COMPILER_FLAGS)
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
# If no arch is specified, create common flags
IF(PCH_ARCHS_COUNT LESS 2)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF(PCH_ARCHS_COUNT LESS 2)
IF(APPLE)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF(APPLE)
IF(WITH_PCH_DEBUG)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF(WITH_PCH_DEBUG)
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
ENDIF(MSVC)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
# Add specific flags for an arch
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
IF(PCH_ARCHS_COUNT GREATER 1)
GET_TARGET_PROPERTY(_FLAGS ${_targetName} COMPILE_FLAGS)
IF(${_FLAGS} MATCHES NOTFOUND)
SET(_FLAGS "")
ENDIF(${_FLAGS} MATCHES NOTFOUND)
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
ENDIF(PCH_ARCHS_COUNT GREATER 1)
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH)
MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH)
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT})
ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT})
ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH})
ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp)
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
SET(_PCH_current_target ${_targetName})
IF(NOT CMAKE_BUILD_TYPE)
MESSAGE(FATAL_ERROR
"This is the ADD_PRECOMPILED_HEADER macro. "
"You must set CMAKE_BUILD_TYPE!"
)
ENDIF(NOT CMAKE_BUILD_TYPE)
PCH_SET_COMPILE_FLAGS(${_targetName})
IF(PCH_ARCHS)
SET(PCH_OUTPUTS)
FOREACH(_ARCH ${PCH_ARCHS})
STRING(TOUPPER "${_ARCH}" _UPPER_ARCH)
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "")
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}")
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
ENDFOREACH(_ARCH)
ELSE(PCH_ARCHS)
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
ENDIF(PCH_ARCHS)
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
ENDMACRO(ADD_PRECOMPILED_HEADER)
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
IF(NOT PCHSupport_FOUND)
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
RETURN()
ENDIF(NOT PCHSupport_FOUND)
# 0 => creating a new target for PCH, works for all makefiles
# 1 => setting PCH for VC++ project, works for VC++ projects
# 2 => setting PCH for XCode project, works for XCode projects
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(PCH_METHOD 1)
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
SET(PCH_METHOD 2)
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(PCH_METHOD 0)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
IF(PCH_METHOD EQUAL 1)
# Auto include the precompile (useful for moc processing, since the use of
# precompiled is specified at the target level
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
#also inlude ${oldProps} to have the same compile options
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
ELSEIF(PCH_METHOD EQUAL 2)
# For Xcode, cmake needs my patch to process
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
# When buiding out of the tree, precompiled may not be located
# Use full path instead.
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
ELSE(PCH_METHOD EQUAL 1)
#Fallback to the "old" precompiled suppport
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
ENDIF(PCH_METHOD EQUAL 1)
IF(TARGET ${_targetName}_static)
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
ENDIF(TARGET ${_targetName}_static)
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
================================================
FILE: code/CMakeModules/iOSToolChain.cmake
================================================
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
# files which are included with CMake 2.8.4
# It has been altered for iOS development
#
# Options:
#
# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1)
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# IOS_PLATFORM = OS (default) or SIMULATOR or ALL
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
#
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Standard settings
SET(CMAKE_SYSTEM_NAME Darwin)
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version
SET(UNIX ON)
SET(APPLE ON)
SET(IOS ON)
# Force the compilers to Clang for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
# Setup iOS platform
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
# Check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (${IOS_PLATFORM} STREQUAL "ALL")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
else (${IOS_PLATFORM} STREQUAL "OS")
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(EXISTS ${XCODE_POST_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*")
IF(_CMAKE_IOS_SDKS)
LIST(SORT _CMAKE_IOS_SDKS)
LIST(REVERSE _CMAKE_IOS_SDKS)
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
ENDFOREACH(_CMAKE_IOS_SDK)
ENDIF(_CMAKE_IOS_SDKS)
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
# Find and use the most recent iOS sdk
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
# Search for a specific version of a SDK
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS)
IF(NOT IOS_VERSIONS)
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
ENDIF(NOT IOS_VERSIONS)
IF(IOS_VERSION)
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
ELSE(_INDEX EQUAL -1)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(_INDEX EQUAL -1)
ELSE(IOS_VERSION)
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(IOS_VERSION)
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
SET(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version")
# Set the sysroot default to the most recent SDK
SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
IF(CMAKE_GENERATOR MATCHES Xcode)
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ELSE(CMAKE_GENERATOR MATCHES Xcode)
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386
SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;i386")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)
================================================
FILE: code/CMakeModules/nel.cmake
================================================
# Force Release configuration for compiler checks
SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release")
# Force Release configuration by default
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Declare CMAKE_CONFIGURATION_TYPES before PROJECT
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
###
# Helper macro that generates .pc and installs it.
# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc"
###
MACRO(NL_GEN_PC name)
IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig)
ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
ENDMACRO(NL_GEN_PC)
###
# Helper macro that generates revision.h from revision.h.in
###
MACRO(NL_GEN_REVISION_H)
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
SET(TOOL_FOUND OFF)
IF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/")
FIND_PACKAGE(Subversion)
IF(SUBVERSION_FOUND)
SET(TOOL_FOUND ON)
ENDIF(SUBVERSION_FOUND)
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/")
IF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/")
FIND_PACKAGE(Mercurial)
IF(MERCURIAL_FOUND)
SET(TOOL_FOUND ON)
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/")
# if already generated
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
# copy it
MESSAGE(STATUS "Copying provided revision.h...")
FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR})
SET(HAVE_REVISION_H ON)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
IF(TOOL_FOUND)
# a custom target that is always built
ADD_CUSTOM_TARGET(revision ALL
COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DROOT_DIR=${CMAKE_SOURCE_DIR}/..
-DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/CMakeModules
-P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake)
# revision.h is a generated file
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE)
SET(HAVE_REVISION_H ON)
ENDIF(TOOL_FOUND)
IF(HAVE_REVISION_H)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_REVISION_H)
ENDIF(HAVE_REVISION_H)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
ENDMACRO(NL_GEN_REVISION_H)
###
#
###
MACRO(NL_TARGET_LIB name)
IF(WITH_STATIC)
ADD_LIBRARY(${name} STATIC ${ARGN})
ELSE(WITH_STATIC)
ADD_LIBRARY(${name} SHARED ${ARGN})
ENDIF(WITH_STATIC)
ENDMACRO(NL_TARGET_LIB)
###
#
###
MACRO(NL_TARGET_DRIVER name)
IF(WITH_STATIC_DRIVERS)
ADD_LIBRARY(${name} STATIC ${ARGN})
ELSE(WITH_STATIC_DRIVERS)
ADD_LIBRARY(${name} MODULE ${ARGN})
ENDIF(WITH_STATIC_DRIVERS)
ENDMACRO(NL_TARGET_DRIVER)
###
# Helper macro that sets the default library properties.
# Argument: name - the target name whose properties are being set
# Argument:
###
MACRO(NL_DEFAULT_PROPS name label)
IF(HAVE_REVISION_H)
# explicitly say that the target depends on revision.h
ADD_DEPENDENCIES(${name} revision)
ENDIF(HAVE_REVISION_H)
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
STRING(REGEX REPLACE "\\:" " -" proj_label ${label})
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${proj_label})
GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
IF(NL_LIB_PREFIX)
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
ENDMACRO(NL_DEFAULT_PROPS)
###
# Adds the target suffix on Windows.
# Argument: name - the library's target name.
###
MACRO(NL_ADD_LIB_SUFFIX name)
IF(WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r")
ENDIF(WIN32)
ENDMACRO(NL_ADD_LIB_SUFFIX)
###
# Adds the runtime link flags for Win32 binaries and links STLport.
# Argument: name - the target to add the link flags to.
###
MACRO(NL_ADD_RUNTIME_FLAGS name)
IF(WIN32)
# SET_TARGET_PROPERTIES(${name} PROPERTIES
# LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}"
# LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}")
ENDIF(WIN32)
IF(WITH_STLPORT)
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(WITH_STLPORT)
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
MACRO(NL_ADD_STATIC_VID_DRIVERS name)
IF(WITH_STATIC_DRIVERS)
IF(WIN32)
IF(WITH_DRIVER_DIRECT3D)
TARGET_LINK_LIBRARIES(${name} nel_drv_direct3d_win)
ENDIF(WITH_DRIVER_DIRECT3D)
ENDIF(WIN32)
IF(WITH_DRIVER_OPENGL)
IF(WIN32)
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl_win)
ELSE(WIN32)
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl)
ENDIF(WIN32)
ENDIF(WITH_DRIVER_OPENGL)
IF(WITH_DRIVER_OPENGLES)
IF(WIN32)
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles_win)
ELSE(WIN32)
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles)
ENDIF(WIN32)
ENDIF(WITH_DRIVER_OPENGLES)
ENDIF(WITH_STATIC_DRIVERS)
ENDMACRO(NL_ADD_STATIC_VID_DRIVERS)
MACRO(NL_ADD_STATIC_SND_DRIVERS name)
IF(WITH_STATIC_DRIVERS)
IF(WIN32)
IF(WITH_DRIVER_DSOUND)
TARGET_LINK_LIBRARIES(${name} nel_drv_dsound_win)
ENDIF(WITH_DRIVER_DSOUND)
IF(WITH_DRIVER_XAUDIO2)
TARGET_LINK_LIBRARIES(${name} nel_drv_xaudio2_win)
ENDIF(WITH_DRIVER_XAUDIO2)
IF(WITH_DRIVER_OPENAL)
TARGET_LINK_LIBRARIES(${name} nel_drv_openal_win)
ENDIF(WITH_DRIVER_OPENAL)
IF(WITH_DRIVER_FMOD)
TARGET_LINK_LIBRARIES(${name} nel_drv_fmod_win)
ENDIF(WITH_DRIVER_FMOD)
ELSE(WIN32)
IF(WITH_DRIVER_OPENAL)
TARGET_LINK_LIBRARIES(${name} nel_drv_openal)
ENDIF(WITH_DRIVER_OPENAL)
IF(WITH_DRIVER_FMOD)
TARGET_LINK_LIBRARIES(${name} nel_drv_fmod)
ENDIF(WITH_DRIVER_FMOD)
ENDIF(WIN32)
ENDIF(WITH_STATIC_DRIVERS)
ENDMACRO(NL_ADD_STATIC_SND_DRIVERS)
###
# Checks build vs. source location. Prevents In-Source builds.
###
MACRO(CHECK_OUT_OF_SOURCE)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
MESSAGE(FATAL_ERROR "
CMake generation for this project is not allowed within the source directory!
Remove the CMakeCache.txt file and try again from another folder, e.g.:
rm CMakeCache.txt
mkdir cmake
cd cmake
cmake ..
")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
ENDMACRO(CHECK_OUT_OF_SOURCE)
MACRO(NL_SETUP_DEFAULT_OPTIONS)
###
# Features
###
OPTION(WITH_LOGGING "With Logging" ON )
OPTION(WITH_COVERAGE "With Code Coverage Support" OFF)
OPTION(WITH_PCH "With Precompiled Headers" ON )
OPTION(FINAL_VERSION "Build in Final Version mode" OFF)
# Default to static building on Windows.
#IF(WIN32)
OPTION(WITH_STATIC "With static libraries." ON )
#ELSE(WIN32)
# OPTION(WITH_STATIC "With static libraries." OFF)
#ENDIF(WIN32)
#IF (WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" ON )
#ELSE(WITH_STATIC)
# OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
#ENDIF(WITH_STATIC)
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
IF(WIN32)
OPTION(WITH_EXTERNAL "With provided external." ON )
ELSE(WIN32)
OPTION(WITH_EXTERNAL "With provided external." OFF)
ENDIF(WIN32)
OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF)
OPTION(WITH_INSTALL_LIBRARIES "Install development files." OFF)
IF(WIN32)
OPTION(WITH_GTK "With GTK Support" OFF)
ELSE(WIN32)
OPTION(WITH_GTK "With GTK Support" OFF)
ENDIF(WIN32)
###
# Optional support
###
OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" ON )
#IF(WIN32)
OPTION(WITH_STLPORT "With STLport support." OFF )
#ELSE(WIN32)
# OPTION(WITH_STLPORT "With STLport support." OFF)
#ENDIF(WIN32)
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
OPTION(WITH_NEL "Build NeL (nearly always required)." ON )
# OPTION(WITH_NELNS "Build NeL Network Services." OFF)
OPTION(WITH_EVA "Build EVA." ON)
OPTION(WITH_TOOLS "Build Tools." OFF)
ENDMACRO(NL_SETUP_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
###
# Core libraries
###
OPTION(WITH_NET "Build NLNET" ON )
# OPTION(WITH_GEORGES "Build NLGEORGES" ON)
# OPTION(WITH_LIGO "Build NLLIGO" OFF)
# OPTION(WITH_LOGIC "Build NLLOGIC" OFF)
###
# Optional support
###
OPTION(WITH_NEL_TOOLS "Build NeL Tools" OFF)
OPTION(WITH_NEL_SAMPLES "Build NeL Samples" OFF)
OPTION(WITH_NEL_TESTS "Build NeL Unit Tests" OFF)
#OPTION(WITH_LUA51 "Build EVA using Lua 5.1" ON )
#OPTION(WITH_LUA52 "Build EVA using Lua 5.2" OFF)
OPTION(WITH_SSE2 "With SSE2" OFF )
OPTION(WITH_SSE3 "With SSE3" ON )
IF(NOT MSVC)
OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF)
OPTION(WITH_GCC_FPERMISSIVE "With GCC -fpermissive" ON)
ENDIF(NOT MSVC)
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
###
# Core libraries
###
#OPTION(WITH_NELNS_SERVER "Build NeLNS Services" OFF )
#OPTION(WITH_NELNS_LOGIN_SYSTEM "Build NeLNS Login System Tools" OFF )
###
# Optional support
###
OPTION(WITH_ROBOT "Build Robot" OFF)
ENDMACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
MACRO(ADD_PLATFORM_FLAGS _FLAGS)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}")
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}")
ENDMACRO()
MACRO(ADD_PLATFORM_LINKFLAGS _FLAGS)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${_FLAGS}")
ENDMACRO()
MACRO(NL_SETUP_BUILD)
#-----------------------------------------------------------------------------
# Setup the buildmode variables.
#
# None = NL_RELEASE
# Debug = NL_DEBUG
# Release = NL_RELEASE
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(NL_BUILD_MODE "NL_DEBUG")
ELSE()
IF(CMAKE_BUILD_TYPE MATCHES "Release")
SET(NL_BUILD_MODE "NL_RELEASE")
ELSE()
SET(NL_BUILD_MODE "NL_RELEASE")
# enforce release mode if it's neither Debug nor Release
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF()
ENDIF()
IF(CMAKE_CXX_LIBRARY_ARCHITECTURE)
SET(HOST_CPU ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
ELSE()
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
ENDIF()
IF(HOST_CPU MATCHES "(amd|AMD|x86_)64")
SET(HOST_CPU "x86_64")
ELSEIF(HOST_CPU MATCHES "i.86")
SET(HOST_CPU "x86")
ENDIF()
# Determine target CPU
# If not specified, use the same CPU as host
IF(NOT TARGET_CPU)
SET(TARGET_CPU ${HOST_CPU})
ENDIF()
IF(TARGET_CPU MATCHES "(amd|AMD|x86_)64")
SET(TARGET_CPU "x86_64")
ELSEIF(TARGET_CPU MATCHES "i.86")
SET(TARGET_CPU "x86")
ENDIF()
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON)
MESSAGE(STATUS "Using Clang ${CMAKE_CXX_COMPILER_VERSION} compiler")
ENDIF()
IF(CMAKE_GENERATOR MATCHES "Xcode")
SET(XCODE ON)
MESSAGE(STATUS "Generating Xcode project")
ENDIF()
IF(CMAKE_GENERATOR MATCHES "NMake")
SET(NMAKE ON)
MESSAGE(STATUS "Generating NMake project")
ENDIF()
IF(CMAKE_GENERATOR MATCHES "Ninja")
SET(NINJA ON)
MESSAGE(STATUS "Generating Ninja project")
ENDIF()
# If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
# x86-compatible CPU
IF(HOST_CPU MATCHES "x86")
IF(NOT CMAKE_SIZEOF_VOID_P)
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
ENDIF()
# Using 32 or 64 bits libraries
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(TARGET_CPU "x86_64")
ELSE()
SET(TARGET_CPU "x86")
ENDIF()
ELSEIF(HOST_CPU MATCHES "arm")
SET(TARGET_CPU "arm")
ELSE()
SET(TARGET_CPU "unknown")
MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}")
ENDIF()
# TODO: add checks for PPC
ELSE()
MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}")
ENDIF()
# Use values from environment variables
SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}")
SET(PLATFORM_CXXFLAGS "$ENV{CXXFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CXXFLAGS}")
SET(PLATFORM_LINKFLAGS "$ENV{LDFLAGS} ${PLATFORM_LINKFLAGS}")
# Remove -g and -O flag because we are managing them ourself
STRING(REPLACE "-g" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS})
STRING(REPLACE "-g" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS})
STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS})
STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS})
# Strip spaces
STRING(STRIP ${PLATFORM_CFLAGS} PLATFORM_CFLAGS)
STRING(STRIP ${PLATFORM_CXXFLAGS} PLATFORM_CXXFLAGS)
STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS)
IF(NOT CMAKE_OSX_ARCHITECTURES)
IF(TARGET_CPU STREQUAL "x86_64")
SET(TARGET_X64 1)
SET(TARGET_X86 1)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1)
ELSEIF(TARGET_CPU STREQUAL "arm64")
SET(TARGET_ARM 1)
SET(TARGET_ARM64 1)
ELSEIF(TARGET_CPU STREQUAL "armv7s")
SET(TARGET_ARM 1)
SET(TARGET_ARMV7S 1)
ELSEIF(TARGET_CPU STREQUAL "armv7")
SET(TARGET_ARM 1)
SET(TARGET_ARMV7 1)
ELSEIF(TARGET_CPU STREQUAL "armv6")
SET(TARGET_ARM 1)
SET(TARGET_ARMV6 1)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(TARGET_ARM 1)
SET(TARGET_ARMV5 1)
ELSEIF(TARGET_CPU STREQUAL "arm")
SET(TARGET_ARM 1)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(TARGET_MIPS 1)
ENDIF()
IF(TARGET_ARM)
IF(TARGET_ARM64)
ADD_PLATFORM_FLAGS("-DHAVE_ARM64")
ENDIF()
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S")
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7")
ENDIF()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-HAVE_ARMV6")
ENDIF()
ADD_PLATFORM_FLAGS("-DHAVE_ARM")
ENDIF()
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-DHAVE_X86")
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64")
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-DHAVE_MIPS")
ENDIF()
ENDIF()
# Fix library paths suffixes for Debian MultiArch
IF(LIBRARY_ARCHITECTURE)
SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH})
IF(TARGET_X64)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64)
ELSEIF(TARGET_X86)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32)
ENDIF()
ENDIF()
IF(APPLE AND NOT IOS)
SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
ENDIF()
IF(WITH_LOGGING)
ADD_PLATFORM_FLAGS("-DENABLE_LOGS")
ENDIF()
IF(MSVC)
# Ignore default include paths
ADD_PLATFORM_FLAGS("/X")
IF(MSVC14)
ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2015 and 2017, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
# Special cases for VC++ 2017
IF(MSVC_VERSION EQUAL "1911")
SET(MSVC1411 ON)
ELSEIF(MSVC_VERSION EQUAL "1910")
SET(MSVC1410 ON)
ENDIF()
ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC11)
ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2012, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC10)
ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC90)
ADD_PLATFORM_FLAGS("/Gy-")
# don't use a /O[012x] flag if you want custom optimizations
SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC80)
ADD_PLATFORM_FLAGS("/Gy- /Wp64")
# don't use a /O[012x] flag if you want custom optimizations
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE()
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF()
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WIN32 /DWIN32 /D_WINDOWS /wd4250")
# huge PCH
ADD_PLATFORM_FLAGS("/Zm1000")
IF(TARGET_X64)
# Fix a bug with Intellisense
ADD_PLATFORM_FLAGS("/D_WIN64")
# Fix a compilation error for some big C++ files
ADD_PLATFORM_FLAGS("/bigobj")
ELSE()
# Allows 32 bits applications to use 3 GB of RAM
ADD_PLATFORM_LINKFLAGS("/LARGEADDRESSAWARE")
ENDIF()
# Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa")
IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/DEBUG ${NL_RELEASE_LINKFLAGS}")
ELSE()
SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}")
ENDIF()
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}")
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:LIBCMTD.lib /NODEFAULTLIB:LIBCMT.lib ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO /NODEFAULTLIB:LIBCMTD.lib /NODEFAULTLIB:LIBCMT.lib ${NL_RELEASE_LINKFLAGS}")
IF(WITH_WARNINGS)
SET(DEBUG_CFLAGS "/W4 ${DEBUG_CFLAGS}")
ELSE()
SET(DEBUG_CFLAGS "/W3 ${DEBUG_CFLAGS}")
ENDIF()
ELSE()
IF(WIN32)
ADD_PLATFORM_FLAGS("-DWIN32 -D_WIN32")
IF(CLANG)
ADD_PLATFORM_FLAGS("-nobuiltininc")
ENDIF()
ENDIF()
IF(WITH_SSE3)
ADD_PLATFORM_FLAGS("-msse3")
ENDIF()
IF(WITH_GCC_FPMATH_BOTH)
ADD_PLATFORM_FLAGS("-mfpmath=both")
ENDIF()
IF(WITH_GCC_FPERMISSIVE)
ADD_PLATFORM_FLAGS("-fpermissive")
ENDIF()
IF(APPLE)
SET(OBJC_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch -fobjc-weak)
IF(NOT XCODE)
IF(CMAKE_OSX_ARCHITECTURES)
SET(TARGETS_COUNT 0)
SET(_ARCHS)
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
IF(_ARCH STREQUAL "i386")
SET(_ARCHS "${_ARCHS} i386")
SET(TARGET_X86 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "x86_64")
SET(_ARCHS "${_ARCHS} x86_64")
SET(TARGET_X64 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "armv7s")
SET(_ARCHS "${_ARCHS} armv7s")
SET(TARGET_ARMV7S 1)
SET(TARGET_ARM 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "armv7")
SET(_ARCHS "${_ARCHS} armv7")
SET(TARGET_ARMV7 1)
SET(TARGET_ARM 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "armv6")
SET(_ARCHS "${_ARCHS} armv6")
SET(TARGET_ARMV6 1)
SET(TARGET_ARM 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "mips")
SET(_ARCHS "${_ARCHS} mips")
SET(TARGET_MIPS 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSE()
SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})")
ENDIF()
ENDFOREACH(_ARCH)
MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}")
ELSE()
SET(TARGETS_COUNT 0)
ENDIF()
IF(TARGETS_COUNT EQUAL 1)
IF(TARGET_ARM)
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-arch armv7s -DHAVE_ARMV7S")
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-arch armv7 -DHAVE_ARMV7")
ENDIF()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-arch armv6 -DHAVE_ARMV6")
ENDIF()
IF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-arch armv5 -DHAVE_ARMV5")
ENDIF()
ADD_PLATFORM_FLAGS("-mthumb -DHAVE_ARM")
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-arch x86_64 -DHAVE_X64 -DHAVE_X86_64 -DHAVE_X86")
ELSEIF(TARGET_X86)
ADD_PLATFORM_FLAGS("-arch i386 -DHAVE_X86")
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-arch mips -DHAVE_MIPS")
ENDIF()
ELSEIF(TARGETS_COUNT EQUAL 0)
# Not using CMAKE_OSX_ARCHITECTURES, HAVE_XXX already defined before
IF(TARGET_ARM)
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-arch armv7s")
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-arch armv7")
ENDIF()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-arch armv6")
ENDIF()
IF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-arch armv5")
ENDIF()
ADD_PLATFORM_FLAGS("-mthumb")
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-arch x86_64")
ELSEIF(TARGET_X86)
ADD_PLATFORM_FLAGS("-arch i386")
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-arch mips")
ENDIF()
ELSE()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6")
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-Xarch_armv7 -mthumb -Xarch_armv7 -DHAVE_ARM -Xarch_armv7 -DHAVE_ARMV7")
ENDIF()
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-Xarch_i386 -DHAVE_X86")
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64")
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-Xarch_mips -DHAVE_MIPS")
ENDIF()
ENDIF()
IF(IOS)
SET(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE)
IF(IOS_VERSION)
PARSE_VERSION_STRING(${IOS_VERSION} IOS_VERSION_MAJOR IOS_VERSION_MINOR IOS_VERSION_PATCH)
CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER)
ADD_PLATFORM_FLAGS("-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IOS_VERSION_NUMBER}")
ENDIF()
IF(CMAKE_IOS_SYSROOT)
IF(TARGET_ARMV7S)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_armv7s ")
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF()
IF(TARGET_ARMV7)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_armv7 ")
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF()
IF(TARGET_ARMV6)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_armv6 ")
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF()
ENDIF()
IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_i386 ")
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}")
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF()
ENDIF()
ELSE()
# Always force -mmacosx-version-min to override environement variable
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.7")
MESSAGE(FATAL_ERROR "Minimum target for OS X is 10.7 but you're using ${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF()
ADD_PLATFORM_LINKFLAGS("-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF()
ENDIF()
# use libc++ under OX X to be able to use new C++ features (and else it'll use GCC 4.2.1 STL)
# minimum target is now OS X 10.7
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -stdlib=libc++")
ADD_PLATFORM_LINKFLAGS("-Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ADD_PLATFORM_LINKFLAGS("-Wl,-search_paths_first")
ENDIF()
ENDIF()
ELSE()
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
ADD_PLATFORM_FLAGS("-m32 -march=i686")
ENDIF()
IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ADD_PLATFORM_FLAGS("-m64")
ENDIF()
ENDIF()
# use c++0x standard to use std::unique_ptr and std::shared_ptr
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -std=c++0x")
ADD_PLATFORM_FLAGS("-D_REENTRANT")
# hardening
ADD_PLATFORM_FLAGS("-D_FORTIFY_SOURCE=2")
IF(NOT WITH_LOW_MEMORY)
ADD_PLATFORM_FLAGS("-pipe")
ENDIF()
IF(WITH_COVERAGE)
ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage")
ENDIF()
IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wall")
ELSE()
# Check wrong formats in printf-like functions
ADD_PLATFORM_FLAGS("-Wformat -Werror=format-security")
ENDIF()
# never display these warnings because they are minor
ADD_PLATFORM_FLAGS("-Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-value")
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6.0.0")
ADD_PLATFORM_FLAGS("-Wno-unused-local-typedefs")
ELSEIF(CLANG)
ADD_PLATFORM_FLAGS("-Wno-unused-private-field -Wno-unused-local-typedef")
ENDIF()
IF(ANDROID)
ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}")
ADD_PLATFORM_FLAGS("-ffunction-sections -funwind-tables")
ADD_PLATFORM_FLAGS("-DANDROID")
ADD_PLATFORM_FLAGS("-Wa,--noexecstack")
IF(TARGET_ARM)
ADD_PLATFORM_FLAGS("-fpic")
ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__")
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16")
ADD_PLATFORM_LINKFLAGS("-march=armv7-a -Wl,--fix-cortex-a8")
ELSEIF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-march=armv5te -mtune=xscale -msoft-float")
ENDIF()
SET(TARGET_THUMB ON)
IF(TARGET_THUMB)
ADD_PLATFORM_FLAGS("-mthumb -finline-limit=64")
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm")
ELSE()
ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300")
ENDIF()
ELSEIF(TARGET_X86)
# Optimizations for Intel Atom
ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops")
ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300")
ELSEIF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300")
ENDIF()
ADD_PLATFORM_LINKFLAGS("-Wl,-z,noexecstack")
ADD_PLATFORM_LINKFLAGS("-L${PLATFORM_ROOT}/usr/lib")
ENDIF()
IF(APPLE)
ADD_PLATFORM_FLAGS("-gdwarf-2 -D_DARWIN_UNLIMITED_STREAMS")
ENDIF()
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(NOT MINGW)
ADD_PLATFORM_FLAGS("-fPIC")
ENDIF()
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
# hardening
ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4")
# If -fstack-protector or -fstack-protector-all enabled, enable too new warnings and fix possible link problems
IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wstack-protector")
ENDIF()
# Fix undefined reference to `__stack_chk_fail' error
ADD_PLATFORM_LINKFLAGS("-lc")
IF(NOT APPLE)
ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed")
ENDIF()
IF(NOT APPLE)
# hardening
ADD_PLATFORM_LINKFLAGS("-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now")
ENDIF()
IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
ELSE()
IF(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip ${NL_RELEASE_LINKFLAGS}")
ELSE()
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
ENDIF()
ENDIF()
SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}")
ENDIF()
ENDMACRO()
MACRO(NL_SETUP_BUILD_FLAGS)
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
## Debug
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
## Release
SET(CMAKE_C_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
ENDMACRO(NL_SETUP_BUILD_FLAGS)
# Macro to create x_ABSOLUTE_PREFIX from x_PREFIX
MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE)
IF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
ELSE()
IF(WITH_UNIX_STRUCTURE)
SET(${NAME_ABSOLUTE} ${CMAKE_INSTALL_PREFIX}/${${NAME_RELATIVE}})
ELSE()
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
ENDIF()
ENDIF()
ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX)
MACRO(NL_SETUP_PREFIX_PATHS)
## Allow override of install_prefix/etc path.
IF(NOT NL_ETC_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(NL_ETC_PREFIX "etc/nel" CACHE PATH "Installation path for configurations")
ELSE()
SET(NL_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_ETC_PREFIX NL_ETC_ABSOLUTE_PREFIX)
## Allow override of install_prefix/share path.
IF(NOT NL_SHARE_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(NL_SHARE_PREFIX "share/nel" CACHE PATH "Installation path for data.")
ELSE()
SET(NL_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_SHARE_PREFIX NL_SHARE_ABSOLUTE_PREFIX)
## Allow override of install_prefix/sbin path.
IF(NOT NL_SBIN_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(NL_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.")
ELSE()
SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_SBIN_PREFIX NL_SBIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/bin path.
IF(NOT NL_BIN_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(NL_BIN_PREFIX "bin" CACHE PATH "Installation path for tools and applications.")
ELSE()
SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_BIN_PREFIX NL_BIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/lib path.
IF(NOT NL_LIB_PREFIX)
IF(LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE()
SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX)
## Allow override of install_prefix/lib path.
IF(NOT NL_DRIVER_PREFIX)
IF(WITH_UNIX_STRUCTURE)
IF(LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.")
ELSE()
SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.")
ENDIF()
ELSE()
SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX)
ENDMACRO(NL_SETUP_PREFIX_PATHS)
MACRO(EVA_SETUP_PREFIX_PATHS)
## Allow override of install_prefix/etc path.
IF(NOT EVA_ETC_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(EVA_ETC_PREFIX "etc/ryzom" CACHE PATH "Installation path for configurations")
ELSE()
SET(EVA_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(EVA_ETC_PREFIX EVA_ETC_ABSOLUTE_PREFIX)
## Allow override of install_prefix/share path.
IF(NOT EVA_SHARE_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(EVA_SHARE_PREFIX "share/ryzom" CACHE PATH "Installation path for data.")
ELSE()
SET(EVA_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(EVA_SHARE_PREFIX EVA_SHARE_ABSOLUTE_PREFIX)
## Allow override of install_prefix/sbin path.
IF(NOT EVA_SBIN_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(EVA_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.")
ELSE()
SET(EVA_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(EVA_SBIN_PREFIX EVA_SBIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/bin path.
IF(NOT EVA_BIN_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(EVA_BIN_PREFIX "bin" CACHE PATH "Installation path for tools.")
ELSE()
SET(EVA_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(EVA_BIN_PREFIX EVA_BIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/lib path.
IF(NOT EVA_LIB_PREFIX)
IF(LIBRARY_ARCHITECTURE)
SET(EVA_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE()
SET(EVA_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(EVA_LIB_PREFIX EVA_LIB_ABSOLUTE_PREFIX)
## Allow override of install_prefix/games path.
IF(NOT EVA_GAMES_PREFIX)
IF(WITH_UNIX_STRUCTURE)
SET(EVA_GAMES_PREFIX "games" CACHE PATH "Installation path for client.")
ELSE()
SET(EVA_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(EVA_GAMES_PREFIX EVA_GAMES_ABSOLUTE_PREFIX)
ENDMACRO(EVA_SETUP_PREFIX_PATHS)
MACRO(SETUP_EXTERNAL)
IF(WITH_EXTERNAL)
FIND_PACKAGE(External REQUIRED)
ENDIF()
IF(WIN32)
FIND_PACKAGE(External REQUIRED)
# If using custom boost, we need to define the right variables used by official boost CMake module
IF(DEFINED BOOST_DIR)
SET(BOOST_INCLUDEDIR ${BOOST_DIR}/include)
SET(BOOST_LIBRARYDIR ${BOOST_DIR}/lib)
ENDIF()
ELSE()
FIND_PACKAGE(External QUIET)
IF(APPLE)
IF(WITH_STATIC_EXTERNAL)
# Look only for static libraries because systems libraries are using Frameworks
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
ENDIF()
ELSE()
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a)
ENDIF()
ENDIF()
ENDIF()
# Android, iOS and Mac OS X have pthread, but no need to link to libpthread
IF(ANDROID OR APPLE)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ELSE()
SET(THREADS_HAVE_PTHREAD_ARG ON)
FIND_PACKAGE(Threads)
# TODO: replace all -l by absolute path to in CMAKE_THREAD_LIBS_INIT
ENDIF()
IF(WITH_STLPORT)
FIND_PACKAGE(STLport REQUIRED)
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
ENDIF()
IF(WIN32)
# Must include DXSDK before WINSDK
#FIND_PACKAGE(DirectXSDK REQUIRED)
# IF(DXSDK_INCLUDE_DIR)
# INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
# ENDIF()
ENDIF()
IF(MSVC)
FIND_PACKAGE(MSVC REQUIRED)
FIND_PACKAGE(WindowsSDK REQUIRED)
ENDIF()
ENDMACRO(SETUP_EXTERNAL)
================================================
FILE: code/CMakePackaging.txt
================================================
cpack_add_install_type(Full DISPLAY_NAME "Full Install")
cpack_add_install_type(Developer DISPLAY_NAME "Developer Install")
cpack_add_install_type(Runtime DISPLAY_NAME "Runtime Files")
cpack_add_component_group(Drivers
EXPANDED
DESCRPTION "The drivers needed to run NeL-based software.")
cpack_add_component_group(Samples
EXPANDED
DESCRPTION "Sample applications and configurations demonstrating NeL.")
cpack_add_component_group(Tools
EXPANDED
DESCRPTION "Tools for NeL development and media creation.")
###############
# #
# Development #
# #
###############
cpack_add_component(libraries
DISPLAY_NAME "Libraries"
DESCRIPTION "Libraries used to build programs with NeL"
GROUP Development
INSTALL_TYPES Full Developer)
cpack_add_component(headers
DISPLAY_NAME "C++ Headers"
DESCRIPTION "C++ headers used to build programs with NeL"
GROUP Development
INSTALL_TYPES Full Developer)
###########
# #
# Drivers #
# #
###########
cpack_add_component(drivers3d
DISPLAY_NAME "3D Drivers"
DESCRIPTION "3D Drivers for running NeL based applications."
GROUP Drivers
INSTALL_TYPES Full Runtime)
cpack_add_component(driverssound
DISPLAY_NAME "Sound Drivers"
DESCRIPTION "Sound Drivers for running NeL based applications."
GROUP Drivers
INSTALL_TYPES Full Runtime)
#########
# #
# Tools #
# #
#########
cpack_add_component(toolsmisc
DISPLAY_NAME "Misc Tools"
DESCRIPTION "Misc. NeL Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
cpack_add_component(tools3d
DISPLAY_NAME "3D Tools"
DESCRIPTION "3D NeL Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
cpack_add_component(toolsgeorges
DISPLAY_NAME "Georges Tools"
DESCRIPTION "NeL Georges Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
cpack_add_component(toolspacs
DISPLAY_NAME "PACS Tools"
DESCRIPTION "NeL PACS Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
###########
# #
# Samples #
# #
###########
cpack_add_component(samplespacs
DISPLAY_NAME "PACS Samples"
DESCRIPTION "Sample applications demonstrating the PACS collision library."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samples3d
DISPLAY_NAME "3D Samples"
DESCRIPTION "Sample applications demonstrating the NeL 3D library."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplesgeorges
DISPLAY_NAME "Georges Samples"
DESCRIPTION "Sample applications demonstrating the Georges data loading module."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplesmisc
DISPLAY_NAME "Misc Samples"
DESCRIPTION "Sample applications demonstrating the core NeL functionality module."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplesnet
DISPLAY_NAME "Net Samples"
DESCRIPTION "Sample applications demonstrating the NeL Network functionality."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplessound
DISPLAY_NAME "Sound Samples"
DESCRIPTION "Sample applications demonstrating the NeL Sound functionality."
GROUP Samples
INSTALL_TYPES Full)
================================================
FILE: code/COPYING
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
================================================
FILE: code/CTestConfig.cmake
================================================
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(Dart)
set(CTEST_PROJECT_NAME "RyzomCore")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CST")
set(CTEST_UPDATE_TYPE "hg")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "ci.ryzomcore.org")
set(CTEST_DROP_LOCATION "/submit.php?project=RyzomCore")
set(CTEST_DROP_SITE_CDASH TRUE)
================================================
FILE: code/EVA/CMakeLists.txt
================================================
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/server )
#SET(SERVER_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/server)
IF(WITH_EVA)
ADD_DEFINITIONS(-DEVA)
ENDIF(WITH_EVA)
ADD_SUBDIRECTORY(server)
IF(WITH_TOOLS)
ADD_SUBDIRECTORY(tools)
ENDIF(WITH_TOOLS)
================================================
FILE: code/EVA/server/CMakeLists.txt
================================================
FIND_PACKAGE(CURL)
FIND_PACKAGE(MySQL)
#FIND_PACKAGE(ToLua)
# move to server_share/CMakeLists.txt
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_SUBDIRECTORY(server_share)
#ADD_SUBDIRECTORY(admin_modules)
ADD_SUBDIRECTORY(naming_service)
ADD_SUBDIRECTORY(frontend_service)
ADD_SUBDIRECTORY(player_logic_service)
ADD_SUBDIRECTORY(schedule_service)
#ADD_SUBDIRECTORY(admin_service)
#ADD_SUBDIRECTORY(client_robot)
#INSTALL(FILES common.cfg DESTINATION ~/service COMPONENT services)
================================================
FILE: code/EVA/server/_del_log.bat
================================================
@echo off
del *.log
del log /q
del aes_*.txt
del pid.state
del rns /q
rd rns /q
del aes /q
rd aes /q
del egs /q
rd egs /q
del ras /q
rd ras /q
del fes_0 /q
rd fes_0 /q
del lgc_0 /q
rd lgc_0 /q
del pds /q
rd pds /q
================================================
FILE: code/EVA/server/_robot_start .bat
================================================
@echo off
REM This script will start all the services with good parameters
REM set MODE=Debug
REM set MODE=.
set MODE=..\..\..\build\bin\Debug
taskkill /IM client_robot.exe /F
rem ns
start %MODE%\client_robot --nolog
ping -n 2 127.0.0.1 > NUL 2>&1
================================================
FILE: code/EVA/server/_robot_stop .bat
================================================
@echo off
REM This script will kill all the services launched by _robot_start.bat
rem robot
taskkill /IM client_robot.exe /F
================================================
FILE: code/EVA/server/_shard_start.bat
================================================
@echo off
REM This script will start all the services with good parameters
call _shard_stop.bat
REM set MODE=Debug
REM set MODE=.
set MODE=..\..\..\build\bin\Debug
rem ns
start %MODE%\naming_service --nolog
ping -n 2 127.0.0.1 > NUL 2>&1
rem pls
start %MODE%\player_logic_service --nolog
ping -n 2 127.0.0.1 > NUL 2>&1
rem fes
start %MODE%\frontend_service --nolog
ping -n 2 127.0.0.1 > NUL 2>&1
rem sch
start %MODE%\schedule_service --nolog
ping -n 2 127.0.0.1 > NUL 2>&1
================================================
FILE: code/EVA/server/_shard_stop.bat
================================================
@echo off
REM This script will kill all the services launched by _shard_start.bat
rem ns
taskkill /IM naming_service.exe /F
rem fes
taskkill /IM frontend_service.exe /F
rem pls
taskkill /IM player_logic_service.exe /F
rem pls
taskkill /IM schedule_service.exe /F
================================================
FILE: code/EVA/server/admin_executor_service.cfg
================================================
// Use with commandline: admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES
#include "common.cfg"
// I don't need a connection to a naming service
DontUseNS = 1;
// Address of the admin service (default port is 49996)
ASHost = "localhost";
ASPort="46701";
// ---- service NeL variables (used by ConfigFile class)
AESAliasName= "aes";
StartCommands=
{
// Create a gateway module
"moduleManager.createModule StandardGateway gw",
// add a layer 5 transport
"gw.transportAdd L5Transport l5",
// open the transport
"gw.transportCmd l5(open)",
/// Create default connection with admin executor service
// Create a gateway module
"moduleManager.createModule StandardGateway gw_aes",
// create the admin executor service module
"moduleManager.createModule AdminExecutorServiceClient aes_client",
"aes_client.plug gw_aes",
// create a layer 3 client to connect to aes gateway
"gw_aes.transportAdd L3Client aes_l3c",
"gw_aes.transportCmd aes_l3c(connect addr="+AESHost+":"+AESPort+")",
// create the admin executor service module
"moduleManager.createModule AdminExecutorService aes",
// create a gateway to connect to as
"moduleManager.createModule StandardGateway asc_gw",
// create a layer 3 client
"asc_gw.transportAdd L3Client l3c",
"asc_gw.transportCmd l3c(connect addr="+ASHost+":"+ASPort+")",
// create a gateway for services to connect
"moduleManager.createModule StandardGateway aes_gw",
// create a layer 3 server
"aes_gw.transportAdd L3Server l3s",
"aes_gw.transportOptions l3s(PeerInvisible)",
"aes_gw.transportCmd l3s(open port="+AESPort+")",
// plug the as
"aes.plug asc_gw",
"aes.plug aes_gw",
};
StartCommands +=
{
"aes.addRegisteredService ras 本地服务器",
"aes.addRegisteredService aes 本地服务器",
"aes.addRegisteredService rns 本地服务器",
"aes.addRegisteredService pds 本地服务器",
"aes.addRegisteredService egs 本地服务器",
"aes.addRegisteredService fes_0 本地服务器",
"aes.addRegisteredService lgc_0 本地服务器",
};
/// server_daemon command
ras = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/admin_service.exe", "--fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid" };
aes = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/admin_service.exe", "--fulladminname=admin_executor_service --shortadminname=AES -C. -L. --nobreak --writepid" };
rns = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/naming_service.exe", "-C. -L. --nobreak --writepid" };
pds = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/persistant_data_service.exe", "-C. -L. --nobreak --writepid" };
egs = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/entities_game_service.exe", "-C. -L. --nobreak --writepid" };
fes_0 = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/frontend_service.exe", "-C. -L. --nobreak --writepid" };
lgc_0 = { "D:/MT/trunk/code/EVA/server/", "D:/MT/trunk/build/bin/Debug/player_logic_service.exe", "-C. -L. --nobreak --writepid" };
/// for server_daemon
RegisteredServices=
{
"ras",
"aes",
"rns",
"pds",
"egs",
"fes_0",
"lgc_0",
};
//
DontUseStdIn = 0;
// ---- service NeL variables (used by CVariable class)
// If the update loop is too slow, a thread will produce an assertion.
// By default, the value is set to 10 minutes.
// Set to 0 for no assertion.
UpdateAssertionThreadTimeout = 0;
// ---- service custom variables (used by CVariable class)
// in second, -1 for not restarting
RestartDelay = 60;
// how many second before aborting the request if not finished
RequestTimeout = 5;
// log path for advanced log report
LogPath = "/.";
// setup for deployment environment with exeternal configuration system responsible for launching apps and
// for configuring AES services
DontLaunchServicesDirectly = 1;
UseExplicitAESRegistration = 1;
KillServicesOnDisconnect = 1;
ShardName="dev";
================================================
FILE: code/EVA/server/admin_modules/CMakeLists.txt
================================================
FILE(GLOB SRC *.cpp *.h)
NL_TARGET_LIB(eva_adminmodules ${SRC})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
TARGET_LINK_LIBRARIES(eva_adminmodules nelmisc nelnet)
NL_DEFAULT_PROPS(eva_adminmodules "Base, Library: Service Admin Modules")
NL_ADD_RUNTIME_FLAGS(eva_adminmodules)
NL_ADD_LIB_SUFFIX(eva_adminmodules)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
#INSTALL(TARGETS eva_adminmodules LIBRARY DESTINATION ${EVA_LIB_PREFIX} ARCHIVE DESTINATION ${EVA_LIB_PREFIX} COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS eva_adminmodules LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
================================================
FILE: code/EVA/server/admin_modules/admin_modules.cpp
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
/** This file declare a pure nel module library */
#include "nel/net/module_manager.h"
#include "nel/net/module.h"
#include "nel/net/module_builder_parts.h"
using namespace std;
using namespace NLMISC;
using namespace NLNET;
extern void as_forceLink();
extern void aes_forceLink();
extern void aesclient_forceLink();
void admin_modules_forceLink()
{
as_forceLink();
aes_forceLink();
aesclient_forceLink();
}
//NLMISC_DECL_PURE_LIB(CNelModuleLibrary);
================================================
FILE: code/EVA/server/admin_modules/admin_modules_itf.cpp
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
#include "admin_modules_itf.h"
namespace ADMIN
{
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
const CAdminServiceSkel::TMessageHandlerMap &CAdminServiceSkel::getMessageHandlers() const
{
static TMessageHandlerMap handlers;
static bool init = false;
if (!init)
{
std::pair < TMessageHandlerMap::iterator, bool > res;
res = handlers.insert(std::make_pair(std::string("USU"), &CAdminServiceSkel::upServiceUpdate_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("GU"), &CAdminServiceSkel::graphUpdate_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("HRGU"), &CAdminServiceSkel::highRezGraphUpdate_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("CR"), &CAdminServiceSkel::commandResult_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
init = true;
}
return handlers;
}
bool CAdminServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
{
const TMessageHandlerMap &mh = getMessageHandlers();
TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
if (it == mh.end())
{
return false;
}
TMessageHandler cmd = it->second;
(this->*cmd)(sender, message);
return true;
}
void CAdminServiceSkel::upServiceUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminServiceSkel_upServiceUpdate_USU);
std::vector < TServiceStatus > serviceStatus;
nlRead(__message, serialCont, serviceStatus);
upServiceUpdate(sender, serviceStatus);
}
void CAdminServiceSkel::graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminServiceSkel_graphUpdate_GU);
TGraphDatas graphDatas;
nlRead(__message, serial, graphDatas);
graphUpdate(sender, graphDatas);
}
void CAdminServiceSkel::highRezGraphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminServiceSkel_highRezGraphUpdate_HRGU);
THighRezDatas graphDatas;
nlRead(__message, serial, graphDatas);
highRezGraphUpdate(sender, graphDatas);
}
void CAdminServiceSkel::commandResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminServiceSkel_commandResult_CR);
uint32 commandId;
nlRead(__message, serial, commandId);
std::string serviceAlias;
nlRead(__message, serial, serviceAlias);
std::string result;
nlRead(__message, serial, result);
commandResult(sender, commandId, serviceAlias, result);
}
// An AES send an update of the list of service up
void CAdminServiceProxy::upServiceUpdate(NLNET::IModule *sender, const std::vector < TServiceStatus > &serviceStatus)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->upServiceUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), serviceStatus);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_upServiceUpdate(__message, serviceStatus);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// An AES send graph data update
void CAdminServiceProxy::graphUpdate(NLNET::IModule *sender, const TGraphDatas &graphDatas)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->graphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_graphUpdate(__message, graphDatas);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// An AES send high rez graph data update
void CAdminServiceProxy::highRezGraphUpdate(NLNET::IModule *sender, const THighRezDatas &graphDatas)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->highRezGraphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_highRezGraphUpdate(__message, graphDatas);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// AES send back the result of execution of a command
void CAdminServiceProxy::commandResult(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->commandResult(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, result);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_commandResult(__message, commandId, serviceAlias, result);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_upServiceUpdate(NLNET::CMessage &__message, const std::vector < TServiceStatus > &serviceStatus)
{
__message.setType("USU");
nlWrite(__message, serialCont, const_cast < std::vector < TServiceStatus >& > (serviceStatus));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas)
{
__message.setType("GU");
nlWrite(__message, serial, const_cast < TGraphDatas& > (graphDatas));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas)
{
__message.setType("HRGU");
nlWrite(__message, serial, const_cast < THighRezDatas& > (graphDatas));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result)
{
__message.setType("CR");
nlWrite(__message, serial, commandId);
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(__message, serial, const_cast < std::string& > (result));
return __message;
}
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
const CAdminExecutorServiceSkel::TMessageHandlerMap &CAdminExecutorServiceSkel::getMessageHandlers() const
{
static TMessageHandlerMap handlers;
static bool init = false;
if (!init)
{
std::pair < TMessageHandlerMap::iterator, bool > res;
res = handlers.insert(std::make_pair(std::string("SCO"), &CAdminExecutorServiceSkel::setShardOrders_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("SDS"), &CAdminExecutorServiceSkel::shutdownShard_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("CC"), &CAdminExecutorServiceSkel::controlCmd_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("SCMD"), &CAdminExecutorServiceSkel::serviceCmd_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("CR"), &CAdminExecutorServiceSkel::commandResult_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("GU"), &CAdminExecutorServiceSkel::graphUpdate_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("HRGU"), &CAdminExecutorServiceSkel::highRezGraphUpdate_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("SSU"), &CAdminExecutorServiceSkel::serviceStatusUpdate_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
init = true;
}
return handlers;
}
bool CAdminExecutorServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
{
const TMessageHandlerMap &mh = getMessageHandlers();
TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
if (it == mh.end())
{
return false;
}
TMessageHandler cmd = it->second;
(this->*cmd)(sender, message);
return true;
}
void CAdminExecutorServiceSkel::setShardOrders_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_setShardOrders_SCO);
std::string shardName;
nlRead(__message, serial, shardName);
TShardOrders shardOrders;
nlRead(__message, serial, shardOrders);
setShardOrders(sender, shardName, shardOrders);
}
void CAdminExecutorServiceSkel::shutdownShard_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_shutdownShard_SDS);
std::string shardName;
nlRead(__message, serial, shardName);
uint32 delay;
nlRead(__message, serial, delay);
shutdownShard(sender, shardName, delay);
}
void CAdminExecutorServiceSkel::controlCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_controlCmd_CC);
uint32 commandId;
nlRead(__message, serial, commandId);
std::string serviceAlias;
nlRead(__message, serial, serviceAlias);
std::string command;
nlRead(__message, serial, command);
controlCmd(sender, commandId, serviceAlias, command);
}
void CAdminExecutorServiceSkel::serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_serviceCmd_SCMD);
uint32 commandId;
nlRead(__message, serial, commandId);
std::string serviceAlias;
nlRead(__message, serial, serviceAlias);
std::string command;
nlRead(__message, serial, command);
serviceCmd(sender, commandId, serviceAlias, command);
}
void CAdminExecutorServiceSkel::commandResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_commandResult_CR);
uint32 commandId;
nlRead(__message, serial, commandId);
std::string serviceAlias;
nlRead(__message, serial, serviceAlias);
std::string result;
nlRead(__message, serial, result);
commandResult(sender, commandId, serviceAlias, result);
}
void CAdminExecutorServiceSkel::graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_graphUpdate_GU);
TGraphDatas graphDatas;
nlRead(__message, serial, graphDatas);
graphUpdate(sender, graphDatas);
}
void CAdminExecutorServiceSkel::highRezGraphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_highRezGraphUpdate_HRGU);
THighRezDatas graphDatas;
nlRead(__message, serial, graphDatas);
highRezGraphUpdate(sender, graphDatas);
}
void CAdminExecutorServiceSkel::serviceStatusUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceSkel_serviceStatusUpdate_SSU);
std::string status;
nlRead(__message, serial, status);
serviceStatusUpdate(sender, status);
}
// AS send orders for a shard
void CAdminExecutorServiceProxy::setShardOrders(NLNET::IModule *sender, const std::string &shardName, const TShardOrders &shardOrders)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->setShardOrders(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), shardName, shardOrders);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_setShardOrders(__message, shardName, shardOrders);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// AS send a command to shutdown a shard with a delay
void CAdminExecutorServiceProxy::shutdownShard(NLNET::IModule *sender, const std::string &shardName, uint32 delay)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->shutdownShard(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), shardName, delay);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_shutdownShard(__message, shardName, delay);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// AS send a control command to this AES
void CAdminExecutorServiceProxy::controlCmd(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->controlCmd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, command);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_controlCmd(__message, commandId, serviceAlias, command);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// Send a command to a service.
void CAdminExecutorServiceProxy::serviceCmd(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->serviceCmd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, command);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_serviceCmd(__message, commandId, serviceAlias, command);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// AES client send back the result of execution of a command
void CAdminExecutorServiceProxy::commandResult(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->commandResult(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, result);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_commandResult(__message, commandId, serviceAlias, result);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// A service send graph data update
void CAdminExecutorServiceProxy::graphUpdate(NLNET::IModule *sender, const TGraphDatas &graphDatas)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->graphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_graphUpdate(__message, graphDatas);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// A service high rez graph data update
void CAdminExecutorServiceProxy::highRezGraphUpdate(NLNET::IModule *sender, const THighRezDatas &graphDatas)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->highRezGraphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_highRezGraphUpdate(__message, graphDatas);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// A service send an update of of it's status string
void CAdminExecutorServiceProxy::serviceStatusUpdate(NLNET::IModule *sender, const std::string &status)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->serviceStatusUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), status);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_serviceStatusUpdate(__message, status);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_setShardOrders(NLNET::CMessage &__message, const std::string &shardName, const TShardOrders &shardOrders)
{
__message.setType("SCO");
nlWrite(__message, serial, const_cast < std::string& > (shardName));
nlWrite(__message, serial, shardOrders);
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_shutdownShard(NLNET::CMessage &__message, const std::string &shardName, uint32 delay)
{
__message.setType("SDS");
nlWrite(__message, serial, const_cast < std::string& > (shardName));
nlWrite(__message, serial, delay);
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_controlCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
__message.setType("CC");
nlWrite(__message, serial, commandId);
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(__message, serial, const_cast < std::string& > (command));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
__message.setType("SCMD");
nlWrite(__message, serial, commandId);
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(__message, serial, const_cast < std::string& > (command));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result)
{
__message.setType("CR");
nlWrite(__message, serial, commandId);
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(__message, serial, const_cast < std::string& > (result));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas)
{
__message.setType("GU");
nlWrite(__message, serial, const_cast < TGraphDatas& > (graphDatas));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas)
{
__message.setType("HRGU");
nlWrite(__message, serial, const_cast < THighRezDatas& > (graphDatas));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_serviceStatusUpdate(NLNET::CMessage &__message, const std::string &status)
{
__message.setType("SSU");
nlWrite(__message, serial, const_cast < std::string& > (status));
return __message;
}
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
const CAdminExecutorServiceClientSkel::TMessageHandlerMap &CAdminExecutorServiceClientSkel::getMessageHandlers() const
{
static TMessageHandlerMap handlers;
static bool init = false;
if (!init)
{
std::pair < TMessageHandlerMap::iterator, bool > res;
res = handlers.insert(std::make_pair(std::string("SCMD"), &CAdminExecutorServiceClientSkel::serviceCmd_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
res = handlers.insert(std::make_pair(std::string("SCMDNR"), &CAdminExecutorServiceClientSkel::serviceCmdNoReturn_skel));
// if this assert, you have a doubly message name in your interface definition !
nlassert(res.second);
init = true;
}
return handlers;
}
bool CAdminExecutorServiceClientSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
{
const TMessageHandlerMap &mh = getMessageHandlers();
TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
if (it == mh.end())
{
return false;
}
TMessageHandler cmd = it->second;
(this->*cmd)(sender, message);
return true;
}
void CAdminExecutorServiceClientSkel::serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceClientSkel_serviceCmd_SCMD);
uint32 commandId;
nlRead(__message, serial, commandId);
std::string command;
nlRead(__message, serial, command);
serviceCmd(sender, commandId, command);
}
void CAdminExecutorServiceClientSkel::serviceCmdNoReturn_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
{
H_AUTO(CAdminExecutorServiceClientSkel_serviceCmdNoReturn_SCMDNR);
std::string command;
nlRead(__message, serial, command);
serviceCmdNoReturn(sender, command);
}
// execute a command and return the result.
void CAdminExecutorServiceClientProxy::serviceCmd(NLNET::IModule *sender, uint32 commandId, const std::string &command)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->serviceCmd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, command);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_serviceCmd(__message, commandId, command);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// Send a command to a service without waiting for the return value.
void CAdminExecutorServiceClientProxy::serviceCmdNoReturn(NLNET::IModule *sender, const std::string &command)
{
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
{
// immediate local synchronous dispatching
_LocalModuleSkel->serviceCmdNoReturn(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), command);
}
else
{
// send the message for remote dispatching and execution or local queing
NLNET::CMessage __message;
buildMessageFor_serviceCmdNoReturn(__message, command);
_ModuleProxy->sendModuleMessage(sender, __message);
}
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceClientProxy::buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &command)
{
__message.setType("SCMD");
nlWrite(__message, serial, commandId);
nlWrite(__message, serial, const_cast < std::string& > (command));
return __message;
}
// Message serializer. Return the message received in reference for easier integration
const NLNET::CMessage &CAdminExecutorServiceClientProxy::buildMessageFor_serviceCmdNoReturn(NLNET::CMessage &__message, const std::string &command)
{
__message.setType("SCMDNR");
nlWrite(__message, serial, const_cast < std::string& > (command));
return __message;
}
}
================================================
FILE: code/EVA/server/admin_modules/admin_modules_itf.h
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
#ifndef ADMIN_MODULES_ITF
#define ADMIN_MODULES_ITF
#include "nel/misc/types_nl.h"
#include
#include "nel/misc/hierarchical_timer.h"
#include "nel/misc/string_conversion.h"
#include "nel/net/message.h"
#include "nel/net/module.h"
#include "nel/net/module_builder_parts.h"
#include "nel/net/module_message.h"
#include "nel/net/module_gateway.h"
#include "server_share/callback_adaptor.h"
#include "nel/misc/time_nl.h"
namespace ADMIN
{
class TGraphData;
class TGraphDatas;
class THighRezData;
class THighRezDatas;
class TServiceStatus;
// This is the interface used by PHP to call methods
// on the Admin service module
class CAdminServiceWebItf
{
protected:
/// the callback server adaptor
std::auto_ptr _CallbackServer;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
{
static NLNET::TCallbackItem callbackArray[] =
{
{ "GCMD", CAdminServiceWebItf::cb_globalCmd },
{ "CCMD", CAdminServiceWebItf::cb_controlCmd },
{ "SCMD", CAdminServiceWebItf::cb_serviceCmd },
{ "GSO", CAdminServiceWebItf::cb_getShardOrders },
{ "GS", CAdminServiceWebItf::cb_getStates },
{ "GHRGI", CAdminServiceWebItf::cb_getHighRezGraphInfo },
{ "GHRG", CAdminServiceWebItf::cb_getHighRezGraph },
};
arrayPtr = callbackArray;
arraySize = sizeofarray(callbackArray);
}
static void _cbConnection(NLNET::TSockId from, void *arg)
{
H_AUTO(CAdminServiceWeb__cbConnection);
CAdminServiceWebItf *_this = reinterpret_cast(arg);
_this->on_CAdminServiceWeb_Connection(from);
}
static void _cbDisconnection(NLNET::TSockId from, void *arg)
{
H_AUTO(CAdminServiceWeb__cbDisconnection);
CAdminServiceWebItf *_this = reinterpret_cast(arg);
_this->on_CAdminServiceWeb_Disconnection(from);
}
public:
/** Constructor, if you specify a replacement adaptor, then the object
* become owner of the adaptor (and it will be released with the
* interface).
*/
CAdminServiceWebItf(ICallbackServerAdaptor *replacementAdaptor = NULL)
{
if (replacementAdaptor == NULL)
{
// use default callback server
_CallbackServer = std::auto_ptr(new CNelCallbackServerAdaptor(this));
}
else
{
// use the replacement one
_CallbackServer = std::auto_ptr(replacementAdaptor);
}
}
virtual ~CAdminServiceWebItf()
{
}
/// Open the interface socket in the specified port
void openItf(uint16 port)
{
NLNET::TCallbackItem *arrayPtr;
uint32 arraySize;
getCallbakArray(arrayPtr, arraySize);
_CallbackServer->addCallbackArray(arrayPtr, arraySize);
_CallbackServer->setConnectionCallback (_cbConnection, this);
_CallbackServer->setDisconnectionCallback (_cbDisconnection, this);
_CallbackServer->init(port);
}
/** Must be called evenly, update the network subclass to receive message
* and dispatch method invokation.
*/
void update()
{
H_AUTO(CAdminServiceWeb_update);
try
{
_CallbackServer->update();
}
catch (...)
{
nlwarning("CAdminServiceWeb : Exception launch in callback server update");
}
}
void commandResult(NLNET::TSockId dest, const std::string &serviceAlias, const std::string &result)
{
H_AUTO(commandResult_commandResult);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::commandResult called");
#endif
NLNET::CMessage message("CMDR");
nlWrite(message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(message, serial, const_cast < std::string& > (result));
_CallbackServer->send(message, dest);
}
static void cb_globalCmd (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(globalCmd_on_globalCmd);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_globalCmd received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
std::string command;
nlRead(message, serial, command);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_globalCmd : calling on_globalCmd");
#endif
callback->on_globalCmd(from, command);
}
static void cb_controlCmd (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(controlCmd_on_controlCmd);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_controlCmd received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
std::string serviceAlias;
std::string command;
nlRead(message, serial, serviceAlias);
nlRead(message, serial, command);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_controlCmd : calling on_controlCmd");
#endif
callback->on_controlCmd(from, serviceAlias, command);
}
static void cb_serviceCmd (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(serviceCmd_on_serviceCmd);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_serviceCmd received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
std::string serviceAlias;
std::string command;
nlRead(message, serial, serviceAlias);
nlRead(message, serial, command);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_serviceCmd : calling on_serviceCmd");
#endif
callback->on_serviceCmd(from, serviceAlias, command);
}
static void cb_getShardOrders (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(getShardOrders_on_getShardOrders);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getShardOrders received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getShardOrders : calling on_getShardOrders");
#endif
std::vector retValue;
retValue = callback->on_getShardOrders(from);
NLNET::CMessage retMsg("R_GSO");
nlWrite(retMsg, serialCont, retValue);
callback->_CallbackServer->send(retMsg, from);
}
static void cb_getStates (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(getStates_on_getStates);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getStates received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getStates : calling on_getStates");
#endif
std::vector retValue;
retValue = callback->on_getStates(from);
NLNET::CMessage retMsg("R_GS");
nlWrite(retMsg, serialCont, retValue);
callback->_CallbackServer->send(retMsg, from);
}
static void cb_getHighRezGraphInfo (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(getHighRezGraphInfo_on_getHighRezGraphInfo);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getHighRezGraphInfo received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
std::string varAddr;
nlRead(message, serial, varAddr);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getHighRezGraphInfo : calling on_getHighRezGraphInfo");
#endif
std::vector retValue;
retValue = callback->on_getHighRezGraphInfo(from, varAddr);
NLNET::CMessage retMsg("R_GHRGI");
nlWrite(retMsg, serialCont, retValue);
callback->_CallbackServer->send(retMsg, from);
}
static void cb_getHighRezGraph (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
H_AUTO(getHighRezGraph_on_getHighRezGraph);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getHighRezGraph received from class '%s'", typeid(netbase).name());
#endif
ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData());
CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
std::string varAddr;
uint32 startDate;
uint32 endDate;
uint32 milliStep;
nlRead(message, serial, varAddr);
nlRead(message, serial, startDate);
nlRead(message, serial, endDate);
nlRead(message, serial, milliStep);
#ifdef NL_DEBUG
nldebug("CAdminServiceWeb::cb_getHighRezGraph : calling on_getHighRezGraph");
#endif
std::vector retValue;
retValue = callback->on_getHighRezGraph(from, varAddr, startDate, endDate, milliStep);
NLNET::CMessage retMsg("R_GHRG");
nlWrite(retMsg, serialCont, retValue);
callback->_CallbackServer->send(retMsg, from);
}
/// Connection callback : a new interface client connect
virtual void on_CAdminServiceWeb_Connection(NLNET::TSockId from) =0;
/// Disconnection callback : one of the interface client disconnect
virtual void on_CAdminServiceWeb_Disconnection(NLNET::TSockId from) =0;
// Send a command to the AS.
// This is used to issue global commands like 'as.allStart' or 'as.allStop'.
// The result is returned by the return message
// serviceCmdResult.
virtual void on_globalCmd(NLNET::TSockId from, const std::string &command) =0;
// Send a service related command to the executor
// (not to the controled service)
// The result is returned by the return message
// controlCmdResult.
virtual void on_controlCmd(NLNET::TSockId from, const std::string &serviceAlias, const std::string &command) =0;
// Send a command to a service.
// The result is returned by the return message
// serviceCmdResult.
virtual void on_serviceCmd(NLNET::TSockId from, const std::string &serviceAlias, const std::string &command) =0;
// Get the orders of each known shard.
// The return value is a vector of string, one entry by shard
virtual std::vector on_getShardOrders(NLNET::TSockId from) =0;
// Get the last known state of all services.
// The return value is a vector of string, one entry by service
virtual std::vector on_getStates(NLNET::TSockId from) =0;
// Get information about a high rez graph.
// The return is a string array containing
// the name of the var, the available sample
// period as two unix date (start dans end)
// and the number of samples available
// If the var is not found, an empty array is returned
virtual std::vector on_getHighRezGraphInfo(NLNET::TSockId from, const std::string &varAddr) =0;
// Get the data for a high resolution graph.
// The return is a string array, each
// string containing 'time:milliOffset:value
// Set endDate to 0 to specify a start date relative
// to the last sample date. In this case, start date
// is interpreted as the number of second before
// the last sample.
virtual std::vector on_getHighRezGraph(NLNET::TSockId from, const std::string &varAddr, uint32 startDate, uint32 endDate, uint32 milliStep) =0;
};
// This is the interface used by PHP to call methods
// on the Admin service module
/** This is the client side of the interface
* Derive from this class to invoke method on the callback server
*/
class CAdminServiceWebClientItf
{
protected:
/// the callback client adaptor
std::auto_ptr < ICallbackClientAdaptor > _CallbackClient;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
{
static NLNET::TCallbackItem callbackArray[] =
{
{ "CMDR", CAdminServiceWebClientItf::cb_commandResult },
};
arrayPtr = callbackArray;
arraySize = sizeofarray(callbackArray);
}
static void _cbDisconnection(NLNET::TSockId from, void *arg)
{
CAdminServiceWebClientItf *_this = reinterpret_cast(arg);
_this->on_CAdminServiceWebClient_Disconnection(from);
}
public:
/// Retreive the message name for a given callback name
static const std::string &getMessageName(const std::string &methodName)
{
static std::map messageNames;
static bool initialized = false;
if (!initialized)
{
messageNames.insert(std::make_pair(std::string("on_commandResult"), std::string("CMDR")));
initialized = true;
}
std::map < std::string, std::string>::const_iterator it(messageNames.find(methodName));
if (it != messageNames.end())
return it->second;
static std::string emptyString;
return emptyString;
}
CAdminServiceWebClientItf(ICallbackClientAdaptor *adaptorReplacement = NULL)
{
if (adaptorReplacement == NULL)
{
// use the default Nel adaptor
_CallbackClient = std::auto_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this));
}
else
{
// use the replacement one
_CallbackClient = std::auto_ptr < ICallbackClientAdaptor >(adaptorReplacement);
}
}
/// Connect the interface client to the callback server at the specified address and port
virtual void connectItf(NLNET::CInetAddress address)
{
NLNET::TCallbackItem *arrayPtr;
uint32 arraySize;
static bool callbackAdded = false;
if (!callbackAdded)
{
getCallbakArray(arrayPtr, arraySize);
_CallbackClient->addCallbackArray(arrayPtr, arraySize);
}
_CallbackClient->setDisconnectionCallback (_cbDisconnection, this);
_CallbackClient->connect(address);
}
/** Must be called evenly, update the network subclass to receive message
* and dispatch invokation returns.
*/
virtual void update()
{
H_AUTO(CAdminServiceWeb_update);
try
{
_CallbackClient->update();
}
catch (...)
{
nlwarning("CAdminServiceWeb : Exception launch in callback client update");
}
}
// Send a command to the AS.
// This is used to issue global commands like 'as.allStart' or 'as.allStop'.
// The result is returned by the return message
// serviceCmdResult.
void globalCmd(const std::string &command)
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::globalCmd called");
#endif
NLNET::CMessage message("GCMD");
nlWrite(message, serial, const_cast < std::string& > (command));
_CallbackClient->send(message);
}
// Send a service related command to the executor
// (not to the controled service)
// The result is returned by the return message
// controlCmdResult.
void controlCmd(const std::string &serviceAlias, const std::string &command)
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::controlCmd called");
#endif
NLNET::CMessage message("CCMD");
nlWrite(message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(message, serial, const_cast < std::string& > (command));
_CallbackClient->send(message);
}
// Send a command to a service.
// The result is returned by the return message
// serviceCmdResult.
void serviceCmd(const std::string &serviceAlias, const std::string &command)
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::serviceCmd called");
#endif
NLNET::CMessage message("SCMD");
nlWrite(message, serial, const_cast < std::string& > (serviceAlias));
nlWrite(message, serial, const_cast < std::string& > (command));
_CallbackClient->send(message);
}
// Get the orders of each known shard.
// The return value is a vector of string, one entry by shard
void getShardOrders()
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::getShardOrders called");
#endif
NLNET::CMessage message("GSO");
_CallbackClient->send(message);
}
// Get the last known state of all services.
// The return value is a vector of string, one entry by service
void getStates()
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::getStates called");
#endif
NLNET::CMessage message("GS");
_CallbackClient->send(message);
}
// Get information about a high rez graph.
// The return is a string array containing
// the name of the var, the available sample
// period as two unix date (start dans end)
// and the number of samples available
// If the var is not found, an empty array is returned
void getHighRezGraphInfo(const std::string &varAddr)
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::getHighRezGraphInfo called");
#endif
NLNET::CMessage message("GHRGI");
nlWrite(message, serial, const_cast < std::string& > (varAddr));
_CallbackClient->send(message);
}
// Get the data for a high resolution graph.
// The return is a string array, each
// string containing 'time:milliOffset:value
// Set endDate to 0 to specify a start date relative
// to the last sample date. In this case, start date
// is interpreted as the number of second before
// the last sample.
void getHighRezGraph(const std::string &varAddr, uint32 startDate, uint32 endDate, uint32 milliStep)
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::getHighRezGraph called");
#endif
NLNET::CMessage message("GHRG");
nlWrite(message, serial, const_cast < std::string& > (varAddr));
nlWrite(message, serial, startDate);
nlWrite(message, serial, endDate);
nlWrite(message, serial, milliStep);
_CallbackClient->send(message);
}
static void cb_commandResult (NLNET::CMessage &message, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase)
{
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::cb_commandResult received from class '%s'", typeid(netbase).name());
#endif
ICallbackClientAdaptor *adaptor = static_cast< ICallbackClientAdaptor *>(netbase.getUserData());
CAdminServiceWebClientItf *callback = (CAdminServiceWebClientItf *)adaptor->getContainerClass();
if (callback == NULL)
return;
std::string serviceAlias;
std::string result;
nlRead(message, serial, serviceAlias);
nlRead(message, serial, result);
#ifdef NL_DEBUG
nldebug("CAdminServiceWebClient::cb_commandResult : calling on_commandResult");
#endif
callback->on_commandResult(from, serviceAlias, result);
}
/// Disconnection callback : the connection to the server is lost
virtual void on_CAdminServiceWebClient_Disconnection(NLNET::TSockId from) =0;
virtual void on_commandResult(NLNET::TSockId from, const std::string &serviceAlias, const std::string &result) =0;
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class TGraphData
{
protected:
//
std::string _ServiceAlias;
//
std::string _VarName;
//
uint32 _SamplePeriod;
//
double _Value;
public:
//
const std::string &getServiceAlias() const
{
return _ServiceAlias;
}
std::string &getServiceAlias()
{
return _ServiceAlias;
}
void setServiceAlias(const std::string &value)
{
_ServiceAlias = value;
}
//
const std::string &getVarName() const
{
return _VarName;
}
std::string &getVarName()
{
return _VarName;
}
void setVarName(const std::string &value)
{
_VarName = value;
}
//
uint32 getSamplePeriod() const
{
return _SamplePeriod;
}
void setSamplePeriod(uint32 value)
{
_SamplePeriod = value;
}
//
double getValue() const
{
return _Value;
}
void setValue(double value)
{
_Value = value;
}
bool operator == (const TGraphData &other) const
{
return _ServiceAlias == other._ServiceAlias
&& _VarName == other._VarName
&& _SamplePeriod == other._SamplePeriod
&& _Value == other._Value;
}
// constructor
TGraphData()
{
}
void serial(NLMISC::IStream &s)
{
s.serial(_ServiceAlias);
s.serial(_VarName);
s.serial(_SamplePeriod);
s.serial(_Value);
}
private:
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class TGraphDatas
{
protected:
//
uint32 _CurrentTime;
//
std::vector < TGraphData > _Datas;
public:
//
uint32 getCurrentTime() const
{
return _CurrentTime;
}
void setCurrentTime(uint32 value)
{
_CurrentTime = value;
}
//
const std::vector < TGraphData > &getDatas() const
{
return _Datas;
}
std::vector < TGraphData > &getDatas()
{
return _Datas;
}
void setDatas(const std::vector < TGraphData > &value)
{
_Datas = value;
}
bool operator == (const TGraphDatas &other) const
{
return _CurrentTime == other._CurrentTime
&& _Datas == other._Datas;
}
// constructor
TGraphDatas()
{
}
void serial(NLMISC::IStream &s)
{
s.serial(_CurrentTime);
s.serialCont(_Datas);
}
private:
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class THighRezData
{
protected:
//
NLMISC::TTime _SampleTick;
//
double _Value;
public:
//
NLMISC::TTime getSampleTick() const
{
return _SampleTick;
}
void setSampleTick(NLMISC::TTime value)
{
_SampleTick = value;
}
//
double getValue() const
{
return _Value;
}
void setValue(double value)
{
_Value = value;
}
bool operator == (const THighRezData &other) const
{
return _SampleTick == other._SampleTick
&& _Value == other._Value;
}
// constructor
THighRezData()
{
}
void serial(NLMISC::IStream &s)
{
s.serial(_SampleTick);
s.serial(_Value);
}
private:
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class THighRezDatas
{
protected:
//
std::string _ServiceAlias;
//
std::string _VarName;
//
uint32 _CurrentTime;
//
std::vector < THighRezData > _Datas;
public:
//
const std::string &getServiceAlias() const
{
return _ServiceAlias;
}
std::string &getServiceAlias()
{
return _ServiceAlias;
}
void setServiceAlias(const std::string &value)
{
_ServiceAlias = value;
}
//
const std::string &getVarName() const
{
return _VarName;
}
std::string &getVarName()
{
return _VarName;
}
void setVarName(const std::string &value)
{
_VarName = value;
}
//
uint32 getCurrentTime() const
{
return _CurrentTime;
}
void setCurrentTime(uint32 value)
{
_CurrentTime = value;
}
//
const std::vector < THighRezData > &getDatas() const
{
return _Datas;
}
std::vector < THighRezData > &getDatas()
{
return _Datas;
}
void setDatas(const std::vector < THighRezData > &value)
{
_Datas = value;
}
bool operator == (const THighRezDatas &other) const
{
return _ServiceAlias == other._ServiceAlias
&& _VarName == other._VarName
&& _CurrentTime == other._CurrentTime
&& _Datas == other._Datas;
}
// constructor
THighRezDatas()
{
}
void serial(NLMISC::IStream &s)
{
s.serial(_ServiceAlias);
s.serial(_VarName);
s.serial(_CurrentTime);
s.serialCont(_Datas);
}
private:
};
struct TShardOrders
{
enum TValues
{
so_autostart_on,
so_autostart_off,
/// the highest valid value in the enum
last_enum_item = so_autostart_off,
/// a value equal to the last enum item +1
end_of_enum,
invalid_val,
/// Number of enumerated values
nb_enum_items = 2
};
/// Index table to convert enum value to linear index table
const std::map &getIndexTable() const
{
static std::map indexTable;
static bool init = false;
if (!init)
{
// fill the index table
indexTable.insert(std::make_pair(so_autostart_on, 0));
indexTable.insert(std::make_pair(so_autostart_off, 1));
init = true;
}
return indexTable;
}
static const NLMISC::CStringConversion &getConversionTable()
{
NL_BEGIN_STRING_CONVERSION_TABLE(TValues)
NL_STRING_CONVERSION_TABLE_ENTRY(so_autostart_on)
NL_STRING_CONVERSION_TABLE_ENTRY(so_autostart_off)
NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val)
};
static NLMISC::CStringConversion
conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table)
/ sizeof(TValues_nl_string_conversion_table[0]), invalid_val);
return conversionTable;
}
TValues _Value;
public:
TShardOrders()
: _Value(invalid_val)
{
}
TShardOrders(TValues value)
: _Value(value)
{
}
TShardOrders(const std::string &str)
{
_Value = getConversionTable().fromString(str);
}
void serial(NLMISC::IStream &s)
{
s.serialEnum(_Value);
}
bool operator == (const TShardOrders &other) const
{
return _Value == other._Value;
}
bool operator != (const TShardOrders &other) const
{
return ! (_Value == other._Value);
}
bool operator < (const TShardOrders &other) const
{
return _Value < other._Value;
}
bool operator <= (const TShardOrders &other) const
{
return _Value <= other._Value;
}
bool operator > (const TShardOrders &other) const
{
return !(_Value <= other._Value);
}
bool operator >= (const TShardOrders &other) const
{
return !(_Value < other._Value);
}
const std::string &toString() const
{
return getConversionTable().toString(_Value);
}
static const std::string &toString(TValues value)
{
return getConversionTable().toString(value);
}
TValues getValue() const
{
return _Value;
}
// return true if the actual value of the enum is valid, otherwise false
bool isValid()
{
if (_Value == invalid_val)
return false;
// not invalid, check other enum value
return getConversionTable().isValid(_Value);
}
uint32 asIndex()
{
std::map::const_iterator it(getIndexTable().find(_Value));
nlassert(it != getIndexTable().end());
return it->second;
}
};
struct TRunningOrders
{
enum TValues
{
ro_deactivated,
ro_activated,
/// the highest valid value in the enum
last_enum_item = ro_activated,
/// a value equal to the last enum item +1
end_of_enum,
invalid_val,
/// Number of enumerated values
nb_enum_items = 2
};
/// Index table to convert enum value to linear index table
const std::map &getIndexTable() const
{
static std::map indexTable;
static bool init = false;
if (!init)
{
// fill the index table
indexTable.insert(std::make_pair(ro_deactivated, 0));
indexTable.insert(std::make_pair(ro_activated, 1));
init = true;
}
return indexTable;
}
static const NLMISC::CStringConversion &getConversionTable()
{
NL_BEGIN_STRING_CONVERSION_TABLE(TValues)
NL_STRING_CONVERSION_TABLE_ENTRY(ro_deactivated)
NL_STRING_CONVERSION_TABLE_ENTRY(ro_activated)
NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val)
};
static NLMISC::CStringConversion
conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table)
/ sizeof(TValues_nl_string_conversion_table[0]), invalid_val);
return conversionTable;
}
TValues _Value;
public:
TRunningOrders()
: _Value(invalid_val)
{
}
TRunningOrders(TValues value)
: _Value(value)
{
}
TRunningOrders(const std::string &str)
{
_Value = getConversionTable().fromString(str);
}
void serial(NLMISC::IStream &s)
{
s.serialEnum(_Value);
}
bool operator == (const TRunningOrders &other) const
{
return _Value == other._Value;
}
bool operator != (const TRunningOrders &other) const
{
return ! (_Value == other._Value);
}
bool operator < (const TRunningOrders &other) const
{
return _Value < other._Value;
}
bool operator <= (const TRunningOrders &other) const
{
return _Value <= other._Value;
}
bool operator > (const TRunningOrders &other) const
{
return !(_Value <= other._Value);
}
bool operator >= (const TRunningOrders &other) const
{
return !(_Value < other._Value);
}
const std::string &toString() const
{
return getConversionTable().toString(_Value);
}
static const std::string &toString(TValues value)
{
return getConversionTable().toString(value);
}
TValues getValue() const
{
return _Value;
}
// return true if the actual value of the enum is valid, otherwise false
bool isValid()
{
if (_Value == invalid_val)
return false;
// not invalid, check other enum value
return getConversionTable().isValid(_Value);
}
uint32 asIndex()
{
std::map::const_iterator it(getIndexTable().find(_Value));
nlassert(it != getIndexTable().end());
return it->second;
}
};
struct TRunningState
{
enum TValues
{
rs_stopped,
rs_running,
rs_online,
/// the highest valid value in the enum
last_enum_item = rs_online,
/// a value equal to the last enum item +1
end_of_enum,
invalid_val,
/// Number of enumerated values
nb_enum_items = 3
};
/// Index table to convert enum value to linear index table
const std::map &getIndexTable() const
{
static std::map indexTable;
static bool init = false;
if (!init)
{
// fill the index table
indexTable.insert(std::make_pair(rs_stopped, 0));
indexTable.insert(std::make_pair(rs_running, 1));
indexTable.insert(std::make_pair(rs_online, 2));
init = true;
}
return indexTable;
}
static const NLMISC::CStringConversion &getConversionTable()
{
NL_BEGIN_STRING_CONVERSION_TABLE(TValues)
NL_STRING_CONVERSION_TABLE_ENTRY(rs_stopped)
NL_STRING_CONVERSION_TABLE_ENTRY(rs_running)
NL_STRING_CONVERSION_TABLE_ENTRY(rs_online)
NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val)
};
static NLMISC::CStringConversion
conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table)
/ sizeof(TValues_nl_string_conversion_table[0]), invalid_val);
return conversionTable;
}
TValues _Value;
public:
TRunningState()
: _Value(invalid_val)
{
}
TRunningState(TValues value)
: _Value(value)
{
}
TRunningState(const std::string &str)
{
_Value = getConversionTable().fromString(str);
}
void serial(NLMISC::IStream &s)
{
s.serialEnum(_Value);
}
bool operator == (const TRunningState &other) const
{
return _Value == other._Value;
}
bool operator != (const TRunningState &other) const
{
return ! (_Value == other._Value);
}
bool operator < (const TRunningState &other) const
{
return _Value < other._Value;
}
bool operator <= (const TRunningState &other) const
{
return _Value <= other._Value;
}
bool operator > (const TRunningState &other) const
{
return !(_Value <= other._Value);
}
bool operator >= (const TRunningState &other) const
{
return !(_Value < other._Value);
}
const std::string &toString() const
{
return getConversionTable().toString(_Value);
}
static const std::string &toString(TValues value)
{
return getConversionTable().toString(value);
}
TValues getValue() const
{
return _Value;
}
// return true if the actual value of the enum is valid, otherwise false
bool isValid()
{
if (_Value == invalid_val)
return false;
// not invalid, check other enum value
return getConversionTable().isValid(_Value);
}
uint32 asIndex()
{
std::map::const_iterator it(getIndexTable().find(_Value));
nlassert(it != getIndexTable().end());
return it->second;
}
};
struct TRunningTag
{
enum TValues
{
rt_chain_crashing,
rt_locally_started,
rt_locally_stopped,
rt_globally_stopped,
rt_stopped_for_patch,
rt_externaly_started,
rt_slow_to_stop,
rt_slow_to_start,
/// the highest valid value in the enum
last_enum_item = rt_slow_to_start,
/// a value equal to the last enum item +1
end_of_enum,
invalid_val,
/// Number of enumerated values
nb_enum_items = 8
};
/// Index table to convert enum value to linear index table
const std::map &getIndexTable() const
{
static std::map indexTable;
static bool init = false;
if (!init)
{
// fill the index table
indexTable.insert(std::make_pair(rt_chain_crashing, 0));
indexTable.insert(std::make_pair(rt_locally_started, 1));
indexTable.insert(std::make_pair(rt_locally_stopped, 2));
indexTable.insert(std::make_pair(rt_globally_stopped, 3));
indexTable.insert(std::make_pair(rt_stopped_for_patch, 4));
indexTable.insert(std::make_pair(rt_externaly_started, 5));
indexTable.insert(std::make_pair(rt_slow_to_stop, 6));
indexTable.insert(std::make_pair(rt_slow_to_start, 7));
init = true;
}
return indexTable;
}
static const NLMISC::CStringConversion &getConversionTable()
{
NL_BEGIN_STRING_CONVERSION_TABLE(TValues)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_chain_crashing)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_locally_started)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_locally_stopped)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_globally_stopped)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_stopped_for_patch)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_externaly_started)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_slow_to_stop)
NL_STRING_CONVERSION_TABLE_ENTRY(rt_slow_to_start)
NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val)
};
static NLMISC::CStringConversion
conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table)
/ sizeof(TValues_nl_string_conversion_table[0]), invalid_val);
return conversionTable;
}
TValues _Value;
public:
TRunningTag()
: _Value(invalid_val)
{
}
TRunningTag(TValues value)
: _Value(value)
{
}
TRunningTag(const std::string &str)
{
_Value = getConversionTable().fromString(str);
}
void serial(NLMISC::IStream &s)
{
s.serialEnum(_Value);
}
bool operator == (const TRunningTag &other) const
{
return _Value == other._Value;
}
bool operator != (const TRunningTag &other) const
{
return ! (_Value == other._Value);
}
bool operator < (const TRunningTag &other) const
{
return _Value < other._Value;
}
bool operator <= (const TRunningTag &other) const
{
return _Value <= other._Value;
}
bool operator > (const TRunningTag &other) const
{
return !(_Value <= other._Value);
}
bool operator >= (const TRunningTag &other) const
{
return !(_Value < other._Value);
}
const std::string &toString() const
{
return getConversionTable().toString(_Value);
}
static const std::string &toString(TValues value)
{
return getConversionTable().toString(value);
}
TValues getValue() const
{
return _Value;
}
// return true if the actual value of the enum is valid, otherwise false
bool isValid()
{
if (_Value == invalid_val)
return false;
// not invalid, check other enum value
return getConversionTable().isValid(_Value);
}
uint32 asIndex()
{
std::map::const_iterator it(getIndexTable().find(_Value));
nlassert(it != getIndexTable().end());
return it->second;
}
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class TServiceStatus
{
protected:
//
std::string _ShardName;
//
std::string _ServiceLongName;
//
std::string _ServiceShortName;
//
std::string _ServiceAliasName;
//
TRunningState _RunningState;
//
TRunningOrders _RunningOrders;
//
std::set < TRunningTag > _RunningTags;
//
std::string _Status;
public:
//
const std::string &getShardName() const
{
return _ShardName;
}
std::string &getShardName()
{
return _ShardName;
}
void setShardName(const std::string &value)
{
_ShardName = value;
}
//
const std::string &getServiceLongName() const
{
return _ServiceLongName;
}
std::string &getServiceLongName()
{
return _ServiceLongName;
}
void setServiceLongName(const std::string &value)
{
_ServiceLongName = value;
}
//
const std::string &getServiceShortName() const
{
return _ServiceShortName;
}
std::string &getServiceShortName()
{
return _ServiceShortName;
}
void setServiceShortName(const std::string &value)
{
_ServiceShortName = value;
}
//
const std::string &getServiceAliasName() const
{
return _ServiceAliasName;
}
std::string &getServiceAliasName()
{
return _ServiceAliasName;
}
void setServiceAliasName(const std::string &value)
{
_ServiceAliasName = value;
}
//
TRunningState getRunningState() const
{
return _RunningState;
}
void setRunningState(TRunningState value)
{
_RunningState = value;
}
//
TRunningOrders getRunningOrders() const
{
return _RunningOrders;
}
void setRunningOrders(TRunningOrders value)
{
_RunningOrders = value;
}
//
const std::set < TRunningTag > &getRunningTags() const
{
return _RunningTags;
}
std::set < TRunningTag > &getRunningTags()
{
return _RunningTags;
}
void setRunningTags(const std::set < TRunningTag > &value)
{
_RunningTags = value;
}
//
const std::string &getStatus() const
{
return _Status;
}
std::string &getStatus()
{
return _Status;
}
void setStatus(const std::string &value)
{
_Status = value;
}
bool operator == (const TServiceStatus &other) const
{
return _ShardName == other._ShardName
&& _ServiceLongName == other._ServiceLongName
&& _ServiceShortName == other._ServiceShortName
&& _ServiceAliasName == other._ServiceAliasName
&& _RunningState == other._RunningState
&& _RunningOrders == other._RunningOrders
&& _RunningTags == other._RunningTags
&& _Status == other._Status;
}
// constructor
TServiceStatus()
{
}
void serial(NLMISC::IStream &s)
{
s.serial(_ShardName);
s.serial(_ServiceLongName);
s.serial(_ServiceShortName);
s.serial(_ServiceAliasName);
s.serial(_RunningState);
s.serial(_RunningOrders);
s.serialCont(_RunningTags);
s.serial(_Status);
}
private:
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class CAdminServiceSkel
{
public:
/// the interceptor type
typedef NLNET::CInterceptorForwarder < CAdminServiceSkel> TInterceptor;
protected:
CAdminServiceSkel()
{
// do early run time check for message table
getMessageHandlers();
}
virtual ~CAdminServiceSkel()
{
}
void init(NLNET::IModule *module)
{
_Interceptor.init(this, module);
}
// unused interceptors
std::string fwdBuildModuleManifest() const { return std::string(); }
void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}
void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}
void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}
// process module message interceptor
bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
private:
typedef void (CAdminServiceSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
typedef std::map TMessageHandlerMap;
const TMessageHandlerMap &getMessageHandlers() const;
void upServiceUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void highRezGraphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void commandResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
// declare one interceptor member of the skeleton
TInterceptor _Interceptor;
// declare the interceptor forwarder as friend of this class
friend class NLNET::CInterceptorForwarder < CAdminServiceSkel>;
public:
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
// An AES send an update of the list of service up
virtual void upServiceUpdate(NLNET::IModuleProxy *sender, const std::vector < TServiceStatus > &serviceStatus) =0;
// An AES send graph data update
virtual void graphUpdate(NLNET::IModuleProxy *sender, const TGraphDatas &graphDatas) =0;
// An AES send high rez graph data update
virtual void highRezGraphUpdate(NLNET::IModuleProxy *sender, const THighRezDatas &graphDatas) =0;
// AES send back the result of execution of a command
virtual void commandResult(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result) =0;
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class CAdminServiceProxy
{
/// Smart pointer on the module proxy
NLNET::TModuleProxyPtr _ModuleProxy;
// Pointer on the local module that implement the interface (if the proxy is for a local module)
NLNET::TModulePtr _LocalModule;
// Direct pointer on the server implementation interface for collocated module
CAdminServiceSkel *_LocalModuleSkel;
public:
CAdminServiceProxy(NLNET::IModuleProxy *proxy)
{
_ModuleProxy = proxy;
// initialize collocated servant interface
if (proxy->getModuleDistance() == 0)
{
_LocalModule = proxy->getLocalModule();
nlassert(_LocalModule != NULL);
CAdminServiceSkel::TInterceptor *interceptor = NULL;
interceptor = static_cast < NLNET::CModuleBase* >(_LocalModule.getPtr())->getInterceptor(interceptor);
nlassert(interceptor != NULL);
_LocalModuleSkel = interceptor->getParent();
nlassert(_LocalModuleSkel != NULL);
}
else
_LocalModuleSkel = 0;
}
virtual ~CAdminServiceProxy()
{
}
NLNET::IModuleProxy *getModuleProxy()
{
return _ModuleProxy;
}
// An AES send an update of the list of service up
void upServiceUpdate(NLNET::IModule *sender, const std::vector < TServiceStatus > &serviceStatus);
// An AES send graph data update
void graphUpdate(NLNET::IModule *sender, const TGraphDatas &graphDatas);
// An AES send high rez graph data update
void highRezGraphUpdate(NLNET::IModule *sender, const THighRezDatas &graphDatas);
// AES send back the result of execution of a command
void commandResult(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_upServiceUpdate(NLNET::CMessage &__message, const std::vector < TServiceStatus > &serviceStatus);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result);
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class CAdminExecutorServiceSkel
{
public:
/// the interceptor type
typedef NLNET::CInterceptorForwarder < CAdminExecutorServiceSkel> TInterceptor;
protected:
CAdminExecutorServiceSkel()
{
// do early run time check for message table
getMessageHandlers();
}
virtual ~CAdminExecutorServiceSkel()
{
}
void init(NLNET::IModule *module)
{
_Interceptor.init(this, module);
}
// unused interceptors
std::string fwdBuildModuleManifest() const { return std::string(); }
void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}
void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}
void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}
// process module message interceptor
bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
private:
typedef void (CAdminExecutorServiceSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
typedef std::map TMessageHandlerMap;
const TMessageHandlerMap &getMessageHandlers() const;
void setShardOrders_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void shutdownShard_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void controlCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void commandResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void highRezGraphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void serviceStatusUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
// declare one interceptor member of the skeleton
TInterceptor _Interceptor;
// declare the interceptor forwarder as friend of this class
friend class NLNET::CInterceptorForwarder < CAdminExecutorServiceSkel>;
public:
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
// AS send orders for a shard
virtual void setShardOrders(NLNET::IModuleProxy *sender, const std::string &shardName, const TShardOrders &shardOrders) =0;
// AS send a command to shutdown a shard with a delay
virtual void shutdownShard(NLNET::IModuleProxy *sender, const std::string &shardName, uint32 delay) =0;
// AS send a control command to this AES
virtual void controlCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command) =0;
// Send a command to a service.
virtual void serviceCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command) =0;
// AES client send back the result of execution of a command
virtual void commandResult(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result) =0;
// A service send graph data update
virtual void graphUpdate(NLNET::IModuleProxy *sender, const TGraphDatas &graphDatas) =0;
// A service high rez graph data update
virtual void highRezGraphUpdate(NLNET::IModuleProxy *sender, const THighRezDatas &graphDatas) =0;
// A service send an update of of it's status string
virtual void serviceStatusUpdate(NLNET::IModuleProxy *sender, const std::string &status) =0;
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class CAdminExecutorServiceProxy
{
/// Smart pointer on the module proxy
NLNET::TModuleProxyPtr _ModuleProxy;
// Pointer on the local module that implement the interface (if the proxy is for a local module)
NLNET::TModulePtr _LocalModule;
// Direct pointer on the server implementation interface for collocated module
CAdminExecutorServiceSkel *_LocalModuleSkel;
public:
CAdminExecutorServiceProxy(NLNET::IModuleProxy *proxy)
{
_ModuleProxy = proxy;
// initialize collocated servant interface
if (proxy->getModuleDistance() == 0)
{
_LocalModule = proxy->getLocalModule();
nlassert(_LocalModule != NULL);
CAdminExecutorServiceSkel::TInterceptor *interceptor = NULL;
interceptor = static_cast < NLNET::CModuleBase* >(_LocalModule.getPtr())->getInterceptor(interceptor);
nlassert(interceptor != NULL);
_LocalModuleSkel = interceptor->getParent();
nlassert(_LocalModuleSkel != NULL);
}
else
_LocalModuleSkel = 0;
}
virtual ~CAdminExecutorServiceProxy()
{
}
NLNET::IModuleProxy *getModuleProxy()
{
return _ModuleProxy;
}
// AS send orders for a shard
void setShardOrders(NLNET::IModule *sender, const std::string &shardName, const TShardOrders &shardOrders);
// AS send a command to shutdown a shard with a delay
void shutdownShard(NLNET::IModule *sender, const std::string &shardName, uint32 delay);
// AS send a control command to this AES
void controlCmd(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command);
// Send a command to a service.
void serviceCmd(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command);
// AES client send back the result of execution of a command
void commandResult(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result);
// A service send graph data update
void graphUpdate(NLNET::IModule *sender, const TGraphDatas &graphDatas);
// A service high rez graph data update
void highRezGraphUpdate(NLNET::IModule *sender, const THighRezDatas &graphDatas);
// A service send an update of of it's status string
void serviceStatusUpdate(NLNET::IModule *sender, const std::string &status);
// AS send orders for a shard
// This is the broadcast version of the method.
template < class ProxyIterator >
static void broadcast_setShardOrders(ProxyIterator first, ProxyIterator last, NLNET::IModule *sender, const std::string &shardName, const TShardOrders &shardOrders)
{
NLNET::CMessage message;
// create the message to send to multiple dest
buildMessageFor_setShardOrders(message , shardName, shardOrders);
for (; first != last; ++first)
{
NLNET::IModuleProxy *proxy = *first;
proxy->sendModuleMessage(sender, message);
}
}
// AS send a command to shutdown a shard with a delay
// This is the broadcast version of the method.
template < class ProxyIterator >
static void broadcast_shutdownShard(ProxyIterator first, ProxyIterator last, NLNET::IModule *sender, const std::string &shardName, uint32 delay)
{
NLNET::CMessage message;
// create the message to send to multiple dest
buildMessageFor_shutdownShard(message , shardName, delay);
for (; first != last; ++first)
{
NLNET::IModuleProxy *proxy = *first;
proxy->sendModuleMessage(sender, message);
}
}
// AS send a control command to this AES
// This is the broadcast version of the method.
template < class ProxyIterator >
static void broadcast_controlCmd(ProxyIterator first, ProxyIterator last, NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
NLNET::CMessage message;
// create the message to send to multiple dest
buildMessageFor_controlCmd(message , commandId, serviceAlias, command);
for (; first != last; ++first)
{
NLNET::IModuleProxy *proxy = *first;
proxy->sendModuleMessage(sender, message);
}
}
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_setShardOrders(NLNET::CMessage &__message, const std::string &shardName, const TShardOrders &shardOrders);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_shutdownShard(NLNET::CMessage &__message, const std::string &shardName, uint32 delay);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_controlCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_serviceStatusUpdate(NLNET::CMessage &__message, const std::string &status);
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class CAdminExecutorServiceClientSkel
{
public:
/// the interceptor type
typedef NLNET::CInterceptorForwarder < CAdminExecutorServiceClientSkel> TInterceptor;
protected:
CAdminExecutorServiceClientSkel()
{
// do early run time check for message table
getMessageHandlers();
}
virtual ~CAdminExecutorServiceClientSkel()
{
}
void init(NLNET::IModule *module)
{
_Interceptor.init(this, module);
}
// unused interceptors
std::string fwdBuildModuleManifest() const { return std::string(); }
void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}
void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}
void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}
// process module message interceptor
bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
private:
typedef void (CAdminExecutorServiceClientSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
typedef std::map TMessageHandlerMap;
const TMessageHandlerMap &getMessageHandlers() const;
void serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
void serviceCmdNoReturn_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message);
// declare one interceptor member of the skeleton
TInterceptor _Interceptor;
// declare the interceptor forwarder as friend of this class
friend class NLNET::CInterceptorForwarder < CAdminExecutorServiceClientSkel>;
public:
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
// execute a command and return the result.
virtual void serviceCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &command) =0;
// Send a command to a service without waiting for the return value.
virtual void serviceCmdNoReturn(NLNET::IModuleProxy *sender, const std::string &command) =0;
};
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
class CAdminExecutorServiceClientProxy
{
/// Smart pointer on the module proxy
NLNET::TModuleProxyPtr _ModuleProxy;
// Pointer on the local module that implement the interface (if the proxy is for a local module)
NLNET::TModulePtr _LocalModule;
// Direct pointer on the server implementation interface for collocated module
CAdminExecutorServiceClientSkel *_LocalModuleSkel;
public:
CAdminExecutorServiceClientProxy(NLNET::IModuleProxy *proxy)
{
_ModuleProxy = proxy;
// initialize collocated servant interface
if (proxy->getModuleDistance() == 0)
{
_LocalModule = proxy->getLocalModule();
nlassert(_LocalModule != NULL);
CAdminExecutorServiceClientSkel::TInterceptor *interceptor = NULL;
interceptor = static_cast < NLNET::CModuleBase* >(_LocalModule.getPtr())->getInterceptor(interceptor);
nlassert(interceptor != NULL);
_LocalModuleSkel = interceptor->getParent();
nlassert(_LocalModuleSkel != NULL);
}
else
_LocalModuleSkel = 0;
}
virtual ~CAdminExecutorServiceClientProxy()
{
}
NLNET::IModuleProxy *getModuleProxy()
{
return _ModuleProxy;
}
// execute a command and return the result.
void serviceCmd(NLNET::IModule *sender, uint32 commandId, const std::string &command);
// Send a command to a service without waiting for the return value.
void serviceCmdNoReturn(NLNET::IModule *sender, const std::string &command);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &command);
// Message serializer. Return the message received in reference for easier integration
static const NLNET::CMessage &buildMessageFor_serviceCmdNoReturn(NLNET::CMessage &__message, const std::string &command);
};
}
#endif
================================================
FILE: code/EVA/server/admin_modules/admin_modules_itf.xml
================================================
================================================
FILE: code/EVA/server/admin_modules/aes_client_module.cpp
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#include "nel/misc/singleton.h"
#include "nel/net/module.h"
#include "nel/net/module_builder_parts.h"
#include "nel/net/unified_network.h"
#include "nel/net/service.h"
#include "admin_modules_itf.h"
using namespace std;
using namespace NLMISC;
using namespace NLNET;
void aesclient_forceLink() {}
namespace ADMIN
{
class CAdminExecutorServiceClient
: /*public CManualSingleton,*/
public CEmptyModuleServiceBehav > >,
public CAdminExecutorServiceClientSkel
{
enum
{
// Maximum time without sending report string (a kind of 'keep alive')
MAX_DELAY_BETWEEN_REPORT = 30, // 30 seconds
};
/// Flag to inform AES that we don't want to be affected by shard orders
bool _DontUseShardOrders;
/// Admin executor service module
TModuleProxyPtr _AdminExecutorService;
/// Date of last state reporting to AES
uint32 _LastStateReport;
/// Last date of status string update
uint32 _LastStatusStringReport;
/// Last status string sent (to avoid double send)
string _LastSentStatus;
/// The service alias (must be an unique name)
string _ServiceAlias;
/// A cache of the value because reading it is very slow
uint32 _ProcessUsedMemory;
struct TGraphSample
{
// The date of the sample (in second)
uint32 TimeStamp;
// The date of the sample (in ms)
TTime HighRezTimeStamp;
// sample value
double SampleValue;
};
struct TGraphVarInfo
{
/// Name of the graphed var
string VarName;
/** Mean time between two sample in ms
* (in fact, if will be the min period)
* Set it to 1 to have a sample at each tick
* If the period is set less than 1000 ms,
* then the var is considered 'high rez'.
* Otherwise, the period is rounded at the
* nearest integer second.
* For 'high rez' var, the service buffer
* the relative timestamp in ms at each
* tick loop and send update every seconds
* to the AES service.
* In addition, HighRez var are also sent
* every second as normal sample.
*/
uint32 MeanSamplePeriod;
/// Date of last sample (low rez)
uint32 LastSampleTimeStamp;
/// Date of last sample (high rez)
TTime LastHighRezTimeStamp;
/// The vector of buffered samples
vector Samples;
TGraphVarInfo()
: MeanSamplePeriod(1000),
LastSampleTimeStamp(0),
LastHighRezTimeStamp(0)
{
}
};
/// The list of variable to graph (build from service config file var 'GraphVars')
vector _GraphVars;
/// Date of last graph
public:
CAdminExecutorServiceClient()
: _DontUseShardOrders(false),
_LastStateReport(0),
_LastStatusStringReport(0),
_ProcessUsedMemory(0)
{
CAdminExecutorServiceClientSkel::init(this);
}
std::string makeServiceAlias()
{
string serviceAlias = IService::getInstance()->getServiceAliasName();
if (serviceAlias.empty())
{
serviceAlias = IService::getInstance()->getHostName()+"."+IService::getInstance()->getServiceUnifiedName();
}
return serviceAlias;
}
string getModuleManifest() const
{
uint32 pid = getpid ();
string serviceAlias = _ServiceAlias;
CSString manifest;
manifest << "LongName=" << IService::getInstance()->getServiceLongName()
<< " ShortName=" << IService::getInstance()->getServiceShortName()
<< " AliasName=" << serviceAlias
<< " PID=" << pid
<< " DontUseShardOrders=" << _DontUseShardOrders;
return manifest;
}
bool initModule(const TParsedCommandLine &pcl)
{
if (!CModuleBase::initModule(pcl))
return false;
// try to read the config file
IService *service = IService::getInstance();
if (service == NULL)
{
nlwarning("Failed to get the IService singleton instance");
return false;
}
CConfigFile::CVar *gv = service->ConfigFile.getVarPtr("GraphVars");
if (gv)
{
_GraphVars.clear();
for (uint i =0; isize()/2; ++i)
{
TGraphVarInfo gvi;
gvi.VarName = gv->asString(i*2);
gvi.MeanSamplePeriod = max(1, gv->asInt((i*2)+1));
_GraphVars.push_back(gvi);
}
}
// precompute the service name
_ServiceAlias = makeServiceAlias();
// loop for an optional 'dontUseShardOrders' flag in init params
const TParsedCommandLine *duso = pcl.getParam("dontUseShardOrders");
if (duso != NULL)
_DontUseShardOrders = (duso->ParamValue == "true" || duso->ParamName == "1");
return true;
}
void onModuleUp(IModuleProxy *proxy)
{
if (proxy->getModuleClassName() == "AdminExecutorService")
{
nldebug("CAdminExecutorServiceClient : admin executor service up as '%s'", proxy->getModuleName().c_str());
// we found the manager of AES
if (_AdminExecutorService != NULL)
{
nlwarning("CAdminExecutorServiceClient : admin executor service already known as '%s', replacing with new one", _AdminExecutorService->getModuleName().c_str());
}
_AdminExecutorService = proxy;
// // send basic service info to AES
// CAdminExecutorServiceProxy aes(proxy);
//
// uint32 pid = getpid ();
//
// string serviceAlias = IService::getInstance()->getServiceAliasName();
// if (serviceAlias.empty())
// serviceAlias = getModuleFullyQualifiedName();
//
// aes.serviceConnected(this,
// IService::getInstance()->getServiceLongName(),
// IService::getInstance()->getServiceShortName(),
// serviceAlias,
// pid);
// for resend of the current status to the new AES
_LastSentStatus = "";
sendServiceStatus();
}
}
void onModuleDown(IModuleProxy *proxy)
{
if (proxy == _AdminExecutorService)
{
nldebug("CAdminExecutorServiceClient : admin executor service '%s' is down", proxy->getModuleName().c_str());
_AdminExecutorService = NULL;
}
}
void onModuleUpdate()
{
H_AUTO(CAdminExecutorServiceClient_onModuleUpdate);
uint32 now = CTime::getSecondsSince1970();
TTime timer = CTime::getLocalTime();
// update every HR variables
for (uint i=0; i<_GraphVars.size(); ++i)
{
if (_GraphVars[i].MeanSamplePeriod < 1000)
{
// this is a HR var
TGraphVarInfo &gvi = _GraphVars[i];
if (gvi.LastHighRezTimeStamp + gvi.MeanSamplePeriod < timer)
{
// it's time to get a sample
// create a sample
gvi.Samples.push_back(TGraphSample());
TGraphSample &gs = gvi.Samples.back();
// inialise it
gs.TimeStamp = now;
gs.HighRezTimeStamp = timer;
IVariable *var = dynamic_cast(ICommand::getCommand(gvi.VarName));
if (var != NULL)
gs.SampleValue = atof(var->toString().c_str());
}
}
}
if (_LastStateReport != now)
{
if ((now & 0xf) == 0)
{
// every 16 seconds because very slow
IVariable *var = dynamic_cast(ICommand::getCommand("ProcessUsedMemory"));
if (var != NULL)
NLMISC::fromString(var->toString(), _ProcessUsedMemory);
}
// at least one second as passed, check for updates to send to
// AES
TGraphDatas graphDatas;
graphDatas.setCurrentTime(now);
THighRezDatas highRezDatas;
highRezDatas.setServiceAlias(_ServiceAlias);
highRezDatas.setCurrentTime(now);
vector &datas = graphDatas.getDatas();
for (uint i=0; i<_GraphVars.size(); ++i)
{
if (_GraphVars[i].LastSampleTimeStamp+(_GraphVars[i].MeanSamplePeriod/1000) < now)
{
TGraphVarInfo &gvi = _GraphVars[i];
// it's time to send update for this var
// create a new sample entry
datas.push_back(TGraphData());
// and fill it
TGraphData &gd = datas.back();
gd.setServiceAlias(_ServiceAlias);
gd.setVarName(gvi.VarName);
gd.setSamplePeriod(max(uint32(1), uint32(gvi.MeanSamplePeriod/1000)));
if (gvi.Samples.empty())
{
// no sample collected yet, just ask a new one
IVariable *var = dynamic_cast(ICommand::getCommand(gvi.VarName));
if (var != NULL)
gd.setValue(atof(var->toString().c_str()));
}
else
{
// we have some sample collected, just use the last one
gd.setValue(gvi.Samples.back().SampleValue);
}
// if it's a high rez sampler, send the complete buffer
if (gvi.MeanSamplePeriod < 1000 && _AdminExecutorService != NULL)
{
// build the message
highRezDatas.setVarName(gvi.VarName);
highRezDatas.getDatas().clear();
for (uint j=0; j(ICommand::getCommand("State"));
if (var != NULL)
status << "\tState=" <toString();
var = dynamic_cast(ICommand::getCommand("UserSpeedLoop"));
if (var != NULL)
status << "\tUserSpeedLoop=" <toString();
var = dynamic_cast(ICommand::getCommand("TickSpeedLoop"));
if (var != NULL)
status << "\tTickSpeedLoop=" <toString();
if (_ProcessUsedMemory != 0)
status << "\tProcessUsedMemory=" <<_ProcessUsedMemory;
var = dynamic_cast(ICommand::getCommand("Uptime"));
if (var != NULL)
status << "\tUpTime=" <toString();
var = dynamic_cast(ICommand::getCommand("NbPlayers"));
if (var != NULL)
status << "\tNbPlayers=" <toString();
var = dynamic_cast(ICommand::getCommand("NbEntities"));
if (var != NULL)
status << "\tNbEntities=" <toString();
var = dynamic_cast(ICommand::getCommand("LocalEntities"));
if (var != NULL)
status << "\tLocalEntities=" <toString();
uint32 shardId = IService::getInstance()->getShardId();
status << "\tShardId=" <getServiceStatusString();
}
if ((status != _LastSentStatus || (now - _LastStatusStringReport) > MAX_DELAY_BETWEEN_REPORT)
&& _AdminExecutorService != NULL)
{
CAdminExecutorServiceProxy aes(_AdminExecutorService);
aes.serviceStatusUpdate(this, status);
_LastSentStatus = status;
_LastStatusStringReport = now;
}
}
///////////////////////////////////////////////////////////////
// implementation from Admin executor service client
///////////////////////////////////////////////////////////////
// execute a command and return the result.
virtual void serviceCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &command)
{
// create a displayer to gather the output of the command
class CStringDisplayer: public IDisplayer
{
public:
virtual void doDisplay( const CLog::TDisplayInfo& args, const char *message)
{
_Data += message;
}
std::string _Data;
};
CStringDisplayer stringDisplayer;
IService::getInstance()->CommandLog.addDisplayer(&stringDisplayer);
// retrieve the command from the input message and execute it
nlinfo ("ADMIN: Executing command from network : '%s'", command.c_str());
ICommand::execute (command, IService::getInstance()->CommandLog);
// unhook our displayer as it's work is now done
IService::getInstance()->CommandLog.removeDisplayer(&stringDisplayer);
string serviceAlias = IService::getInstance()->getServiceAliasName();
if (serviceAlias.empty())
serviceAlias = getModuleFullyQualifiedName();
// return the result to AES
CAdminExecutorServiceProxy aes(sender);
aes.commandResult(this, commandId, serviceAlias, stringDisplayer._Data);
}
// execute a command without result
virtual void serviceCmdNoReturn(NLNET::IModuleProxy *sender, const std::string &command)
{
// retrieve the command from the input message and execute it
nlinfo ("ADMIN: Executing command from network : '%s'", command.c_str());
ICommand::execute (command, IService::getInstance()->CommandLog);
}
};
NLNET_REGISTER_MODULE_FACTORY(CAdminExecutorServiceClient, "AdminExecutorServiceClient");
} // namespace ADMIN
================================================
FILE: code/EVA/server/admin_modules/aes_module.cpp
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#include "nel/misc/singleton.h"
#include
#include "nel/misc/path.h"
#include "nel/net/module.h"
#include "nel/net/module_builder_parts.h"
#include "nel/net/unified_network.h"
#include "nel/net/service.h"
#include "server_share/utils.h"
#include "admin_modules_itf.h"
using namespace std;
using namespace NLMISC;
using namespace NLNET;
void aes_forceLink() {}
namespace ADMIN
{
const char* LAUNCH_CTRL_START = "LAUNCH";
const char* LAUNCH_CTRL_STOP = "STOP";
const char *AESPersistentStateFilename = "aes_state.txt";
/// We want 10 slot (you can change this, but need at least 3 slots)
const uint32 CRASH_COUNTER_SLOT = 10;
/// The delay (in second) between slots roll. This value * CRASH_COUNTER_SLOT give the total sampling period
const uint32 CRASH_COUNTER_ROLL_DELAY = 10*60; // 10 mn
/// If we have more than 5 start of a service in the sampling period, we tag the service as 'chain crashing'
const uint32 CRASH_COUNTER_CHAIN_THRESHOLD = 5;
/** the name of the file written by the patch man to request a global shutdown
* of all registered the services before switching to a new version.
*/
CVariable ShutdownRequestFileName("aes","ShutdownRequestFileName", "name of the file to use for shutdown requests", "./global.launch_ctrl", 0, true);
/** A kind rolling buffer used to count services start from the runner
* script.
*/
class CRunnerLoopCounter
{
/// The slot table. Each slot accumulate the service start for a time frame
uint32 _Slots[CRASH_COUNTER_SLOT];
/** The last value read from the runner script. This is used to compute
* the delta value to add to the first slot
*/
uint32 _LastValueRead;
/// The total sum of all slot (could be recomputed on demand, but a little more efficient)
uint32 _CounterSum;
public:
CRunnerLoopCounter()
{
// we need at least 3 slots
nlctassert(CRASH_COUNTER_SLOT >= 3);
// init all slots with 0
for (uint i=0; i0; --i)
{
_Slots[i] = _Slots[i-1];
}
_Slots[0] = 0;
}
/// Return the sum of all the slots
uint32 getSum()
{
return _CounterSum;
}
/// Return the sum of the first slot, the tree first slot and
/// the total of all slots.
/// This is useful to understand the behavoir of a crashing
/// service over the sampling period.
void getCounters(uint32 &oneSlot, uint32 &treeSlots, uint32 &allSlots)
{
oneSlot = _Slots[0];
treeSlots = _Slots[0]+_Slots[1]+_Slots[2];
allSlots = _CounterSum;
}
/// Reset all counter to zero
void resetCounter()
{
for (uint i=0; i,*/
public CEmptyModuleServiceBehav > >,
public CAdminExecutorServiceSkel,
public IModuleTrackerCb
{
public:
enum
{
SLOW_TO_START_THRESHOLD = 60, // 1 mn
SLOW_TO_STOP_THRESHOLD = 60, // 1 mn
_NagiosReportDelay = 60, // 1 mn
};
private:
typedef CModuleTracker TServiceTracker;
// tracker for admin executor client modules
TServiceTracker _ServiceTracker;
/// Admin service module
TModuleProxyPtr _AdminService;
/// Date of last state reporting to AS
uint32 _LastStateReport;
/// Date of last nagios report output
uint32 _LastNagiosReport;
typedef string TAliasName;
typedef string TShardName;
typedef set TRegisteredServices;
/// List of 'registered service', ie. those that are configured in aes cfg.
TRegisteredServices _RegisteredServices;
/// A set of data for each registered or connected service
struct TServiceState
{
string ShardName;
bool DontUseShardOrders;
TRunningState RunningState;
set RunningTags;
string LongName;
string ShortName;
uint32 PID;
string State;
uint32 LastStateDate;
uint32 StopRequestDate;
uint32 StartRequestDate;
TModuleProxyPtr ServiceModule;
CRunnerLoopCounter RunnerLoopCounter;
TServiceState()
: DontUseShardOrders(false),
RunningState(TRunningState::rs_stopped),
PID(0),
LastStateDate(0),
StopRequestDate(0),
StartRequestDate(0)
{}
};
typedef map TServiceStates;
/// States for each connected or registered service
TServiceStates _ServiceStates;
typedef map TConnectedServiceIndex;
/// Index of connected service proxy to alias name
TConnectedServiceIndex _ConnectedServiceIndex;
typedef map TPersistentServiceOrders;
/// Persistent service state, i.e state that are restored after a stop/start of the aes
TPersistentServiceOrders _PersistentServiceOrders;
typedef map TShardsOrders;
/// Shard orders (set by AS)
TShardsOrders _ShardOrders;
/// flag for shutdown request form patch manager.
bool _ShutdownForPatch;
/// A flag that mean we need to save the persistent state file
bool _NeedToWriteStateFile;
/// Date of last roll of the runner loop counters
uint32 _LastRunnerLoopCounterRoll;
/// Data for each command pending result from a service
struct TPendingWebCommand
{
/// Date of reception of the command for timeout
uint32 ReceptionDate;
/// Name of the target service
string ServiceAlias;
/// Command
string Command;
};
typedef uint32 TCommandId;
typedef map TPendingWebCommands;
/// A list of pending command sent to service and waiting result
TPendingWebCommands _PendingWebCommands;
/// information about shard being stopped
struct TStopingShardInfo
{
/// Name of the shard to stop
string ShardName;
/// Delay before stop
uint32 Delay;
/// Begin date of countdown
uint32 BeginDate;
};
typedef vector TStopingShardInfos;
/// The vector of shard to stop.
TStopingShardInfos _StopingShards;
public:
CAdminExecutorService()
: _ServiceTracker(TModuleClassPred("AdminExecutorServiceClient")),
_LastStateReport(0),
_LastNagiosReport(0),
_ShutdownForPatch(false),
_NeedToWriteStateFile(false),
_LastRunnerLoopCounterRoll(0)
{
CAdminExecutorServiceSkel::init(this);
_ServiceTracker.init(this, this);
}
bool initModule(const TParsedCommandLine &pcl)
{
CModuleBase::initModule(pcl);
// read the persistent state file if any
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "rt");
if (fp != NULL)
{
char buffer[1024];
char *ret;
while ((ret=fgets(buffer, 1024, fp)) != NULL)
{
CSString line(buffer);
CSString cmd(line.firstWord(true));
if (cmd == "ServiceState")
{
CSString serviceAlias = line.firstWord(true);
CSString serviceOrders = line.firstWord(true);
TRunningOrders runningOrders(serviceOrders);
if (!serviceAlias.empty() && runningOrders != TRunningOrders::invalid_val)
{
// add this one in the list of persistent state
_PersistentServiceOrders[serviceAlias] = runningOrders;
}
}
else if (cmd == "ShardOrders")
{
string shardName(line.firstWord(true));
TShardOrders shardOrders(line.firstWord(true));
if (shardOrders != TShardOrders::invalid_val)
_ShardOrders[shardName] = shardOrders;
}
}
// clear the flag because 'setGlobalState' has set it
_NeedToWriteStateFile = false;
fclose(fp);
}
return true;
}
void onModuleUp(IModuleProxy *proxy)
{
if (proxy->getModuleClassName() == "AdminService")
{
nldebug("CAdminExecutorService : admin service up as '%s'", proxy->getModuleName().c_str());
// we found the manager of AES
if (_AdminService != NULL)
{
nlwarning("CAdminExecutorService : admin service already known as '%s', replacing with new one", _AdminService->getModuleName().c_str());
}
_AdminService = proxy;
// cleanup the persistent service state by removing any state not in registered or connected service
{
set removeList;
// first, fill the list with all the persistent state service name
{
TPersistentServiceOrders::iterator first(_PersistentServiceOrders.begin()), last(_PersistentServiceOrders.end());
for (; first != last; ++first)
{
removeList.insert(first->first);
}
}
// remove the registered service from the removelist
{
TRegisteredServices::iterator first(_RegisteredServices.begin()), last(_RegisteredServices.end());
for (; first != last; ++first)
{
removeList.erase(*first);
}
}
// remove any connected service (even unregistered one)
{
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
removeList.erase(first->first);
}
}
// no remove persistent state that left in the remove list
while (!removeList.empty())
{
_PersistentServiceOrders.erase(*(removeList.begin()));
_NeedToWriteStateFile = true;
removeList.erase(removeList.begin());
}
}
// send the current status
sendUpServiceUpdate();
}
uint32 now = NLMISC::CTime::getSecondsSince1970();
// check pending command timeout
TPendingWebCommands::iterator first(_PendingWebCommands.begin()), last(_PendingWebCommands.end());
for (; first != last; ++first)
{
TPendingWebCommand &pwc = first->second;
if (now - pwc.ReceptionDate > 10)
{
// timeout
if (_AdminService != NULL)
{
CAdminServiceProxy as(_AdminService);
as.commandResult(this, first->first, pwc.ServiceAlias, "ERROR : AES : no reponse from service");
}
_PendingWebCommands.erase(first);
// check other pending commands at next update
break;
}
}
}
void onModuleDown(IModuleProxy *proxy)
{
if (proxy == _AdminService)
{
nldebug("CAdminExecutorService : admin service '%s' is down", proxy->getModuleName().c_str());
_AdminService = NULL;
}
}
void onModuleUpdate()
{
H_AUTO(CAdminExecutorService_onModuleUpdate);
uint32 now = CTime::getSecondsSince1970();
if (_LastStateReport < now)
{
// every second
// check services every second
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
string aliasName = first->first;
TServiceState &ss = first->second;
if (_RegisteredServices.find(aliasName) != _RegisteredServices.end())
{
// this is a registered service, we need to control is running state
// read the actual running state from the runner script written file
if (getOfflineServiceState(aliasName) == "RUNNING")
{
// the service is running
ss.RunningTags.erase(TRunningTag::rt_locally_stopped);
ss.RunningTags.erase(TRunningTag::rt_globally_stopped);
ss.RunningTags.erase(TRunningTag::rt_stopped_for_patch);
if (ss.StopRequestDate != 0)
{
// still not stopped, check for slow to stop service
if (now - ss.StopRequestDate > SLOW_TO_STOP_THRESHOLD)
{
// add a running tag
ss.RunningTags.insert(TRunningTag::rt_slow_to_stop);
}
}
if (ss.RunningState != TRunningState::rs_online)
{
// tag slow to start service
if (now - ss.StartRequestDate > SLOW_TO_START_THRESHOLD)
{
// add a running tag
ss.RunningTags.insert(TRunningTag::rt_slow_to_start);
}
else
{
ss.RunningState = TRunningState::rs_running;
}
}
}
else
{
// the service is stopped
ss.RunningState = TRunningState::rs_stopped;
ss.RunningTags.erase(TRunningTag::rt_locally_started);
ss.RunningTags.erase(TRunningTag::rt_externaly_started);
ss.RunningTags.erase(TRunningTag::rt_slow_to_stop);
// clean the stop request date
ss.StopRequestDate = 0;
}
// try to obtains service orders from its shard
TShardOrders shardOrders(TShardOrders::so_autostart_on);
if (_ShardOrders.find(ss.ShardName) != _ShardOrders.end())
{
shardOrders = _ShardOrders[ss.ShardName];
}
// little check, the service must have a entry in the service orders container.
nlassert(_PersistentServiceOrders.find(aliasName) != _PersistentServiceOrders.end());
TRunningOrders serviceOrders = _PersistentServiceOrders[aliasName];
// look if service need to be started
if (ss.RunningState == TRunningState::rs_stopped // its stopped
&& serviceOrders == TRunningOrders::ro_activated // and activated
&& shardOrders == TShardOrders::so_autostart_on // and shard is autostart on
&& !ss.DontUseShardOrders // and this service follow its shard orders
&& !_ShutdownForPatch // and no patch pending
)
{
// we must start this service !
startService(aliasName);
}
// look for service that need to be stopped
if (ss.RunningState != TRunningState::rs_stopped // its not stopped
&& (serviceOrders == TRunningOrders::ro_deactivated // and deactivated
|| _ShutdownForPatch) // or patch pending
&& ss.StopRequestDate == 0 // no stop request send
)
{
// we must stop this service
stopService(aliasName);
// store the sop
ss.StopRequestDate = now;
}
// shuted down for patch ?
if (_ShutdownForPatch)
ss.RunningTags.insert(TRunningTag::rt_stopped_for_patch);
else
ss.RunningTags.erase(TRunningTag::rt_stopped_for_patch);
// chain crashing ?
if (ss.RunnerLoopCounter.getSum() > CRASH_COUNTER_CHAIN_THRESHOLD)
ss.RunningTags.insert(TRunningTag::rt_chain_crashing);
else
ss.RunningTags.erase(TRunningTag::rt_chain_crashing);
// update the crash counter
ss.RunnerLoopCounter.updateCounter(getServiceStartLoopCounter(aliasName));
}
}
// if we have an admin service connected, send it an update of service state
if (_AdminService != NULL)
sendUpServiceUpdate();
if ((now & 0xf) == 0)
{
// every 8 seconds for low frequency work
// check for shutdown request from patchman
checkShutdownRequest();
}
// check for shard to stop (and warning to send)
checkServiceToStop();
// time to output the nagios report ?
if (now > _LastNagiosReport+_NagiosReportDelay)
{
// write the nagios report
FILE *fp = fopen("aes_nagios_report.txt", "wt");
if (fp != NULL)
{
// output the current date
time_t t = now;
fprintf(fp, "AESReportDate=%s", ::ctime(&t));
fprintf(fp, "NBService=%u\n", (uint32)_ServiceStates.size());
// output state of each service
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
CSString serviceLine;
TServiceState &ss = first->second;
const string &aliasName = first->first;
CSString runningTags;
set::iterator rtf(ss.RunningTags.begin()), rte(ss.RunningTags.end());
for (; rtf != rte; ++rtf)
{
runningTags<<"<"<toString()<<">";
}
bool registered = _RegisteredServices.find(aliasName) != _RegisteredServices.end();
serviceLine << "ServiceAlias='"<second.RunnerLoopCounter.rollCounter();
}
_LastRunnerLoopCounterRoll = now;
}
if (_NeedToWriteStateFile)
{
/// The persistent service orders need to be saved
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "wt");
if (fp != NULL)
{
{
CSString line;
TShardsOrders::iterator first(_ShardOrders.begin()), last(_ShardOrders.end());
for (; first != last; ++first)
{
line << "ShardOrders "<first<<" "<second.toString()<<"\n";
}
fputs(line.c_str(), fp);
}
{
TPersistentServiceOrders::iterator first(_PersistentServiceOrders.begin()), last(_PersistentServiceOrders.end());
for (; first != last; ++first)
{
CSString line;
line << "ServiceState "<first<<" "<second.toString()<<"\n";
fputs(line.c_str(), fp);
}
}
// clear the flag because 'setGlobalState' has set it
_NeedToWriteStateFile = false;
fclose(fp);
}
}
}
void sendUpServiceUpdate()
{
if (_AdminService != NULL)
{
vector serviceStatus;
set missingServices = _RegisteredServices;
// send an updated list to AES
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
const string &aliasName = first->first;
bool registered = _RegisteredServices.find(aliasName) != _RegisteredServices.end();
TServiceState &ss = first->second;
serviceStatus.push_back(TServiceStatus());
TServiceStatus &ts = serviceStatus.back();
ts.setShardName(ss.ShardName);
ts.setServiceLongName(ss.LongName);
ts.setServiceShortName(ss.ShortName);
ts.setServiceAliasName(aliasName);
ts.setRunningState(ss.RunningState);
if (registered)
ts.setRunningOrders(_PersistentServiceOrders[aliasName]);
else
ts.setRunningOrders(TRunningOrders::invalid_val);
ts.setRunningTags(ss.RunningTags);
CSString state;
state << ss.State << "\tNoReportSince=" << (NLMISC::CTime::getSecondsSince1970()-ss.LastStateDate);
// add the host name
state << "\tHostname=" << IService::getInstance()->getHostName();
if (registered)
{
// this is a registered service, send the start counter
uint32 oneSlot, treeSlots, allSlots;
ss.RunnerLoopCounter.getCounters(oneSlot, treeSlots, allSlots);
state << "\tStartCounter="<second == serviceAlias)
{
// ok, we found it
return first->first;
}
}
// not found
return NULL;
}
void checkShutdownRequest()
{
// if there's no ctrl file to be found then giveup
if (!NLMISC::CFile::fileExists(ShutdownRequestFileName)) return;
// if a shutdown ctrl file exists then read it's contents (if the file doesn't exist this returns an empty string)
CSString fileContents;
fileContents.readFromFile(ShutdownRequestFileName.c_str());
// see if the file exists
if (!fileContents.empty())
{
NLMISC::CFile::deleteFile(ShutdownRequestFileName);
fileContents= fileContents.strip().splitToOneOfSeparators(" \t\n\r\x1a");
NLMISC::fromString(fileContents, _ShutdownForPatch);
_ShutdownForPatch = !_ShutdownForPatch;
}
}
void checkServiceToStop()
{
uint32 now = CTime::getSecondsSince1970();
// for each shard to stop
for (uint i=0; i<_StopingShards.size(); ++i)
{
const TStopingShardInfo &stopShardInfo = _StopingShards[i];
bool timeToStop = stopShardInfo.BeginDate + stopShardInfo.Delay <= now;
uint32 timeLeft = (stopShardInfo.BeginDate + stopShardInfo.Delay) - now;
// check every service
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
TServiceState &serviceState = first->second;
if (serviceState.ServiceModule != NULL && serviceState.ShardName == stopShardInfo.ShardName)
{
// this one belong to the shard to stop
if (!timeToStop)
{
// send a warning every 30 s
if (((now - stopShardInfo.BeginDate) % 30) == 0)
{
CAdminExecutorServiceClientProxy aec(serviceState.ServiceModule);
nlinfo("Sending command 'quitDelay' to service '%s'", first->first.c_str());
aec.serviceCmdNoReturn(this, toString("quitDelay %u", timeLeft));
}
}
else
{
// stop the service
stopService(first->first);
}
}
}
if (timeToStop)
{
nlinfo("All local service for shard %s are stopped", stopShardInfo.ShardName.c_str());
// shard stopped, erase this entry
_StopingShards.erase(_StopingShards.begin()+i);
--i;
}
}
}
// the following routine reads the text string contained in the ".state" file for this service
// it's used to provide a 'state' value for services that are registered but are not connected
// to give info on whether they've been launched, whether their launcher is online, etc
std::string getOfflineServiceState(const std::string& serviceAlias)
{
// open the file for reading
FILE* f= fopen(getServiceStateFileName(serviceAlias).c_str(),"rt");
if (f==NULL) return "STOPPED";
// setup a buffer to hold the text read from the file
uint32 fileSize= NLMISC::CFile::getFileSize(f);
std::string txt;
txt.resize(fileSize);
// read the text from the file - note that the number of bytes read may be less than the
// number of bytes requested because we've opened the file in text mode and not binary mode
uint32 bytesRead= (uint32)fread(&txt[0],1,fileSize,f);
txt.resize(bytesRead);
fclose(f);
// return the text read from the file
return txt;
}
// the following routine reads the text string contained in the "pid.state" file for this service
// it's used to provide a early pid information to the AES (before the service is connected)
uint32 getOfflineServicePID(const std::string& serviceAlias)
{
// open the file for reading
FILE* f= fopen(getServicePIDFileName(serviceAlias).c_str(),"rt");
if (f==NULL) return 0;
// setup a buffer to hold the text read from the file
uint32 fileSize= NLMISC::CFile::getFileSize(f);
std::string txt;
txt.resize(fileSize);
// read the text from the file - note that the number of bytes read may be less than the
// number of bytes requested because we've opened the file in text mode and not binary mode
uint32 bytesRead= (uint32)fread(&txt[0],1,fileSize,f);
txt.resize(bytesRead);
fclose(f);
// return the pid read from the file
uint32 pid;
NLMISC::fromString(txt, pid);
return pid;
}
// the following routine reads the text string contained in the ".start_counter" file for this service
// it's used to provide the number of start done by the runner loop on the service
// This is used for the chain crash detector system.
uint32 getServiceStartLoopCounter(const std::string& serviceAlias)
{
// open the file for reading
FILE* f= fopen(getServiceLoopCounterFileName(serviceAlias).c_str(),"rt");
if (f==NULL)
return 0;
// setup a buffer to hold the text read from the file
uint32 fileSize= NLMISC::CFile::getFileSize(f);
std::string txt;
txt.resize(fileSize);
// read the text from the file - note that the number of bytes read may be less than the
// number of bytes requested because we've opened the file in text mode and not binary mode
uint32 bytesRead= (uint32)fread(&txt[0],1,fileSize,f);
txt.resize(bytesRead);
fclose(f);
// parse the text in the buffer
uint32 counter;
NLMISC::fromString(txt, counter);
return counter;
}
// retrieve service launch info in the config file
bool getServiceLaunchInfo(const string& serviceAlias, string& path)
{
string basePath;
CConfigFile::CVar *launchDir = IService::getInstance()->ConfigFile.getVarPtr("AESLauncherDir");
if (launchDir != NULL)
{
basePath = launchDir->asString()+"/";
}
if (_RegisteredServices.find(serviceAlias) == _RegisteredServices.end())
return false;
path = basePath + serviceAlias+"/";
return true;
}
std::string getServiceStateFileName(const std::string& serviceAlias)
{
string servicePath;
if (getServiceLaunchInfo(serviceAlias, servicePath))
return NLMISC::CPath::standardizePath(servicePath)+serviceAlias+".state";
else
return string();
}
std::string getServicePIDFileName(const std::string& serviceAlias)
{
string servicePath;
if (getServiceLaunchInfo(serviceAlias, servicePath))
return NLMISC::CPath::standardizePath(servicePath)+"pid.state";
else
return string();
}
std::string getServiceLoopCounterFileName(const std::string& serviceAlias)
{
string servicePath;
if (getServiceLaunchInfo(serviceAlias, servicePath))
return NLMISC::CPath::standardizePath(servicePath)+serviceAlias+".start_count";
else
return string();
}
std::string getServiceLaunchCtrlFileName(const std::string& serviceAlias,const std::string& serviceExecutionPath, bool deferred)
{
return NLMISC::CPath::standardizePath(serviceExecutionPath)+serviceAlias+(deferred?".deferred_":".")+"launch_ctrl";
}
bool writeServiceLaunchCtrl(const std::string& serviceAlias, bool deferred, const std::string& txt)
{
string path;
if (!getServiceLaunchInfo(serviceAlias, path))
return false;
// make sure the path exists
NLMISC::CFile::createDirectoryTree(path);
// open the file for writing
FILE* f= fopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt");
if (f==NULL) return false;
// write the text to the file
fprintf(f,"%s",txt.c_str());
fclose(f);
return true;
}
bool startService(const std::string &serviceAlias)
{
if (_ServiceStates.find(serviceAlias) != _ServiceStates.end())
{
TServiceState &ss = _ServiceStates[serviceAlias];
if (ss.RunningState != TRunningState::rs_stopped)
{
nlwarning("startService '%s' : the service is already running", serviceAlias.c_str());
return false;
}
// store the start date
ss.StartRequestDate = CTime::getSecondsSince1970();
}
if (_RegisteredServices.find(serviceAlias) == _RegisteredServices.end())
{
nlwarning("startService '%s' : the service in not registered, can't start it", serviceAlias.c_str());
return false;
}
// write the start command
bool ret = writeServiceLaunchCtrl(serviceAlias, false, LAUNCH_CTRL_START);
return ret;
}
bool stopService(const std::string &serviceAlias)
{
// check that the service is running
TServiceStates::iterator it(_ServiceStates.find(serviceAlias));
if (it == _ServiceStates.end())
{
nlwarning("stopService : Failed to found service '%s' in the list of services", serviceAlias.c_str());
return false;
}
TServiceState &ss = it->second;
// write the launch control to stop
if (_RegisteredServices.find(serviceAlias) != _RegisteredServices.end())
{
if (!writeServiceLaunchCtrl(serviceAlias, false, LAUNCH_CTRL_STOP))
{
nlwarning("Failed to write launch control file for service '%s'", serviceAlias.c_str());
return false;
}
else
nlinfo("Service '%s' launch control file updated", serviceAlias.c_str());
}
// set the stopre request date if needed
if (ss.StopRequestDate != 0)
{
ss.StopRequestDate = CTime::getSecondsSince1970();
}
if (ss.ServiceModule == NULL)
{
nlwarning("stopService : The service '%s' is not connected, can't ask him to stop", serviceAlias.c_str());
return false;
}
// send the "quit" command to the service
CAdminExecutorServiceClientProxy aec(ss.ServiceModule);
nlinfo("Sending command 'quit' to service '%s'", serviceAlias.c_str());
aec.serviceCmdNoReturn(this, "quit");
return true;
}
///////////////////////////////////////////////////////////////////////
//// Virtuals from IModuleTrackerCb
///////////////////////////////////////////////////////////////////////
virtual void onTrackedModuleUp(IModuleProxy *moduleProxy)
{
nldebug("Service module '%s' UP", moduleProxy->getModuleName().c_str());
TParsedCommandLine pcl;
if (!pcl.parseParamList(moduleProxy->getModuleManifest()))
{
nlwarning("CAdminExecutorService:onTrackedModuleUp : failed to parse manifest");
}
const TParsedCommandLine *pclLongName = pcl.getParam("LongName");
const TParsedCommandLine *pclShortName = pcl.getParam("ShortName");
const TParsedCommandLine *pclAliasName = pcl.getParam("AliasName");
const TParsedCommandLine *pclPID = pcl.getParam("PID");
const TParsedCommandLine *pclDontUseShardOrders = pcl.getParam("DontUseShardOrders");
string aliasName = pclAliasName != NULL ? pclAliasName->ParamValue : moduleProxy->getModuleName();
// remove the temporary state and update connected service index
_ServiceStates.erase(moduleProxy->getModuleName());
_ConnectedServiceIndex[moduleProxy] = aliasName;
nlinfo("AES client module %s for service %s is up",
moduleProxy->getModuleName().c_str(),
aliasName.c_str());
// create a new entry or get an existing one
TServiceState &ss = _ServiceStates[aliasName];
// update the service state
ss.RunningState = TRunningState::rs_online;
if (pclDontUseShardOrders)
NLMISC::fromString(pclDontUseShardOrders->ParamValue, ss.DontUseShardOrders);
else
ss.DontUseShardOrders = false;
ss.LongName = pclLongName != NULL ? pclLongName->ParamValue : "unknown";
ss.ShortName = pclShortName != NULL ? pclShortName->ParamValue : "unknown";
if (pclPID!= NULL)
{
NLMISC::fromString(pclPID->ParamValue, ss.PID);
}
else
{
ss.PID = 0;
}
ss.State = "";
ss.LastStateDate = NLMISC::CTime::getSecondsSince1970();
ss.ServiceModule = moduleProxy;
ss.StartRequestDate = 0;
ss.RunningTags.erase(TRunningTag::rt_slow_to_start);
if (_RegisteredServices.find(aliasName) == _RegisteredServices.end())
{
ss.RunningTags.insert(TRunningTag::rt_externaly_started);
}
// else
// {
// // if this service is locally stopped or if the shard it belong to is stopped,
// // then flag it as 'localy started'
// if (_PersistentServiceOrders.find(aliasName) != _PersistentServiceOrders.end()
// && _PersistentServiceOrders[aliasName] == TRunningOrders::ro_stopped)
// {
// // flag it as started
// _PersistentServiceOrders[aliasName] = TRunningOrders::ro_running;
// ss.RunningTags.insert(TRunningTag::rt_locally_started);
// _NeedToWriteStateFile = true;
// }
// else if (_ShardOrders.find(ss.ShardName) != _ShardOrders.end()
// && _ShardOrders[ss.ShardName] == TRunningOrders::ro_stopped)
// {
// // the shard is stopped, flag the service as started
// _PersistentServiceOrders[aliasName] = TRunningOrders::ro_running;
// ss.RunningTags.insert(TRunningTag::rt_locally_started);
// _NeedToWriteStateFile = true;
// }
// }
sendUpServiceUpdate();
}
virtual void onTrackedModuleDown(IModuleProxy *moduleProxy)
{
nldebug("Service module '%s' DOWN", moduleProxy->getModuleName().c_str());
TConnectedServiceIndex::iterator it(_ConnectedServiceIndex.find(moduleProxy));
if (it != _ConnectedServiceIndex.end())
{
string &aliasName = it->second;
nlinfo("AES client module %s of service %s is down",
moduleProxy->getModuleName().c_str(),
aliasName.c_str());
BOMB_IF(_ServiceStates.find(aliasName) == _ServiceStates.end(), "Service down from "<getModuleName()<<" with alias "< 1)
{
nlinfo("Killing process %u (%s) because aes client module '%s' is down",
ss.PID,
aliasName.c_str(),
moduleProxy->getModuleName().c_str());
killProgram(ss.PID);
}
}
retry_pending_command_loop:
// check for pending command
TPendingWebCommands::iterator first(_PendingWebCommands.begin()), last(_PendingWebCommands.end());
for (; first != last; ++first)
{
TPendingWebCommand &pwc = first->second;
if (pwc.ServiceAlias == aliasName)
{
if (_AdminService != NULL)
{
CAdminServiceProxy as(_AdminService);
as.commandResult(this, first->first, pwc.ServiceAlias, "ERROR : AES : service connection lost during command");
}
_PendingWebCommands.erase(first);
// goto to avoid iterator dodging
goto retry_pending_command_loop;
}
}
// remove the index record
_ConnectedServiceIndex.erase(it);
}
else
{
nlinfo("AES client module %s is not associated with a service",
moduleProxy->getModuleName().c_str());
}
sendUpServiceUpdate();
}
///////////////////////////////////////////////////////////////////////
//// Virtuals from CAdminExecutorServiceSkel
///////////////////////////////////////////////////////////////////////
// AS send orders for a shard
virtual void setShardOrders(NLNET::IModuleProxy *sender, const std::string &shardName, const TShardOrders &shardOrders)
{
nlinfo("AS setShardOrders for shard '%s' to '%s'", shardName.c_str(), shardOrders.toString().c_str());
if (_ShardOrders[shardName] == shardOrders)
{
// nothing to do
return;
}
_ShardOrders[shardName] = shardOrders;
_NeedToWriteStateFile = true;
// nothing more to do, if service need to be started, they are started
// by the module update function
}
// AS send a command to shutdown a shard with a delay
virtual void shutdownShard(NLNET::IModuleProxy *sender, const std::string &shardName, uint32 delay)
{
TStopingShardInfo ssi;
ssi.ShardName = shardName;
ssi.Delay = delay;
ssi.BeginDate = CTime::getSecondsSince1970();
_StopingShards.push_back(ssi);
nlinfo("Received command to stop all service of shard %s in %us", ssi.ShardName.c_str(), ssi.Delay);
// force a first update (to send the first warning message or stop immediately)
checkServiceToStop();
}
// AS send a control command to this AES
virtual void controlCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
// create a displayer to gather the output of the command
class CStringDisplayer: public IDisplayer
{
public:
virtual void doDisplay( const CLog::TDisplayInfo& args, const char *message)
{
_Data += message;
}
std::string _Data;
};
nldebug("Control command from '%s' : '%s' '%s'",
sender->getModuleName().c_str(),
serviceAlias.c_str(),
command.c_str());
// look in the list of service for a matching one
IModuleProxy *service = findOnlineService(serviceAlias);
if (service == NULL && _RegisteredServices.find(serviceAlias) == _RegisteredServices.end())
{
CAdminServiceProxy as(sender);
as.commandResult(this, commandId, serviceAlias, "ERROR : AES : service not found will dispatching the control command");
return;
}
// ok, we can execute the command concerning the service.
CStringDisplayer stringDisplayer;
IService::getInstance()->CommandLog.addDisplayer(&stringDisplayer);
// build the command line
CSString args(command);
CSString cmdName = args.firstWord(true);
CSString cmdLine;
cmdLine << getCommandHandlerName() << "." << cmdName << " " << serviceAlias << " " << args;
// retrieve the command from the input message and execute it
nlinfo ("ADMIN: Executing control command : '%s' for service '%s'", cmdLine.c_str(), serviceAlias.c_str());
ICommand::execute (cmdLine, IService::getInstance()->CommandLog);
// unhook our displayer as it's work is now done
IService::getInstance()->CommandLog.removeDisplayer(&stringDisplayer);
// send the result back to AS
CAdminServiceProxy as(sender);
as.commandResult(this, commandId, serviceAlias, stringDisplayer._Data);
}
//The return is sent back by another message
virtual void serviceCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
{
// look in the list of service for a matching one
IModuleProxy *proxy = findOnlineService(serviceAlias);
if (proxy == NULL)
{
CAdminServiceProxy as(sender);
as.commandResult(this, commandId, serviceAlias, "ERROR AES : unknown service");
return;
}
// ok, we found it !
TPendingWebCommand pwc;
pwc.Command = command;
pwc.ReceptionDate = NLMISC::CTime::getSecondsSince1970();
pwc.ServiceAlias = serviceAlias;
_PendingWebCommands.insert(make_pair(commandId, pwc));
CAdminExecutorServiceClientProxy service(proxy);
service.serviceCmd(this, commandId, command);
}
// AES client send back the result of execution of a command
virtual void commandResult(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result)
{
// check for waiting commands
TPendingWebCommands::iterator it(_PendingWebCommands.find(commandId));
if (it == _PendingWebCommands.end())
{
if (commandId != 0)
nlwarning("CAdminExecutor::commandResult : service '%s' sent result for command ID %u but not in pending command table",
sender->getModuleName().c_str(),
commandId);
return;
}
// send the result back to AS
if (_AdminService != NULL)
{
CAdminServiceProxy as(_AdminService);
as.commandResult(this, commandId, serviceAlias, result);
}
_PendingWebCommands.erase(commandId);
}
// An AES send graph data update
virtual void graphUpdate(NLNET::IModuleProxy *sender, const TGraphDatas &graphDatas)
{
if (_AdminService != NULL)
{
CAdminServiceProxy as(_AdminService);
as.graphUpdate(this, graphDatas);
}
}
// A service high rez graph data update
virtual void highRezGraphUpdate(NLNET::IModuleProxy *sender, const THighRezDatas &graphDatas)
{
if (_AdminService != NULL)
{
CAdminServiceProxy as(_AdminService);
as.highRezGraphUpdate(this, graphDatas);
}
}
// A service send an update of of it's status string
virtual void serviceStatusUpdate(NLNET::IModuleProxy *sender, const std::string &status)
{
TConnectedServiceIndex::iterator it(_ConnectedServiceIndex.find(sender));
if (it == _ConnectedServiceIndex.end())
{
nlwarning("serviceStatusUpdate : service '%s' send status but is unknown !", sender->getModuleName().c_str());
return;
}
string &aliasName = it->second;
TServiceStates::iterator it2(_ServiceStates.find(aliasName));
BOMB_IF(it2 == _ServiceStates.end(), "serviceStateUpdate : service '"
<getModuleName()
<<"' send an update, but alias '"<second;
ss.State = status;
ss.LastStateDate = NLMISC::CTime::getSecondsSince1970();
}
///////////////////////////////////////////////////////////////////////
//// commands handlers
///////////////////////////////////////////////////////////////////////
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CAdminExecutorService, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, dump, "Dump a status report to appropriate output logger", "no args")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, addRegisteredService, "add a registered service", " ")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, removeRegisteredService, "remove a registered service", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, startService, "start a registered service", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, restartService, "stop then start a registered service", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, stopService, "stop a service (registered or not)", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, killService, "kill a (possibly not responding) service (registered or not)", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, abortService, "abort a (possibly not responding) service with SIGABORT (registered or not)", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, activateService, "activate a service, i.e make it startable either manually or from a shard orders", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, deactivateService, "deactivate a service, i.e make it unstartable (either manually or from a shard orders) and stop it if needed", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, execScript, "execute the predefined bash script '/home/nevrax/patchman/aes_runnable_script.sh' and give it the passed parameters", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, resetStartCounter, "reset the start counter to 0", "no params")
NLMISC_COMMAND_HANDLER_ADD(CAdminExecutorService, stopShard, "Stop all service of a given shard aftert the provided delay", " ")
NLMISC_COMMAND_HANDLER_TABLE_END
NLMISC_CLASS_COMMAND_DECL(stopShard)
{
if (args.size() != 2)
return false;
string shardName = args[0];
uint32 delay;
NLMISC::fromString(args[1], delay);
log.displayNL("Received command to stop all service of shard %s in %us", shardName.c_str(), delay);
shutdownShard(NULL, shardName, delay);
return true;
}
NLMISC_CLASS_COMMAND_DECL(resetStartCounter)
{
if (args.size() != 0)
return false;
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
TServiceState &ss = first->second;
ss.RunnerLoopCounter.resetCounter();
}
return true;
}
NLMISC_CLASS_COMMAND_DECL(execScript)
{
string cmdLine("/home/nevrax/patchman/aes_runnable_script.sh");
// add parameters
for (uint i=0; i "+logFile;
log.displayNL("Executing '%s'", cmdLine.c_str());
// execute the command
int ret = system(cmdLine.c_str());
// echo the output to the requester
CSString output;
output.readFromFile(logFile);
vector lines;
output.splitLines(lines);
log.displayNL("Command returned value %d", ret);
log.displayNL("-------------------- Command output begin -----------------------");
for (uint i=0; isecond;
if (ss.RunningState == TRunningState::rs_stopped)
{
log.displayNL("The service to abort '%s' is currently stopped", serviceAlias.c_str());
return true;
}
if (ss.PID < 2)
{
log.displayNL("AES have no valid PID to abort the service '%s'", serviceAlias.c_str());
return true;
}
// abort it
log.displayNL("Aborting service '%s' with pid %u", serviceAlias.c_str(), ss.PID);
abortProgram(ss.PID);
return true;
}
NLMISC_CLASS_COMMAND_DECL(killService)
{
if (args.size() != 1)
return false;
string serviceAlias = args[0];
// check that the service is running
TServiceStates::iterator it(_ServiceStates.find(serviceAlias));
if (it == _ServiceStates.end())
{
log.displayNL("Failed to found service '%s' in the list of running services", serviceAlias.c_str());
return true;
}
TServiceState &ss = it->second;
if (ss.RunningState == TRunningState::rs_stopped)
{
log.displayNL("The service to kill '%s' is currently stopped", serviceAlias.c_str());
return true;
}
if (ss.PID < 2)
{
log.displayNL("AES have no valid PID to kill the service '%s'", serviceAlias.c_str());
return true;
}
// kill it
log.displayNL("Killing service '%s' with pid %u", serviceAlias.c_str(), ss.PID);
killProgram(ss.PID);
return true;
}
NLMISC_CLASS_COMMAND_DECL(stopService)
{
if (args.size() != 1)
return false;
string serviceAlias = args[0];
if (_ServiceStates.find(serviceAlias) == _ServiceStates.end())
{
log.displayNL("Unknown service '%s', could not stop it", serviceAlias.c_str());
return true;
}
TServiceState &ss = _ServiceStates[serviceAlias];
// look for a shard orders for this service
TShardsOrders::iterator it(_ShardOrders.find(ss.ShardName));
if (it != _ShardOrders.end())
{
TShardOrders &so = it->second;
if (so == TShardOrders::so_autostart_on)
{
log.displayNL("Can't stop service '%s' because shard '%s' is autostarting, considers either to deactivate the service or just restart it",
serviceAlias.c_str(),
ss.ShardName.c_str());
return true;
}
}
if (stopService(serviceAlias))
log.displayNL("Failed to stop the service '%s'", serviceAlias.c_str());
else
log.displayNL("Service '%s' stop request done", serviceAlias.c_str());
return true;
}
NLMISC_CLASS_COMMAND_DECL(restartService)
{
if (args.size() != 1)
return false;
string serviceAlias = args[0];
if (_RegisteredServices.find(serviceAlias) == _RegisteredServices.end())
{
log.displayNL("startService %s : the service in not registered, can't restart it", serviceAlias.c_str());
return true;
}
// look for service orders for this service
if (_PersistentServiceOrders.find(serviceAlias) != _PersistentServiceOrders.end())
{
if (_PersistentServiceOrders[serviceAlias] == TRunningOrders::ro_deactivated)
{
log.displayNL("Can't restart service '%s' because it is currently deactivated", serviceAlias.c_str());
return true;
}
}
// check that the service is running
TServiceStates::iterator it(_ServiceStates.find(serviceAlias));
if (it == _ServiceStates.end())
{
log.displayNL("Failed to found service '%s' in the list of running services", serviceAlias.c_str());
return true;
}
// write the deferred start command
if (!writeServiceLaunchCtrl(serviceAlias, true, LAUNCH_CTRL_START))
{
log.displayNL("Failed to write deferred start control file to restart service '%s'", serviceAlias.c_str());
return true;
}
else
log.displayNL("Service '%s' start command written", serviceAlias.c_str());
if (it->second.ServiceModule == NULL)
{
log.displayNL("The AES client module proxy is null ! can't send 'quit' command");
}
// send the "quit" command to the service
CAdminExecutorServiceClientProxy aec(it->second.ServiceModule);
aec.serviceCmd(this, 0, "quit");
log.displayNL("Service '%s' command 'quit' sent", serviceAlias.c_str());
return true;
}
NLMISC_CLASS_COMMAND_DECL(startService)
{
if (args.size() != 1)
return false;
string serviceAlias = args[0];
if (_ServiceStates.find(serviceAlias) == _ServiceStates.end())
{
log.displayNL("Unknown service '%s', could not start it", serviceAlias.c_str());
return true;
}
TServiceState &ss = _ServiceStates[serviceAlias];
// look for service orders for this service
if (_PersistentServiceOrders.find(serviceAlias) != _PersistentServiceOrders.end())
{
if (_PersistentServiceOrders[serviceAlias] == TRunningOrders::ro_deactivated)
{
log.displayNL("Can't start service '%s' because it is curently deactivated", serviceAlias.c_str());
return true;
}
}
// look for a shard orders for this service
TShardsOrders::iterator it(_ShardOrders.find(ss.ShardName));
if (it != _ShardOrders.end())
{
TShardOrders &so = it->second;
if (so == TShardOrders::so_autostart_on)
{
log.displayNL("Can't start service '%s' because shard '%s' is autostarting, consider to restart it",
serviceAlias.c_str(),
ss.ShardName.c_str());
return true;
}
}
if (!startService(serviceAlias))
log.displayNL("Failed to start service '%s'", serviceAlias.c_str());
else
log.displayNL("Service '%s' start command written", serviceAlias.c_str());
return true;
}
NLMISC_CLASS_COMMAND_DECL(removeRegisteredService)
{
if (args.size() != 1)
return false;
string serviceAlias = args[0];
if (_ServiceStates.find(serviceAlias) == _ServiceStates.end())
{
log.displayNL("Unknown service '%s', could not start it", serviceAlias.c_str());
return true;
}
TServiceState &ss = _ServiceStates[serviceAlias];
_RegisteredServices.erase(serviceAlias);
if (ss.RunningState == TRunningState::rs_stopped)
{
// remove the record
_ServiceStates.erase(serviceAlias);
}
else
{
// just update some data related the registered service
ss.ShardName = "";
ss.RunningTags.erase(TRunningTag::rt_locally_started);
ss.RunningTags.erase(TRunningTag::rt_chain_crashing);
ss.RunningTags.insert(TRunningTag::rt_externaly_started);
}
_PersistentServiceOrders.erase(serviceAlias);
_NeedToWriteStateFile = true;
// update the state of services to the AS
sendUpServiceUpdate();
return true;
}
NLMISC_CLASS_COMMAND_DECL(addRegisteredService)
{
if (args.size() != 2)
return false;
string serviceAlias = args[0];
string shardName = args[1];
_RegisteredServices.insert(serviceAlias);
_ServiceStates.insert(make_pair(serviceAlias, TServiceState()));
_ServiceStates[serviceAlias].ShardName = shardName;
// _ServiceRunnerLoopCounters.insert(make_pair(serviceAlias, TRunnerLoopCounter()));
if (_PersistentServiceOrders.find(serviceAlias) == _PersistentServiceOrders.end())
{
_PersistentServiceOrders[serviceAlias] = TRunningOrders::ro_activated;
_NeedToWriteStateFile = true;
}
// update the state of services to the AS
sendUpServiceUpdate();
return true;
}
NLMISC_CLASS_COMMAND_DECL(dump)
{
NLMISC_CLASS_COMMAND_CALL_BASE(CModuleBase, dump);
log.displayNL("===============================");
log.displayNL(" Dumping Admin executor states");
log.displayNL("===============================");
{
log.displayNL(" There are %u known shard :", _ShardOrders.size());
{
TShardsOrders::iterator first(_ShardOrders.begin()), last(_ShardOrders.end());
for (; first != last; ++first)
{
log.displayNL(" + Shard '%s' orders is '%s'", first->first.c_str(), first->second.toString().c_str());
}
}
if (_ShutdownForPatch)
log.displayNL(" All service are shuting down for patch !");
log.displayNL(" There are %u known services :", _ServiceStates.size());
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)
{
TServiceState &ss = first->second;
const string &aliasName = first->first;
CSString runningTags;
set::iterator rtf(ss.RunningTags.begin()), rte(ss.RunningTags.end());
for (; rtf != rte; ++rtf)
{
runningTags<<"<"<toString()<<">";
}
bool registered = _RegisteredServices.find(aliasName) != _RegisteredServices.end();
log.displayNL(" + Service alias='%s' (%s) ShardName = '%s' RunningState='%s' RunningTag='%s'",
aliasName.c_str(),
registered ? "REGISTERED" : "NOT REGISTERED",
ss.ShardName.c_str(),
ss.RunningState.toString().c_str(),
runningTags.c_str());
log.display(" | %s", ss.DontUseShardOrders ? "DontUseShardOders" : "UseShardOrders");
if (ss.RunningState != TRunningState::rs_stopped)
{
// the pid should be valid
log.display(" PID=%u", ss.PID);
}
if (registered)
{
log.display(" ServiceOrders=%s", _PersistentServiceOrders[aliasName].toString().c_str());
}
log.displayNL("");
if (ss.ServiceModule != NULL)
{
// dump a connected service
log.displayNL(" | longName='%s' shortName='%s' moduleName='%s'",
ss.LongName.c_str(),
ss.ShortName.c_str(),
ss.ServiceModule->getModuleName().c_str());
log.displayNL(" | State '%s' (last received %sago)", ss.State.c_str(), NLMISC::CTime::getHumanRelativeTime(NLMISC::CTime::getSecondsSince1970() - ss.LastStateDate).c_str());
}
else
{
// dump a offline registered service
// dump a connected service
log.displayNL(" | longName='%s' shortName='%s' ",
ss.LongName.c_str(),
ss.ShortName.c_str());
log.displayNL(" | State '%s' (last received %sago)", ss.State.c_str(), NLMISC::CTime::getHumanRelativeTime(NLMISC::CTime::getSecondsSince1970() - ss.LastStateDate).c_str());
}
if (registered)
{
uint32 c1, c2, c3;
ss.RunnerLoopCounter.getCounters(c1, c2, c3);
log.displayNL(" | Service Runner Start counter (%u mn:%u run, %u mn:%u run, %u mn:%u run)",
CRASH_COUNTER_ROLL_DELAY/60, c1,
(CRASH_COUNTER_ROLL_DELAY*3)/60, c2,
(CRASH_COUNTER_ROLL_DELAY*CRASH_COUNTER_SLOT)/60, c3);
}
}
}
return true;
}
};
NLNET_REGISTER_MODULE_FACTORY(CAdminExecutorService, "AdminExecutorService");
} // namespace ADMIN
================================================
FILE: code/EVA/server/admin_modules/as_module.cpp
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#include "nel/misc/types_nl.h"
#include
#include "nel/misc/file.h"
#include "nel/misc/sstring.h"
#include "nel/misc/mutable_container.h"
#include "nel/net/service.h"
#include "nel/net/module.h"
#include "nel/net/module_builder_parts.h"
#include "admin_modules_itf.h"
using namespace std;
using namespace NLMISC;
using namespace NLNET;
void as_forceLink() {}
namespace ADMIN
{
/// name of the persistent state file
const char *ASPersistentStateFilename = "as_state.txt";
class CAdminService
: public CEmptyModuleServiceBehav > >,
CAdminServiceSkel,
CAdminServiceWebItf,
IModuleTrackerCb
{
enum
{
/// The maximum time without report from an AES before flagging it as 'not responding'
AES_REPORT_WARNING_DELAY = 5,
};
typedef CModuleTracker TAESTracker;
/// Tracker for EAS modules
TAESTracker _AESTracker;
struct TAESServices
{
/// The date of last report send by this AES. Used to display 'not responding' AES
uint32 LastReportDate;
/// The list of service known by this AES
vector ServiceStatus;
TAESServices()
: LastReportDate(0)
{}
};
/// all known service status by known AES
typedef map TKnownServices;
TKnownServices _KnownServices;
/// data for a command comming form web and waiting execution by the module task
struct TPendingWebCommand
{
/// Received command date
uint32 ReceptionDate;
/// Is this a control command (otherwise it's a service command)
bool ControlCommand;
/// Sock id of the web connection that wait the command result
TSockId Requester;
/// Alias of the command target service
string ServiceAlias;
/// the command and it's parameters
string Command;
};
typedef uint32 TCommandId;
TCommandId _NextCommandId;
typedef map TPendingWebCommands;
/// A stack of web command request to be treated by module task
TPendingWebCommands _PendingWebCommands;
/// The global running state of the domain
// TRunningOrders _GlobalOrders;
typedef string TShardName;
typedef map TShardsOrders;
/// The running state of each shard
TShardsOrders _ShardOrders;
/// a flag to write the state file at next module update
bool _NeedToWriteStateFile;
public:
CAdminService()
: _AESTracker(TModuleClassPred("AdminExecutorService")),
_NextCommandId(0),
// _GlobalOrders(TRunningOrders::ro_running),
_NeedToWriteStateFile(false)
{
CAdminServiceSkel::init(this);
_AESTracker.init(this, this);
}
~CAdminService()
{}
void setShardOrders(const std::string &shardName, TShardOrders newOrders)
{
_ShardOrders[shardName] = newOrders;
// switch(_GlobalOrders.getValue())
// {
// case TRunningOrders::ro_stopped:
// IService::getInstance()->addStatusTag("GLOBAL_STOPPED");
// break;
// case TRunningOrders::ro_running:
// IService::getInstance()->removeStatusTag("GLOBAL_STOPPED");
// break;
// }
_NeedToWriteStateFile = true;
// update all AES with the new state
CAdminExecutorServiceProxy::broadcast_setShardOrders(_AESTracker.getTrackedModules().begin(), _AESTracker.getTrackedModules().end(),
this, shardName, newOrders);
}
/// Methods called by a module task to handle web command request
void sendCommandToAES(TCommandId commandId, TPendingWebCommand &pwc)
{
// look in the list of known state to retrieve the target of the command
TKnownServices::iterator first(_KnownServices.begin()), last(_KnownServices.end());
for (; first != last; ++first)
{
const vector &status = first->second.ServiceStatus;
for (uint i=0; ifirst);
if (pwc.ControlCommand)
{
// this is a control command
aes.controlCmd(this, commandId, pwc.ServiceAlias, pwc.Command);
}
else
{
// this is a service command
aes.serviceCmd(this, commandId, pwc.ServiceAlias, pwc.Command);
}
// terminate here !
return;
//-----------------------------------------------------
}
}
}
// not found !
CAdminServiceWebItf::commandResult(pwc.Requester, pwc.ServiceAlias, "ERROR : AS : unknown service alias");
// remove the pending command
_PendingWebCommands.erase(commandId);
}
bool initModule(const TParsedCommandLine &pcl)
{
CModuleBase::initModule(pcl);
// read the command line
const TParsedCommandLine *webPort = pcl.getParam("webPort");
nlassert(webPort != NULL);
uint16 port;
NLMISC::fromString(webPort->ParamValue, port);
// open the web interface
CAdminServiceWebItf::openItf(port);
// read the persistent state file if any
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "rt");
if (fp != NULL)
{
char buffer[1024];
char *ret;
while ((ret=fgets(buffer, 1024, fp)) != NULL)
{
CSString line(buffer);
string cmd = line.firstWord(true);
if (cmd == "ShardOrders")
{
string shardName = line.firstWord(true);
string orders = line.firstWord(true);
TShardOrders shardOrders(orders);
if (shardOrders != TShardOrders::invalid_val)
setShardOrders(shardName, shardOrders);
}
}
// clear the flag because 'setGlobalState' has set it
_NeedToWriteStateFile = false;
fclose(fp);
}
return true;
}
void onModuleUpdate()
{
H_AUTO(CAdminService_onModuleUpdate);
CAdminServiceWebItf::update();
if (_NeedToWriteStateFile)
{
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "wt");
if (fp != NULL)
{
CSString line;
TShardsOrders::iterator first(_ShardOrders.begin()), last(_ShardOrders.end());
for (; first != last; ++first)
{
line << "ShardOrders "<first<<" "<second.toString()<<"\n";
}
fputs(line.c_str(), fp);
fclose(fp);
_NeedToWriteStateFile = false;
}
}
uint32 now = NLMISC::CTime::getSecondsSince1970();
// check for timeout commands
TPendingWebCommands::iterator first(_PendingWebCommands.begin()), last(_PendingWebCommands.end());
for (; first != last; ++first)
{
TPendingWebCommand &pwc = first->second;
if (now - pwc.ReceptionDate > 10)
{
CAdminServiceWebItf::commandResult(pwc.Requester, pwc.ServiceAlias, "ERROR : no response from service or AES");
_PendingWebCommands.erase(first);
// check at next update for the rest
break;
}
}
{
// save one high rez graph at a time
static string lastCheckedBuffer;
THighRezBuffers::iterator it(_HighRezBuffers.upper_bound(lastCheckedBuffer));
if (it == _HighRezBuffers.end())
lastCheckedBuffer = "";
else
{
lastCheckedBuffer = it->first;
THighRezBuffer &hrBuffer = it->second;
if (hrBuffer.Dirty)
{
// save this buffer
CMemStream sbuff;
// write the updated buffer
sbuff.serial(hrBuffer);
string filename = getHighRezBufferFilename(it->first);
NLMISC::COFile of(filename);
if (of.isOpen()) // test added, because sometime on windows, the file fail to open !
{
of.serialBuffer((uint8*)sbuff.buffer(), sbuff.size());
hrBuffer.Dirty = false;
}
else
{
nlwarning("CAdminService::onUpdateModule : failed to open file %s for writing", filename.c_str());
}
}
}
}
}
///////////////////////////////////////////////////////////////////////
//// Virtuals from IModuleTrackerCb
///////////////////////////////////////////////////////////////////////
virtual void onTrackedModuleUp(IModuleProxy *moduleProxy)
{
nldebug("AES module '%s' UP", moduleProxy->getModuleName().c_str());
// send it the current global state
CAdminExecutorServiceProxy aes(moduleProxy);
TShardsOrders::iterator first(_ShardOrders.begin()), last(_ShardOrders.end());
for (; first != last; ++first)
{
aes.setShardOrders(this, first->first, first->second);
}
}
virtual void onTrackedModuleDown(IModuleProxy *moduleProxy)
{
nldebug("AES module '%s' DOWN", moduleProxy->getModuleName().c_str());
// check for any pending commands with this AES
TAESServices &as = _KnownServices[moduleProxy];
for (uint i=0; isecond;
if (pwc.ServiceAlias == aliasName)
{
// remove this command
CAdminServiceWebItf::commandResult(pwc.Requester, pwc.ServiceAlias, "ERROR : connection lost with AES during command");
TCommandId commandId = first->first;
_PendingWebCommands.erase(first);
// restart the loop to avoid iterator dodging
goto retry_pending_command;
}
}
}
// remove any service status
_KnownServices.erase(moduleProxy);
}
///////////////////////////////////////////////////////////////////////
//// Virtuals from CAdminServiceSkel
///////////////////////////////////////////////////////////////////////
// An AES send an update of the list of service up
virtual void upServiceUpdate(NLNET::IModuleProxy *sender, const std::vector < TServiceStatus > &serviceStatus)
{
if (_AESTracker.getTrackedModules().find(sender) == _AESTracker.getTrackedModules().end())
{
nlwarning("'%s' send upServiceUpdate but is not an valid AES", sender->getModuleName().c_str());
return;
}
_KnownServices[sender].LastReportDate = NLMISC::CTime::getSecondsSince1970();
_KnownServices[sender].ServiceStatus = serviceStatus;
// check that we have this shards in the shard orders table
for (uint i=0; iConfigFile.getVar("RRDVarPath").asString());
rrdfilename << gd.getServiceAlias() <<"." <ConfigFile.getVar("RRDToolPath").asString(), arg);
arg = "";
}
arg<<"update "<ConfigFile.getVar("RRDToolPath").asString(), arg);
}
}
enum
{
HR_BUFFER_SIZE = 5000,
};
/// Circular buffer to store high resolution samples
struct THighRezBuffer
{
bool Dirty;
uint32 NBSample;
uint32 FrameStart;
uint32 FrameEnd; // == FrameStart if empty
struct THighRezItem
{
uint32 Date;
TTime SampleTick;
double Value;
void serial(NLMISC::IStream &s)
{
s.serial(Date);
s.serial(SampleTick);
s.serial(Value);
}
};
vector Datas;
THighRezBuffer()
: Dirty(false),
NBSample(HR_BUFFER_SIZE),
FrameStart(0),
FrameEnd(0)
{
Datas.resize(NBSample);
}
void serial(NLMISC::IStream &s)
{
s.serial(NBSample);
s.serial(FrameStart);
s.serial(FrameEnd);
s.serialCont(Datas);
if (s.isReading())
{
// make some adjustment in case of HR_BUFFER_SIZE change
Datas.resize(HR_BUFFER_SIZE);
FrameEnd %= HR_BUFFER_SIZE;
FrameStart %= HR_BUFFER_SIZE;
NBSample = HR_BUFFER_SIZE;
}
}
};
typedef map THighRezBuffers;
THighRezBuffers _HighRezBuffers;
string getHighRezBufferFilename(const std::string &varAddr)
{
CSString filename = CPath::standardizePath (IService::getInstance()->ConfigFile.getVar("RRDVarPath").asString());
filename << varAddr<<".hrd";
return filename;
}
// An AES send high rez graph data update
virtual void highRezGraphUpdate(NLNET::IModuleProxy *sender, const THighRezDatas &graphDatas)
{
// dump the datas
// nldebug("Received high rez graph info for var %s from service %s",
// graphDatas.getServiceName().c_str(),
// graphDatas.getVarName().c_str());
//
// for (uint i=0; igetModuleClassName().c_str(),
serviceName.c_str(),
commandId);
return;
}
TPendingWebCommand &pwc = it->second;
CAdminServiceWebItf::commandResult(pwc.Requester, pwc.ServiceAlias, result);
// erase this command
_PendingWebCommands.erase(it);
}
// An AES send it's updated state strings
// virtual void updateAESStates(NLNET::IModuleProxy *sender, const std::vector < std::string > &states)
// {
// nlstop;
// }
// AES send back the result of execution of a control command
virtual void controlCmdResult(NLNET::IModuleProxy *sender, const std::string &serviceName, const std::vector < std::string > &result)
{
nlstop;
}
///////////////////////////////////////////////////////////////////////
//// Virtuals from CAdminServiceWebItf
///////////////////////////////////////////////////////////////////////
/// Connection callback : a new interface client connect
virtual void on_CAdminServiceWeb_Connection(NLNET::TSockId from)
{
}
/// Disconnection callback : one of the interface client disconnect
virtual void on_CAdminServiceWeb_Disconnection(NLNET::TSockId from)
{
}
// This is used to issue global commands like 'as.allStart' or 'as.allStop'.
// The result is returned by the return message
// serviceCmdResult.
virtual void on_globalCmd(NLNET::TSockId from, const std::string &command)
{
// create a displayer to gather the output of the command
class CStringDisplayer: public IDisplayer
{
public:
virtual void doDisplay( const CLog::TDisplayInfo& args, const char *message)
{
_Data += message;
}
std::string _Data;
};
nldebug("Global command from web : '%s'",
command.c_str());
// ok, we can execute the command concerning the service.
CStringDisplayer stringDisplayer;
IService::getInstance()->CommandLog.addDisplayer(&stringDisplayer);
// build the command line
CSString cmdLine;
cmdLine << getCommandHandlerName() << "." << command;
// retrieve the command from the input message and execute it
nlinfo ("ADMIN: Executing global command : '%s'", cmdLine.c_str());
ICommand::execute (cmdLine, IService::getInstance()->CommandLog);
// unhook our displayer as it's work is now done
IService::getInstance()->CommandLog.removeDisplayer(&stringDisplayer);
// send the result back to the web
CAdminServiceWebItf::commandResult(from, "", stringDisplayer._Data);
}
// Send a service related command to the executor
// (not to the controled service)
// The return value is a string containing the content
// returned by the command.
virtual void on_controlCmd(NLNET::TSockId from, const std::string &serviceAlias, const std::string &command)
{
// push the request info
TPendingWebCommand pwc;
pwc.ReceptionDate = NLMISC::CTime::getSecondsSince1970();
pwc.Command = command;
pwc.ControlCommand = true;
pwc.Requester = from;
pwc.ServiceAlias = serviceAlias;
_PendingWebCommands.insert(make_pair(_NextCommandId, pwc));
// send the request to the AES
sendCommandToAES(_NextCommandId++, pwc);
}
// Send a command to the AS.
// Send a command to a service.
// The return value is a string containing the content returned by the
virtual void on_serviceCmd(NLNET::TSockId from, const std::string &serviceAlias, const std::string &command)
{
// push the request info
TPendingWebCommand pwc;
pwc.ReceptionDate = NLMISC::CTime::getSecondsSince1970();
pwc.Command = command;
pwc.ControlCommand = false;
pwc.Requester = from;
pwc.ServiceAlias = serviceAlias;
_PendingWebCommands.insert(make_pair(_NextCommandId, pwc));
// send the request to the AES
sendCommandToAES(_NextCommandId++, pwc);
}
// Get the orders of each known shard.
// The return value is a vector of string, one entry by shard
virtual std::vector on_getShardOrders(NLNET::TSockId from)
{
vector ret;
TShardsOrders::iterator first(_ShardOrders.begin()), last(_ShardOrders.end());
for (; first != last; ++first)
{
CSString orders;
orders << "ShardName=" << first->first;
orders << "\tOrders=" << first->second.toString();
ret.push_back(orders);
}
return ret;
}
// Get the last known state of all services.
// The return value is a vector of string, one entry by service
virtual std::vector on_getStates(NLNET::TSockId from)
{
uint32 now = NLMISC::CTime::getSecondsSince1970();
vector ret;
TAESTracker::TTrackedModules::iterator first(_AESTracker.getTrackedModules().begin()), last(_AESTracker.getTrackedModules().end());
for (; first != last; ++first)
{
IModuleProxy *aes = *first;
const vector &status = _KnownServices[*first].ServiceStatus;
uint32 aesStallDelay = now - _KnownServices[*first].LastReportDate;
bool aesStall = aesStallDelay > AES_REPORT_WARNING_DELAY;
for (uint i=0; i::const_iterator frt(ss.getRunningTags().begin()), lrt(ss.getRunningTags().end());
for (; frt != lrt; ++frt)
{
state << frt->toString() << " ";
}
state << "\t" << status[i].getStatus();
if (aesStall)
{
state << "\tAESStall=" << toString(aesStallDelay);
}
ret.push_back(state);
}
}
return ret;
}
// Get information about a high rez graph.
// The return is a string array containing
// the name of the var, the available sample
// period as two unix date (start dans end)
// and the number of samples available
// If the var is not found, an empty array is returned
virtual std::vector on_getHighRezGraphInfo(NLNET::TSockId from, const std::string &varAddr)
{
vector ret;
THighRezBuffers::iterator it(_HighRezBuffers.find(varAddr));
if (it == _HighRezBuffers.end())
{
return ret;
}
THighRezBuffer &buffer = it->second;
ret.push_back(varAddr);
if (buffer.FrameStart == buffer.FrameEnd)
{
// the buffer is empty
ret.push_back(0);
ret.push_back(0);
ret.push_back(0);
}
else
{
ret.push_back(toString(buffer.Datas[buffer.FrameStart].Date));
ret.push_back(toString(buffer.Datas[(buffer.FrameEnd-1)%HR_BUFFER_SIZE].Date));
ret.push_back(toString((buffer.FrameEnd - buffer.FrameStart) % HR_BUFFER_SIZE));
}
return ret;
}
// Get the data for a high resolution graph.
// The return is a string array, each
// string containing 'time:milliOffset:value
virtual std::vector on_getHighRezGraph(NLNET::TSockId from, const std::string &varAddr, uint32 startDate, uint32 endDate, uint32 milliStep)
{
vector ret;
THighRezBuffers::iterator it(_HighRezBuffers.find(varAddr));
if (it == _HighRezBuffers.end())
{
return ret;
}
THighRezBuffer &buffer = it->second;
if (buffer.FrameStart == buffer.FrameEnd)
{
// the buffer is empty
return ret;
}
if (endDate == 0)
{
// the end date is zero, this mean that start date is relative
// to the last sample date.
endDate = buffer.Datas[(buffer.FrameEnd-1)%HR_BUFFER_SIZE].Date;
if (endDate > startDate)
startDate = endDate - startDate;
else
startDate = 0;
}
// advance in the buffer until we found a time greater than start date
uint32 startPointer = buffer.FrameStart;
while (startPointer != buffer.FrameEnd && buffer.Datas[startPointer].Date < startDate)
{
++startPointer;
if (startPointer == HR_BUFFER_SIZE)
startPointer = 0;
}
if (startPointer == buffer.FrameEnd)
return ret;
// retrieve starting times
uint32 startTime = buffer.Datas[buffer.FrameStart].Date;
TTime startMilli = buffer.Datas[buffer.FrameStart].SampleTick;
TTime lastSampleTick = startMilli;
double minSample = DBL_MAX;
double maxSample = DBL_MIN;
double meanSample = 0;
uint32 nbMergedSample = 0;
// now collect sample in the result until end of buffer or end date
for (uint32 i=startPointer; i != buffer.FrameEnd; ++i%=HR_BUFFER_SIZE)
{
// check for end of time slice
if (buffer.Datas[i].Date >= endDate)
{
// stop the loop
break;
}
double value = buffer.Datas[i].Value;
if (value < minSample)
minSample = value;
if (value > maxSample)
maxSample = value;
meanSample += value;
++nbMergedSample;
if (buffer.Datas[i].SampleTick - lastSampleTick > milliStep)
{
// output this sample
uint32 date = startTime + uint32((buffer.Datas[i].SampleTick - startMilli)/1000);
ret.push_back(toString("%u : %llu : %f %f %f", date, buffer.Datas[i].SampleTick, minSample, meanSample/nbMergedSample, maxSample));
lastSampleTick = buffer.Datas[i].SampleTick;
minSample = DBL_MAX;
maxSample = DBL_MIN;
meanSample = 0;
nbMergedSample = 0;
}
}
return ret;
}
///////////////////////////////////////////////////////////////////////
//// commands handlers
///////////////////////////////////////////////////////////////////////
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CAdminService, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CAdminService, dump, "Dump a status report to appropriate output logger", "no args")
// NLMISC_COMMAND_HANDLER_ADD(CAdminService, allStart, "set the state of the controled domain to started", "no args")
// NLMISC_COMMAND_HANDLER_ADD(CAdminService, allStop, "set the state of the controled domain to stopped", "no args")
// NLMISC_COMMAND_HANDLER_ADD(CAdminService, startShard, "start a shard in the controled domain", "")
// NLMISC_COMMAND_HANDLER_ADD(CAdminService, stopShard, "stop a shard in the controled domain", "")
NLMISC_COMMAND_HANDLER_ADD(CAdminService, setShardStartMode, "set the autostart mode of a shard", " on|off")
NLMISC_COMMAND_HANDLER_ADD(CAdminService, stopShard, "stop all service of a shard with a programmable timer (can be 0 for immediate shutdown)", " ")
NLMISC_COMMAND_HANDLER_TABLE_END
NLMISC_CLASS_COMMAND_DECL(setShardStartMode)
{
if (args.size() != 2)
return false;
string shardName = args[0];
if (_ShardOrders.find(shardName) == _ShardOrders.end())
{
log.displayNL("Unknown shard '%s'", shardName.c_str());
return true;
}
TShardOrders shardOrders;
if (args[1] == "on")
shardOrders = TShardOrders::so_autostart_on;
else if (args[1] == "off")
shardOrders = TShardOrders::so_autostart_off;
else
{
log.displayNL("Invalid option '%s', must be 'on' or 'off'", args[1].c_str());
return true;
}
setShardOrders(shardName, shardOrders);
return true;
}
// NLMISC_CLASS_COMMAND_DECL(startShard)
// {
// if (args.size() != 1)
// return false;
//
// string shardName = args[0];
//
// if (_ShardOrders.find(shardName) == _ShardOrders.end())
// {
// log.displayNL("Unknown shard '%s'", shardName.c_str());
// return true;
// }
//
// setShardOrders(shardName, TRunningOrders::ro_running);
//
// return true;
// }
// NLMISC_CLASS_COMMAND_DECL(stopShard)
// {
// if (args.size() != 1)
// return false;
//
// string shardName = args[0];
//
// if (_ShardOrders.find(shardName) == _ShardOrders.end())
// {
// log.displayNL("Unknown shard '%s'", shardName.c_str());
// return true;
// }
//
// setShardOrders(shardName, TRunningOrders::ro_stopped);
//
// return true;
// }
//
// NLMISC_CLASS_COMMAND_DECL(allStart)
// {
// if (args.size() != 0)
// return false;
//
// setGlobalOrders(TRunningOrders::ro_running);
//
// return true;
// }
//
// NLMISC_CLASS_COMMAND_DECL(allStop)
// {
// if (args.size() != 0)
// return false;
//
// setGlobalOrders(TRunningOrders::ro_stopped);
//
// return true;
// }
NLMISC_CLASS_COMMAND_DECL(stopShard)
{
if (args.size() != 2)
return false;
string shardName = args[0];
uint32 delay;
NLMISC::fromString(args[1], delay);
if (_ShardOrders.find(shardName) == _ShardOrders.end())
{
log.displayNL("Unknown shard '%s'", shardName.c_str());
return true;
}
// dispatch the request to all AES (they will apply to the pertinent service)
CAdminExecutorServiceProxy::broadcast_shutdownShard(_AESTracker.getTrackedModules().begin(), _AESTracker.getTrackedModules().end(),
this, shardName, delay);
return true;
}
NLMISC_CLASS_COMMAND_DECL(dump)
{
NLMISC_CLASS_COMMAND_CALL_BASE(CModuleBase, dump);
log.displayNL("===============================");
log.displayNL(" Dumping Admin states");
log.displayNL("===============================");
// log.displayNL(" Global orders is '%s'", _GlobalOrders.toString().c_str());
log.displayNL(" There are %u known shards :", _ShardOrders.size());
{
TShardsOrders::iterator first(_ShardOrders.begin()), last(_ShardOrders.end());
for (; first != last; ++first)
{
log.displayNL(" + Shard '%s' is '%s'", first->first.c_str(), first->second.toString().c_str());
}
}
log.displayNL(" There are %u AES services :", _AESTracker.getTrackedModules().size());
TAESTracker::TTrackedModules::iterator first(_AESTracker.getTrackedModules().begin()), last(_AESTracker.getTrackedModules().end());
for (; first != last; ++first) {
IModuleProxy *aes = *first;
const vector &status = _KnownServices[*first].ServiceStatus;
log.displayNL(" + AES '%s', with %u connected services",
aes->getModuleName().c_str(),
status.size());
for (uint i=0; i
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
//-----------------------------------------------------------------------------
// includes
//-----------------------------------------------------------------------------
#include "nel/net/service.h"
#ifdef NL_OS_WINDOWS
# define NOMINMAX
# include
#endif // NL_OS_WINDOWS
using namespace std;
using namespace NLMISC;
using namespace NLNET;
// force admin module to link in
extern void admin_modules_forceLink();
void foo()
{
admin_modules_forceLink();
}
//-----------------------------------------------------------------------------
// class CServiceClass
//-----------------------------------------------------------------------------
class CServiceClass : public NLNET::IService
{
public :
void init()
{
}
bool update()
{
return true;
}
void release()
{
}
};
//-----------------------------------------------
// NLNET_SERVICE_MAIN
//-----------------------------------------------
static const char* getCompleteServiceName(const IService* theService)
{
static std::string s;
s= "admin_service";
if (theService->haveLongArg("adminname"))
{
s+= "_"+theService->getLongArg("adminname");
}
if (theService->haveLongArg("fulladminname"))
{
s= theService->getLongArg("fulladminname");
}
return s.c_str();
}
static const char* getShortServiceName(const IService* theService)
{
static std::string s;
s= "RAS";
if (theService->haveLongArg("shortadminname"))
{
s= theService->getLongArg("shortadminname");
}
return s.c_str();
}
NLNET_SERVICE_MAIN( CServiceClass, getShortServiceName(scn), getCompleteServiceName(scn), 0, EmptyCallbackArray, "", "" );
================================================
FILE: code/EVA/server/admin_service.cfg
================================================
// Use with commandline: admin_service --fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid
// ---- config local variables
ASWebPort="46700";
ASPort="46701";
#include "common.cfg"
// ---- service NeL variables (used by ConfigFile class)
DontUseNS = 1;
AESAliasName= "ras";
//Paths = {
// ".",
//};
// ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by CVariable class)
RRDToolPath = "../tools/rrdtool/rrdtool.exe";
RRDVarPath = "save_shard/rrd_graphs";
// Variables required to be defined by other cfgs
//AESHost="localhost";
//ASWebPort="46700";
//ASPort="46701";
StartCommands +=
{
// create the admin service module and open the web interface
"moduleManager.createModule AdminService as webPort="+ASWebPort,
// create a gateway for aes to connect
"moduleManager.createModule StandardGateway as_gw",
// create a layer 3 server
"as_gw.transportAdd L3Server l3s",
"as_gw.transportOptions l3s(PeerInvisible)",
"as_gw.transportCmd l3s(open port="+ASPort+")",
// plug the as
"as.plug as_gw",
};
================================================
FILE: code/EVA/server/client_robot/CMakeLists.txt
================================================
FILE(GLOB SRC *.cpp *.h)
ADD_EXECUTABLE(client_robot WIN32 ${SRC})
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
TARGET_LINK_LIBRARIES( client_robot
servershare)
NL_DEFAULT_PROPS(client_robot "Base, Client: ClientRobot")
NL_ADD_RUNTIME_FLAGS(client_robot)
================================================
FILE: code/EVA/server/client_robot/client_robot.cpp
================================================
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace NLMISC;
using namespace NLNET;
using namespace std;
class CClientRobot : public NLNET::IService
{
public:
/// Init the service, load the universal time.
void init ()
{
TimerManager->init();
LuaNetworkMgr.Init();
ScriptMgr.init();
LuaThreadMgr.Init();
}
bool update ()
{
NLMISC::TTicks curr_ticks = CTime::getLocalTime();
LocalTime.SetCurrTime(curr_ticks);
TimerManager->tickUpdate();
ScriptMgr.update();
LuaNetworkMgr.Update();
LuaThreadMgr.Update();
return true;
}
void release ()
{
TimerManager->release();
ScriptMgr.release();
LuaNetworkMgr.Release();
LuaThreadMgr.Release();
}
};
// Service instantiation
NLNET_SERVICE_MAIN (CClientRobot, "ROBOT", "client_robot", 0, EmptyCallbackArray, "", "");
================================================
FILE: code/EVA/server/client_robot.cfg
================================================
RootConfigFilename = "common.cfg";
AESAliasName = "robot";
SId = 1;
DontUseNS = 1;
DontUseAES = 1;
DisplayedVariables += { "", "@Info|info" };
StartLuaScript = "_ClientRobotMain.lua";
Paths =
{
"./script/__Robot/", // for lua root script
};
/*
LuaWorkThread =
{
"thd_player DBSubStart.lua",
};
*/
================================================
FILE: code/EVA/server/common.cfg
================================================
// ---- config local variables
// Used by ConfigFile in EGS and WS
ShardId = 0;
UpdateTimeout = 20;
// Used to connect to AES (this file) and to set up AES service (admin_executor_service.cfg)
AESPort="46702";
AESHost="localhost";
// ---- service NeL variables (used by ConfigFile class)
WindowStyle = "WIN";
// don't connect to the old NeLNS AES
DontUseAES = 1;
// Configure module gateway for layer 5 module comm
/*
StartCommands +=
{
// Create a gateway module
"moduleManager.createModule StandardGateway gw",
// add a layer 5 transport
"gw.transportAdd L5Transport l5",
// open the transport
"gw.transportCmd l5(open)",
/// Create default connection with admin executor service
// Create a gateway module
"moduleManager.createModule StandardGateway gw_aes",
// create the admin executor service module
"moduleManager.createModule AdminExecutorServiceClient aes_client",
"aes_client.plug gw_aes",
// create a layer 3 client to connect to aes gateway
"gw_aes.transportAdd L3Client aes_l3c",
"gw_aes.transportCmd aes_l3c(connect addr="+AESHost+":"+AESPort+")",
};
*/
// by default, use localhost to find the naming service
NSHost = "localhost:49901";
NSPort = 49901;
// A list of vars to graph for any service
GraphVars +=
{
"ProcessUsedMemory", "60000", // every minute
};
IgnoredFiles = { "continent.cfg", "__read_me.txt", "bandit.html", "flora_primr.primitive" };
// Set a mainland SessionId.
// Live: Must be 0 for ring shards, non-zero (usually ShardId) for mainland shards
// Dev: Can be non-zero to initially connect a client to a ring shard
NoWSShardId = ShardId;
// ---- service NeL variables (used by CVariable class)
// Disable generation / display of nldebug messages
DisableNLDebug = 0;
// Disable nel net verbose logging
VerboseNETTC = 1;
VerboseLNETL0 = 1;
VerboseLNETL1 = 1;
VerboseLNETL2 = 1;
VerboseLNETL3 = 1;
VerboseLNETL4 = 1;
VerboseLNETL5 = 1;
VerboseLNETL6 = 1;
// If the update loop is too slow, a thread will produce an assertion.
// By default, the value is set to 10 minutes.
// Set to 0 for no assertion.
UpdateAssertionThreadTimeout = 6000000;
// how to sleep between 2 network updates
// 0 = pipe
// 1 = usleep
// 2 = nanosleep
// 3 = sched_yield
// 4 = nothing
UseYieldMethod = 0;
DefaultMaxExpectedBlockSize = 200000000; // 200 M !
DefaultMaxSentBlockSize = 200000000; // 200 M !
// Will SaveFilesDirectory will be converted to a full path?
ConvertSaveFilesDirectoryToFullPath = 1;
// Where to save specific shard data (ie: player backup), relatively to SaveShardRoot
SaveFilesDirectory = "";
// where to save generic shard data (ie: packed_sheet)
WriteFilesDirectory = "data_shard";
// ---- service custom variables (used by ConfigFile class)
NegFiltersDebug += { "NETL", "NET" };
NegFiltersInfo += { "NETL" };
NegFiltersWarning += { };
// where to send error reports
DefaultEmailSMTP = "smtp";
DefaultEmailFrom = "sanguo@0xcc.com";
DefaultEmailTo = "li9chuan@qq.com";
LogDirectory = "./log/";
Language = "cn";
================================================
FILE: code/EVA/server/frontend_service/CMakeLists.txt
================================================
FILE(GLOB SRC *.cpp *.h)
ADD_EXECUTABLE(frontend_service WIN32 ${SRC})
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
TARGET_LINK_LIBRARIES( frontend_service
#eva_adminmodules
servershare)
NL_DEFAULT_PROPS(frontend_service "Base, Services: Frontend Service (FES)")
NL_ADD_RUNTIME_FLAGS(frontend_service)
#ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH AND NOT MINGW) # FIXME: PCH too large (> 130MB), crashes cc1plus under MinGW
ADD_NATIVE_PRECOMPILED_HEADER(frontend_service ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH AND NOT MINGW)
INSTALL(TARGETS frontend_service RUNTIME DESTINATION sbin COMPONENT services)
================================================
FILE: code/EVA/server/frontend_service/frontend_service.cpp
================================================
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include
#include
#include
#include
#include
#include
#include "frontend_service.h"
#include
#include
#include
#ifdef NL_OS_WINDOWS
#include
#endif
using namespace std;
using namespace NLMISC;
using namespace NLNET;
using namespace DEF;
//extern void admin_modules_forceLink();
//void foo() { admin_modules_forceLink(); }
NLMISC::CVariable VAR_PLAYER_NUM("fes", "NbPlayers" , "memo", 0);
void CFrontEndService::init()
{
LocalTime.SetCurrTime( CTime::getLocalTime() );
//string fn = IService::getInstance()->SaveFilesDirectory.toString();
//fn += ConfigFile.getVar("LogDir").asString();
//fn += "frontend_service.stat";
//nlinfo("Frontend stat in directory '%s'", fn.c_str());
//NLMISC::CFileDisplayer *Fd = new NLMISC::CFileDisplayer(fn);
//Loger().addDisplayer(Fd);
//if (WindowDisplayer) Loger().addDisplayer (WindowDisplayer);
///////////////////////////////////////////////////
MsgDesc.LoadMsgXml();
TimerManager->init();
LuaThreadMgr.Init();
LuaNetworkMgr.Init();
ScriptMgr.init();
}
bool CFrontEndService::update()
{
LocalTime.SetCurrTime( CTime::getLocalTime() );
///////////////////////////////////////
TimerManager->tickUpdate();
ScriptMgr.update();
LuaNetworkMgr.Update();
LuaThreadMgr.Update();
return true;
}
void CFrontEndService::release()
{
TimerManager->release();
ScriptMgr.release();
LuaNetworkMgr.Release();
LuaThreadMgr.Release();
google::protobuf::ShutdownProtobufLibrary();
}
/****************************************************************************
* FRONTEND SERVICE MAIN Function
*
* This call create a main function for a service:
*
* - based on the "CFrontEndService" class
* - having the short name "FES"
* - having the long name "frontend_service"
* - listening on the port "0" (dynamically determined)
* - and shard callback set to "CallbackArray"
*
****************************************************************************/
NLNET_SERVICE_MAIN (CFrontEndService, "FES", "frontend_service", 0, EmptyCallbackArray, "", "")
/* end of file */
================================================
FILE: code/EVA/server/frontend_service/frontend_service.h
================================================
#ifndef FRONTEND_SERVICE_H
#define FRONTEND_SERVICE_H
// We're using the NeL Service framework and layer 5
#include
#include
#include
#include
//typedef CHashMap< TDataSetIndex, std::string> TEntityNamesMap;
/**
* CFrontEndService, based on IService5
*/
class CFrontEndService : public NLNET::IService
{
public:
CFrontEndService():ReceiveWatch(10),
SendWatch(10) {}
/// Return the instance of the service
static CFrontEndService *instance() { return (CFrontEndService*)IService::getInstance(); }
// Initialisation
void init();
bool update();
void release();
NLMISC::CStopWatch ReceiveWatch; // All Receive Sub
NLMISC::CStopWatch SendWatch; // All Send Sub
};
#define FrontEndService CFrontEndService::instance()
#endif
================================================
FILE: code/EVA/server/frontend_service/stdpch.cpp
================================================
// Ryzom - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#include "stdpch.h"
================================================
FILE: code/EVA/server/frontend_service/stdpch.h
================================================
#include "nel/misc/types_nl.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include