This repository was archived by the owner on Apr 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmake_build.cmd
More file actions
95 lines (91 loc) · 3.29 KB
/
cmake_build.cmd
File metadata and controls
95 lines (91 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
@echo off
IF "%MG_PKG_VER%"=="" (
echo Could not determine NuGet package version. This should've been set by envsetupsdk.cmd
exit /B 1
)
REM Test for CMake
which cmake
if %errorlevel% neq 0 (
echo CMake not found
goto error
)
REM Test for Ninja
REM which ninja
REM if %errorlevel% neq 0 (
REM echo Ninja not found
REM goto error
REM )
SET WITH_JAVA=1
SET WITH_PHP=1
SET WITH_DOTNET=1
SET THIS_DIR=%CD%
SET TOOLS_DIR=%CD%\tools
SET WORKING_DIR=%1
if "%WORKING_DIR%" == "" goto no_working_dir
if not exist "%WORKING_DIR% mkdir" mkdir "%WORKING_DIR%"
if not exist "%WORKING_DIR%\x64_release" mkdir "%WORKING_DIR%\x64_release"
if not exist "%WORKING_DIR%\x86_release" mkdir "%WORKING_DIR%\x86_release"
SET PACKAGE_DIR=%CD%\packages
SET USE_CMAKE_GENERATOR_X86=Visual Studio 14 2015
SET USE_CMAKE_GENERATOR_X64=Visual Studio 14 2015 Win64
REM SET USE_CMAKE_GENERATOR_X86=Ninja
REM SET USE_CMAKE_GENERATOR_X64=Ninja
SET USE_CMAKE_VSTOOLSET=v140
echo CMake Generator (32-bit): %USE_CMAKE_GENERATOR_X86%
echo CMake Generator (64-bit): %USE_CMAKE_GENERATOR_X64%
pushd "%WORKING_DIR%\x86_release"
cmake -G "%USE_CMAKE_GENERATOR_X86%" -DCMAKE_BUILD_TYPE=Release -DSWIG_WIN_PATH=%SWIG_TOOL_PATH% -DMG_CPU=32 -DWITH_JAVA=%WITH_JAVA% -DWITH_DOTNET=%WITH_DOTNET% -DWITH_PHP=%WITH_PHP% -DMG_PACKAGE_DIR="%PACKAGE_DIR%" %THIS_DIR%
if %errorlevel% neq 0 goto error
cmake --build . --config Release
if %errorlevel% neq 0 goto error
popd
pushd "%WORKING_DIR%\x64_release"
cmake -G "%USE_CMAKE_GENERATOR_X64%" -DCMAKE_BUILD_TYPE=Release -DSWIG_WIN_PATH=%SWIG_TOOL_PATH% -DMG_CPU=64 -DWITH_JAVA=%WITH_JAVA% -DWITH_DOTNET=%WITH_DOTNET% -DWITH_PHP=%WITH_PHP% -DMG_PACKAGE_DIR="%PACKAGE_DIR%" %THIS_DIR%
if %errorlevel% neq 0 goto error
cmake --build . --config Release
if %errorlevel% neq 0 goto error
popd
if "%WITH_JAVA%" == "1" (
pushd src\Managed\Java
echo Building java classes...
"%JAVA_HOME%\bin\javac" -classpath . org\osgeo\mapguide\*.java
echo Building JAR file
"%JAVA_HOME%\bin\jar" cf %PACKAGE_DIR%\Java\Release\x86\MapGuideApi.jar org\osgeo\mapguide\*.class
echo Building -sources JAR file
"%JAVA_HOME%\bin\jar" cf %PACKAGE_DIR%\Java\Release\x86\MapGuideApi-sources.jar org\osgeo\mapguide\*.java
copy /Y %PACKAGE_DIR%\Java\Release\x86\*.jar %PACKAGE_DIR%\Java\Release\x64
popd
)
if "%WITH_DOTNET%" == "1" (
pushd src\Managed\DotNet\MapGuideDotNetApi
call dotnet restore
if %errorlevel% neq 0 goto error
call dotnet pack --configuration Release --output "%PACKAGE_DIR%" /p:Version=%MG_PKG_VER%
if %errorlevel% neq 0 goto error
popd
)
if "%WITH_PHP%" == "1" (
echo Running PHP post-processor
%TOOLS_DIR%\PhpPostProcess "%PACKAGE_DIR%\php\Release\x86\MapGuideApi.php"
if %errorlevel% neq 0 goto error
%TOOLS_DIR%\PhpPostProcess "%PACKAGE_DIR%\php\Release\x64\MapGuideApi.php"
if %errorlevel% neq 0 goto error
)
echo Building Sample dataset
pushd src\TestData\Samples\Sheboygan
call build.bat
if %errorlevel% neq 0 goto error
popd
goto end
:no_working_dir
echo Must specify working directory
echo Usage: cmake_build.cmd [path to working directory] [path to swig directory]
goto error
:no_swig
echo Cannot find swig
echo Usage: cmake_build.cmd [path to working directory] [path to swig directory]
goto error
:error
echo An error occurred while building a component
popd
:end