码迷,mamicode.com
首页 > 其他好文 > 详细

plain framework 商业版 开发总结2 项目管理器

时间:2015-05-08 14:47:38      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:

任何事情都有三个阶段,分析、制作、质检的过程。在程序中就分为设计、编码、调试(测试)三个阶段,其中设计最为重要,设计的不好会导致编码和调试重复,甚至最后又回到了设计的过程。为了不会重复返工,所以设计的时候需要考了全面,否则会导致资源上的浪费和占用,甚至造成资源不足而终止。就像任何一个投资项目一样,设计的不好,往往会导致人力资源的浪费,如果在项目进程中达不到预期的效果,这个项目生命周期就会缩短。

1、项目管理器设计

  为什么要使用到项目管理器?如果这点都不明确,那么这样的功能需求是无效的,也就是说不需要这样的功能。编译的功能,以前在编译的时候如果换了一个平台或者VS的版本,就需要重写编译脚本。其实现在的CMAKE已经具备这样的跨平台功能,可惜不能完全满足PF项目的需求。所以需要使用项目管理器的一个功能就是生成不同平台的编译脚本,这样项目管理器就是一个有效的需求了。其次大部分开源或是商业框架都使用到了自身的命令行或者管理器,如著名的虚幻引擎,也有自己的项目管理器。故而项目管理器,也是势在必行的。

  项目管理器现在的主要功能是对现有的项目自动生成对应平台的编译脚本,Windows下面现在实现的是VC12的脚本,LINUX实现的是CMAKE脚本。

  以下是原型:

# This file generate by plain framework admin tool, date: 2015-05-07 19:42:16
SET(EXECUTABLE_OUTPUT_PATH ../../bin)

ADD_DEFINITIONS(-DPF_BUILD_AS_DLL)
ADD_DEFINITIONS(-D_DATABASE)
ADD_DEFINITIONS(-D__SERVER__)
SET(USE_32BITS 0)

IF(CMAKE_SYSTEM MATCHES Linux)
  ADD_DEFINITIONS(-D_REENTRANT)
  ADD_DEFINITIONS(-DDONT_TD_VOID)
  ADD_DEFINITIONS(-D_PF_NET_EPOLL)
ELSE(CMAKE_SYSTEM MATCHES Linux)
ENDIF(CMAKE_SYSTEM MATCHES Linux)

LINK_DIRECTORIES(
  "./"
  "./../../../pf/core/dll/"
  "./../../../pf/dependencies/dll/"
)

INCLUDE_DIRECTORIES(
  "../../../pf/core/include/"
  "../include/"
  "../../common/include/"
  "../../../pf/dependencies/lua/src/"
  "/usr/local/unixODBC/include/"
)

SET (COMMON_INCLUDE_COMMON_LIST
  ../../common/include/common/config.h
)

SET (COMMON_INCLUDE_COMMON_DEFINE_LIST
  ../../common/include/common/define/all.h
  ../../common/include/common/define/config.h
  ../../common/include/common/define/enum.h
  ../../common/include/common/define/file.h
  ../../common/include/common/define/log.h
  ../../common/include/common/define/macros.h
  ../../common/include/common/define/struct.h
)

SET (COMMON_INCLUDE_COMMON_DEFINE_NET_LIST
  ../../common/include/common/define/net/config.h
)

SET (COMMON_INCLUDE_COMMON_DEFINE_NET_PACKET_LIST
  ../../common/include/common/define/net/packet/config.h
)

SET (COMMON_INCLUDE_COMMON_DEFINE_NET_PACKET_ID_LIST
  ../../common/include/common/define/net/packet/id/all.h
  ../../common/include/common/define/net/packet/id/billinglogin.h
  ../../common/include/common/define/net/packet/id/clientlogin.h
  ../../common/include/common/define/net/packet/id/clientserver.h
  ../../common/include/common/define/net/packet/id/config.h
  ../../common/include/common/define/net/packet/id/logincenter.h
  ../../common/include/common/define/net/packet/id/servercenter.h
  ../../common/include/common/define/net/packet/id/serverserver.h
)

SET (COMMON_INCLUDE_COMMON_NET_LIST
  ../../common/include/common/net/config.h
  ../../common/include/common/net/packetfactory.h
)

SET (COMMON_INCLUDE_COMMON_NET_PACKET_LIST
  ../../common/include/common/net/packet/config.h
)

SET (COMMON_INCLUDE_COMMON_NET_PACKET_SERVERSERVER_LIST
  ../../common/include/common/net/packet/serverserver/config.h
  ../../common/include/common/net/packet/serverserver/connect.h
  ../../common/include/common/net/packet/serverserver/dbquery.h
  ../../common/include/common/net/packet/serverserver/dbresult.h
  ../../common/include/common/net/packet/serverserver/config.h
  ../../common/include/common/net/packet/serverserver/connect.h
  ../../common/include/common/net/packet/serverserver/dbquery.h
  ../../common/include/common/net/packet/serverserver/dbresult.h
)
SET (INCLUDE_LIST
  ../include/main.h
)

SET (INCLUDE_APPLICATION_LIST
  ../include/application/config.h
)

SET (INCLUDE_ENGINE_LIST
  ../include/engine/config.h
  ../include/engine/system.h
)

SET (INCLUDE_THREAD_LIST
  ../include/thread/archive.h
  ../include/thread/archivemanager.h
  ../include/thread/config.h
)
SET (COMMON_SRC_DEFINE_LIST
  ../../common/src/define/struct.cc
)

SET (COMMON_SRC_LIST
  ../../common/src/setting.cc
)

SET (COMMON_SRC_NET_PACKET_SERVERSERVER_LIST
  ../../common/src/net/packet/serverserver/connect.cc
  ../../common/src/net/packet/serverserver/dbquery.cc
  ../../common/src/net/packet/serverserver/dbresult.cc
  ../../common/src/net/packet/serverserver/connect.cc
  ../../common/src/net/packet/serverserver/dbquery.cc
  ../../common/src/net/packet/serverserver/dbresult.cc
)

SET (COMMON_SRC_NET_LIST
  ../../common/src/net/packetfactory.cc
)
SET (SRC_LIST
  ../src/main.cc
)

SET (SRC_ENGINE_LIST
  ../src/engine/system.cc
)

SET (SRC_MESSAGE_HANDLER_SERVERSERVER_LIST
  ../src/message/handler/serverserver/connect.cc
  ../src/message/handler/serverserver/dbquery.cc
)

SET (SRC_THREAD_LIST
  ../src/thread/archive.cc
  ../src/thread/archivemanager.cc
)


ADD_EXECUTABLE(database
  ${SRC_LIST}
  ${SRC_ENGINE_LIST}
  ${SRC_MESSAGE_HANDLER_SERVERSERVER_LIST}
  ${SRC_THREAD_LIST}
  ${COMMON_SRC_DEFINE_LIST}
  ${COMMON_SRC_LIST}
  ${COMMON_SRC_NET_PACKET_SERVERSERVER_LIST}
  ${COMMON_SRC_NET_LIST}
)

if(USE_32BITS)
  SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
  SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
else()
  SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
  SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
endif(USE_32BITS)

if (WIN32)
TARGET_LINK_LIBRARIES(database ws2_32.lib odbc32.lib odbccp32.lib pf_core.lib lua.lib iconv.lib)
else()
TARGET_LINK_LIBRARIES(database odbc pf_core lua iconv)
  if(USE_32BITS)
    SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
    SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
  else()
    SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
    SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
  endif(USE_32BITS)
endif(WIN32)
<?xml version="1.0" encoding="utf-8"?>
<!-- This file generate by plain framework admin tool, date: 2015-05-07 21:21:36 -->
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>

  <ItemGroup>
    <ClCompile Include="..\..\common\include\common\config.h" />
    <ClCompile Include="..\..\common\include\common\define\all.h" />
    <ClCompile Include="..\..\common\include\common\define\config.h" />
    <ClCompile Include="..\..\common\include\common\define\enum.h" />
    <ClCompile Include="..\..\common\include\common\define\file.h" />
    <ClCompile Include="..\..\common\include\common\define\log.h" />
    <ClCompile Include="..\..\common\include\common\define\macros.h" />
    <ClCompile Include="..\..\common\include\common\define\struct.h" />
    <ClCompile Include="..\..\common\include\common\define\net\config.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\config.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\all.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\billinglogin.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\clientlogin.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\clientserver.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\config.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\logincenter.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\servercenter.h" />
    <ClCompile Include="..\..\common\include\common\define\net\packet\id\serverserver.h" />
    <ClCompile Include="..\..\common\include\common\net\config.h" />
    <ClCompile Include="..\..\common\include\common\net\packetfactory.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\config.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\config.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\connect.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\dbquery.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\dbresult.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\config.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\connect.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\dbquery.h" />
    <ClCompile Include="..\..\common\include\common\net\packet\serverserver\dbresult.h" />
    <ClInclude Include="..\include\main.h" />
    <ClInclude Include="..\include\application\config.h" />
    <ClInclude Include="..\include\engine\config.h" />
    <ClInclude Include="..\include\engine\system.h" />
    <ClInclude Include="..\include\thread\archive.h" />
    <ClInclude Include="..\include\thread\archivemanager.h" />
    <ClInclude Include="..\include\thread\config.h" />
    <ClInclude Include="resource.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="..\..\common\src\define\applications_common_define_struct.cc" />
    <ClCompile Include="..\..\common\src\applications_common_src_setting.cc" />
    <ClCompile Include="..\..\common\src\net\packet\serverserver\applications_common_net_packet_serverserver_connect.cc" />
    <ClCompile Include="..\..\common\src\net\packet\serverserver\applications_common_net_packet_serverserver_dbquery.cc" />
    <ClCompile Include="..\..\common\src\net\packet\serverserver\applications_common_net_packet_serverserver_dbresult.cc" />
    <ClCompile Include="..\..\common\src\net\packet\serverserver\applications_common_net_packet_serverserver_connect.cc" />
    <ClCompile Include="..\..\common\src\net\packet\serverserver\applications_common_net_packet_serverserver_dbquery.cc" />
    <ClCompile Include="..\..\common\src\net\packet\serverserver\applications_common_net_packet_serverserver_dbresult.cc" />
    <ClCompile Include="..\..\common\src\net\applications_common_net_packetfactory.cc" />
    <ClCompile Include="..\src\applications_database_src_main.cc" />
    <ClCompile Include="..\src\engine\applications_database_engine_system.cc" />
    <ClCompile Include="..\src\thread\applications_database_thread_archive.cc" />
    <ClCompile Include="..\src\thread\applications_database_thread_archivemanager.cc" />
    <ClCompile Include="..\src\message\handler\serverserver\applications_database_message_handler_serverserver_connect.cc" />
    <ClCompile Include="..\src\message\handler\serverserver\applications_database_message_handler_serverserver_dbquery.cc" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="database.rc" />
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{88F6D0EC-8597-40CE-9BA5-6A2813C82C3A}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>${project_name}</RootNamespace>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘">
    <LinkIncremental>true</LinkIncremental>
    <OutDir>./../bin/$(PlatformName)/$(Configuration)/</OutDir>
    <IntDir>$(ProjectName).dir/$(PlatformName)/$(Configuration)/</IntDir>
  </PropertyGroup>
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘">
    <LinkIncremental>true</LinkIncremental>
    <OutDir>./../bin/$(PlatformName)/$(Configuration)/</OutDir>
    <IntDir>$(ProjectName).dir/$(PlatformName)/$(Configuration)/</IntDir>
  </PropertyGroup>
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘">
    <LinkIncremental>false</LinkIncremental>
    <OutDir>./../bin/$(PlatformName)/$(Configuration)/</OutDir>
    <IntDir>$(ProjectName).dir/$(PlatformName)/$(Configuration)/</IntDir>
  </PropertyGroup>
  <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘">
    <LinkIncremental>false</LinkIncremental>
    <OutDir>./../bin/$(PlatformName)/$(Configuration)/</OutDir>
    <IntDir>$(ProjectName).dir/$(PlatformName)/$(Configuration)/</IntDir>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘">
    <ClCompile>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <WarningLevel>Level4</WarningLevel>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;PF_BUILD_AS_DLL;_DATABASE;__SERVER__;PF_BUILD_AS_DLL;ICONV_BUILD_AS_DLL;CHARSET_BUILD_AS_DLL;LUA_BUILD_AS_DLL;ZLIB_DLL;PF_PLUGIN_BUILD_AS_DLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>../../../pf/core/include/;../include/;../../common/include/;../../../pf/dependencies/lua/src/;/usr/local/unixODBC/include/;</AdditionalIncludeDirectories>
      <DisableSpecificWarnings>4819;</DisableSpecificWarnings>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
       <Version>1.00</Version>
      <AdditionalLibraryDirectories>./$(PlatformName)/$(Configuration)/;./../../../pf/core/dll/$(PlatformName)/$(Configuration)/;./../../../pf/dependencies/dll/$(PlatformName)/$(Configuration)/;</AdditionalLibraryDirectories>
      <AdditionalDependencies>ws2_32.lib;pf_core.lib;lua.lib;iconv.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘">
    <ClCompile>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <WarningLevel>Level4</WarningLevel>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;PF_BUILD_AS_DLL;_DATABASE;__SERVER__;PF_BUILD_AS_DLL;ICONV_BUILD_AS_DLL;CHARSET_BUILD_AS_DLL;LUA_BUILD_AS_DLL;ZLIB_DLL;PF_PLUGIN_BUILD_AS_DLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>../../../pf/core/include/;../include/;../../common/include/;../../../pf/dependencies/lua/src/;/usr/local/unixODBC/include/;</AdditionalIncludeDirectories>
      <DisableSpecificWarnings>4819;</DisableSpecificWarnings>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
       <Version>1.00</Version>
      <AdditionalLibraryDirectories>./$(PlatformName)/$(Configuration)/;./../../../pf/core/dll/$(PlatformName)/$(Configuration)/;./../../../pf/dependencies/dll/$(PlatformName)/$(Configuration)/;</AdditionalLibraryDirectories>
      <AdditionalDependencies>ws2_32.lib;pf_core.lib;lua.lib;iconv.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;PF_BUILD_AS_DLL;_DATABASE;__SERVER__;PF_BUILD_AS_DLL;ICONV_BUILD_AS_DLL;CHARSET_BUILD_AS_DLL;LUA_BUILD_AS_DLL;ZLIB_DLL;PF_PLUGIN_BUILD_AS_DLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>../../../pf/core/include/;../include/;../../common/include/;../../../pf/dependencies/lua/src/;/usr/local/unixODBC/include/;</AdditionalIncludeDirectories>
      <DisableSpecificWarnings>4819;</DisableSpecificWarnings>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
       <Version>1.00</Version>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <AdditionalLibraryDirectories>./$(PlatformName)/$(Configuration)/;./../../../pf/core/dll/$(PlatformName)/$(Configuration)/;./../../../pf/dependencies/dll/$(PlatformName)/$(Configuration)/;</AdditionalLibraryDirectories>
      <AdditionalDependencies>ws2_32.lib;pf_core.lib;lua.lib;iconv.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;PF_BUILD_AS_DLL;_DATABASE;__SERVER__;PF_BUILD_AS_DLL;ICONV_BUILD_AS_DLL;CHARSET_BUILD_AS_DLL;LUA_BUILD_AS_DLL;ZLIB_DLL;PF_PLUGIN_BUILD_AS_DLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>../../../pf/core/include/;../include/;../../common/include/;../../../pf/dependencies/lua/src/;/usr/local/unixODBC/include/;</AdditionalIncludeDirectories>
      <DisableSpecificWarnings>4819;</DisableSpecificWarnings>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
       <Version>1.00</Version>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <AdditionalLibraryDirectories>./$(PlatformName)/$(Configuration)/;./../../../pf/core/dll/$(PlatformName)/$(Configuration)/;./../../../pf/dependencies/dll/$(PlatformName)/$(Configuration)/;</AdditionalLibraryDirectories>
      <AdditionalDependencies>ws2_32.lib;pf_core.lib;lua.lib;iconv.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>

  功能需求很明确,就是要怎样生成这两种脚本。要生成这两种脚本,必要的就是这两种文件的结构。要写一个CMAKE其实不太难,而VS脚本直接用VS编辑器生成即可。但是我们现在知道的是源码所在的目录,或者一些散乱的源码文件,那么怎样生成这两种文件?

  要生成文件,我们就要知道文件的内容是怎样的,其组成又是怎样的。本次是以CMAKE2.6和VS2013作为基础,那么我们就看下这两种编译脚本的结构是怎么样的吧。

  分析不同平台的异同,于是我将之总结为以下字段,形成项目管理的基本文件。

/**
  Plain framework project file.
  Version:              The project current version.
  Type:                 Project type [library|executable].
  LinkDirectories:      Link directories as the Dependencies directories.
  IncludeDirectories:   Include directories.
  ExtraSources:         Extra source file or directories.
  SourceFilters:        Source directory or filename filter(not active).
  OutputPath:           The project output path.
  Definitions:          Macros definitions.
  Dependencies:         Dependencies library.
**/
{
  "Version": "1.0.1",
  "Type": "executable",
  "LinkDirectories": [
    "./",
    "./../../../pf/core/dll",
    "./../../../pf/dependencies/dll"
  ],
  "IncludeDirectories": [
    "../../../pf/core/include",
    "../include",
    "../../common/include",
    "../../../pf/dependencies/lua/src",
    "/usr/local/unixODBC/include"
  ],
  "ExtraSources": [
   /* static common settings { */
    "../common/include/common/config.h",
    "../common/include/common/define/",
    "../common/include/common/net/config.h",
    "../common/include/common/net/packet/config.h",
    "../common/include/common/net/packetfactory.h",
    "../common/include/common/net/packet/serverserver",
    "../common/src/define",
    "../common/src/setting.cc",
    "../common/src/net/packet/serverserver/",
    "../common/src/net/packetfactory.cc"
  /* static common settings } */ /* projcet only { */ /* } projcet only */ ], "SourceFilters": [ "CMakeFiles" ], "DisableSpecificWarnings": "4819;", "OutputPath": "../../bin", "Definitions": [ "PF_BUILD_AS_DLL", "_DATABASE", "__SERVER__" ], "Dependencies": [ "pf_core", "lua", "iconv" ]

2、项目管理器编码

  有很多的数据不需要我们改变,此时联想到的就是模板。到了这里,很多人可能不明白模板是什么。我就简单用一句话概括,模板是生产通用的模型。可能这句话难以理解,不过可以自己查找一下,如C++中的模板、PHP等脚本框架中的smart模板等等。

  模板就是要把固定和可变的部分分离出来,固定的部分我们直接放在模板中不用动,可变的部分我们用一种叫模板变量的东西关联起来。那么在使用过程中,模板变量又是如何操作的?简言之,模板变量就是值替换的过程。

  项目管理基本文件中的配置,就有这些模板变量,在编码的时候我们就需要考虑怎样将这些变量替换到模板中。其中比较复杂的就是文件列表,这部分可以自己找寻一些目录遍历。

  CMAKE模板:

# This file generate by plain framework admin tool, date: ${time}
${outputpath}
${definitions}
${basebit}

IF(CMAKE_SYSTEM MATCHES Linux)
  ADD_DEFINITIONS(-D_REENTRANT)
  ADD_DEFINITIONS(-DDONT_TD_VOID)
  ADD_DEFINITIONS(-D_PF_NET_EPOLL)
ELSE(CMAKE_SYSTEM MATCHES Linux)
ENDIF(CMAKE_SYSTEM MATCHES Linux)

LINK_DIRECTORIES(
${link_directories}
)

INCLUDE_DIRECTORIES(
${include_directories}
)

${sources_list}

${type_auto}
${sources_group_list}
)

if(USE_32BITS)
  SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
  SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
else()
  SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
  SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
endif(USE_32BITS)

if (WIN32)
TARGET_LINK_LIBRARIES(${project_name} ws2_32.lib ${odbc_dependencies_w} ${dependencies_w})
else()
TARGET_LINK_LIBRARIES(${project_name} ${odbc_dependencies} ${dependencies})
  if(USE_32BITS)
    SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
    SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
  else()
    SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
    SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=x86-64 -mtune=i686")
  endif(USE_32BITS)
endif(WIN32)

3、项目管理器调试

  首先生成的脚本在LINUX上使用CMAKE运行,其次再使用VS打开编译脚本进行编译。如果编译通过,那么初次测试就算通过了。

技术分享

 技术分享

plain framework 商业版 开发总结2 项目管理器

标签:

原文地址:http://www.cnblogs.com/lianyue/p/4487470.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!