Skip to content

Commit 4ad2cb9

Browse files
committed
Merge pull request #109 from mpsonntag/winBuildBatch
Add Win32 and Win64 build batch file Awesome
2 parents 0706ed5 + 1ed8ebb commit 4ad2cb9

File tree

5 files changed

+119
-54
lines changed

5 files changed

+119
-54
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 2.8.4)
22
project(nix_mx CXX)
33

4-
set(VERSION_MAJOR 0)
4+
set(VERSION_MAJOR 1)
55
set(VERSION_MINOR 1)
66
set(VERSION_PATCH 0)
77

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ The *NIX-MX* project is an extension to [NIX] (https://github.com/G-Node/nix) an
77
Development Status
88
------------------
99

10-
The *NIX-MX* project has been developed and tested solely under Windows 32 and Windows 64 and is in an alpha stage of development. Specifically all of the features of NIX have been implemented and unit tests for all of the methods exist and pass, but extensive testing and some refactoring of existing code has to be done as of yet.
10+
The *NIX-MX* project has been developed and tested solely under Windows 32 and Windows 64 and is in a beta stage of development. Specifically all of the features of NIX have been implemented and unit tests for all of the methods exist and pass, but extensive testing and some refactoring of existing code has to be done as of yet.
1111

1212

1313
Getting Started (Windows 32/64)
1414
-------------------------------
1515

16-
**Quick start packages, Pre-Release 1.01**
16+
**Quick start packages, Beta-Release 1.1.0**
1717

18-
The [quick start packages] (https://github.com/G-Node/nix-mx/releases/tag/v1.01-Pre-Release) are compiled under Windows 32/64 and contain all dlls, binary and Matlab files required to use NIX-MX with the respective Windows OS.
19-
To use the packages, unzip them into a folder of your choice and run the `startup.m` script from the root folder. Do not change the file/folder structure.
18+
The [quick start packages] (https://github.com/G-Node/nix-mx/releases) are compiled under Windows 32/64 and contain all dlls, binary and Matlab files required to use NIX-MX with the respective Windows OS.
19+
The included *NIX* dll is a [stable release 1.1.0 build] (https://github.com/G-Node/nix/releases/tag/1.1.0) . To use the packages, unzip them into a folder of your choice and run the `startup.m` script from the root folder. Do not change the file/folder structure.
2020

2121
The Windows 32 package contains:
2222
- HDF5 dlls (Release 1.8.14)
23-
- NIX dll (build commit f357124d0ec5028d4574e4f5816cca7b8d7c9e8b, compiled using BOOST 1.57.0 and CPPUNIT 1.13.2)
24-
- NIX-MX (Pre-Release 1.01, 22.06.2015)
23+
- NIX dll (stable release 1.1.0 build, compiled using BOOST 1.57.0 and CPPUNIT 1.13.2)
24+
- NIX-MX (Beta-Release 1.1.0, 26.01.2016)
2525

2626
The Windows 64 package contains:
2727
- HDF5 dlls (Release 1.8.14)
28-
- NIX dll (build commit f357124d0ec5028d4574e4f5816cca7b8d7c9e8b, compiled using BOOST 1.57.0 and CPPUNIT 1.13.2)
29-
- NIX-MX (Pre-Release 1.01, 22.06.2015)
28+
- NIX dll (stable release 1.1.0 build, compiled using BOOST 1.57.0 and CPPUNIT 1.13.2)
29+
- NIX-MX (Beta-Release 1.1.0, 26.01.2016)
3030

3131

3232
**Build NIX-MX under Windows**

WinBuild.md

Lines changed: 61 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,57 @@ Follow these steps to set up the development environment for the NIX Matlab bind
55

66
**Dependencies**
77
- download and install Visual Studio 12
8-
- make sure you have a fork of [NIX](https://github.com/G-Node/nix) and [NIX-MX](https://github.com/G-Node/nix-mx)
8+
- make sure you have a clone of [NIX](https://github.com/G-Node/nix) and [NIX-MX](https://github.com/G-Node/nix-mx)
99
- get the latest [NIX Windows dependencies](https://projects.g-node.org/nix/), extract to [your path]/nix-dep/
1010

11-
- IMPORTANT: if you need the DEBUG instead of the RELEASE build, make sure you use the corresponding debug folders instead of the release folders and settings in all subsequent paths and scripts of these set up notes:
11+
**Build process**
12+
- open [your path]/nix-mx/win_build.bat with an editor of your choice.
13+
- adjust the first three lines of the batch file to the corresponding directories on your system (NIX_DEP, NIX_ROOT, NIX_MX_ROOT).
14+
- NOTE: If you need the "Debug" instead of the "Release" build, change the corresponding line in the batch file.
15+
- start cmd (NOT powershell!)
16+
- run [your path]/nix-mx/win_build.bat
1217

13-
**Build process for RELEASE build**
14-
- start cmd (NOT powershell!), move to [your path]/nix; create "build" directory, move inside
15-
- if you need any other build than DEBUG (in our case RELEASE) on a 32bit windows, edit [your path]/nix-dep/nixenv.bat:
16-
edit PLATFORM from x86 to x64 if required
17-
edit CONFIGURATION from Debug to Release if required
18-
- to set up dependencies path variables for NIX cmake, run:
18+
19+
**Step by step build process**
20+
21+
If you want to build nix-mx step by step use the following guidelines:
22+
23+
***Build process for "Release" build***
24+
25+
1. start cmd (NOT powershell!), move to [your path]/nix; create "build" directory, move inside.
26+
2. to set up dependencies path variables for NIX cmake, build type Release, run:
1927
`[your path]/nix-dep/nixenv.bat`
20-
- if working on a 32bit Windows, run:
28+
3. if working on a 32bit Windows, run:
2129
`cmake .. -G "Visual Studio 12"`
22-
- if working on a 64bit Windows, run:
30+
4. if working on a 64bit Windows, run:
2331
`cmake .. -G "Visual Studio 12 Win64"`
24-
- with Visual Studio open [your path]/nix/build/nix.sln
25-
26-
IMPORTANT NOTE! Visual Studio builds by default with configuration "Debug" and "32bit"!
27-
- If some other build is required (in our case we need at least configuration "Release"), set BUILD->ConfigurationManager->Active solution configuration!
28-
- Build "ALL_BUILD"
29-
- within the cmd shell move to [your path]/nix/build/Release
30-
- run
32+
5. with Visual Studio open [your path]/nix/build/nix.sln
33+
IMPORTANT NOTE! Visual Studio builds by default with configuration "Debug" and "32bit"!
34+
6. If some other build is required (in our case we need at least configuration "Release"), set BUILD->ConfigurationManager->Active solution configuration!
35+
7. Build "ALL_BUILD".
36+
8. within the cmd shell move to [your path]/nix/build/Release.
37+
9. run
3138
`[your path]/nix/build/Release/TestRunner.exe`
32-
- within the cmd shell move to [your path]/nix-mx, create and move into "build" folder
33-
- set the NIX root path;
39+
10. within the cmd shell move to [your path]/nix-mx, create and move into "build" folder.
40+
11. set the NIX root path;
3441
`set NIX_ROOT=[your path]/nix`
3542

3643
IMPORTANT:
3744
- do not use quotes in cmd!
3845
- do not use backslashes, only slashes! e.g. c:/work/nix; c:\work\nix will not work!
3946

40-
- check, if the nix.dll library has been created in [your path]/nix/build/Release
41-
- if yes, open [your path]/nix-mx/cmake/FindNIX.cmake
42-
- add "HINTS $ENV{NIX_ROOT}/build/Release" to the "find_library(NIX_LIBRARY NAMES" statement
43-
- if working on Windows 32bit, run
47+
12. check, if the nix.dll library has been created in [your path]/nix/build/Release
48+
13. if yes, run
49+
`SET NIX_BUILD_DIR=%NIX_ROOT%/build/Release`
50+
51+
14. if working on Windows 32bit, run
4452
`cmake .. -G "Visual Studio 12"`
45-
- if working on Windows 64bit, run
53+
15. if working on Windows 64bit, run
4654
`cmake .. -G "Visual Studio 12 Win64"`
47-
- with Visual Studio open [your path]/nix-mx/build/nix-mx.sln
48-
- Set BUILD->ConfigurationManager->Active solution configuration to Release and the correct bit version!
49-
- Build "ALL_BUILD"
50-
- copy all of the following files into the [your path]/nix-mx/build folder; simply providing the directories to MatLab using "addpath" does not work
55+
16. with Visual Studio open [your path]/nix-mx/build/nix-mx.sln.
56+
17. Set BUILD->ConfigurationManager->Active solution configuration to Release and the correct bit version!
57+
18. Build "ALL_BUILD".
58+
19. copy all of the following files into the [your path]/nix-mx/build folder; simply providing the directories to MatLab using "addpath" does not work.
5159

5260
from [your path]/nix-dep/[x86/x64]/hdf5-1.8.14/bin (path dependent on the Windows 32/64 bit version)
5361

@@ -61,25 +69,33 @@ IMPORTANT NOTE! Visual Studio builds by default with configuration "Debug" and "
6169

6270
`nix_mx.mexw32 or nix_mx.mexw64`
6371

64-
- get some NIX files from the [your path]/nix/build/ test folder and NIX away!
72+
20. get some NIX files from the [your path]/nix/build/ test folder and NIX away!
6573

6674

67-
**Alternate build process for DEBUG build**
75+
***Alternate build process for "Debug" build***
6876

69-
The build described above is for RELEASE which requires the usage of msvcp120d.dll and msvcr120d.dll and prevents the usage of msvcp120.dll and msvcr120.dll
77+
The build described above is for "Release" which requires the usage of msvcp120d.dll and msvcr120d.dll and prevents the usage of msvcp120.dll and msvcr120.dll.
7078

71-
To use the hdf5 debug dlls, nix and nix-mx have to be built in DEBUG mode! For this:
72-
- replace "Release" with "Debug" in the nixenv.bat, use this to setup environmental variables
73-
- run cmake
74-
- open sln, in Visual Studio set BUILD->ConfigurationManager->Active solution configuration to "Debug" instead of "Release"
75-
- re-run TestRunner.exe in folder "Debug" instead of "Release"
76-
- move to the [your path]/nix-mx/build folder
77-
- re-run the modified nixenv.bat
78-
- run
79-
`$env:NIX_ROOT="c:/work/nix"`
80-
- open [your path]/nix-mx/cmake/FindNIX.cmake and add
79+
To use the hdf5 debug dlls, nix and nix-mx have to be built with build type "Debug"! For this change the following steps in the guideline above:
80+
- Step 0. Delete everything from the nix/build and nix-mx/build directories.
81+
- Step 2. setup the environmental variables by using:
82+
`[your path]/nix-dep/nixenv.bat Debug`
83+
- Step 6. open nix sln, in Visual Studio set BUILD->ConfigurationManager->Active solution configuration to "Debug" instead of "Release".
84+
- Step 8. re-run TestRunner.exe in folder "Debug" instead of "Release".
85+
- Step 12. check, if the nix.dll library has been created in [your path]/nix/build/Debug.
86+
- Step 13. run
87+
`SET NIX_BUILD_DIR=%NIX_ROOT%/build/Debug`
88+
- Step 16. open nix-mx sln, in Visual Studio set BUILD->ConfigurationManager->Active solution configuration to "Debug" instead of "Release".
89+
- Step 19. copy all of the following files into the [your path]/nix-mx/build folder; simply providing the directories to MatLab using "addpath" does not work.
8190

82-
"HINTS $ENV{NIX_ROOT}/build/Debug" to the "find_library(NIX_LIBRARY NAMES" statement
83-
- run cmake
84-
- open sln, in Visual Studio set BUILD->ConfigurationManager->Active solution configuration to "Debug" instead of "Release"
85-
- setup the rest like in debug mode
91+
from [your path]/nix-dep/[x86/x64]/hdf5-1.8.14/bin (path dependent on the Windows 32/64 bit version)
92+
93+
`hdf5.dll, msvcp120.dll, msvcr120.dll, szip.dll, zlib.dll`
94+
95+
from [your path]/nix/build/Debug
96+
97+
`nix.dll`
98+
99+
from [your path]/nix-mx/build/Debug
100+
101+
`nix_mx.mexw32 or nix_mx.mexw64`

cmake/FindNIX.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ find_path(NIX_INCLUDE_DIR nix.hpp
1212
PATH_SUFFIXES nix)
1313

1414
find_library(NIX_LIBRARY NAMES nix libnix
15+
HINTS $ENV{NIX_BUILD_DIR}
1516
HINTS ${NIX_INCLUDE_DIR}/../lib
1617
HINTS ${NIX_INCLUDE_DIR}/../build
1718
/usr/local/lib

win_build.bat

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
SET NIX_DEP=c:\work\nix-dep
2+
SET NIX_ROOT=c:\work\nix
3+
SET NIX_MX_ROOT=c:\work\nix-mx
4+
REM Use only build types "Release" or "Debug"
5+
SET BUILD_TYPE=Release
6+
7+
IF NOT %BUILD_TYPE% == Release (IF NOT %BUILD_TYPE% == Debug (ECHO Please use only Release or Debug as BUILD_TYPE))
8+
IF NOT %BUILD_TYPE% == Release (IF NOT %BUILD_TYPE% == Debug (EXIT /b))
9+
REM Set NIX_BUILD_DIR for nix-mx FindNIX.cmake
10+
SET NIX_BUILD_DIR=%NIX_ROOT%\build\%BUILD_TYPE%
11+
12+
IF %BUILD_TYPE% == Debug (CALL %NIX_DEP%\nixenv.bat Debug) ELSE (CALL %NIX_DEP%\nixenv.bat)
13+
14+
IF NOT EXIST %NIX_ROOT%\build (MKDIR %NIX_ROOT%\build)
15+
CD %NIX_ROOT%\build
16+
REM Clean up build folder to ensure clean build.
17+
DEL * /S /Q
18+
RD /S /Q "CMakeFiles" "Testing" "Debug" "Release" "nix-tool.dir" "x64" "TestRunner.dir" "nix.dir"
19+
20+
IF %PROCESSOR_ARCHITECTURE% == x86 ( cmake .. -G "Visual Studio 12") ELSE (cmake .. -G "Visual Studio 12 Win64")
21+
22+
REM Start %NIX_ROOT%\build\nix.sln
23+
cmake --build . --config %CONFIGURATION% --target nix
24+
25+
%NIX_BUILD_DIR%\TestRunner.exe
26+
27+
IF NOT EXIST %NIX_MX_ROOT%\build (MKDIR %NIX_MX_ROOT%\build)
28+
CD %NIX_MX_ROOT%\build
29+
REM Clean up build folder to ensure clean build.
30+
DEL * /S /Q
31+
RD /S /Q "CMakeFiles" "Debug" "nix_mx.dir" "Release" "Win32" "x64"
32+
33+
COPY %NIX_BUILD_DIR%\nix.dll %NIX_MX_ROOT%\build\ /Y
34+
COPY %HDF5_BASE%\bin\hdf5.dll %NIX_MX_ROOT%\build\ /Y
35+
COPY %HDF5_BASE%\bin\msvcp120.dll %NIX_MX_ROOT%\build\ /Y
36+
COPY %HDF5_BASE%\bin\msvcr120.dll %NIX_MX_ROOT%\build\ /Y
37+
COPY %HDF5_BASE%\bin\szip.dll %NIX_MX_ROOT%\build\ /Y
38+
COPY %HDF5_BASE%\bin\zlib.dll %NIX_MX_ROOT%\build\ /Y
39+
40+
IF %PROCESSOR_ARCHITECTURE% == x86 (cmake .. -G "Visual Studio 12") ELSE (cmake .. -G "Visual Studio 12 Win64")
41+
42+
cmake --build . --config %CONFIGURATION%
43+
44+
COPY %NIX_MX_ROOT%\build\%BUILD_TYPE%\nix_mx.mexw* %NIX_MX_ROOT%\build\ /Y
45+
46+
CD %NIX_MX_ROOT%
47+
48+
Start %NIX_MX_ROOT%\startup.m

0 commit comments

Comments
 (0)