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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617
|
# =======================================================================
# Created on: 2014-07-24
# Created by: SKI
# Copyright (c) 2014 OPEN CASCADE SAS
#
# This file is part of Open CASCADE Technology software library.
#
# This library is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License version 2.1 as published
# by the Free Software Foundation, with special exception defined in the file
# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
# distribution for complete text of the license and disclaimer of any warranty.
#
# Alternatively, this file may be used under the terms of Open CASCADE
# commercial license or contractual agreement.
# =======================================================================
# This script defines Tcl command genproj generating project files for
# different IDEs and platforms. Run it with -help to get synopsis.
# =======================================================================
source [file join [file dirname [info script]] genconfdeps.tcl]
# the script is assumed to be run from CASROOT (or dependent Products root)
set path [file normalize .]
set THE_CASROOT ""
set fBranch ""
if { [info exists ::env(CASROOT)] } {
set THE_CASROOT [file normalize "$::env(CASROOT)"]
}
proc _get_options { platform type branch } {
set res ""
if {[file exists "$::THE_CASROOT/adm/CMPLRS"]} {
set fd [open "$::THE_CASROOT/adm/CMPLRS" rb]
set opts [split [read $fd] "\n"]
close $fd
foreach line $opts {
if {[regexp "^${platform} ${type} ${branch} (.+)$" $line dummy res]} {
while {[regexp {\(([^\(\)]+) ([^\(\)]+) ([^\(\)]+)\)(.+)} $res dummy p t b oldres]} {
set res "[_get_options $p $t $b] $oldres"
}
}
}
}
return $res
}
proc _get_type { name } {
set UDLIST {}
if {[file exists "$::path/adm/UDLIST"]} {
set fd [open "$::path/adm/UDLIST" rb]
set UDLIST [concat $UDLIST [split [read $fd] "\n"]]
close $fd
}
if { "$::path/adm/UDLIST" != "$::THE_CASROOT/adm/UDLIST" && [file exists "$::THE_CASROOT/adm/UDLIST"] } {
set fd [open "$::THE_CASROOT/adm/UDLIST" rb]
set UDLIST [concat $UDLIST [split [read $fd] "\n"]]
close $fd
}
foreach uitem $UDLIST {
set line [split $uitem]
if {[lindex $line 1] == "$name"} {
return [lindex $line 0]
}
}
return ""
}
proc _get_used_files { pk theSrcDir {inc true} {src true} } {
global path
set type [_get_type $pk]
set lret {}
set pk_path "$path/$theSrcDir/$pk"
set FILES_path "$path/$theSrcDir/$pk/FILES"
set FILES {}
if {[file exists $FILES_path]} {
set fd [open $FILES_path rb]
set FILES [split [read $fd] "\n"]
close $fd
}
set FILES [lsearch -inline -all -not -exact $FILES ""]
set index -1
foreach line $FILES {
incr index
if {$inc && ([regexp {([^:\s]*\.[hgl]xx)$} $line dummy name] || [regexp {([^:\s]*\.h)$} $line dummy name]) && [file exists $pk_path/$name]} {
lappend lret "pubinclude $name $pk_path/$name"
continue
}
if {[regexp {:} $line]} {
regexp {[^:]*:+([^\s]*)} $line dummy line
}
regexp {([^\s]*)} $line dummy line
if {$src && [file exists $pk_path/$line]} {
lappend lret "source $line $pk_path/$line"
}
}
return $lret
}
# return location of the path within source directory
proc osutils:findSrcSubPath {theSrcDir theSubPath} {
if {[file exists "$::path/$theSrcDir/$theSubPath"]} {
return "$::path/$theSrcDir/$theSubPath"
}
return "$::THE_CASROOT/$theSrcDir/$theSubPath"
}
# Auxiliary tool comparing content of two files line-by-line.
proc osutils:isEqualContent { theContent1 theContent2 } {
set aLen1 [llength $theContent1]
set aLen2 [llength $theContent2]
if { $aLen1 != $aLen2 } {
return false
}
for {set aLineIter 0} {$aLineIter < $aLen1} {incr aLineIter} {
set aLine1 [lindex $theContent1 $aLineIter]
set aLine2 [lindex $theContent2 $aLineIter]
if { $aLine1 != $aLine2 } {
return false
}
}
return true
}
# Auxiliary function for writing new file content only if it has been actually changed
# (e.g. to preserve file timestamp on no change).
# Useful for automatically (re)generated files.
proc osutils:writeTextFile { theFile theContent {theEol lf} {theToBackup false} } {
if {[file exists "${theFile}"]} {
set aFileOld [open "${theFile}" rb]
fconfigure $aFileOld -translation crlf
set aLineListOld [split [read $aFileOld] "\n"]
close $aFileOld
# append empty line for proper comparison (which will be implicitly added by last puts below)
set aContent $theContent
lappend aContent ""
if { [osutils:isEqualContent $aLineListOld $aContent] == true } {
return false
}
if { $theToBackup == true } {
puts "Warning: file ${theFile} is updated. Old content is saved to ${theFile}.bak"
file copy -force -- "${theFile}" "${theFile}.bak"
}
file delete -force "${theFile}"
}
set anOutFile [open "$theFile" "w"]
fconfigure $anOutFile -translation $theEol
foreach aLine ${theContent} {
puts $anOutFile "${aLine}"
}
close $anOutFile
return true
}
# Function re-generating header files for specified text resource
proc genResources { theSrcDir theResource } {
global path
set aResFileList {}
set aResourceAbsPath [file normalize "${path}/$theSrcDir/${theResource}"]
set aResourceDirectory ""
set isResDirectory false
if {[file isdirectory "${aResourceAbsPath}"]} {
if {[file exists "${aResourceAbsPath}/FILES"]} {
set aFilesFile [open "${aResourceAbsPath}/FILES" rb]
set aResFileList [split [read $aFilesFile] "\n"]
close $aFilesFile
}
set aResFileList [lsearch -inline -all -not -exact $aResFileList ""]
set aResourceDirectory "${theResource}"
set isResDirectory true
} else {
set aResourceName [file tail "${theResource}"]
lappend aResFileList "res:::${aResourceName}"
set aResourceDirectory [file dirname "${theResource}"]
}
foreach aResFileIter ${aResFileList} {
if {![regexp {^[^:]+:::(.+)} "${aResFileIter}" dump aResFileIter]} {
continue
}
set aResFileName [file tail "${aResFileIter}"]
regsub -all {\.} "${aResFileName}" {_} aResFileName
set aHeaderFileName "${aResourceDirectory}_${aResFileName}.pxx"
if { $isResDirectory == true && [lsearch $aResFileList $aHeaderFileName] == -1 } {
continue
}
# generate
set aContent {}
lappend aContent "// This file has been automatically generated from resource file $theSrcDir/${aResourceDirectory}/${aResFileIter}"
lappend aContent ""
# generate necessary structures
set aLineList {}
if {[file exists "${path}/$theSrcDir/${aResourceDirectory}/${aResFileIter}"]} {
set anInputFile [open "${path}/$theSrcDir/${aResourceDirectory}/${aResFileIter}" rb]
fconfigure $anInputFile -translation crlf
set aLineList [split [read $anInputFile] "\n"]
close $anInputFile
}
# drop empty trailing line
set anEndOfFile ""
if { [lindex $aLineList end] == "" } {
set aLineList [lreplace $aLineList end end]
set anEndOfFile "\\n"
}
lappend aContent "static const char ${aResourceDirectory}_${aResFileName}\[\] ="
set aNbLines [llength $aLineList]
set aLastLine [expr $aNbLines - 1]
for {set aLineIter 0} {$aLineIter < $aNbLines} {incr aLineIter} {
set aLine [lindex $aLineList $aLineIter]
regsub -all {\"} "${aLine}" {\\"} aLine
if { $aLineIter == $aLastLine } {
lappend aContent " \"${aLine}${anEndOfFile}\";"
} else {
lappend aContent " \"${aLine}\\n\""
}
}
# Save generated content to header file
set aHeaderFilePath "${path}/$theSrcDir/${aResourceDirectory}/${aHeaderFileName}"
if { [osutils:writeTextFile $aHeaderFilePath $aContent] == true } {
puts "Generating header file from resource file: ${path}/$theSrcDir/${aResourceDirectory}/${aResFileIter}"
} else {
#puts "Header file from resource ${path}/src/${aResourceDirectory}/${aResFileIter} is up-to-date"
}
}
}
# Function re-generating header files for all text resources
proc genAllResources { theSrcDir } {
global path
set aCasRoot [file normalize $path]
if {![file exists "$aCasRoot/adm/RESOURCES"]} {
puts "OCCT directory is not defined correctly: $aCasRoot"
return
}
set aFileResources [open "$aCasRoot/adm/RESOURCES" rb]
set anAdmResources [split [read $aFileResources] "\r\n"]
close $aFileResources
set anAdmResources [lsearch -inline -all -not -exact $anAdmResources ""]
foreach line $anAdmResources {
genResources $theSrcDir "${line}"
}
}
# Wrapper-function to generate VS project files
proc genproj {theFormat args} {
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vc143" "vclang" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false
# check format argument
if { $theFormat == "-h" || $theFormat == "-help" || $theFormat == "--help" } {
set isHelpRequire true
} elseif { [lsearch -exact $aSupportedFormats $theFormat] < 0 } {
puts "Error: genproj: unrecognized project format \"$theFormat\""
set isHelpRequire true
}
# choice of compiler for Code::Blocks, currently hard-coded
set aCmpl "gcc"
# Determine default platform: wnt for vc*, mac for xcd, current for cbp
if { [regexp "^vc" $theFormat] } {
set aPlatform "wnt"
} elseif { $theFormat == "xcd" || $::tcl_platform(os) == "Darwin" } {
set aPlatform "mac"
} elseif { $::tcl_platform(platform) == "windows" } {
set aPlatform "wnt"
} elseif { $::tcl_platform(platform) == "unix" } {
set aPlatform "lin"
}
# Check optional arguments
set aLibType "dynamic"
set aSolution "OCCT"
for {set anArgIter 0} {$anArgIter < [llength args]} {incr anArgIter} {
set arg [lindex $args $anArgIter]
if { $arg == "" } {
continue
} elseif { $arg == "-h" || $arg == "-help" || $arg == "--help" } {
set isHelpRequire true
} elseif { [lsearch -exact $aSupportedPlatforms $arg] >= 0 } {
set aPlatform $arg
} elseif { $arg == "-static" } {
set aLibType "static"
puts "Static build has been selected"
} elseif { $arg == "-dynamic" } {
set aLibType "dynamic"
puts "Dynamic build has been selected"
} elseif { $arg == "-solution" } {
incr anArgIter
set aSolution [lindex $args $anArgIter]
} else {
puts "Error: genproj: unrecognized option \"$arg\""
set isHelpRequire true
}
}
if { $isHelpRequire == true } {
puts "usage: genproj Format \[Platform\] \[-static\] \[-h|-help|--help\]
Format must be one of:
vc8 - Visual Studio 2005
vc9 - Visual Studio 2008
vc10 - Visual Studio 2010
vc11 - Visual Studio 2012
vc12 - Visual Studio 2013
vc14 - Visual Studio 2015
vc141 - Visual Studio 2017
vc142 - Visual Studio 2019
vc143 - Visual Studio 2022
vclang - Visual Studio with ClangCL toolset
cbp - CodeBlocks
xcd - XCode
pro - Qt Creator
Platform (optional):
wnt - Windows Desktop
uwp - Universal Windows Platform
lin - Linux
mac - OS X
ios - iOS
qnx - QNX
Option -static can be used with XCode to build static libraries
"
return
}
if { ! [info exists aPlatform] } {
puts "Error: genproj: Cannon identify default platform, please specify!"
return
}
puts "Preparing to generate $theFormat projects for $aPlatform platform..."
# base path to where to generate projects, hardcoded from current dir
set anAdmPath [file normalize "${::path}/adm"]
OS:MKPRC "$anAdmPath" "$theFormat" "$aLibType" "$aPlatform" "$aCmpl" "$aSolution"
genprojbat "$theFormat" "$aPlatform" "$aSolution"
genAllResources "src"
}
# copy file providing warning if the target file exists and has
# different date or size; if it is newer than source, save it as .bak
proc copy_with_warning {from to} {
if { [file exists "$to"] &&
([file size "$to"] != [file size "$from"] ||
[file mtime "$to"] != [file mtime "$from"]) } {
puts "Warning: file $to is updated (copied from $from)!"
if { [file mtime $to] > [file mtime $from] } {
puts "Info: old content of file $to is saved in ${to}.bak"
file copy -force -- "$to" "${to}.bak"
}
}
file copy -force -- "$from" "$to"
}
# Generate auxiliary scripts for launching IDE.
proc genprojbat {theFormat thePlatform theSolution} {
set aTargetPlatformExt sh
set aTargetEol lf
if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
set aTargetPlatformExt bat
set aTargetEol crlf
}
if { [file exists "$::path/src/OS/FoundationClasses.tcl"] || ![file exists "$::path/env.${aTargetPlatformExt}"] } {
# generate env.bat/sh
set anEnvTmplFilePath "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}"
set anEnvTmplFile [open "$anEnvTmplFilePath" "r"]
set anEnvTmpl [read $anEnvTmplFile]
close $anEnvTmplFile
set aCasRoot ""
if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
}
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
set aLineList [split $anEnvTmpl "\n"]
osutils:writeTextFile "$::path/env.${aTargetPlatformExt}" $aLineList $aTargetEol true
copy_with_warning "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
if { "$::BUILD_Inspector" == "true" } {
copy_with_warning "$::THE_CASROOT/adm/templates/inspector.${aTargetPlatformExt}" "$::path/inspector.${aTargetPlatformExt}"
}
}
set aSolShList ""
if { [regexp {^vc} $theFormat] } {
set aSolShList "msvc.bat"
} else {
switch -exact -- "$theFormat" {
"cbp" {
set aSolShList { "codeblocks.sh" "codeblocks.bat" }
# Code::Blocks 16.01 does not create directory for import libs, help him
set aPlatformAndCompiler "${thePlatform}/gcc"
if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
set aPlatformAndCompiler "${thePlatform}/clang"
}
file mkdir "$::path/${aPlatformAndCompiler}/lib"
file mkdir "$::path/${aPlatformAndCompiler}/libd"
}
"xcd" { set aSolShList "xcode.sh" }
}
}
foreach aSolSh $aSolShList {
set anShFile [open "$::THE_CASROOT/adm/templates/${aSolSh}" "r"]
set anShTmpl [read $anShFile]
close $anShFile
regsub -all -- {__SOLUTION__} $anShTmpl "$theSolution" anShTmpl
set anShFile [open "$::path/${aSolSh}" "w"]
puts $anShFile $anShTmpl
close $anShFile
}
}
###### MSVC #############################################################33
proc removeAllOccurrencesOf { theObject theList } {
set aSortIndices [lsort -decreasing [lsearch -all -nocase $theList $theObject]]
foreach anIndex $aSortIndices {
set theList [lreplace $theList $anIndex $anIndex]
}
return $theList
}
set aTKNullKey "TKNull"
set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
# Entry function to generate project files
# @param theOutDir Root directory for project files
# @param theFormat Project format name (vc.. for Visual Studio projects, cbp for Code::Blocks, xcd for XCode)
# @param theLibType Library type - dynamic or static
# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS
# @param theCmpl Compiler option (msvc or gcc)
# @param theSolution Solution name
proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution } {
global path
set anOutRoot $theOutDir
if { $anOutRoot == "" } {
error "Error : \"theOutDir\" is not initialized"
}
# Create output directory
set aWokStation "$thePlatform"
if { [regexp {^vc} $theFormat] } {
set aWokStation "msvc"
}
set aSuffix ""
set isUWP 0
if { $thePlatform == "uwp" } {
set aSuffix "-uwp"
set isUWP 1
}
set anOutDir "${anOutRoot}/${aWokStation}/${theFormat}${aSuffix}"
# read map of already generated GUIDs
set aGuidsFilePath [file join $anOutDir "wok_${theFormat}_guids.txt"]
if [file exists "$aGuidsFilePath"] {
set aFileIn [open "$aGuidsFilePath" r]
set aFileDataRaw [read $aFileIn]
close $aFileIn
set aFileData [split $aFileDataRaw "\n"]
foreach aLine $aFileData {
set aLineSplt [split $aLine "="]
if { [llength $aLineSplt] == 2 } {
set ::THE_GUIDS_LIST([lindex $aLineSplt 0]) [lindex $aLineSplt 1]
}
}
}
# make list of modules and platforms
set aModules [OS:init OS Modules]
if { [llength $aModules] == 0 } {
set aModules [OS:init VAS Products]
}
if { "$thePlatform" == "ios" } {
set goaway [list Draw]
set aModules [osutils:juststation $goaway $aModules]
}
# Draw module is turned off due to it is not supported on UWP
if { $isUWP } {
set aDrawIndex [lsearch -exact ${aModules} "Draw"]
if { ${aDrawIndex} != -1 } {
set aModules [lreplace ${aModules} ${aDrawIndex} ${aDrawIndex}]
}
}
# create the out dir if it does not exist
if (![file isdirectory $path/inc]) {
puts "$path/inc folder does not exists and will be created"
wokUtils:FILES:mkdir $path/inc
}
# collect all required header files
puts "Collecting required header files into $path/inc ..."
osutils:collectinc $aModules "src" $path/inc
# make list of Inspector tools
set aTools {}
if { "$::BUILD_Inspector" == "true" } {
set aTools [OS:init OS Tools]
if { [llength $aTools] == 0 } {
set aTools [OS:init VAS Tools]
}
# create the out dir if it does not exist
if (![file isdirectory $path/inc/inspector]) {
puts "$path/inc/inspector folder does not exists and will be created"
wokUtils:FILES:mkdir $path/inc/inspector
}
# collect all required header files
puts "Collecting required tools header files into $path/inc/inspector ..."
osutils:collectinc $aTools "tools" $path/inc/inspector
}
if { "$theFormat" == "pro" } {
return
}
wokUtils:FILES:mkdir $anOutDir
if { ![file exists $anOutDir] } {
puts stderr "Error: Could not create output directory \"$anOutDir\""
return
}
# Generating project files for the selected format
switch -exact -- "$theFormat" {
"vc7" -
"vc8" -
"vc9" -
"vc10" -
"vc11" -
"vc12" -
"vc14" -
"vc141" -
"vc142" -
"vc143" -
"vclang" { OS:MKVC $anOutDir $aModules $aTools $theSolution $theFormat $isUWP}
"cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $theSolution $theLibType $thePlatform
}
}
# Store generated GUIDs map
set anOutFile [open "$aGuidsFilePath" "w"]
fconfigure $anOutFile -translation lf
foreach aKey [array names ::THE_GUIDS_LIST] {
set aValue $::THE_GUIDS_LIST($aKey)
puts $anOutFile "${aKey}=${aValue}"
}
close $anOutFile
}
# Function to generate Visual Studio solution and project files
proc OS:MKVC { theOutDir theModules theTools theAllSolution theVcVer isUWP } {
puts stderr "Generating VS project files for $theVcVer"
# generate projects for toolkits and separate solution for each module
foreach aModule $theModules {
OS:vcsolution $theVcVer $aModule $aModule $theOutDir ::THE_GUIDS_LIST "src" "" ""
OS:vcproj $theVcVer $isUWP $aModule $theOutDir ::THE_GUIDS_LIST "src" ""
}
# generate projects for toolkits and separate solution for each tool
foreach aTool $theTools {
OS:vcsolution $theVcVer $aTool $aTool $theOutDir ::THE_GUIDS_LIST "tools" "" "src"
OS:vcproj $theVcVer $isUWP $aTool $theOutDir ::THE_GUIDS_LIST "tools" "src"
}
# generate single solution "OCCT" containing projects from all modules
if { "$theAllSolution" != "" } {
OS:vcsolution $theVcVer $theAllSolution $theModules $theOutDir ::THE_GUIDS_LIST "src" $theTools "tools"
}
puts "The Visual Studio solution and project files are stored in the $theOutDir directory"
}
proc OS:init {theVas theNameOfDefFile {os {}}} {
set askplat $os
set aModules {}
if { "$os" == "" } {
set os $::tcl_platform(os)
}
if { ![file exists "$::path/src/${theVas}/${theNameOfDefFile}.tcl"]} {
return $aModules
}
# Load list of OCCT modules and their definitions
source "$::path/src/${theVas}/${theNameOfDefFile}.tcl"
foreach aModuleIter [${theVas}:${theNameOfDefFile}] {
set aFileTcl "$::path/src/${theVas}/${aModuleIter}.tcl"
if [file exists $aFileTcl] {
source $aFileTcl
lappend aModules $aModuleIter
} else {
puts stderr "Definition file for $aModuleIter is not found in unit ${theVas}"
}
}
return $aModules
}
# topological sort. returns a list { {a h} {b g} {c f} {c h} {d i} } => { d a b c i g f h }
proc wokUtils:EASY:tsort { listofpairs } {
foreach x $listofpairs {
set e1 [lindex $x 0]
set e2 [lindex $x 1]
if ![info exists pcnt($e1)] {
set pcnt($e1) 0
}
if ![ info exists pcnt($e2)] {
set pcnt($e2) 1
} else {
incr pcnt($e2)
}
if ![info exists scnt($e1)] {
set scnt($e1) 1
} else {
incr scnt($e1)
}
set l {}
if [info exists slist($e1)] {
set l $slist($e1)
}
lappend l $e2
set slist($e1) $l
}
set nodecnt 0
set back 0
foreach node [array names pcnt] {
incr nodecnt
if { $pcnt($node) == 0 } {
incr back
set q($back) $node
}
if ![info exists scnt($node)] {
set scnt($node) 0
}
}
set res {}
for {set front 1} { $front <= $back } { incr front } {
lappend res [set node $q($front)]
for {set i 1} {$i <= $scnt($node) } { incr i } {
set ll $slist($node)
set j [expr {$i - 1}]
set u [expr { $pcnt([lindex $ll $j]) - 1 }]
if { [set pcnt([lindex $ll $j]) $u] == 0 } {
incr back
set q($back) [lindex $ll $j]
}
}
}
if { $back != $nodecnt } {
puts stderr "input contains a cycle"
return {}
} else {
return $res
}
}
proc wokUtils:LIST:Purge { l } {
set r {}
foreach e $l {
if ![info exist tab($e)] {
lappend r $e
set tab($e) {}
}
}
return $r
}
# Read file pointed to by path
# 1. sort = 1 tri
# 2. trim = 1 plusieurs blancs => 1 seul blanc
# 3. purge= not yet implemented.
# 4. emptl= dont process blank lines
proc wokUtils:FILES:FileToList { path {sort 0} {trim 0} {purge 0} {emptl 1} } {
if ![ catch { set id [ open $path r ] } ] {
set l {}
while {[gets $id line] >= 0 } {
if { $trim } {
regsub -all {[ ]+} $line " " line
}
if { $emptl } {
if { [string length ${line}] != 0 } {
lappend l $line
}
} else {
lappend l $line
}
}
close $id
if { $sort } {
return [lsort $l]
} else {
return $l
}
} else {
return {}
}
}
# retorn the list of executables in module.
proc OS:executable { module } {
set lret {}
foreach XXX [${module}:ressources] {
if { "[lindex $XXX 1]" == "x" } {
lappend lret [lindex $XXX 2]
}
}
return $lret
}
# Topological sort of toolkits in tklm
proc osutils:tk:sort { tklm theSrcDir theSourceDirOther } {
set tkby2 {}
foreach tkloc $tklm {
set lprg [wokUtils:LIST:Purge [osutils:tk:close $tkloc $theSrcDir $theSourceDirOther]]
foreach tkx $lprg {
if { [lsearch $tklm $tkx] != -1 } {
lappend tkby2 [list $tkx $tkloc]
} else {
lappend tkby2 [list $tkloc {}]
}
}
}
set lret {}
foreach e [wokUtils:EASY:tsort $tkby2] {
if { $e != {} } {
lappend lret $e
}
}
return $lret
}
# close dependencies of ltk. (full work paths of toolkits)
# The CURRENT WOK LOCATION MUST contains ALL TOOLKITS required.
# (locate not performed.)
proc osutils:tk:close { ltk theSrcDir theSourceDirOther } {
set result {}
set recurse {}
foreach dir $ltk {
set ids [LibToLink $dir $theSrcDir $theSourceDirOther]
# puts "osutils:tk:close($ltk) ids='$ids'"
set eated [osutils:tk:eatpk $ids]
set result [concat $result $eated]
set ids [LibToLink $dir $theSrcDir $theSourceDirOther]
set result [concat $result $ids]
foreach file $eated {
set kds [osutils:findSrcSubPath $theSrcDir "$file/EXTERNLIB"]
if { [osutils:tk:eatpk $kds] != {} } {
lappend recurse $file
}
}
}
if { $recurse != {} } {
set result [concat $result [osutils:tk:close $recurse $theSrcDir $theSourceDirOther]]
}
return $result
}
proc osutils:tk:eatpk { EXTERNLIB } {
set l [wokUtils:FILES:FileToList $EXTERNLIB]
set lret {}
foreach str $l {
if ![regexp -- {(CSF_[^ ]*)} $str csf] {
lappend lret $str
}
}
return $lret
}
# Define libraries to link using only EXTERNLIB file
proc LibToLink {theTKit theSrcDir theSourceDirOther} {
regexp {^.*:([^:]+)$} $theTKit dummy theTKit
set type [_get_type $theTKit]
if {$type != "t" && $type != "x"} {
return
}
set aToolkits {}
set anExtLibList [osutils:tk:eatpk [osutils:findSrcSubPath $theSrcDir "$theTKit/EXTERNLIB"]]
foreach anExtLib $anExtLibList {
set aFullPath [LocateRecur $anExtLib $theSrcDir]
if { "$aFullPath" == "" && "$theSourceDirOther" != "" } {
set aFullPath [LocateRecur $anExtLib $theSourceDirOther]
}
if { "$aFullPath" != "" && [_get_type $anExtLib] == "t" } {
lappend aToolkits $anExtLib
}
}
return $aToolkits
}
# Search unit recursively
proc LocateRecur {theName theSrcDir} {
set theNamePath [osutils:findSrcSubPath $theSrcDir "$theName"]
if {[file isdirectory $theNamePath]} {
return $theNamePath
}
return ""
}
proc OS:genGUID { {theFormat "vc"} } {
if { "$theFormat" == "vc" } {
set p1 "[format %07X [expr { int(rand() * 268435456) }]][format %X [expr { int(rand() * 16) }]]"
set p2 "[format %04X [expr { int(rand() * 6536) }]]"
set p3 "[format %04X [expr { int(rand() * 6536) }]]"
set p4 "[format %04X [expr { int(rand() * 6536) }]]"
set p5 "[format %06X [expr { int(rand() * 16777216) }]][format %06X [expr { int(rand() * 16777216) }]]"
return "{$p1-$p2-$p3-$p4-$p5}"
} else {
set p1 "[format %04X [expr { int(rand() * 6536) }]]"
set p2 "[format %04X [expr { int(rand() * 6536) }]]"
set p3 "[format %04X [expr { int(rand() * 6536) }]]"
set p4 "[format %04X [expr { int(rand() * 6536) }]]"
set p5 "[format %04X [expr { int(rand() * 6536) }]]"
set p6 "[format %04X [expr { int(rand() * 6536) }]]"
return "$p1$p2$p3$p4$p5$p6"
}
}
# collect all include file that required for theModules in theOutDir
proc osutils:collectinc {theModules theSrcDir theIncPath} {
global path
set aCasRoot [file normalize $path]
set anIncPath [file normalize $theIncPath]
if {![file isdirectory $aCasRoot]} {
puts "OCCT directory is not defined correctly: $aCasRoot"
return
}
set anUsedToolKits {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
lappend anUsedToolKits $aToolKit
foreach aDependency [LibToLink $aToolKit $theSrcDir ""] {
lappend anUsedToolKits $aDependency
}
}
foreach anExecutable [OS:executable ${aModule}] {
lappend anUsedToolKits $anExecutable
foreach aDependency [LibToLink $anExecutable $theSrcDir ""] {
lappend anUsedToolKits $aDependency
}
}
}
set anUsedToolKits [lsort -unique $anUsedToolKits]
set anUnits {}
foreach anUsedToolKit $anUsedToolKits {
set anUnits [concat $anUnits [osutils:tk:units $anUsedToolKit $theSrcDir] ]
}
set anUnits [lsort -unique $anUnits]
# define copying style
set aCopyType "copy"
if { [info exists ::env(SHORTCUT_HEADERS)] } {
if { [string equal -nocase $::env(SHORTCUT_HEADERS) "hard"]
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "hardlink"] } {
set aCopyType "hardlink"
} elseif { [string equal -nocase $::env(SHORTCUT_HEADERS) "true"]
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "shortcut"] } {
set aCopyType "shortcut"
}
}
set allHeaderFiles {}
if { $aCopyType == "shortcut" } {
# template preparation
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
return
}
set aHeaderTmpl [wokUtils:FILES:FileToString $::THE_CASROOT/adm/templates/header.in]
# relative anIncPath in connection with aCasRoot/$theSrcDir
set aFromBuildIncToSrcPath [relativePath "$anIncPath" "$aCasRoot/$theSrcDir"]
# create and copy shortcut header files
foreach anUnit $anUnits {
osutils:checksrcfiles ${anUnit} $theSrcDir
set aHFiles [_get_used_files ${anUnit} $theSrcDir true false]
foreach aHeaderFile ${aHFiles} {
set aHeaderFileName [lindex ${aHeaderFile} 1]
lappend allHeaderFiles "${aHeaderFileName}"
regsub -all -- {@OCCT_HEADER_FILE_CONTENT@} $aHeaderTmpl "#include \"$aFromBuildIncToSrcPath/$anUnit/$aHeaderFileName\"" aShortCutHeaderFileContent
if {[file exists "$theIncPath/$aHeaderFileName"] && [file readable "$theIncPath/$aHeaderFileName"]} {
set fp [open "$theIncPath/$aHeaderFileName" r]
set aHeaderContent [read $fp]
close $fp
# minus eof
set aHeaderLenght [expr [string length $aHeaderContent] - 1]
if {$aHeaderLenght == [string length $aShortCutHeaderFileContent]} {
# remove eof from string
set aHeaderContent [string range $aHeaderContent 0 [expr $aHeaderLenght - 1]]
if {[string compare $aShortCutHeaderFileContent $aHeaderContent] == 0} {
continue
}
}
file delete -force "$theIncPath/$aHeaderFileName"
}
set aShortCutHeaderFile [open "$theIncPath/$aHeaderFileName" "w"]
fconfigure $aShortCutHeaderFile -translation lf
puts $aShortCutHeaderFile $aShortCutHeaderFileContent
close $aShortCutHeaderFile
}
}
} else {
set nbcopied 0
foreach anUnit $anUnits {
osutils:checksrcfiles ${anUnit} $theSrcDir
set aHFiles [_get_used_files ${anUnit} $theSrcDir true false]
foreach aHeaderFile ${aHFiles} {
set aHeaderFileName [lindex ${aHeaderFile} 1]
lappend allHeaderFiles "${aHeaderFileName}"
# copy file only if target does not exist or is older than original
set torig [file mtime $aCasRoot/$theSrcDir/$anUnit/$aHeaderFileName]
set tcopy 0
if { [file isfile $anIncPath/$aHeaderFileName] } {
set tcopy [file mtime $anIncPath/$aHeaderFileName]
}
if { $tcopy < $torig } {
incr nbcopied
if { $aCopyType == "hardlink" } {
if { $tcopy != 0 } {
file delete -force "$theIncPath/$aHeaderFileName"
}
file link -hard $anIncPath/$aHeaderFileName $aCasRoot/$theSrcDir/$anUnit/$aHeaderFileName
} else {
file copy -force $aCasRoot/$theSrcDir/$anUnit/$aHeaderFileName $anIncPath/$aHeaderFileName
}
} elseif { $tcopy != $torig } {
puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aCasRoot/$theSrcDir/$anUnit/$aHeaderFileName, not changed!"
}
}
}
puts "Info: $nbcopied files updated"
}
# remove header files not listed in FILES
set anIncFiles [glob -tails -nocomplain -dir ${anIncPath} "*"]
foreach anIncFile ${anIncFiles} {
if { [lsearch -exact ${allHeaderFiles} ${anIncFile}] == -1 } {
puts "Warning: file ${anIncPath}/${anIncFile} is not present in the sources and will be removed from ${theIncPath}"
file delete -force "${theIncPath}/${anIncFile}"
}
}
}
# Generate header for VS solution file
proc osutils:vcsolution:header { vcversion } {
if { "$vcversion" == "vc7" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 8.00\n"
} elseif { "$vcversion" == "vc8" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 9.00\n" \
"# Visual Studio 2005\n"
} elseif { "$vcversion" == "vc9" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 10.00\n" \
"# Visual Studio 2008\n"
} elseif { "$vcversion" == "vc10" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 11.00\n" \
"# Visual Studio 2010\n"
} elseif { "$vcversion" == "vc11" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2012\n"
} elseif { "$vcversion" == "vc12" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n"
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
"$vcversion" == "vc142" || "$vcversion" == "vc143" || "$vcversion" == "vclang" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n"
} else {
puts stderr "Error: Visual Studio version $vcversion is not supported by this function!"
}
return $var
}
# Returns extension (without dot) for project files of given version of VC
proc osutils:vcproj:ext { vcversion } {
if { "$vcversion" == "vc7" || "$vcversion" == "vc8" || "$vcversion" == "vc9" } {
return "vcproj"
} else {
return "vcxproj"
}
}
# Generate start of configuration section of VS solution file
proc osutils:vcsolution:config:begin { vcversion } {
if { "$vcversion" == "vc7" } {
append var \
"Global\n" \
"\tGlobalSection(SolutionConfiguration) = preSolution\n" \
"\t\tDebug = Debug\n" \
"\t\tRelease = Release\n" \
"\tEndGlobalSection\n" \
"\tGlobalSection(ProjectConfiguration) = postSolution\n"
} else {
append var \
"Global\n" \
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" \
"\t\tDebug|Win32 = Debug|Win32\n" \
"\t\tRelease|Win32 = Release|Win32\n" \
"\t\tDebug|x64 = Debug|x64\n" \
"\t\tRelease|x64 = Release|x64\n" \
"\tEndGlobalSection\n" \
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n"
}
return $var
}
# Generate part of configuration section of VS solution file describing one project
proc osutils:vcsolution:config:project { vcversion guid } {
if { "$vcversion" == "vc7" } {
append var \
"\t\t$guid.Debug.ActiveCfg = Debug|Win32\n" \
"\t\t$guid.Debug.Build.0 = Debug|Win32\n" \
"\t\t$guid.Release.ActiveCfg = Release|Win32\n" \
"\t\t$guid.Release.Build.0 = Release|Win32\n"
} else {
append var \
"\t\t$guid.Debug|Win32.ActiveCfg = Debug|Win32\n" \
"\t\t$guid.Debug|Win32.Build.0 = Debug|Win32\n" \
"\t\t$guid.Release|Win32.ActiveCfg = Release|Win32\n" \
"\t\t$guid.Release|Win32.Build.0 = Release|Win32\n" \
"\t\t$guid.Debug|x64.ActiveCfg = Debug|x64\n" \
"\t\t$guid.Debug|x64.Build.0 = Debug|x64\n" \
"\t\t$guid.Release|x64.ActiveCfg = Release|x64\n" \
"\t\t$guid.Release|x64.Build.0 = Release|x64\n"
}
return $var
}
# Generate start of configuration section of VS solution file
proc osutils:vcsolution:config:end { vcversion } {
if { "$vcversion" == "vc7" } {
append var \
"\tEndGlobalSection\n" \
"\tGlobalSection(ExtensibilityGlobals) = postSolution\n" \
"\tEndGlobalSection\n" \
"\tGlobalSection(ExtensibilityAddIns) = postSolution\n" \
"\tEndGlobalSection\n"
} else {
append var \
"\tEndGlobalSection\n" \
"\tGlobalSection(SolutionProperties) = preSolution\n" \
"\t\tHideSolutionNode = FALSE\n" \
"\tEndGlobalSection\n"
}
return $var
}
# generate Visual Studio solution file
# if module is empty, generates one solution for all known modules
proc OS:vcsolution { theVcVer theSolName theModules theOutDir theGuidsMap theSrcDir theModulesOther theSourceDirOther } {
global path
upvar $theGuidsMap aGuidsMap
# collect list of projects to be created
set aProjects {}
set aDependencies {}
osutils:convertModules $theModules $theSrcDir $theSourceDirOther aProjects aProjectsInModule aDependencies
osutils:convertModules $theModulesOther $theSourceDirOther $theSrcDir aProjects aProjectsInModule aDependencies
# generate GUIDs for projects (unless already known)
foreach aProject $aProjects {
if { ! [info exists aGuidsMap($aProject)] } {
set aGuidsMap($aProject) [OS:genGUID]
}
}
# generate solution file
# puts "Generating Visual Studio ($theVcVer) solution file for $theSolName ($aProjects)"
append aFileBuff [osutils:vcsolution:header $theVcVer]
# GUID identifying group projects in Visual Studio
set VC_GROUP_GUID "{2150E333-8FDC-42A3-9474-1A3956D46DE8}"
# generate group projects -- one per module
if { "$theVcVer" != "vc7" && [llength "$theModules"] > 1 } {
foreach aModule $theModules {
if { ! [info exists aGuidsMap(_$aModule)] } {
set aGuidsMap(_$aModule) [OS:genGUID]
}
set aGuid $aGuidsMap(_$aModule)
append aFileBuff "Project(\"${VC_GROUP_GUID}\") = \"$aModule\", \"$aModule\", \"$aGuid\"\nEndProject\n"
}
}
if { "$theVcVer" != "vc7" && [llength "$theModulesOther"] > 1 } {
set aModule "Tools"
if { ! [info exists aGuidsMap(_$aModule)] } {
set aGuidsMap(_$aModule) [OS:genGUID]
}
set aGuid $aGuidsMap(_$aModule)
append aFileBuff "Project(\"${VC_GROUP_GUID}\") = \"$aModule\", \"$aModule\", \"$aGuid\"\nEndProject\n"
}
# extension of project files
set aProjExt [osutils:vcproj:ext $theVcVer]
# GUID identifying C++ projects in Visual Studio
set VC_CPP_GUID "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
# generate normal projects
set aProjsNb [llength $aProjects]
for {set aProjId 0} {$aProjId < $aProjsNb} {incr aProjId} {
set aProj [lindex $aProjects $aProjId]
set aGuid $aGuidsMap($aProj)
append aFileBuff "Project(\"${VC_CPP_GUID}\") = \"$aProj\", \"$aProj.${aProjExt}\", \"$aGuid\"\n"
# write projects dependencies information (vc7 to vc9)
set aDepGuids ""
foreach aDepLib [lindex $aDependencies $aProjId] {
if { $aDepLib != $aProj && [lsearch $aProjects $aDepLib] != "-1" } {
set depGUID $aGuidsMap($aDepLib)
append aDepGuids "\t\t$depGUID = $depGUID\n"
}
}
if { "$aDepGuids" != "" } {
append aFileBuff "\tProjectSection(ProjectDependencies) = postProject\n"
append aFileBuff "$aDepGuids"
append aFileBuff "\tEndProjectSection\n"
}
append aFileBuff "EndProject\n"
}
# generate configuration section
append aFileBuff [osutils:vcsolution:config:begin $theVcVer]
foreach aProj $aProjects {
append aFileBuff [osutils:vcsolution:config:project $theVcVer $aGuidsMap($aProj)]
}
append aFileBuff [osutils:vcsolution:config:end $theVcVer]
# write information of grouping of projects by module
if { "$theVcVer" != "vc7" && [llength "$theModules"] > 1 } {
append aFileBuff " GlobalSection(NestedProjects) = preSolution\n"
foreach aModule $theModules {
if { ! [info exists aProjectsInModule($aModule)] } { continue }
foreach aProject $aProjectsInModule($aModule) {
append aFileBuff " $aGuidsMap($aProject) = $aGuidsMap(_$aModule)\n"
}
}
set aToolsName "Tools"
foreach aModule $theModulesOther {
if { ! [info exists aProjectsInModule($aModule)] } { continue }
foreach aProject $aProjectsInModule($aModule) {
append aFileBuff " $aGuidsMap($aProject) = $aGuidsMap(_$aToolsName)\n"
}
}
append aFileBuff " EndGlobalSection\n"
}
# final word (footer)
append aFileBuff "EndGlobal"
# write solution
set aFile [open [set fdsw [file join $theOutDir ${theSolName}.sln]] w]
fconfigure $aFile -translation crlf
puts $aFile $aFileBuff
close $aFile
return [file join $theOutDir ${theSolName}.sln]
}
# Generate auxiliary containers with information about modules.
# @param theModules List of modules
# @param theSrcDir Directory of module toolkits
# @param theSourceDirOther Directory with other additional sources to find out toolkits in dependencies
# @param theProjects list of all found projects/toolkits
# @param theProjectsInModule map of module into toolkits/projects
# @param theDependencies list of the project dependencies. To find the project dependencies, get it by the index in project container
proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects theProjectsInModule theDependencies } {
global path
upvar $theProjectsInModule aProjectsInModule
upvar $theProjects aProjects
upvar $theDependencies aDependencies
foreach aModule $theModules {
# toolkits
foreach aToolKit [osutils:tk:sort [${aModule}:toolkits] $theSrcDir $theSourceDirOther] {
lappend aProjects $aToolKit
lappend aProjectsInModule($aModule) $aToolKit
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
}
# executables
foreach aUnit [OS:executable ${aModule}] {
lappend aProjects $aUnit
lappend aProjectsInModule($aModule) $aUnit
lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
}
}
}
# Generate Visual Studio projects for specified version
proc OS:vcproj { theVcVer isUWP theModules theOutDir theGuidsMap theSrcDir theSourceDirOther } {
upvar $theGuidsMap aGuidsMap
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
lappend aProjectFiles [osutils:vcproj $theVcVer $isUWP $theOutDir $aToolKit aGuidsMap $theSrcDir $theSourceDirOther]
}
foreach anExecutable [OS:executable ${aModule}] {
lappend aProjectFiles [osutils:vcprojx $theVcVer $isUWP $theOutDir $anExecutable aGuidsMap $theSrcDir $theSourceDirOther]
}
}
return $aProjectFiles
}
# generate template name and load it for given version of Visual Studio and platform
proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
set anExt $theVcVer
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set anExt vc10
}
# determine versions of runtime and toolset
set aVCRTVer $theVcVer
set aToolset "v[string range $theVcVer 2 3]0"
if { $theVcVer == "vc141" } {
set aVCRTVer "vc14"
set aToolset "v141"
} elseif { $theVcVer == "vc142" } {
set aVCRTVer "vc14"
set aToolset "v142"
} elseif { $theVcVer == "vc143" } {
set aVCRTVer "vc14"
set aToolset "v143"
} elseif { $theVcVer == "vclang" } {
set aVCRTVer "vc14"
set aToolset "ClangCL"
}
set what "$theVcVer"
set aCmpl32 ""
set aCmpl64 ""
set aCharSet "Unicode"
if { $isExec } {
set anExt "${anExt}x"
set what "$what executable"
}
if { "$theVcVer" == "vc10" } {
# SSE2 is enabled by default in vc11+, but not in vc10 for 32-bit target
set aCmpl32 "<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>"
}
set aTmpl [osutils:readtemplate $anExt "MS VC++ project ($what)"]
if { $isUWP } {
set UwpWinRt "<CompileAsWinRT>false</CompileAsWinRT>"
foreach bitness {32 64} {
set indent ""
if {"[set aCmpl${bitness}]" != ""} {
set indent "\n "
}
set aCmpl${bitness} "[set aCmpl${bitness}]${indent}${UwpWinRt}"
}
}
set format_template "\[\\r\\n\\s\]*"
foreach bitness {32 64} {
set format_templateloc ""
if {"[set aCmpl${bitness}]" == ""} {
set format_templateloc "$format_template"
}
regsub -all -- "${format_templateloc}__VCMPL${bitness}__" $aTmpl "[set aCmpl${bitness}]" aTmpl
}
set aDebugInfo "no"
set aReleaseLnk ""
if { "$::HAVE_RelWithDebInfo" == "true" } {
set aDebugInfo "true"
set aReleaseLnk "\n <OptimizeReferences>true</OptimizeReferences>\n <EnableCOMDATFolding>true</EnableCOMDATFolding>"
}
regsub -all -- {__VCVER__} $aTmpl $aVCRTVer aTmpl
regsub -all -- {__VCVEREXT__} $aTmpl $aToolset aTmpl
regsub -all -- {__VCCHARSET__} $aTmpl $aCharSet aTmpl
regsub -all -- {__VCReleasePDB__} $aTmpl $aDebugInfo aTmpl
regsub -all -- "${format_template}__VCLNKREL__" $aTmpl "${aReleaseLnk}" aTmpl
return $aTmpl
}
proc osutils:readtemplate {ext what} {
set loc "$::THE_CASROOT/adm/templates/template.$ext"
return [wokUtils:FILES:FileToString $loc]
}
# Read a file in a string as is.
proc wokUtils:FILES:FileToString { fin } {
if { [catch { set in [ open $fin r ] } errin] == 0 } {
set strin [read $in [file size $fin]]
close $in
return $strin
} else {
return {}
}
}
# List extensions of compilable files in OCCT
proc osutils:compilable {thePlatform} {
if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } { return [list .c .cxx .cpp .mm] }
return [list .c .cxx .cpp]
}
# List extensions of header file in OCCT
proc osutils:fileExtensionsHeaders {thePlatform} {
if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } { return [list .h .hxx .hpp .lxx .pxx .gxx ] }
return [list .h .hxx .hpp .lxx .pxx .gxx .mm ]
}
# List extensions of Qt resource file in OCCT
proc osutils:fileExtensionsResources {thePlatform} {
return [list .qrc ]
}
proc osutils:commonUsedTK { theToolKit theSrcDir theSourceDirOther} {
set anUsedToolKits [list]
set aDepToolkits [LibToLink $theToolKit $theSrcDir $theSourceDirOther]
foreach tkx $aDepToolkits {
if {[_get_type $tkx] == "t"} {
lappend anUsedToolKits "${tkx}"
}
}
return $anUsedToolKits
}
# Return the list of name *CSF_ in a EXTERNLIB description of a toolkit
proc osutils:tk:csfInExternlib { EXTERNLIB } {
set l [wokUtils:FILES:FileToList $EXTERNLIB]
set lret {STLPort}
foreach str $l {
if [regexp -- {(CSF_[^ ]*)} $str csf] {
lappend lret $csf
}
}
return $lret
}
# Collect dependencies map depending on target OS (libraries for CSF_ codenames used in EXTERNLIB) .
# @param theOS - target OS
# @param theCsfLibsMap - libraries map
# @param theCsfFrmsMap - frameworks map, OS X specific
proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
upvar $theCsfLibsMap aLibsMap
upvar $theCsfFrmsMap aFrmsMap
unset theCsfLibsMap
unset theCsfFrmsMap
if { "$::HAVE_FREETYPE" == "true" } {
set aLibsMap(CSF_FREETYPE) "freetype"
}
set aLibsMap(CSF_TclLibs) "tcl8.6"
if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk8.6"
}
if { "$::HAVE_FREEIMAGE" == "true" } {
if { "$theOS" == "wnt" } {
set aLibsMap(CSF_FreeImagePlus) "FreeImage"
} else {
set aLibsMap(CSF_FreeImagePlus) "freeimage"
}
} elseif { "$theOS" == "wnt" } {
set aLibsMap(CSF_FreeImagePlus) "windowscodecs"
}
if { "$::HAVE_FFMPEG" == "true" } {
set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
}
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
}
if { "$::HAVE_VTK" == "true" } {
if { "$theOS" == "wnt" } {
set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
} else {
set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
}
}
if { "$::HAVE_ZLIB" == "true" } {
set aLibsMap(CSF_ZLIB) "z"
}
if { "$::HAVE_LIBLZMA" == "true" } {
set aLibsMap(CSF_LIBLZMA) "liblzma"
}
if { "$::HAVE_DRACO" == "true" } {
set aLibsMap(CSF_Draco) "draco"
}
if { "$::HAVE_OPENVR" == "true" } {
set aLibsMap(CSF_OpenVR) "openvr_api"
}
if { "$::HAVE_E57" == "true" && "$theOS" != "wnt" } {
# exclude wnt, as there are different pragma lib depending on debug/release
set aLibsMap(CSF_E57) "E57RefImpl"
set aLibsMap(CSF_xerces) "xerces-c"
}
if { "$theOS" == "wnt" } {
# WinAPI libraries
set aLibsMap(CSF_kernel32) "kernel32"
set aLibsMap(CSF_advapi32) "advapi32"
set aLibsMap(CSF_gdi32) "gdi32"
set aLibsMap(CSF_user32) "user32 comdlg32"
set aLibsMap(CSF_shell32) "shell32"
set aLibsMap(CSF_opengl32) "opengl32"
set aLibsMap(CSF_wsock32) "wsock32"
set aLibsMap(CSF_netapi32) "netapi32"
set aLibsMap(CSF_winmm) "winmm"
set aLibsMap(CSF_OpenGlLibs) "opengl32"
set aLibsMap(CSF_OpenGlesLibs) "libEGL libGLESv2"
set aLibsMap(CSF_psapi) "Psapi"
set aLibsMap(CSF_d3d9) "d3d9"
# the naming is different on Windows
set aLibsMap(CSF_TclLibs) "tcl86"
if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk86"
}
if { "$theRelease" == "true" } {
set aLibsMap(CSF_QT) "Qt5Gui Qt5Widgets Qt5Xml Qt5Core"
} else {
set aLibsMap(CSF_QT) "Qt5Guid Qt5Widgetsd Qt5Xmld Qt5Cored"
}
# tbb headers define different pragma lib depending on debug/release
set aLibsMap(CSF_TBB) ""
if { "$::HAVE_ZLIB" == "true" } {
set aLibsMap(CSF_ZLIB) "zlib"
}
} else {
set aLibsMap(CSF_dl) "dl"
if { "$::HAVE_XLIB" == "true" } {
set aLibsMap(CSF_OpenGlLibs) "GL"
} else {
set aLibsMap(CSF_OpenGlLibs) "GL EGL"
}
set aLibsMap(CSF_OpenGlesLibs) "EGL GLESv2"
if { "$theOS" == "mac" || "$theOS" == "ios" } {
set aLibsMap(CSF_objc) "objc"
set aLibsMap(CSF_OpenGlLibs) ""
set aLibsMap(CSF_OpenGlesLibs) ""
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_OpenGlesLibs) "OpenGLES"
if { "$theOS" == "ios" } {
set aFrmsMap(CSF_Appkit) "UIKit"
} else {
set aFrmsMap(CSF_Appkit) "AppKit"
}
set aFrmsMap(CSF_IOKit) "IOKit"
set aLibsMap(CSF_TclLibs) ""
set aLibsMap(CSF_TclTkLibs) ""
set aFrmsMap(CSF_TclLibs) "Tcl"
if { "$::HAVE_TK" == "true" } {
set aFrmsMap(CSF_TclTkLibs) "Tk"
}
set aLibsMap(CSF_QT) "QtCore QtGui"
} elseif { "$theOS" == "android" } {
set aLibsMap(CSF_androidlog) "log"
} else {
if { "$::HAVE_FREETYPE" == "true" } {
set aLibsMap(CSF_fontconfig) "fontconfig"
}
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part of libc on QNX
} else {
set aLibsMap(CSF_ThreadLibs) "pthread rt"
if { "$::HAVE_TK" == "true" } {
set aLibsMap(CSF_TclTkLibs) "tk8.6"
}
if { "$::HAVE_XLIB" == "true" } {
set aLibsMap(CSF_XwLibs) "X11"
}
}
}
}
}
# Returns string of library dependencies for generation of Visual Studio project or make lists.
proc osutils:vtkCsf {{theOS ""}} {
set aVtkVer "6.1"
set aPathSplitter ":"
if {"$theOS" == "wnt"} {
set aPathSplitter ";"
}
set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"]
foreach anIncItem $anOptIncs {
if {[regexp -- "vtk-(.*)$" [file tail $anIncItem] dummy aFoundVtkVer]} {
set aVtkVer $aFoundVtkVer
}
}
set aLibArray [list vtkCommonCore vtkCommonDataModel vtkCommonExecutionModel vtkCommonMath vtkCommonTransforms vtkRenderingCore \
vtkRenderingOpenGL vtkFiltersGeneral vtkIOCore vtkIOImage vtkImagingCore vtkInteractionStyle]
# Additional suffices for the libraries
set anIdx 0
foreach anItem $aLibArray {
lset aLibArray $anIdx $anItem-$aVtkVer
incr anIdx
}
return [join $aLibArray " "]
}
# @param theLibsList - dependencies (libraries list)
# @param theFrameworks - dependencies (frameworks list, OS X specific)
proc osutils:usedOsLibs { theToolKit theOS theLibsList theFrameworks theSrcDir { theRelease true } } {
global path
upvar $theLibsList aLibsList
upvar $theFrameworks aFrameworks
set aLibsList [list]
set aFrameworks [list]
osutils:csfList $theOS aLibsMap aFrmsMap $theRelease
foreach aCsfElem [osutils:tk:csfInExternlib "$path/$theSrcDir/${theToolKit}/EXTERNLIB"] {
if [info exists aLibsMap($aCsfElem)] {
foreach aLib [split "$aLibsMap($aCsfElem)"] {
if { [lsearch $aLibsList $aLib] == "-1" } {
lappend aLibsList $aLib
}
}
}
if [info exists aFrmsMap($aCsfElem)] {
foreach aFrm [split "$aFrmsMap($aCsfElem)"] {
if { [lsearch $aFrameworks $aFrm] == "-1" } {
lappend aFrameworks $aFrm
}
}
}
}
}
# Returns liste of UD in a toolkit. tkloc is a full path wok.
proc osutils:tk:units { tkloc theSrcDir } {
global path
set l {}
set PACKAGES "$path/$theSrcDir/$tkloc/PACKAGES"
foreach u [wokUtils:FILES:FileToList $PACKAGES] {
if {[file isdirectory "$path/$theSrcDir/$u"]} {
lappend l $u
}
}
if { $l == {} } {
;#puts stderr "Warning. No devunit included in $tkloc"
}
return $l
}
# remove from listloc OpenCascade units indesirables on NT
proc osutils:juststation {goaway listloc} {
global path
set lret {}
foreach u $listloc {
if {([file isdirectory "$path/src/$u"] && [lsearch $goaway $u] == -1 )
|| (![file isdirectory "$path/src/$u"] && [lsearch $goaway $u] == -1 ) } {
lappend lret $u
}
}
return $lret
}
# intersect3 - perform the intersecting of two lists, returning a list containing three lists.
# The first list is everything in the first list that wasn't in the second,
# the second list contains the intersection of the two lists, the third list contains everything
# in the second list that wasn't in the first.
proc osutils:intersect3 {list1 list2} {
set la1(0) {} ; unset la1(0)
set lai(0) {} ; unset lai(0)
set la2(0) {} ; unset la2(0)
foreach v $list1 {
set la1($v) {}
}
foreach v $list2 {
set la2($v) {}
}
foreach elem [concat $list1 $list2] {
if {[info exists la1($elem)] && [info exists la2($elem)]} {
unset la1($elem)
unset la2($elem)
set lai($elem) {}
}
}
list [lsort [array names la1]] [lsort [array names lai]] [lsort [array names la2]]
}
# Prepare relative path
proc relativePath {thePathFrom thePathTo} {
if { [file isdirectory "$thePathFrom"] == 0 } {
return ""
}
set aPathFrom [file normalize "$thePathFrom"]
set aPathTo [file normalize "$thePathTo"]
set aCutedPathFrom "${aPathFrom}/dummy"
set aRelatedDeepPath ""
while { "$aCutedPathFrom" != [file normalize "$aCutedPathFrom/.."] } {
set aCutedPathFrom [file normalize "$aCutedPathFrom/.."]
# does aPathTo contain aCutedPathFrom?
regsub -all $aCutedPathFrom $aPathTo "" aPathFromAfterCut
if { "$aPathFromAfterCut" != "$aPathTo" } { # if so
if { "$aCutedPathFrom" == "$aPathFrom" } { # just go higher, for example, ./somefolder/someotherfolder
set aPathTo ".${aPathTo}"
} elseif { "$aCutedPathFrom" == "$aPathTo" } { # remove the last "/"
set aRelatedDeepPath [string replace $aRelatedDeepPath end end ""]
}
regsub -all $aCutedPathFrom $aPathTo $aRelatedDeepPath aPathToAfterCut
regsub -all "//" $aPathToAfterCut "/" aPathToAfterCut
return $aPathToAfterCut
}
set aRelatedDeepPath "$aRelatedDeepPath../"
}
return $thePathTo
}
proc wokUtils:EASY:bs1 { s } {
regsub -all {/} $s {\\} r
return $r
}
# Returns for a full path the liste of n last directory part
# n = 1 => tail
# n = 2 => dir/file.c
# n = 3 => sdir/dir/file.c
# etc..
proc wokUtils:FILES:wtail { f n } {
set ll [expr [llength [set lif [file split $f]]] -$n]
return [join [lrange $lif $ll end] /]
}
# Generate entry for one source file in Visual Studio 10 project file
proc osutils:vcxproj:cxxfile { theFile theParams theSrcFileLevel } {
if { $theParams == "" } {
return " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile $theSrcFileLevel]]\" />\n"
}
set aParams [string trim ${theParams}]
append text " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile 3]]\">\n"
append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Debug|Win32\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Release|Win32\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Debug|x64\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Release|x64\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
append text " </ClCompile>\n"
return $text
}
# Generate entry for one header file in Visual Studio 10 project file
proc osutils:vcxproj:hxxfile { theFile } { return " <ClInclude Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile 3]]\" />\n" }
# Generate Visual Studio 2010 project filters file
proc osutils:vcxproj:filters { dir proj theCxxFilesMap theHxxFilesMap } {
upvar $theCxxFilesMap aCxxFilesMap
upvar $theHxxFilesMap aHxxFilesMap
# header
append text "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
append text "<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
# list of "filters" (units)
append text " <ItemGroup>\n"
append text " <Filter Include=\"Source files\">\n"
append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
append text " </Filter>\n"
append text " <Filter Include=\"Header files\">\n"
append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
append text " </Filter>\n"
foreach unit $aCxxFilesMap(units) {
append text " <Filter Include=\"Source files\\${unit}\">\n"
append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
append text " </Filter>\n"
}
foreach unit $aHxxFilesMap(units) {
append text " <Filter Include=\"Header files\\${unit}\">\n"
append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
append text " </Filter>\n"
}
append text " </ItemGroup>\n"
# list of cxx files
append text " <ItemGroup>\n"
foreach unit $aCxxFilesMap(units) {
foreach file $aCxxFilesMap($unit) {
append text " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $file 3]]\">\n"
append text " <Filter>Source files\\${unit}</Filter>\n"
append text " </ClCompile>\n"
}
}
append text " </ItemGroup>\n"
# list of hxx files
append text " <ItemGroup>\n"
foreach unit $aHxxFilesMap(units) {
foreach file $aHxxFilesMap($unit) {
append text " <ClInclude Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $file 3]]\">\n"
append text " <Filter>Header files\\${unit}</Filter>\n"
append text " </ClInclude>\n"
}
}
append text " </ItemGroup>\n"
append text " <ItemGroup>\n"
append text " <ResourceCompile Include=\"${proj}.rc\" />\n"
append text " </ItemGroup>\n"
# end
append text "</Project>"
# write file
set fp [open [set fvcproj [file join $dir ${proj}.vcxproj.filters]] w]
fconfigure $fp -translation crlf
puts $fp $text
close $fp
return ${proj}.vcxproj.filters
}
# Generate RC file content for ToolKit from template
proc osutils:readtemplate:rc {theOutDir theToolKit} {
set aLoc "$::THE_CASROOT/adm/templates/template_dll.rc"
set aBody [wokUtils:FILES:FileToString $aLoc]
regsub -all -- {__TKNAM__} $aBody $theToolKit aBody
set aFile [open "${theOutDir}/${theToolKit}.rc" "w"]
fconfigure $aFile -translation lf
puts $aFile $aBody
close $aFile
return "${theOutDir}/${theToolKit}.rc"
}
# Generate Visual Studio project file for ToolKit
proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
global path
set aHasQtDep "false"
set aTkDefines ""
foreach aCsfElem [osutils:tk:csfInExternlib "$path/$theSrcDir/${theToolKit}/EXTERNLIB"] {
if { "$aCsfElem" == "CSF_QT" } {
set aHasQtDep "true"
} elseif { "$aCsfElem" == "CSF_OpenGlLibs" } {
set aTkDefines "$aTkDefines;HAVE_OPENGL"
} elseif { "$aCsfElem" == "CSF_OpenGlesLibs" } {
set aTkDefines "$aTkDefines;HAVE_GLES2"
}
}
set theProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 0]
set l_compilable [osutils:compilable wnt]
regsub -all -- {__TKNAM__} $theProjTmpl $theToolKit theProjTmpl
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($theToolKit)] } {
set aGuidsMap($theToolKit) [OS:genGUID]
}
regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
set theProjTmpl [osutils:uwp:proj $isUWP ${theProjTmpl}]
set aUsedLibs [list]
if { $isUWP } {
lappend aUsedLibs "WindowsApp.lib"
}
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib"
}
set anOsReleaseLibs {}
set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
regsub -all -- {__TKDEP__} $theProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] theProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $theProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] theProjTmpl
regsub -all -- {__TKDEFINES__} $theProjTmpl $aTkDefines theProjTmpl
set anIncPaths "..\\..\\..\\inc"
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
set listloc [osutils:tk:units $theToolKit $theSrcDir]
if [array exists written] { unset written }
#puts "\t1 [wokparam -v %CMPLRS_CXX_Options [w_info -f]] father"
#puts "\t2 [wokparam -v %CMPLRS_CXX_Options] branch"
#puts "\t1 [wokparam -v %CMPLRS_C_Options [w_info -f]] father"
#puts "\t2 [wokparam -v %CMPLRS_C_Options] branch"
set fxloparamfcxx [lindex [osutils:intersect3 [_get_options wnt cmplrs_cxx f] [_get_options wnt cmplrs_cxx b]] 2]
set fxloparamfc [lindex [osutils:intersect3 [_get_options wnt cmplrs_c f] [_get_options wnt cmplrs_c b]] 2]
set fxloparam ""
foreach fxlo $listloc {
set xlo $fxlo
set aSrcFiles [osutils:tk:cxxfiles $xlo wnt $theSrcDir]
set aHxxFiles [osutils:tk:hxxfiles $xlo wnt $theSrcDir]
# prepare Qt moc files, appears only in Inspector - directory tools
set aGeneratedFiles {}
if { "$aHasQtDep" == "true" } {
set aMocResFiles [osutils:tk:mocfiles $aHxxFiles $theOutDir]
set aGeneratedFiles [osutils:tk:execfiles $aMocResFiles $theOutDir moc${::SYS_EXE_SUFFIX} moc cpp]
set aQrcResFiles [osutils:tk:qrcfiles $xlo wnt $theSrcDir]
set aQrcFiles [osutils:tk:execfiles $aQrcResFiles $theOutDir rcc${::SYS_EXE_SUFFIX} rcc cpp]
foreach resFile $aQrcFiles {
lappend aGeneratedFiles $resFile
}
}
set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx $fxlo]
if {$fxlo_cmplrs_options_cxx == ""} {
set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx b]
}
set fxlo_cmplrs_options_c [_get_options wnt cmplrs_c $fxlo]
if {$fxlo_cmplrs_options_c == ""} {
set fxlo_cmplrs_options_c [_get_options wnt cmplrs_c b]
}
set fxloparam "$fxloparam [lindex [osutils:intersect3 [_get_options wnt cmplrs_cxx b] $fxlo_cmplrs_options_cxx] 2]"
set fxloparam "$fxloparam [lindex [osutils:intersect3 [_get_options wnt cmplrs_c b] $fxlo_cmplrs_options_c] 2]"
#puts "\t3 [wokparam -v %CMPLRS_CXX_Options] branch CXX "
#puts "\t4 [wokparam -v %CMPLRS_CXX_Options $fxlo] $fxlo CXX"
#puts "\t5 [wokparam -v %CMPLRS_C_Options] branch C"
#puts "\t6 [wokparam -v %CMPLRS_C_Options $fxlo] $fxlo C"
set needparam ""
foreach partopt $fxloparam {
if {[string first "-I" $partopt] == "0"} {
# this is an additional includes search path
continue
}
set needparam "$needparam $partopt"
}
# Format of projects in vc10+ is different from vc7-9
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
append aFilesSection [osutils:vcxproj:cxxfile $aSrcFile $needparam 3]
} else {
puts "Warning : in vcproj more than one occurrences for [file tail $aSrcFile]"
}
if { ! [info exists aVcFilesCxx($xlo)] } { lappend aVcFilesCxx(units) $xlo }
lappend aVcFilesCxx($xlo) $aSrcFile
}
foreach aHxxFile [lsort $aHxxFiles] {
if { ![info exists written([file tail $aHxxFile])] } {
set written([file tail $aHxxFile]) 1
append aFilesSection [osutils:vcxproj:hxxfile $aHxxFile]
} else {
puts "Warning : in vcproj more than one occurrences for [file tail $aHxxFile]"
}
if { ! [info exists aVcFilesHxx($xlo)] } { lappend aVcFilesHxx(units) $xlo }
lappend aVcFilesHxx($xlo) $aHxxFile
}
foreach aGenFile [lsort $aGeneratedFiles] {
if { ![info exists written([file tail $aGenFile])] } {
set written([file tail $aGenFile]) 1
append aFilesSection [osutils:vcxproj:cxxfile $aGenFile $needparam 5]
} else {
puts "Warning : in vcproj more than one occurrences for [file tail $aGenFile]"
}
if { ! [info exists aVcFilesCxx($xlo)] } { lappend aVcFilesCxx(units) $xlo }
lappend aVcFilesCxx($xlo) $aGenFile
}
} else {
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"${xlo}\"\n"
append aFilesSection "\t\t\t\t>\n"
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
append aFilesSection [osutils:vcproj:file $theVcVer $aSrcFile $needparam]
} else {
puts "Warning : in vcproj more than one occurrences for [file tail $aSrcFile]"
}
}
append aFilesSection "\t\t\t</Filter>\n"
}
}
regsub -all -- {__TKINC__} $theProjTmpl $anIncPaths theProjTmpl
regsub -all -- {__FILES__} $theProjTmpl $aFilesSection theProjTmpl
# write file
set aFile [open [set aVcFiles [file join $theOutDir ${theToolKit}.[osutils:vcproj:ext $theVcVer]]] w]
fconfigure $aFile -translation crlf
puts $aFile $theProjTmpl
close $aFile
# write filters file for vc10+
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $theToolKit aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $theToolKit]
return $aVcFiles
}
# Appends OS libraries into the list of used libraries.
# Corrects list of referred third-party libraries that are named with suffix
# depending on VC version
# Unites list of used libraries into a variable with separator for VStudio older than vc9
# @param theUsedLibs List of libraries, to be changed
# @param theOsLibs List of Os library names, before using an extension should be added
# @param theVcVer version of VStudio
proc osutils:depLibraries { theUsedLibs theOsLibs theVcVer } {
foreach aLibIter $theOsLibs {
lappend theUsedLibs "${aLibIter}.${::SYS_LIB_SUFFIX}"
}
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {vc[0-9]+} $theUsedLibs $aVCRTVer theUsedLibs
# and put this list to project file
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set theUsedLibs [join $theUsedLibs {;}]
}
return $theUsedLibs
}
# for a unit returns a map containing all its file in the current
# workbench
# local = 1 only local files
proc osutils:tk:loadunit { loc map theSrcDir} {
#puts $loc
upvar $map TLOC
catch { unset TLOC }
set lfiles [_get_used_files $loc $theSrcDir]
foreach f $lfiles {
#puts "\t$f"
set t [lindex $f 0]
set p [lindex $f 2]
if [info exists TLOC($t)] {
set l $TLOC($t)
lappend l $p
set TLOC($t) $l
} else {
set TLOC($t) $p
}
}
return
}
# Returns the list of all files name in a toolkit within specified list of file extensions.
proc osutils:tk:files { tkloc theExtensions theSrcDir } {
set Tfiles(source,nocdlpack) {source pubinclude}
set Tfiles(source,toolkit) {}
set Tfiles(source,executable) {source pubinclude}
set listloc [concat [osutils:tk:units $tkloc $theSrcDir] $tkloc ]
#puts " listloc = $listloc"
set resultloc $listloc
set lret {}
foreach loc $resultloc {
set utyp [_get_type $loc]
#puts "\"$utyp\" \"$loc\""
switch $utyp {
"t" { set utyp "toolkit" }
"n" { set utyp "nocdlpack" }
"x" { set utyp "executable" }
default { error "Error: Cannot determine type of unit $loc, check adm/UDLIST!" }
}
if [array exists map] { unset map }
osutils:tk:loadunit $loc map $theSrcDir
#puts " loc = $loc === > [array names map]"
set LType $Tfiles(source,${utyp})
foreach typ [array names map] {
if { [lsearch $LType $typ] == -1 } {
unset map($typ)
}
}
foreach type [array names map] {
#puts $type
foreach f $map($type) {
#puts $f
if { [lsearch $theExtensions [file extension $f]] != -1 } {
lappend lret $f
}
}
}
}
return $lret
}
# Returns the list of all compilable files name in a toolkit.
proc osutils:tk:cxxfiles { tkloc thePlatform theSrcDir } { return [osutils:tk:files $tkloc [osutils:compilable $thePlatform] $theSrcDir] }
# Returns the list of all header files name in a toolkit.
proc osutils:tk:hxxfiles { tkloc thePlatform theSrcDir } { return [osutils:tk:files $tkloc [osutils:fileExtensionsHeaders $thePlatform] $theSrcDir] }
# Returns the list of all resource (qrc) files name in a toolkit.
proc osutils:tk:qrcfiles { tkloc thePlatform theSourceDir } { return [osutils:tk:files $tkloc [osutils:fileExtensionsResources $thePlatform] $theSourceDir] }
# Returns the list of all header files name in a toolkit.
proc osutils:tk:mocfiles { HxxFiles theOutDir } {
set lret {}
foreach file $HxxFiles {
# processing only files where Q_OBJECT exists
set fd [open "$file" rb]
set FILES [split [read $fd] "\n"]
close $fd
set isQObject [expr [regexp "Q_OBJECT" $FILES]]
if { ! $isQObject } {
continue;
}
lappend lret $file
}
return $lret
}
# Returns the list of all header files name in a toolkit.
proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension} {
set lret {}
set anOutDir $theOutDir/$thePrefix
file mkdir $anOutDir
foreach file $theFiles {
set aResourceName [file tail $file]
set anOutFile $anOutDir/${thePrefix}_[file rootname $aResourceName].$theExtension
exec $theCommand $file -o $anOutFile
lappend lret $anOutFile
}
return $lret
}
# Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
set aVcFiles {}
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjName $theToolKit
set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($aProjName)] } {
set aGuidsMap($aProjName) [OS:genGUID]
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib"
}
set anOsReleaseLibs {}
set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
lappend aVcFilesCxx($theToolKit) $f
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
}
} else {
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
append aFilesSection "\t\t\t\t>\n"
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
}
append aFilesSection "\t\t\t</Filter>"
}
#puts "$aProjTmpl $aFilesSection"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
fconfigure $aFile -translation crlf
puts $aFile $aProjTmpl
close $aFile
set aCommonSettingsFile "$aVcFilePath.user"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf
puts $aFile $aCommonSettingsFileTmpl
close $aFile
lappend aVcFiles "$aCommonSettingsFile"
}
return $aVcFiles
}
# Generate entry for one source file in Visual Studio 7 - 9 project file
proc osutils:vcproj:file { theVcVer theFile theOptions } {
append aText "\t\t\t\t<File\n"
append aText "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile 3]]\">\n"
if { $theOptions == "" } {
append aText "\t\t\t\t</File>\n"
return $aText
}
append aText "\t\t\t\t\t<FileConfiguration\n"
append aText "\t\t\t\t\t\tName=\"Release\|Win32\">\n"
append aText "\t\t\t\t\t\t<Tool\n"
append aText "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
append aText "\t\t\t\t\t\t\tAdditionalOptions=\""
foreach aParam $theOptions {
append aText "$aParam "
}
append aText "\"\n"
append aText "\t\t\t\t\t\t/>\n"
append aText "\t\t\t\t\t</FileConfiguration>\n"
append aText "\t\t\t\t\t<FileConfiguration\n"
append aText "\t\t\t\t\t\tName=\"Debug\|Win32\">\n"
append aText "\t\t\t\t\t\t<Tool\n"
append aText "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
append aText "\t\t\t\t\t\t\tAdditionalOptions=\""
foreach aParam $theOptions {
append aText "$aParam "
}
append aText "\"\n"
append aText "\t\t\t\t\t\t/>\n"
append aText "\t\t\t\t\t</FileConfiguration>\n"
if { "$theVcVer" == "vc7" } {
append aText "\t\t\t\t</File>\n"
return $aText
}
append aText "\t\t\t\t\t<FileConfiguration\n"
append aText "\t\t\t\t\t\tName=\"Release\|x64\">\n"
append aText "\t\t\t\t\t\t<Tool\n"
append aText "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
append aText "\t\t\t\t\t\t\tAdditionalOptions=\""
foreach aParam $theOptions {
append aText "$aParam "
}
append aText "\"\n"
append aText "\t\t\t\t\t\t/>\n"
append aText "\t\t\t\t\t</FileConfiguration>\n"
append aText "\t\t\t\t\t<FileConfiguration\n"
append aText "\t\t\t\t\t\tName=\"Debug\|x64\">\n"
append aText "\t\t\t\t\t\t<Tool\n"
append aText "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
append aText "\t\t\t\t\t\t\tAdditionalOptions=\""
foreach aParam $theOptions {
append aText "$aParam "
}
append aText "\"\n"
append aText "\t\t\t\t\t\t/>\n"
append aText "\t\t\t\t\t</FileConfiguration>\n"
append aText "\t\t\t\t</File>\n"
return $aText
}
proc wokUtils:FILES:mkdir { d } {
global tcl_version
regsub -all {\.[^.]*} $tcl_version "" major
if { $major == 8 } {
file mkdir $d
} else {
if ![file exists $d] {
if { "[info command mkdir]" == "mkdir" } {
mkdir -path $d
} else {
puts stderr "wokUtils:FILES:mkdir : Error unable to find a mkdir command."
}
}
}
if [file exists $d] {
return $d
} else {
return {}
}
}
####### CODEBLOCK ###################################################################
# Function to generate Code Blocks workspace and project files
proc OS:MKCBP { theOutDir theModules theAllSolution thePlatform theCmpl } {
puts stderr "Generating project files for Code Blocks"
# Generate projects for toolkits and separate workspace for each module
foreach aModule $theModules {
OS:cworkspace $aModule $aModule $theOutDir
OS:cbp $theCmpl $aModule $theOutDir $thePlatform
}
# Generate single workspace "OCCT" containing projects from all modules
if { "$theAllSolution" != "" } {
OS:cworkspace $theAllSolution $theModules $theOutDir
}
puts "The Code Blocks workspace and project files are stored in the $theOutDir directory"
}
# Generate Code Blocks projects
proc OS:cbp { theCmpl theModules theOutDir thePlatform } {
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit $thePlatform]
}
foreach anExecutable [OS:executable ${aModule}] {
lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable $thePlatform]
}
}
return $aProjectFiles
}
# Generate Code::Blocks project file for ToolKit
proc osutils:cbptk { theCmpl theOutDir theToolKit thePlatform} {
set aUsedLibs [list]
set aFrameworks [list]
set anIncPaths [list]
set aTKDefines [list]
set aTKSrcFiles [list]
# collect list of referred libraries to link with
osutils:usedOsLibs $theToolKit $thePlatform aUsedLibs aFrameworks "src"
set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit "src" ""]]
foreach tkx $aDepToolkits {
lappend aUsedLibs "${tkx}"
}
lappend anIncPaths "../../../inc"
set listloc [osutils:tk:units $theToolKit "src"]
if { [llength $listloc] == 0 } {
set listloc $theToolKit
}
if [array exists written] { unset written }
foreach fxlo $listloc {
set xlo $fxlo
set aSrcFiles [osutils:tk:cxxfiles $xlo $thePlatform "src"]
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
} else {
puts "Warning : more than one occurrences for [file tail $aSrcFile]"
}
}
# macros for correct DLL exports
# if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
# lappend aTKDefines "__${xlo}_DLL"
# }
}
return [osutils:cbp $theCmpl $theOutDir $theToolKit $thePlatform $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
}
# Generates Code Blocks workspace.
proc OS:cworkspace { theSolName theModules theOutDir } {
global path
set aWsFilePath "${theOutDir}/${theSolName}.workspace"
set aFile [open $aWsFilePath "w"]
set isActiveSet 0
puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
puts $aFile "<CodeBlocks_workspace_file>"
puts $aFile "\t<Workspace title=\"${theSolName}\">"
# collect list of projects to be created
foreach aModule $theModules {
# toolkits
foreach aToolKit [osutils:tk:sort [${aModule}:toolkits] "src" ""] {
set aDependencies [LibToLink $aToolKit "src" ""]
if { [llength $aDependencies] == 0 } {
puts $aFile "\t\t<Project filename=\"${aToolKit}.cbp\" />"
} else {
puts $aFile "\t\t<Project filename=\"${aToolKit}.cbp\" >"
foreach aDepTk $aDependencies {
puts $aFile "\t\t\t<Depends filename=\"${aDepTk}.cbp\" />"
}
puts $aFile "\t\t</Project>"
}
}
# executables, assume one project per cxx file...
foreach aUnit [OS:executable ${aModule}] {
set aUnitLoc $aUnit
set src_files [_get_used_files $aUnit "src" false]
set aSrcFiles {}
foreach s $src_files {
regexp {source ([^\s]+)} $s dummy name
lappend aSrcFiles $name
}
foreach aSrcFile $aSrcFiles {
set aFileExtension [file extension $aSrcFile]
if { $aFileExtension == ".cxx" } {
set aPrjName [file rootname $aSrcFile]
set aDependencies [list]
if {[file isdirectory $path/src/$aUnitLoc]} {
set aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] "src" ""]
}
set anActiveState ""
if { $isActiveSet == 0 } {
set anActiveState " active=\"1\""
set isActiveSet 1
}
if { [llength $aDependencies] == 0 } {
puts $aFile "\t\t<Project filename=\"${aPrjName}.cbp\"${anActiveState}/>"
} else {
puts $aFile "\t\t<Project filename=\"${aPrjName}.cbp\"${anActiveState}>"
foreach aDepTk $aDependencies {
puts $aFile "\t\t\t<Depends filename=\"${aDepTk}.cbp\" />"
}
puts $aFile "\t\t</Project>"
}
}
}
}
}
puts $aFile "\t</Workspace>"
puts $aFile "</CodeBlocks_workspace_file>"
close $aFile
return $aWsFilePath
}
# Generate Code::Blocks project file for Executable
proc osutils:cbpx { theCmpl theOutDir theToolKit thePlatform } {
global path
set aWokArch "$::env(ARCH)"
set aCbpFiles {}
foreach aSrcFile [osutils:tk:cxxfiles $theToolKit $thePlatform "src"] {
# collect list of referred libraries to link with
set aUsedLibs [list]
set aFrameworks [list]
set anIncPaths [list]
set aTKDefines [list]
set aTKSrcFiles [list]
set aProjName [file rootname [file tail $aSrcFile]]
osutils:usedOsLibs $theToolKit $thePlatform aUsedLibs aFrameworks "src"
set aDepToolkits [LibToLinkX $theToolKit $aProjName "src" ""]
foreach tkx $aDepToolkits {
if {[_get_type $tkx] == "t"} {
lappend aUsedLibs "${tkx}"
}
if {[lsearch [glob -tails -directory "$path/src" -types d *] $tkx] == "-1"} {
lappend aUsedLibs "${tkx}"
}
}
set WOKSteps_exec_link [_get_options lin WOKSteps_exec_link $theToolKit]
if { [regexp {WOKStep_DLLink} $WOKSteps_exec_link] || [regexp {WOKStep_Libink} $WOKSteps_exec_link] } {
set isExecutable "false"
} else {
set isExecutable "true"
}
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
} else {
puts "Warning : in cbp there are more than one occurrences for [file tail $aSrcFile]"
}
# macros for correct DLL exports
# if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
# lappend aTKDefines "__${theToolKit}_DLL"
# }
# common include paths
lappend anIncPaths "../../../inc"
lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $thePlatform $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable]
}
return $aCbpFiles
}
# This function intended to generate Code::Blocks project file
# @param theCmpl - the compiler (gcc or msvc)
# @param theOutDir - output directory to place project file
# @param theProjName - project name
# @param theSrcFiles - list of source files
# @param theLibsList - dependencies (libraries list)
# @param theFrameworks - dependencies (frameworks list, Mac OS X specific)
# @param theIncPaths - header search paths
# @param theDefines - compiler macro definitions
# @param theIsExe - flag to indicate executable / library target
proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
set aWokArch "$::env(ARCH)"
set aCmplCbp "gcc"
set aCmplFlags [list]
set aCmplFlagsRelease [list]
set aCmplFlagsDebug [list]
set toPassArgsByFile 0
set aLibPrefix "lib"
set aPlatformAndCompiler "${thePlatform}/gcc"
if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
set aPlatformAndCompiler "${thePlatform}/clang"
}
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" || "$thePlatform" == "qnx" } {
set toPassArgsByFile 1
}
if { "$theCmpl" == "msvc" } {
set aCmplCbp "msvc8"
set aLibPrefix ""
}
if { "$theCmpl" == "msvc" } {
set aCmplFlags "-arch:SSE2 -EHsc -W4 -MP"
set aCmplFlagsRelease "-MD -O2"
set aCmplFlagsDebug "-MDd -Od -Zi"
lappend aCmplFlags "-D_CRT_SECURE_NO_WARNINGS"
lappend aCmplFlags "-D_CRT_NONSTDC_NO_DEPRECATE"
} elseif { "$theCmpl" == "gcc" } {
if { "$thePlatform" != "qnx" } {
set aCmplFlags "-mmmx -msse -msse2 -mfpmath=sse"
}
set aCmplFlagsRelease "-O2"
set aCmplFlagsDebug "-O0 -g"
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
lappend aCmplFlags "-std=gnu++0x"
lappend aCmplFlags "-D_WIN32_WINNT=0x0501"
} else {
lappend aCmplFlags "-std=c++0x"
lappend aCmplFlags "-fPIC"
lappend aCmplFlags "-DOCC_CONVERT_SIGNALS"
}
lappend aCmplFlags "-Wall"
lappend aCmplFlags "-Wextra"
lappend aCmplFlags "-fexceptions"
}
lappend aCmplFlagsRelease "-DNDEBUG"
lappend aCmplFlagsRelease "-DNo_Exception"
lappend aCmplFlagsDebug "-D_DEBUG"
if { "$thePlatform" == "qnx" } {
lappend aCmplFlags "-D_QNX_SOURCE"
}
set aCbpFilePath "${theOutDir}/${theProjName}.cbp"
set aLnkFileName "${theProjName}_obj.link"
set aLnkDebFileName "${theProjName}_objd.link"
set aLnkFilePath "${theOutDir}/${aLnkFileName}"
set aLnkDebFilePath "${theOutDir}/${aLnkDebFileName}"
set aFile [open $aCbpFilePath "w"]
puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
puts $aFile "<CodeBlocks_project_file>"
puts $aFile "\t<FileVersion major=\"1\" minor=\"6\" />"
puts $aFile "\t<Project>"
puts $aFile "\t\t<Option title=\"$theProjName\" />"
puts $aFile "\t\t<Option pch_mode=\"2\" />"
puts $aFile "\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t<Build>"
# Release target configuration
puts $aFile "\t\t\t<Target title=\"Release\">"
if { "$theIsExe" == "true" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bin/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aPlatformAndCompiler}/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aPlatformAndCompiler}/obj\" />"
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
foreach aFlagIter $aCmplFlagsRelease {
puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
puts $aFile "\t\t\t\t</Compiler>"
puts $aFile "\t\t\t\t<Linker>"
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
}
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aPlatformAndCompiler}/lib\" />"
if { "$thePlatform" == "mac" } {
if { [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
if { "$thePlatform" == "lin" } {
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aPlatformAndCompiler}/lib\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t</Target>"
# Debug target configuration
puts $aFile "\t\t\t<Target title=\"Debug\">"
if { "$theIsExe" == "true" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bind/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aPlatformAndCompiler}/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aPlatformAndCompiler}/objd\" />"
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
foreach aFlagIter $aCmplFlagsDebug {
puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
puts $aFile "\t\t\t\t</Compiler>"
puts $aFile "\t\t\t\t<Linker>"
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
}
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aPlatformAndCompiler}/libd\" />"
if { "$thePlatform" == "mac" } {
if { [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
if { "$thePlatform" == "lin" } {
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aPlatformAndCompiler}/libd\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t</Target>"
puts $aFile "\t\t</Build>"
# COMMON compiler options
puts $aFile "\t\t<Compiler>"
foreach aFlagIter $aCmplFlags {
puts $aFile "\t\t\t<Add option=\"$aFlagIter\" />"
}
puts $aFile "\t\t\t<Add option=\"\$(CSF_OPT_CMPL)\" />"
foreach anIncPath $theIncPaths {
puts $aFile "\t\t\t<Add directory=\"$anIncPath\" />"
}
puts $aFile "\t\t</Compiler>"
# COMMON linker options
puts $aFile "\t\t<Linker>"
if { "$thePlatform" == "wnt" && "$theCmpl" == "gcc" } {
puts $aFile "\t\t\t<Add option=\"-Wl,--export-all-symbols\" />"
}
foreach aFrameworkName $theFrameworks {
if { "$aFrameworkName" != "" } {
puts $aFile "\t\t\t<Add option=\"-framework $aFrameworkName\" />"
}
}
foreach aLibName $theLibsList {
if { "$aLibName" != "" } {
if { "$theCmpl" == "msvc" } {
puts $aFile "\t\t\t<Add library=\"${aLibName}.lib\" />"
} else {
puts $aFile "\t\t\t<Add library=\"${aLibName}\" />"
}
}
}
puts $aFile "\t\t</Linker>"
# list of sources
set aFileLnkObj ""
set aFileLnkObjd ""
set isFirstSrcFile 1
if { $toPassArgsByFile == 1 } {
set aFileLnkObj [open $aLnkFilePath "w"]
set aFileLnkObjd [open $aLnkDebFilePath "w"]
}
foreach aSrcFile $theSrcFiles {
if {[string equal -nocase [file extension $aSrcFile] ".mm"]} {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option compile=\"1\" />"
puts $aFile "\t\t\t<Option link=\"1\" />"
puts $aFile "\t\t</Unit>"
} elseif {[string equal -nocase [file extension $aSrcFile] ".c"]} {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option compilerVar=\"CC\" />"
puts $aFile "\t\t</Unit>"
} elseif { $toPassArgsByFile == 1 && $isFirstSrcFile == 0 && [string equal -nocase [file extension $aSrcFile] ".cxx" ] } {
# pass at list single source file to Code::Blocks as is
# and pack the list of other files into the dedicated file to workaround process arguments limits on systems like Windows
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option link=\"0\" />"
puts $aFile "\t\t</Unit>"
set aFileObj [string map {.cxx .o} [string map [list "/src/" "/${aPlatformAndCompiler}/obj/src/"] $aSrcFile]]
set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/${aPlatformAndCompiler}/objd/src/"] $aSrcFile]]
puts -nonewline $aFileLnkObj "$aFileObj "
puts -nonewline $aFileLnkObjd "$aFileObjd "
} else {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\" />"
set isFirstSrcFile 0
}
}
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
close $aFileLnkObj
close $aFileLnkObjd
}
puts $aFile "\t</Project>"
puts $aFile "</CodeBlocks_project_file>"
close $aFile
return $aCbpFilePath
}
# Define libraries to link using only EXTERNLIB file
proc LibToLinkX {thePackage theDummyName theSrcDir theSourceDirOther} {
set aToolKits [LibToLink $thePackage $theSrcDir $theSourceDirOther]
return $aToolKits
}
# Function to generate Xcode workspace and project files
proc OS:MKXCD { theOutDir {theModules {}} {theAllSolution ""} {theLibType "dynamic"} {thePlatform ""} } {
puts stderr "Generating project files for Xcode"
# Generate projects for toolkits and separate workspace for each module
foreach aModule $theModules {
OS:xcworkspace $aModule $aModule $theOutDir
OS:xcodeproj $aModule $theOutDir ::THE_GUIDS_LIST $theLibType $thePlatform
}
# Generate single workspace "OCCT" containing projects from all modules
if { "$theAllSolution" != "" } {
OS:xcworkspace $theAllSolution $theModules $theOutDir
}
}
# Generates toolkits sections for Xcode workspace file.
proc OS:xcworkspace:toolkits { theModule } {
set aBuff ""
# Adding toolkits for module in workspace.
foreach aToolKit [osutils:tk:sort [${theModule}:toolkits] "src" ""] {
append aBuff " <FileRef\n"
append aBuff " location = \"group:${aToolKit}.xcodeproj\">\n"
append aBuff " </FileRef>\n"
}
# Adding executables for module, assume one project per cxx file...
foreach aUnit [OS:executable ${theModule}] {
set aUnitLoc $aUnit
set src_files [_get_used_files $aUnit "src" false]
set aSrcFiles {}
foreach s $src_files {
regexp {source ([^\s]+)} $s dummy name
lappend aSrcFiles $name
}
foreach aSrcFile $aSrcFiles {
set aFileExtension [file extension $aSrcFile]
if { $aFileExtension == ".cxx" } {
set aPrjName [file rootname $aSrcFile]
append aBuff " <FileRef\n"
append aBuff " location = \"group:${aPrjName}.xcodeproj\">\n"
append aBuff " </FileRef>\n"
}
}
}
# Removing unnecessary newline character from the end.
set aBuff [string replace $aBuff end end]
return $aBuff
}
# Generates workspace files for Xcode.
proc OS:xcworkspace { theWorkspaceName theModules theOutDir } {
# Creating workspace directory for Xcode.
set aWorkspaceDir "${theOutDir}/${theWorkspaceName}.xcworkspace"
wokUtils:FILES:mkdir $aWorkspaceDir
if { ! [file exists $aWorkspaceDir] } {
puts stderr "Error: Could not create workspace directory \"$aWorkspaceDir\""
return
}
# Creating workspace file.
set aWsFilePath "${aWorkspaceDir}/contents.xcworkspacedata"
set aFile [open $aWsFilePath "w"]
# Adding header and section for main Group.
puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
puts $aFile "<Workspace"
puts $aFile " version = \"1.0\">"
puts $aFile " <Group"
puts $aFile " location = \"container:\""
puts $aFile " name = \"${theWorkspaceName}\">"
# Adding modules.
if { [llength "$theModules"] > 1 } {
foreach aModule $theModules {
puts $aFile " <Group"
puts $aFile " location = \"container:\""
puts $aFile " name = \"${aModule}\">"
puts $aFile [OS:xcworkspace:toolkits $aModule]
puts $aFile " </Group>"
}
} else {
puts $aFile [OS:xcworkspace:toolkits $theModules]
}
# Adding footer.
puts $aFile " </Group>"
puts $aFile "</Workspace>"
close $aFile
}
# Generates Xcode project files.
proc OS:xcodeproj { theModules theOutDir theGuidsMap theLibType thePlatform} {
upvar $theGuidsMap aGuidsMap
set isStatic 0
if { "$theLibType" == "static" } {
set isStatic 1
} elseif { "$thePlatform" == "ios" } {
set isStatic 1
}
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
lappend aProjectFiles [osutils:xcdtk $theOutDir $aToolKit aGuidsMap $isStatic $thePlatform "dylib"]
}
foreach anExecutable [OS:executable ${aModule}] {
lappend aProjectFiles [osutils:xcdtk $theOutDir $anExecutable aGuidsMap $isStatic $thePlatform "executable"]
}
}
return $aProjectFiles
}
# Generates dependencies section for Xcode project files.
proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids thePlatform theIsStatic} {
upvar $theGuidsMap aGuidsMap
upvar $theFileRefSection aFileRefSection
upvar $theDepsGuids aDepsGuids
upvar $theDepsRefGuids aDepsRefGuids
set aBuildFileSection ""
set aUsedLibs [wokUtils:LIST:Purge [osutils:tk:close $theToolKit "src" ""]]
set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit "src" ""]] $theToolKit]
if { "$theTargetType" == "executable" } {
set aFile [osutils:tk:cxxfiles $theToolKit mac "src"]
set aProjName [file rootname [file tail $aFile]]
set aDepToolkits [LibToLinkX $theToolKit $aProjName "src" ""]
}
set aLibExt "dylib"
if { $theIsStatic == 1 } {
set aLibExt "a"
if { "$theTargetType" != "executable" } {
return $aBuildFileSection
}
}
osutils:usedOsLibs $theToolKit $thePlatform aLibs aFrameworks "src"
set aUsedLibs [concat $aUsedLibs $aLibs]
set aUsedLibs [concat $aUsedLibs $aFrameworks]
foreach tkx $aUsedLibs {
set aDepLib "${tkx}_Dep"
set aDepLibRef "${tkx}_DepRef"
if { ! [info exists aGuidsMap($aDepLib)] } {
set aGuidsMap($aDepLib) [OS:genGUID "xcd"]
}
if { ! [info exists aGuidsMap($aDepLibRef)] } {
set aGuidsMap($aDepLibRef) [OS:genGUID "xcd"]
}
append aBuildFileSection "\t\t$aGuidsMap($aDepLib) = \{isa = PBXBuildFile; fileRef = $aGuidsMap($aDepLibRef) ; \};\n"
if {[lsearch -nocase $aFrameworks $tkx] == -1} {
append aFileRefSection "\t\t$aGuidsMap($aDepLibRef) = \{isa = PBXFileReference; lastKnownFileType = file; name = lib${tkx}.${aLibExt}; path = lib${tkx}.${aLibExt}; sourceTree = \"<group>\"; \};\n"
} else {
append aFileRefSection "\t\t$aGuidsMap($aDepLibRef) = \{isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ${tkx}.framework; path = /System/Library/Frameworks/${tkx}.framework; sourceTree = \"<absolute>\"; \};\n"
}
append aDepsGuids "\t\t\t\t$aGuidsMap($aDepLib) ,\n"
append aDepsRefGuids "\t\t\t\t$aGuidsMap($aDepLibRef) ,\n"
}
return $aBuildFileSection
}
# Generates PBXBuildFile and PBXGroup sections for project file.
proc osutils:xcdtk:sources {theToolKit theTargetType theSrcFileRefSection theGroupSection thePackageGuids theSrcFileGuids theGuidsMap theIncPaths} {
upvar $theSrcFileRefSection aSrcFileRefSection
upvar $theGroupSection aGroupSection
upvar $thePackageGuids aPackagesGuids
upvar $theSrcFileGuids aSrcFileGuids
upvar $theGuidsMap aGuidsMap
upvar $theIncPaths anIncPaths
set listloc [osutils:tk:units $theToolKit "src"]
set aBuildFileSection ""
set aPackages [lsort -nocase $listloc]
if { "$theTargetType" == "executable" } {
set aPackages [list "$theToolKit"]
}
# Generating PBXBuildFile, PBXGroup sections and groups for each package.
foreach fxlo $aPackages {
set xlo $fxlo
set aPackage "${xlo}_Package"
set aSrcFileRefGuids ""
if { ! [info exists aGuidsMap($aPackage)] } {
set aGuidsMap($aPackage) [OS:genGUID "xcd"]
}
set aSrcFiles [osutils:tk:cxxfiles $xlo mac "src"]
foreach aSrcFile [lsort $aSrcFiles] {
set aFileExt "sourcecode.cpp.cpp"
if { [file extension $aSrcFile] == ".c" } {
set aFileExt "sourcecode.c.c"
} elseif { [file extension $aSrcFile] == ".mm" } {
set aFileExt "sourcecode.cpp.objcpp"
}
if { ! [info exists aGuidsMap($aSrcFile)] } {
set aGuidsMap($aSrcFile) [OS:genGUID "xcd"]
}
set aSrcFileRef "${aSrcFile}_Ref"
if { ! [info exists aGuidsMap($aSrcFileRef)] } {
set aGuidsMap($aSrcFileRef) [OS:genGUID "xcd"]
}
if { ! [info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
append aBuildFileSection "\t\t$aGuidsMap($aSrcFile) = \{isa = PBXBuildFile; fileRef = $aGuidsMap($aSrcFileRef) ;\};\n"
append aSrcFileRefSection "\t\t$aGuidsMap($aSrcFileRef) = \{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = ${aFileExt}; name = [wokUtils:FILES:wtail $aSrcFile 1]; path = ../../../[wokUtils:FILES:wtail $aSrcFile 3]; sourceTree = \"<group>\"; \};\n"
append aSrcFileGuids "\t\t\t\t$aGuidsMap($aSrcFile) ,\n"
append aSrcFileRefGuids "\t\t\t\t$aGuidsMap($aSrcFileRef) ,\n"
} else {
puts "Warning : more than one occurrences for [file tail $aSrcFile]"
}
}
append aGroupSection "\t\t$aGuidsMap($aPackage) = \{\n"
append aGroupSection "\t\t\tisa = PBXGroup;\n"
append aGroupSection "\t\t\tchildren = (\n"
append aGroupSection $aSrcFileRefGuids
append aGroupSection "\t\t\t);\n"
append aGroupSection "\t\t\tname = $xlo;\n"
append aGroupSection "\t\t\tsourceTree = \"<group>\";\n"
append aGroupSection "\t\t\};\n"
# Storing packages IDs for adding them later as a child of toolkit
append aPackagesGuids "\t\t\t\t$aGuidsMap($aPackage) ,\n"
}
# Removing unnecessary newline character from the end.
set aPackagesGuids [string replace $aPackagesGuids end end]
return $aBuildFileSection
}
# Creates folders structure and all necessary files for Xcode project.
proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {theTargetType "dylib"} } {
set aPBXBuildPhase "Headers"
set aRunOnlyForDeployment "0"
set aProductType "library.dynamic"
set anExecExtension "\t\t\t\tEXECUTABLE_EXTENSION = dylib;"
set anExecPrefix "\t\t\t\tEXECUTABLE_PREFIX = lib;"
set aWrapperExtension "\t\t\t\tWRAPPER_EXTENSION = dylib;"
set aTKDefines [list "OCC_CONVERT_SIGNALS"]
if { $theIsStatic == 1 } {
lappend aTKDefines "OCCT_NO_PLUGINS"
}
if { "$theTargetType" == "executable" } {
set aPBXBuildPhase "CopyFiles"
set aRunOnlyForDeployment "1"
set aProductType "tool"
set anExecExtension ""
set anExecPrefix ""
set aWrapperExtension ""
} elseif { $theIsStatic == 1 } {
set aProductType "library.static"
set anExecExtension "\t\t\t\tEXECUTABLE_EXTENSION = a;"
set aWrapperExtension "\t\t\t\tWRAPPER_EXTENSION = a;"
}
set aUsername [exec whoami]
# Creation of folders for Xcode projectP.
set aToolkitDir "${theOutDir}/${theToolKit}.xcodeproj"
wokUtils:FILES:mkdir $aToolkitDir
if { ! [file exists $aToolkitDir] } {
puts stderr "Error: Could not create project directory \"$aToolkitDir\""
return
}
set aUserDataDir "${aToolkitDir}/xcuserdata"
wokUtils:FILES:mkdir $aUserDataDir
if { ! [file exists $aUserDataDir] } {
puts stderr "Error: Could not create xcuserdata directory in \"$aToolkitDir\""
return
}
set aUserDataDir "${aUserDataDir}/${aUsername}.xcuserdatad"
wokUtils:FILES:mkdir $aUserDataDir
if { ! [file exists $aUserDataDir] } {
puts stderr "Error: Could not create ${aUsername}.xcuserdatad directory in \"$aToolkitDir\"/xcuserdata"
return
}
set aSchemesDir "${aUserDataDir}/xcschemes"
wokUtils:FILES:mkdir $aSchemesDir
if { ! [file exists $aSchemesDir] } {
puts stderr "Error: Could not create xcschemes directory in \"$aUserDataDir\""
return
}
# End of folders creation.
# Generating GUID for toolkit.
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($theToolKit)] } {
set aGuidsMap($theToolKit) [OS:genGUID "xcd"]
}
# Creating xcscheme file for toolkit from template.
set aXcschemeTmpl [osutils:readtemplate "xcscheme" "xcd"]
regsub -all -- {__TOOLKIT_NAME__} $aXcschemeTmpl $theToolKit aXcschemeTmpl
regsub -all -- {__TOOLKIT_GUID__} $aXcschemeTmpl $aGuidsMap($theToolKit) aXcschemeTmpl
set aXcschemeFile [open "$aSchemesDir/${theToolKit}.xcscheme" "w"]
puts $aXcschemeFile $aXcschemeTmpl
close $aXcschemeFile
# Creating xcschememanagement.plist file for toolkit from template.
set aPlistTmpl [osutils:readtemplate "plist" "xcd"]
regsub -all -- {__TOOLKIT_NAME__} $aPlistTmpl $theToolKit aPlistTmpl
regsub -all -- {__TOOLKIT_GUID__} $aPlistTmpl $aGuidsMap($theToolKit) aPlistTmpl
set aPlistFile [open "$aSchemesDir/xcschememanagement.plist" "w"]
puts $aPlistFile $aPlistTmpl
close $aPlistFile
# Creating project.pbxproj file for toolkit.
set aPbxprojFile [open "$aToolkitDir/project.pbxproj" "w"]
puts $aPbxprojFile "// !\$*UTF8*\$!"
puts $aPbxprojFile "\{"
puts $aPbxprojFile "\tarchiveVersion = 1;"
puts $aPbxprojFile "\tclasses = \{"
puts $aPbxprojFile "\t\};"
puts $aPbxprojFile "\tobjectVersion = 46;"
puts $aPbxprojFile "\tobjects = \{\n"
# Begin PBXBuildFile section
set aPackagesGuids ""
set aGroupSection ""
set aSrcFileRefSection ""
set aSrcFileGuids ""
set aDepsFileRefSection ""
set aDepsGuids ""
set aDepsRefGuids ""
set anIncPaths [list "../../../inc"]
set anLibPaths ""
if { [info exists ::env(CSF_OPT_INC)] } {
set anIncCfg [split "$::env(CSF_OPT_INC)" ":"]
foreach anIncCfgPath $anIncCfg {
lappend anIncPaths $anIncCfgPath
}
}
if { [info exists ::env(CSF_OPT_LIB64)] } {
set anLibCfg [split "$::env(CSF_OPT_LIB64)" ":"]
foreach anLibCfgPath $anLibCfg {
lappend anLibPaths $anLibCfgPath
}
}
puts $aPbxprojFile [osutils:xcdtk:sources $theToolKit $theTargetType aSrcFileRefSection aGroupSection aPackagesGuids aSrcFileGuids aGuidsMap anIncPaths]
puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $thePlatform $theIsStatic]
# End PBXBuildFile section
# Begin PBXFileReference section
set aToolkitLib "lib${theToolKit}.dylib"
set aPath "$aToolkitLib"
if { "$theTargetType" == "executable" } {
set aPath "$theToolKit"
} elseif { $theIsStatic == 1 } {
set aToolkitLib "lib${theToolKit}.a"
}
if { ! [info exists aGuidsMap($aToolkitLib)] } {
set aGuidsMap($aToolkitLib) [OS:genGUID "xcd"]
}
puts $aPbxprojFile "\t\t$aGuidsMap($aToolkitLib) = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.${theTargetType}\"; includeInIndex = 0; path = $aPath; sourceTree = BUILT_PRODUCTS_DIR; };\n"
puts $aPbxprojFile $aSrcFileRefSection
puts $aPbxprojFile $aDepsFileRefSection
# End PBXFileReference section
# Begin PBXFrameworksBuildPhase section
set aTkFrameworks "${theToolKit}_Frameworks"
if { ! [info exists aGuidsMap($aTkFrameworks)] } {
set aGuidsMap($aTkFrameworks) [OS:genGUID "xcd"]
}
puts $aPbxprojFile "\t\t$aGuidsMap($aTkFrameworks) = \{"
puts $aPbxprojFile "\t\t\tisa = PBXFrameworksBuildPhase;"
puts $aPbxprojFile "\t\t\tbuildActionMask = 2147483647;"
puts $aPbxprojFile "\t\t\tfiles = ("
puts $aPbxprojFile $aDepsGuids
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\trunOnlyForDeploymentPostprocessing = 0;"
puts $aPbxprojFile "\t\t\};\n"
# End PBXFrameworksBuildPhase section
# Begin PBXGroup section
set aTkPBXGroup "${theToolKit}_PBXGroup"
if { ! [info exists aGuidsMap($aTkPBXGroup)] } {
set aGuidsMap($aTkPBXGroup) [OS:genGUID "xcd"]
}
set aTkSrcGroup "${theToolKit}_SrcGroup"
if { ! [info exists aGuidsMap($aTkSrcGroup)] } {
set aGuidsMap($aTkSrcGroup) [OS:genGUID "xcd"]
}
puts $aPbxprojFile $aGroupSection
puts $aPbxprojFile "\t\t$aGuidsMap($aTkPBXGroup) = \{"
puts $aPbxprojFile "\t\t\tisa = PBXGroup;"
puts $aPbxprojFile "\t\t\tchildren = ("
puts $aPbxprojFile $aDepsRefGuids
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkSrcGroup) ,"
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aToolkitLib) ,"
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tsourceTree = \"<group>\";"
puts $aPbxprojFile "\t\t\};"
puts $aPbxprojFile "\t\t$aGuidsMap($aTkSrcGroup) = \{"
puts $aPbxprojFile "\t\t\tisa = PBXGroup;"
puts $aPbxprojFile "\t\t\tchildren = ("
puts $aPbxprojFile $aPackagesGuids
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tname = \"Source files\";"
puts $aPbxprojFile "\t\t\tsourceTree = \"<group>\";"
puts $aPbxprojFile "\t\t\};\n"
# End PBXGroup section
# Begin PBXHeadersBuildPhase section
set aTkHeaders "${theToolKit}_Headers"
if { ! [info exists aGuidsMap($aTkHeaders)] } {
set aGuidsMap($aTkHeaders) [OS:genGUID "xcd"]
}
puts $aPbxprojFile "\t\t$aGuidsMap($aTkHeaders) = \{"
puts $aPbxprojFile "\t\t\tisa = PBX${aPBXBuildPhase}BuildPhase;"
puts $aPbxprojFile "\t\t\tbuildActionMask = 2147483647;"
puts $aPbxprojFile "\t\t\tfiles = ("
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\trunOnlyForDeploymentPostprocessing = ${aRunOnlyForDeployment};"
puts $aPbxprojFile "\t\t\};\n"
# End PBXHeadersBuildPhase section
# Begin PBXNativeTarget section
set aTkBuildCfgListNativeTarget "${theToolKit}_BuildCfgListNativeTarget"
if { ! [info exists aGuidsMap($aTkBuildCfgListNativeTarget)] } {
set aGuidsMap($aTkBuildCfgListNativeTarget) [OS:genGUID "xcd"]
}
set aTkSources "${theToolKit}_Sources"
if { ! [info exists aGuidsMap($aTkSources)] } {
set aGuidsMap($aTkSources) [OS:genGUID "xcd"]
}
puts $aPbxprojFile "\t\t$aGuidsMap($theToolKit) = \{"
puts $aPbxprojFile "\t\t\tisa = PBXNativeTarget;"
puts $aPbxprojFile "\t\t\tbuildConfigurationList = $aGuidsMap($aTkBuildCfgListNativeTarget) ;"
puts $aPbxprojFile "\t\t\tbuildPhases = ("
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkSources) ,"
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkFrameworks) ,"
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkHeaders) ,"
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tbuildRules = ("
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tdependencies = ("
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tname = $theToolKit;"
puts $aPbxprojFile "\t\t\tproductName = $theToolKit;"
puts $aPbxprojFile "\t\t\tproductReference = $aGuidsMap($aToolkitLib) ;"
puts $aPbxprojFile "\t\t\tproductType = \"com.apple.product-type.${aProductType}\";"
puts $aPbxprojFile "\t\t\};\n"
# End PBXNativeTarget section
# Begin PBXProject section
set aTkProjectObj "${theToolKit}_ProjectObj"
if { ! [info exists aGuidsMap($aTkProjectObj)] } {
set aGuidsMap($aTkProjectObj) [OS:genGUID "xcd"]
}
set aTkBuildCfgListProj "${theToolKit}_BuildCfgListProj"
if { ! [info exists aGuidsMap($aTkBuildCfgListProj)] } {
set aGuidsMap($aTkBuildCfgListProj) [OS:genGUID "xcd"]
}
puts $aPbxprojFile "\t\t$aGuidsMap($aTkProjectObj) = \{"
puts $aPbxprojFile "\t\t\tisa = PBXProject;"
puts $aPbxprojFile "\t\t\tattributes = \{"
puts $aPbxprojFile "\t\t\t\tLastUpgradeCheck = 0430;"
puts $aPbxprojFile "\t\t\t\};"
puts $aPbxprojFile "\t\t\tbuildConfigurationList = $aGuidsMap($aTkBuildCfgListProj) ;"
puts $aPbxprojFile "\t\t\tcompatibilityVersion = \"Xcode 3.2\";"
puts $aPbxprojFile "\t\t\tdevelopmentRegion = English;"
puts $aPbxprojFile "\t\t\thasScannedForEncodings = 0;"
puts $aPbxprojFile "\t\t\tknownRegions = ("
puts $aPbxprojFile "\t\t\t\ten,"
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tmainGroup = $aGuidsMap($aTkPBXGroup);"
puts $aPbxprojFile "\t\t\tproductRefGroup = $aGuidsMap($aTkPBXGroup);"
puts $aPbxprojFile "\t\t\tprojectDirPath = \"\";"
puts $aPbxprojFile "\t\t\tprojectRoot = \"\";"
puts $aPbxprojFile "\t\t\ttargets = ("
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($theToolKit) ,"
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\};\n"
# End PBXProject section
# Begin PBXSourcesBuildPhase section
puts $aPbxprojFile "\t\t$aGuidsMap($aTkSources) = \{"
puts $aPbxprojFile "\t\t\tisa = PBXSourcesBuildPhase;"
puts $aPbxprojFile "\t\t\tbuildActionMask = 2147483647;"
puts $aPbxprojFile "\t\t\tfiles = ("
puts $aPbxprojFile $aSrcFileGuids
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\trunOnlyForDeploymentPostprocessing = 0;"
puts $aPbxprojFile "\t\t\};\n"
# End PBXSourcesBuildPhase section
# Begin XCBuildConfiguration section
set aTkDebugProject "${theToolKit}_DebugProject"
if { ! [info exists aGuidsMap($aTkDebugProject)] } {
set aGuidsMap($aTkDebugProject) [OS:genGUID "xcd"]
}
set aTkReleaseProject "${theToolKit}_ReleaseProject"
if { ! [info exists aGuidsMap($aTkReleaseProject)] } {
set aGuidsMap($aTkReleaseProject) [OS:genGUID "xcd"]
}
set aTkDebugNativeTarget "${theToolKit}_DebugNativeTarget"
if { ! [info exists aGuidsMap($aTkDebugNativeTarget)] } {
set aGuidsMap($aTkDebugNativeTarget) [OS:genGUID "xcd"]
}
set aTkReleaseNativeTarget "${theToolKit}_ReleaseNativeTarget"
if { ! [info exists aGuidsMap($aTkReleaseNativeTarget)] } {
set aGuidsMap($aTkReleaseNativeTarget) [OS:genGUID "xcd"]
}
# Debug target
puts $aPbxprojFile "\t\t$aGuidsMap($aTkDebugProject) = \{"
puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
puts $aPbxprojFile "\t\t\tbuildSettings = \{"
puts $aPbxprojFile "\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;"
puts $aPbxprojFile "\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;"
if { "$thePlatform" == "ios" } {
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphoneos\*\]\" = \"\$(ARCHS_STANDARD)\";";
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphonesimulator\*\]\" = \"x86_64\";";
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_MODULES = YES;"
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;"
}
puts $aPbxprojFile "\t\t\t\tARCHS = \"\$(ARCHS_STANDARD_64_BIT)\";"
puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";"
puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++0x\";"
puts $aPbxprojFile "\t\t\t\tCOPY_PHASE_STRIP = NO;"
puts $aPbxprojFile "\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;"
puts $aPbxprojFile "\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;"
puts $aPbxprojFile "\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;"
puts $aPbxprojFile "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = ("
puts $aPbxprojFile "\t\t\t\t\t\"DEBUG=1\","
puts $aPbxprojFile "\t\t\t\t\t\"\$\(inherited\)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;"
puts $aPbxprojFile "\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;"
puts $aPbxprojFile "\t\t\t\tOTHER_LDFLAGS = \"\$(CSF_OPT_LNK64D)\"; "
if { "$thePlatform" == "ios" } {
puts $aPbxprojFile "\t\t\t\tONLY_ACTIVE_ARCH = NO;"
puts $aPbxprojFile "\t\t\t\tSDKROOT = iphoneos;"
} else {
puts $aPbxprojFile "\t\t\t\tONLY_ACTIVE_ARCH = YES;"
}
puts $aPbxprojFile "\t\t\t\};"
puts $aPbxprojFile "\t\t\tname = Debug;"
puts $aPbxprojFile "\t\t\};"
# Release target
puts $aPbxprojFile "\t\t$aGuidsMap($aTkReleaseProject) = \{"
puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
puts $aPbxprojFile "\t\t\tbuildSettings = \{"
puts $aPbxprojFile "\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";"
puts $aPbxprojFile "\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;"
if { "$thePlatform" == "ios" } {
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphoneos\*\]\" = \"\$(ARCHS_STANDARD)\";";
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphonesimulator\*\]\" = \"x86_64\";";
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_MODULES = YES;"
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;"
}
puts $aPbxprojFile "\t\t\t\tARCHS = \"\$(ARCHS_STANDARD_64_BIT)\";"
puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";"
puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++0x\";"
puts $aPbxprojFile "\t\t\t\tCOPY_PHASE_STRIP = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;"
puts $aPbxprojFile "\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;"
puts $aPbxprojFile "\t\t\t\tDEAD_CODE_STRIPPING = NO;"
puts $aPbxprojFile "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 2;"
puts $aPbxprojFile "\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;"
puts $aPbxprojFile "\t\t\t\tOTHER_LDFLAGS = \"\$(CSF_OPT_LNK64)\";"
if { "$thePlatform" == "ios" } {
puts $aPbxprojFile "\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 7.0;"
puts $aPbxprojFile "\t\t\t\tSDKROOT = iphoneos;"
}
puts $aPbxprojFile "\t\t\t\};"
puts $aPbxprojFile "\t\t\tname = Release;"
puts $aPbxprojFile "\t\t\};"
puts $aPbxprojFile "\t\t$aGuidsMap($aTkDebugNativeTarget) = \{"
puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
puts $aPbxprojFile "\t\t\tbuildSettings = \{"
puts $aPbxprojFile "${anExecExtension}"
puts $aPbxprojFile "${anExecPrefix}"
puts $aPbxprojFile "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = ("
foreach aMacro $aTKDefines {
puts $aPbxprojFile "\t\t\t\t\t${aMacro} ,"
}
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tHEADER_SEARCH_PATHS = ("
foreach anIncPath $anIncPaths {
puts $aPbxprojFile "\t\t\t\t\t${anIncPath},"
}
puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_INC)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = ("
foreach anLibPath $anLibPaths {
puts $aPbxprojFile "\t\t\t\t\t${anLibPath},"
}
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tOTHER_CFLAGS = ("
puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_CMPL)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tOTHER_CPLUSPLUSFLAGS = ("
puts $aPbxprojFile "\t\t\t\t\t\"\$(OTHER_CFLAGS)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tPRODUCT_NAME = \"\$(TARGET_NAME)\";"
set anUserHeaderSearchPath "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \""
foreach anIncPath $anIncPaths {
append anUserHeaderSearchPath " ${anIncPath}"
}
append anUserHeaderSearchPath "\";"
puts $aPbxprojFile $anUserHeaderSearchPath
puts $aPbxprojFile "${aWrapperExtension}"
puts $aPbxprojFile "\t\t\t\};"
puts $aPbxprojFile "\t\t\tname = Debug;"
puts $aPbxprojFile "\t\t\};"
puts $aPbxprojFile "\t\t$aGuidsMap($aTkReleaseNativeTarget) = \{"
puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
puts $aPbxprojFile "\t\t\tbuildSettings = \{"
puts $aPbxprojFile "${anExecExtension}"
puts $aPbxprojFile "${anExecPrefix}"
puts $aPbxprojFile "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = ("
foreach aMacro $aTKDefines {
puts $aPbxprojFile "\t\t\t\t\t${aMacro} ,"
}
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tHEADER_SEARCH_PATHS = ("
foreach anIncPath $anIncPaths {
puts $aPbxprojFile "\t\t\t\t\t${anIncPath},"
}
puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_INC)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = ("
foreach anLibPath $anLibPaths {
puts $aPbxprojFile "\t\t\t\t\t${anLibPath},"
}
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tOTHER_CFLAGS = ("
puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_CMPL)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tOTHER_CPLUSPLUSFLAGS = ("
puts $aPbxprojFile "\t\t\t\t\t\"\$(OTHER_CFLAGS)\","
puts $aPbxprojFile "\t\t\t\t);"
puts $aPbxprojFile "\t\t\t\tPRODUCT_NAME = \"\$(TARGET_NAME)\";"
puts $aPbxprojFile $anUserHeaderSearchPath
puts $aPbxprojFile "${aWrapperExtension}"
puts $aPbxprojFile "\t\t\t\};"
puts $aPbxprojFile "\t\t\tname = Release;"
puts $aPbxprojFile "\t\t\};\n"
# End XCBuildConfiguration section
# Begin XCConfigurationList section
puts $aPbxprojFile "\t\t$aGuidsMap($aTkBuildCfgListProj) = \{"
puts $aPbxprojFile "\t\t\tisa = XCConfigurationList;"
puts $aPbxprojFile "\t\tbuildConfigurations = ("
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkDebugProject) ,"
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkReleaseProject) ,"
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tdefaultConfigurationIsVisible = 0;"
puts $aPbxprojFile "\t\t\tdefaultConfigurationName = Release;"
puts $aPbxprojFile "\t\t\};"
puts $aPbxprojFile "\t\t$aGuidsMap($aTkBuildCfgListNativeTarget) = \{"
puts $aPbxprojFile "\t\t\tisa = XCConfigurationList;"
puts $aPbxprojFile "\t\t\tbuildConfigurations = ("
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkDebugNativeTarget) ,"
puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkReleaseNativeTarget) ,"
puts $aPbxprojFile "\t\t\t);"
puts $aPbxprojFile "\t\t\tdefaultConfigurationIsVisible = 0;"
puts $aPbxprojFile "\t\t\tdefaultConfigurationName = Release;"
puts $aPbxprojFile "\t\t\};\n"
# End XCConfigurationList section
puts $aPbxprojFile "\t\};"
puts $aPbxprojFile "\trootObject = $aGuidsMap($aTkProjectObj) ;"
puts $aPbxprojFile "\}"
close $aPbxprojFile
}
proc osutils:xcdx { theOutDir theExecutable theGuidsMap } {
set aUsername [exec whoami]
# Creating folders for Xcode project file.
set anExecutableDir "${theOutDir}/${theExecutable}.xcodeproj"
wokUtils:FILES:mkdir $anExecutableDir
if { ! [file exists $anExecutableDir] } {
puts stderr "Error: Could not create project directory \"$anExecutableDir\""
return
}
set aUserDataDir "${anExecutableDir}/xcuserdata"
wokUtils:FILES:mkdir $aUserDataDir
if { ! [file exists $aUserDataDir] } {
puts stderr "Error: Could not create xcuserdata directory in \"$anExecutableDir\""
return
}
set aUserDataDir "${aUserDataDir}/${aUsername}.xcuserdatad"
wokUtils:FILES:mkdir $aUserDataDir
if { ! [file exists $aUserDataDir] } {
puts stderr "Error: Could not create ${aUsername}.xcuserdatad directory in \"$anExecutableDir\"/xcuserdata"
return
}
set aSchemesDir "${aUserDataDir}/xcschemes"
wokUtils:FILES:mkdir $aSchemesDir
if { ! [file exists $aSchemesDir] } {
puts stderr "Error: Could not create xcschemes directory in \"$aUserDataDir\""
return
}
# End folders creation.
# Generating GUID for toolkit.
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($theExecutable)] } {
set aGuidsMap($theExecutable) [OS:genGUID "xcd"]
}
# Creating xcscheme file for toolkit from template.
set aXcschemeTmpl [osutils:readtemplate "xcscheme" "xcode"]
regsub -all -- {__TOOLKIT_NAME__} $aXcschemeTmpl $theExecutable aXcschemeTmpl
regsub -all -- {__TOOLKIT_GUID__} $aXcschemeTmpl $aGuidsMap($theExecutable) aXcschemeTmpl
set aXcschemeFile [open "$aSchemesDir/${theExecutable}.xcscheme" "w"]
puts $aXcschemeFile $aXcschemeTmpl
close $aXcschemeFile
# Creating xcschememanagement.plist file for toolkit from template.
set aPlistTmpl [osutils:readtemplate "plist" "xcode"]
regsub -all -- {__TOOLKIT_NAME__} $aPlistTmpl $theExecutable aPlistTmpl
regsub -all -- {__TOOLKIT_GUID__} $aPlistTmpl $aGuidsMap($theExecutable) aPlistTmpl
set aPlistFile [open "$aSchemesDir/xcschememanagement.plist" "w"]
puts $aPlistFile $aPlistTmpl
close $aPlistFile
}
# Returns available Windows SDKs versions
proc osutils:sdk { theSdkMajorVer {isQuietMode false} {theSdkDirectories {}} } {
if { ![llength ${theSdkDirectories}] } {
foreach anEnvVar { "ProgramFiles" "ProgramFiles\(x86\)" "ProgramW6432" } {
if {[ info exists ::env(${anEnvVar}) ]} {
lappend theSdkDirectories "$::env(${anEnvVar})/Windows Kits/${theSdkMajorVer}/Include"
}
}
}
set sdk_versions {}
foreach sdk_dir ${theSdkDirectories} {
if { [file isdirectory ${sdk_dir}] } {
lappend sdk_versions [glob -tails -directory "${sdk_dir}" -type d *]
}
}
if {![llength ${sdk_versions}] && !${isQuietMode}} {
error "Error : Could not find Windows SDK ${theSdkMajorVer}"
}
return [join [lsort -unique ${sdk_versions}] " "]
}
# Generate global properties to Visual Studio project file for UWP solution
proc osutils:uwp:proj { isUWP theProjTmpl } {
set uwp_properties ""
set uwp_generate_metadata ""
set uwp_app_container ""
set format_template ""
if { $isUWP } {
set sdk_versions [osutils:sdk 10]
set sdk_max_ver [lindex ${sdk_versions} end]
set uwp_properties "<DefaultLanguage>en-US</DefaultLanguage>\n \
<ApplicationType>Windows Store</ApplicationType>\n \
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>\n \
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>\n \
<AppContainerApplication>true</AppContainerApplication>\n \
<WindowsTargetPlatformVersion>${sdk_max_ver}</WindowsTargetPlatformVersion>\n \
<WindowsTargetPlatformMinVersion>${sdk_max_ver}</WindowsTargetPlatformMinVersion>"
set uwp_generate_metadata "<GenerateWindowsMetadata>false</GenerateWindowsMetadata>"
regsub -all -- {[\r\n\s]*<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>} ${theProjTmpl} "" theProjTmpl
} else {
set format_template "\[\\r\\n\\s\]*"
}
regsub -all -- "${format_template}__UWP_PROPERTIES__" ${theProjTmpl} "${uwp_properties}" theProjTmpl
regsub -all -- "${format_template}__UWP_GENERATE_METADATA__" ${theProjTmpl} "${uwp_generate_metadata}" theProjTmpl
return ${theProjTmpl}
}
# Report all files found in package directory but not listed in FILES
proc osutils:checksrcfiles { theUnit theSrcDir} {
global path
set aCasRoot [file normalize ${path}]
if {![file isdirectory ${aCasRoot}]} {
puts "OCCT directory is not defined correctly: ${aCasRoot}"
return
}
set anUnitAbsPath [file normalize "${aCasRoot}/$theSrcDir/${theUnit}"]
if {[file exists "${anUnitAbsPath}/FILES"]} {
set aFilesFile [open "${anUnitAbsPath}/FILES" rb]
set aFilesFileList [split [read ${aFilesFile}] "\n"]
close ${aFilesFile}
set aFilesFileList [lsearch -inline -all -not -exact ${aFilesFileList} ""]
# report all files not listed in FILES
set anAllFiles [glob -tails -nocomplain -dir ${anUnitAbsPath} "*"]
foreach aFile ${anAllFiles} {
if { "${aFile}" == "FILES" } {
continue
}
if { "${aFile}" == "icons" } {
continue
}
if { [lsearch -exact ${aFilesFileList} ${aFile}] == -1 } {
puts "Warning: file ${anUnitAbsPath}/${aFile} is not listed in ${anUnitAbsPath}/FILES!"
}
}
}
}
|