summaryrefslogtreecommitdiff
path: root/modules/dynamic_link/macros/windows/dlwSetEnvCommonVc9Vc10.sci
blob: f157f04ce3c1daa52d6e212b3becacea51263c8c (plain)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) DIGITEO - 2010 - Allan CORNET
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

//=============================================================================
function bOK = dlwSetEnvCommonVc9Vc10(MSVSDir, IsExpress, bWin64)
    bOK = %F;

    windowsSdkPath = dlwGetSdkPath();
    if (windowsSdkPath <> []) then
        err = setenv("WindowsSdkDir", windowsSdkPath);
    else
        windowsSdkPath = "";
    end

    err = setenv("VSINSTALLDIR", MSVSDir);
    if (err == %F) then
        bOK = %F;
        return
    end

    DevEnvDir = MSVSDir + "\Common7\IDE";
    err = setenv("DevEnvDir", DevEnvDir);
    if (err == %F) then
        bOK = %F;
        return
    end

    err = setenv("VCINSTALLDIR", MSVSDir + "\VC\");
    if (err == %F) then
        bOK = %F;
        return
    end

    if bWin64 then
        VC_PATH = getVcPathx64(MSVSDir, windowsSdkPath, IsExpress);
        VC_INCLUDE = getVcIncludex64(MSVSDir, windowsSdkPath, IsExpress);
        VC_LIB = getVcLibx64(MSVSDir, windowsSdkPath, IsExpress);
        VC_LIBPATH = getVcLibPathx64(MSVSDir, windowsSdkPath, IsExpress);
    else
        VC_PATH = getVcPathx86(MSVSDir, windowsSdkPath, IsExpress);
        VC_INCLUDE = getVcIncludex86(MSVSDir, windowsSdkPath, IsExpress);
        VC_LIB = getVcLibx86(MSVSDir, windowsSdkPath, IsExpress);
        VC_LIBPATH = getVcLibPathx86(MSVSDir, windowsSdkPath, IsExpress);
    end

    err = addPathToEnv("PATH", VC_PATH);
    if (err == %F) then
        bOK = %F;
        return
    end

    err = addPathToEnv("INCLUDE", VC_INCLUDE);
    if (err == %F) then
        bOK = %F;
        return
    end

    err = addPathToEnv("LIB", VC_LIB);
    if (err == %F) then
        bOK = %F;
        return
    end

    err = addPathToEnv("LIBPATH", VC_LIBPATH);
    if (err == %F) then
        bOK = %F;
        return
    end

    bOK = %T;
endfunction
//=============================================================================
function VcLib = getVcLibx64(msvsPath, sdkPath, bIsExpress)
    if bIsExpress then
        VcLib = dlwGet64BitPath() + "\VC\lib\amd64";
    else
        VcLib = msvsPath + "\VC\atlmfc\lib\amd64" + pathsep() + ..
        msvsPath + "\VC\lib\amd64";
    end

    VcLib = VcLib + pathsep() + sdkPath + "\lib\x64";
endfunction
//=============================================================================
function VcLib = getVcLibx86(msvsPath, sdkPath, bIsExpress)
    VcLib = "";
    if ~bIsExpress then
        VcLib =  msvsPath + filesep() + "VC\atlmfc\lib";
    end
    VcLib = VcLib + pathsep() + ..
    msvsPath + "\VC\lib" + pathsep() + ..
    sdkPath + "\lib";
endfunction
//=============================================================================
function VcPath = getVcPathx64(msvsPath, sdkPath, bIsExpress)
    if bIsExpress then
        VcPath = dlwGet64BitPath();
    else
        VcPath = msvsPath;
    end

    VcPath = VcPath + "\VC\bin\amd64" + pathsep() + ..
    msvsPath + "\VC\VCPackages" + pathsep() + ..
    msvsPath + "\Common7\IDE" + pathsep() + ..
    msvsPath + "\Common7\Tools" + pathsep() + ..
    msvsPath + "\Common7\Tools\bin" + pathsep() + ..
    sdkPath + "\bin\x64" + pathsep() + ..
    sdkPath + "\bin\win64\x64" + pathsep() + ..
    sdkPath + "\bin";
endfunction
//=============================================================================
function VcPath = getVcPathx86(msvsPath, sdkPath, bIsExpress)
    VcPath = msvsPath + "\Common7\IDE\" + pathsep() + ..
    msvsPath + "\VC\bin" + pathsep() + ..
    msvsPath + "\Common7\Tools" + pathsep() + ..
    msvsPath + "\VC\VCPackages" + pathsep() + ..
    sdkPath + "\bin";
endfunction
//=============================================================================
function VcLibPath = getVcLibPathx64(msvsPath, sdkPath, bIsExpress)
    if bIsExpress then
        VcLibPath = dlwGet64BitPath() +  "\VC\lib\amd64";
    else
        VcLibPath = msvsPath + "\VC\atlmfc\lib\amd64" + pathsep() + ..
        msvsPath + "\VC\lib\amd64";
    end
endfunction
//=============================================================================
function VcLibPath = getVcLibPathx86(msvsPath, sdkPath, bIsExpress)
    VcLibPath = "";
    if ~bIsExpress then
        VcLibPath = msvsPath + "\VC\atlmfc\lib";
    end

    VcLibPath = VcLibPath + pathsep() + ..
    msvsPath + "\VC\lib";
endfunction
//=============================================================================
function VcInclude = getVcIncludex64(msvsPath, sdkPath, bIsExpress)
    if bIsExpress then
        VcInclude = dlwGet64BitPath() + "\VC\include";
    else
        VcInclude = msvsPath + "\VC\include" + pathsep() + ..
        msvsPath + "\VC\atlmfc\include";
    end

    VcInclude = VcInclude + pathsep() + ..
    sdkPath + "\include";
endfunction
//=============================================================================
function VcInclude = getVcIncludex86(msvsPath, sdkPath, bIsExpress)
    VcInclude = "";
    if ~bIsExpress then
        VcInclude = msvsPath + "\VC\atlmfc\include";
    end

    VcInclude = VcInclude + pathsep() + ..
    msvsPath + "\VC\include"  + pathsep() + ..
    sdkPath + "\include";
endfunction
//=============================================================================