Skip to content
Browse files

[mr2997] Improvement Windows CMake auto configuration.

  • Loading branch information...
1 parent f6e14e3 commit fc09a956a910166831013a2a756a3a6c3dc0395a @mns mns committed Oct 9, 2013
Showing with 89 additions and 104 deletions.
  1. +1 −1 CMakeLists.txt
  2. +87 −102 project_setup.bat
  3. +1 −1 src/shared/revision_R2.h
View
2 CMakeLists.txt
@@ -409,7 +409,7 @@ add_subdirectory(dep) # TODO: add vmap extractor build support
# Don't place this above 'dep' subdirectory! Because of defines build will crash.
set(DEFINITIONS
DO_MYSQL
- SYSCONFDIR="${CONF_DIR}/"
+ SYSCONFDIR="../etc/"
)
@rsa2
rsa2 added a note Oct 9, 2013

this broke non-windows making. see preview definition -
set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc)
if this really need, need setup CMAKE_INSTALL_PREFIX=.. in command line.

@mns
mns added a note Oct 9, 2013

This is SYSCONFDIR
This isn't CONF_DIR
Don't worry :)

this cause portability program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
set(DEFINITIONS_RELEASE NDEBUG)
set(DEFINITIONS_DEBUG _DEBUG MANGOS_DEBUG)
View
189 project_setup.bat
@@ -4,68 +4,101 @@ REM ****************************************************************************
REM Set your compiler and another features here. Possible VC1, VC11
REM currently possible VC10 (MS Visual studio 10 Pro) and VC11 (MS Visual studio 11 or 2012 Pro/Ultimate)
REM Warning! VS Express edition not supported! Also need check path (below) to VC10/11 binary
-SET compiler=VC10
+SET vs=Visual studio 11
REM Install path for MaNGOS (in this be created ./bin and ./etc folders)
SET INSTALL_PATH="C:\\MaNGOS"
-rem Platform for build. Possible Win32, Win64. Warning! Win64 build possible only on 64-bit main OS!
+REM Platform for build. Possible Win32, Win64. Warning! Win64 build possible only on 64-bit main OS!
SET BUILD_PLATFORM=Win32
-rem Count of cores on PC, where project compiled. for speedup only
+REM Count of cores on PC, where project compiled. for speedup only
SET CORE_NUMBER=2
-rem Used mangos memory manager. Possible managers - STD, TBB (not recommended), FASTMM (default)
+REM Used mangos memory manager. Possible managers - STD, TBB (not recommended), FASTMM (default)
SET MEMORY_MANAGER=FASTMM
-SET win_partition=C
-SET win_platform=x64
-SET vc_path=Program Files (x86)
+SET vs_path=%ProgramFiles(x86)%
+
+IF "%vs_path%"=="" (
+ SET "vs_path=%ProgramFiles%"
+)
+SET vs_path=%vs_path:\=/%
:menu
+REM *****************************************************************************************
+if "%vs%"=="Visual studio 11" (
+ SET COMPILER="Visual Studio 11"
+ if %BUILD_PLATFORM%==x64 (SET COMPILER="Visual Studio 11 Win64")
+ SET COMPILER_PATH="%vs_path%/Microsoft Visual Studio 11.0/VC/bin/cl.exe"
+ SET LINKER_PATH="%vs_path%/Microsoft Visual Studio 11.0/VC/bin/link.exe"
+ SET VC_VARS="%vs_path%\\Microsoft Visual Studio 11.0\\VC\\"
+)
+if "%vs%"=="Visual studio 10" (
+ SET COMPILER="Visual Studio 10"
+ if %BUILD_PLATFORM%==x64 (SET COMPILER="Visual Studio 10 Win64")
+ SET COMPILER_PATH="%vs_path%/Microsoft Visual Studio 10.0/VC/bin/cl.exe"
+ SET LINKER_PATH="%vs_path%/Microsoft Visual Studio 10.0/VC/bin/link.exe"
+ SET VC_VARS="%vs_path%\\Microsoft Visual Studio 10.0\\VC\\"
+)
+
+SET RESULT_CONF=Release
+SET MEMMAN_STR1="0"
+SET MEMMAN_STR3="0"
+SET MEMMAN_STR2="0"
+if %MEMORY_MANAGER%==STD (SET MEMMAN_STR2="1")
+if %MEMORY_MANAGER%==TBB (SET MEMMAN_STR3="1")
+if %MEMORY_MANAGER%==FASTMM (SET MEMMAN_STR1="1")
+SET C_FLAGS="/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR"
+SET CMakeConfiguration=-G %COMPILER% -DPCH=1 -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_CXX_FLAGS=%C_FLAGS% -DCMAKE_C_FLAGS=%C_FLAGS% -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DUSE_FASTMM_MALLOC=%MEMMAN_STR1% -DUSE_STD_MALLOC=%MEMMAN_STR2% -DUSE_TBB_MALLOC=%MEMMAN_STR3% ..
+SET MSBuildConfiguration=INSTALL.vcxproj /m:%CORE_NUMBER% /p:Configuration=%RESULT_CONF%;Platform=%BUILD_PLATFORM%
+REM *****************************************************************************************
+
cls
echo ##########################
echo # Welcome to R2 compiler #
echo ##########################
echo.
-echo Compile settings
-echo --------------
-echo Compiler: %compiler%
-echo Install path: %INSTALL_PATH%
-echo Build platform: %BUILD_PLATFORM%
-echo CPU core(s) number: %CORE_NUMBER%
+REM *****************************************************************************************
+echo +++++++++++++++++++++ Current CMake configuration +++++++++++++++++++++
+echo cmake %CMakeConfiguration%
+echo.
+echo +++++++++++++++++++++ Current compiler configuration +++++++++++++++++++++
+echo MSBuild %MSBuildConfiguration%
+REM *****************************************************************************************
echo.
-echo Windows partition: %win_partition%
-echo Windows platform: %win_platform%
echo.
-echo 1 - Change compiler
-echo 2 - Change install path
-echo 3 - Change build platform
-echo 4 - Change CPU core number
+echo 0 - Exit R2 compiler
echo.
-echo 5 - Change Windows partition
-echo 6 - Change Windows platform
+echo 1 - Change compiler [%vs%]
+echo 2 - Change build platform [%BUILD_PLATFORM%]
+echo 3 - Change install path [%INSTALL_PATH%]
+echo 4 - Change CPU core(s) number [%CORE_NUMBER%]
echo.
+echo 5 - Change VS Path [%vs_path%]
+echo.
+echo 8 - Create Project
echo 9 - Start compile
echo.
set /P menu=Select a number:
+if "%menu%"=="0" goto end
if "%menu%"=="1" goto compiler
-if "%menu%"=="2" goto path
-if "%menu%"=="3" goto platform
+if "%menu%"=="2" goto platform
+if "%menu%"=="3" goto path
if "%menu%"=="4" goto core
if "%menu%"=="5" goto win_part
-if "%menu%"=="6" goto win_platform
-if "%menu%"=="9" goto start
+if "%menu%"=="8" goto cmake
+if "%menu%"=="9" goto build
if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto menu
:compiler
cls
-echo 1 - VC10
-echo 2 - VC11
+echo 1 - Visual studio 10
+echo 2 - Visual studio 11
set /P menu=Select a number:
-if "%menu%"=="1" SET compiler=VC10 & goto menu
-if "%menu%"=="2" SET compiler=VC11 & goto menu
+if "%menu%"=="1" SET vs=Visual studio 10& goto menu
+if "%menu%"=="2" SET vs=Visual studio 11& goto menu
if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto compiler
:path
@@ -78,11 +111,11 @@ goto menu
:platform
cls
echo 1 - Win32
-echo 2 - Win64
+echo 2 - x64
set /P menu=Select a number:
-if "%menu%"=="1" SET BUILD_PLATFORM=Win32 & goto menu
-if "%menu%"=="2" SET BUILD_PLATFORM=Win64 & goto menu
+if "%menu%"=="1" SET BUILD_PLATFORM=Win32& goto menu
+if "%menu%"=="2" SET BUILD_PLATFORM=x64& goto menu
if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto platform
:core
@@ -92,92 +125,44 @@ goto menu
:win_part
cls
-set /P win_partition=Enter the Windows partition drive letter:
+set /P vs_path=Enter the VS path:
goto menu
-:win_platform
-cls
-echo 1 - x86
-echo 2 - x64
-
-set /P menu=Select a number:
-if "%menu%"=="1" SET win_platform=x86 & goto menu
-if "%menu%"=="2" SET win_platform=x64 & goto menu
-if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto win_platform
-
-:start
-REM *****************************************************************************************
-if %compiler%==VC11 goto :vc11
-if %compiler%==VC10 goto :vc10
-if %win_platform%==x86 set vc_path=Program Files
-if %win_platform%==x64 set vc_path=Program Files (x86)
-goto :help
-REM *****************************************************************************************
-:vc11
-SET COMPILER="Visual Studio 11"
-if %BUILD_PLATFORM%==Win64 (SET COMPILER="Visual Studio 11 Win64")
-SET COMPILER_PATH="%win_partition%:/%vc_path%/Microsoft Visual Studio 11.0/VC/bin/cl.exe"
-SET LINKER_PATH="%win_partition%:/%vc_path%/Microsoft Visual Studio 11.0/VC/bin/link.exe"
-SET VC_VARS="%win_partition%:\\%vc_path%\\Microsoft Visual Studio 11.0\\VC\\"
-goto :common
-REM *****************************************************************************************
-:vc10
-SET COMPILER="Visual Studio 10"
-if %BUILD_PLATFORM%==Win64 (SET COMPILER="Visual Studio 10 Win64")
-SET COMPILER_PATH="%win_partition%:/%vc_path%/Microsoft Visual Studio 10.0/VC/bin/cl.exe"
-SET LINKER_PATH="%win_partition%:/%vc_path%/Microsoft Visual Studio 10.0/VC/bin/link.exe"
-SET VC_VARS="%win_partition%:\\%vc_path%\\Microsoft Visual Studio 10.0\\VC\\"
-goto :common
-REM *****************************************************************************************
-:help
-echo "Set up parameters in this bat file!"
-exit
-REM *****************************************************************************************
-:common
-SET RESULT_CONF=Release
-SET MEMMAN_STR1="0"
-SET MEMMAN_STR3="0"
-SET MEMMAN_STR2="0"
-if %MEMORY_MANAGER%==STD (SET MEMMAN_STR2="1")
-if %MEMORY_MANAGER%==TBB (SET MEMMAN_STR3="1")
-if %MEMORY_MANAGER%==FASTMM (SET MEMMAN_STR1="1")
-SET C_FLAGS="/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR"
-goto :begin
+:cmake
REM *****************************************************************************************
-:begin
if not exist build (
mkdir build
)
if not exist %INSTALL_PATH% (
-mkdir %INSTALL_PATH%
+ mkdir %INSTALL_PATH%
if not exist %INSTALL_PATH% (
- echo Please, make output directory %INSTALL_PATH%
- exit
+ echo Please, make output directory %INSTALL_PATH%
+ pause
+ goto :menu
)
)
-if %BUILD_PLATFORM%==Win32 goto :win32
-if %BUILD_PLATFORM%==Win64 goto :win64
-goto :help
-
-REM *****************************************************************************************
-:win32
cd build
-cmake -G %COMPILER% -DPCH=1 -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_CXX_FLAGS=%C_FLAGS% -DCMAKE_C_FLAGS=%C_FLAGS% -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DUSE_FASTMM_MALLOC=%MEMMAN_STR1% -DUSE_STD_MALLOC=%MEMMAN_STR2% -DUSE_TBB_MALLOC=%MEMMAN_STR3% ..
-call %VC_VARS%vcvarsall.bat
-MSBuild INSTALL.vcxproj /m:%CORE_NUMBER% /t:Rebuild /p:Configuration=%RESULT_CONF%;Platform=%BUILD_PLATFORM%
-goto :end
+cmake %CMakeConfiguration%
+cd ..
+pause
+goto :menu
REM *****************************************************************************************
-:win64
-cd build
-cmake -G %COMPILER% -DPCH=1 -DPLATFORM=X64 -DCMAKE_CXX_FLAGS=%C_FLAGS% -DCMAKE_C_FLAGS=%C_FLAGS% -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DUSE_FASTMM_MALLOC=%MEMMAN_STR1% -DUSE_STD_MALLOC=%MEMMAN_STR2% -DUSE_TBB_MALLOC=%MEMMAN_STR3% ..
+
+:build
call %VC_VARS%vcvarsall.bat
-MSBuild INSTALL.vcxproj /m:%CORE_NUMBER% /t:Rebuild /p:Configuration=%RESULT_CONF%;Platform=x64
-goto :end
+cd build
+MSBuild %MSBuildConfiguration%
+cd ..
+pause
+goto :menu
+REM *****************************************************************************************
+
+:help
+echo "Set up parameters in this bat file!"
+goto :menu
REM *****************************************************************************************
:end
-cd ..
-pause
View
2 src/shared/revision_R2.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_R2_H__
#define __REVISION_R2_H__
- #define REVISION_R2 "2996"
+ #define REVISION_R2 "2997"
#endif // __REVISION_R2_H__

1 comment on commit fc09a95

@FallenAngelX

yay

Please sign in to comment.
Something went wrong with that request. Please try again.