ÔںõĻúÆ÷ÉÏÓÃMDK±àÒ빤³Ì£¬¸Ð¾õ»¹ºÃ£¬µ«ÊÇÔÚÎÒµÄÀϵçÄÔÉÏÓÃMDK±àÒ룬ÄÇÊÇÕæµÄÄѵȡ£ÓÃÁËScons+VScodeÖ®ºó£¬¸Ð¾õÕ⹤¾ßÄÇÊÇÏ൱µÄºÃÓᣵ«ÊÇÓõŤ¾ßÊÇÈ˼ÒдºÃµÄ£¬ÕâÀï×¼±¸Ñ§Ï°Scons¡£
SconsÊÇmakeµÄÉý¼¶²úÆ·£¬Ëü×öµÄÊÂÇé¸úmakeÒ»Ñù£¬µ«¸ü¼òµ¥£¬¸üÈÝÒס£
SconsÊÇÒ»¸ö¿ª·ÅÔ´Â룬ÒÔPythonÓïÑÔ±àÂëµÄ×Ô¶¯»¯¹¹½¨¹¤¾ß£¬¿ÉÓÃÀ´Ìæ´úmake±àд¸´ÔÓµÄmakefile¡£²¢ÇÒsconsÊÇ¿çƽ̨µÄ£¬Ö»Òªscons½Å±¾Ð´µÄºÃ£¬¿ÉÒÔÔÚlinuxºÍWindowsÒÔ¼°macosÏÂËæÒâ±àÒë¡£
SconsµÄÉè¼ÆÄ¿µÄ¾ÍÊÇÈÿª·¢ÈËÔ±¸üÈÝÒ×£¬¸ü¿É¿¿ºÍ¸ü¿ìËٵĽ¨ÔìÈí¼þ¡£
Ó봫ͳµÄmake¹¤¾ß±È½Ï£¬SCons¾ßÓÐÒÔÏÂÓŵ㣺
SconsʹÓÃ
°²×°
ÔÚSConsµÄ¹Ù·½ÍøÕ¾ÉÏ¿ÉÒԲ鵽ÿ¸öƽ̨µÄ¾ßÌå°²×°·½·¨¡£
Winƽ̨ϵÄÏÂÔغͰ²×°£¬¿ÉÒÔһ·NEXT¡£
LinuxÏÂÏÂÔØtar°ü£¬Ö´ÐÐÒÔÏÂÃüÁî¼´¿É£º
tar -zxf scons-2.0.1.tar.gz
cd scons-2.0.1
sudo python3 setup.py install
¶ÔÓÚLinuxÀ´Ëµ£¬scons»áĬÈÏ°²×°µ½/usr/local/binĿ¼Ï£¬¶øÔÚWindowsƽ̨ÉÏ£¬Ôò»á±»°²×°µ½Python3\ScriptĿ¼Ï¡£
ʹÓÃ
ÕâÀïͨ¹ýÒ»¸ö¼òµ¥µÄʾÀýÀ´ËµÃ÷¡£
Ò»¸öhello.cÔ´Îļþ£¬Ò»¸öSConsturctÎļþ
hello.c:
#include <stdio.h>
int main(void)
{
printf("hello,scons!\n");
return 0;
}
SConstruct
Program("hello.c")
ÔËÐÐScons,µÃµ½½á¹ûÈçÏ£º
liujianhuadeiMac:myscons liujianhua$ cat SConstruct
Program("hello.c")
liujianhuadeiMac:myscons liujianhua$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o hello.o -c hello.c
gcc -o hello hello.o
scons: done building targets.
liujianhuadeiMac:myscons liujianhua$ ./hello
hello,scons!
liujianhuadeiMac:myscons liujianhua$ ls
SConstruct hello hello.c hello.o
liujianhuadeiMac:myscons liujianhua$
ÔÚÉÏÃæµÄÔËÐнá¹ûÀïÃæÎÒÃÇ¿´µ½£¬³ÌÐòµÄ±àÒëÓëmakeûÓÐʲôÁ½Ñù£¬Í¬ÑùµÄ²Ù×÷£¬Ö»ÊÇ°Ñscons»»³Émake£¬SConstruct»»³ÉMakefile¡£SconsÏà±ÈMakefile¼òµ¥ºÜ¶à¡£
SconstructÒÔPython½Å±¾µÄÓï·¨±àд£¬Äã¿ÉÒÔÏñ±àдPython¶Ç×Ó±¾Ò»ÑùÀ´±àдËû¡£ÆäÖеÄProgramÊDZàÒëµÄÀàŪ£¬ËµÃ÷Äã×¼±¸Ï뽨һ¸ö¿ÉÖ´ÐеĶþ½øÖƳÌÐò£¬ËüÓÉhello.cÎļþÀ´Éú³É¡£
ÔÚÕâÀûÓÐÖ¸¶¨Éú³ÉµÄ¿ÉÀ©ÐгÌÐòµÄÃû×Ö£¬SCons»á°ÑÔ´´úÂëÎļþÃû×ֵĺó׺ȥµô£¬ÓÃÀ´×÷Ϊ¿ÉÖ´ÐÐÎļþµÄÃû×Ö¡£
ÎÒÃÇÉõÖÁ²»ÐèÒªÏñMakefileÄÇÑùÖ¸¶¨ÇåÀíµÄ¶¯×÷£¬¾Í¿ÉÒÔÀ©ÐÐÇåÀíÈÎÎñ¡£ÔÚSConsÖУ¬Ö´ÐÐÇåÀíÈÎÎñÓɲÎÊý-cÖ¸¶¨£¬ÈçÏ£º
liujianhuadeiMac:myscons liujianhua$ scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed hello.o
Removed hello
scons: done cleaning targets.
liujianhuadeiMac:myscons liujianhua$ ls
SConstruct hello.c
liujianhuadeiMac:myscons liujianhua$
ÒýÓÃ: damiaa ·¢±íÓÚ 2023-4-20 10:00 ºÃ¶«Î÷¡£Â¥Ö÷ÓúÃÁ˶à½éÉܽéÉÜ¡£
¶àл¹Ø×¢£¬ÕýÔÚŬÁ¦Ñ§Ï°ÖУ¬ÕùÈ¡ÒÔºó±à¼Æ÷Óë±àÒëÆ÷·ÖÀ룬ÕâÑù×ÔÓɶȾͺã¬ÏÖÔÚÕû¸ö±àÒë»·¾³ÄÇÊÇÏ൱µÄÀÛ¡£
scons¹¤¾ßÊÇרÃÅΪC¹¤³ÌÉè¼ÆµÄ±àÒ빤¾ß°É£¿
ÒýÓÃ: fxyc87 ·¢±íÓÚ 2023-4-20 14:30 ¸Ð¾õÌ«Âé·³ÁË£¬¼òµ¥µÄÏîÄ¿Åú´¦Àíµ÷ÓþÍÐÐÁË¡£
ÎҸоõÕâ¸öͦºÃµÄ£¬ÌرðÊÇ´¦Àí´ó¹¤³Ìʱ¡£
ÒýÓÃ: wangerxian ·¢±íÓÚ 2023-4-20 14:33 scons¹¤¾ßÊÇרÃÅΪC¹¤³ÌÉè¼ÆµÄ±àÒ빤¾ß°É£¿
C++Ò²Ö§³Ö°É£¬¿ÉÒÔÓõķ¶Î§ºÜ¶à¡£
ÒýÓÃ: ÇØÌìqintian0303 ·¢±íÓÚ 2023-4-20 15:11 VScodeͦºÃÓõģ¬Õâ¸öÈí¼þÏà¶ÔÀ´ËµÐ¡ºÜ¶à
vscode+scons,ÄDzÅÊǾøÅä°É¡£
ÒýÓÃ: lugl4313820 ·¢±íÓÚ 2023-4-20 15:42 C++Ò²Ö§³Ö°É£¬¿ÉÒÔÓõķ¶Î§ºÜ¶à¡£
¶Ô£¬C++/C±àÒ빤¾ß£¬±Ï¾¹ÊÇÒ»¼ÒÈË¡£
ÒýÓÃ: lugl4313820 ·¢±íÓÚ 2023-4-20 15:42 vscode+scons,ÄDzÅÊǾøÅä°É¡£
scons¶¼Ö§³Öʲô±àÒë°¡£¿
ÒýÓÃ: ÇØÌìqintian0303 ·¢±íÓÚ 2023-4-21 08:39 scons¶¼Ö§³Öʲô±àÒë°¡£¿
make ÄÜÖ§³ÖµÄËü¶¼ÄÜÖ§³Ö£¬Ëû¾ÍÊÇÓÃpythonдÁËÒ»¸ö½Å±¾£¬È¥µ÷ÓÃmake£¬±È½ÏÖÇÄÜһЩ¡£
ÒýÓÃ: freebsder ·¢±íÓÚ 2023-4-28 15:40 SconsÓõÄÈ˲»¶à°É£¬Ïà±È½ÏÏÖÔÚ»¹ÊÇcmakeÖ÷Á÷һЩ¡£
RT-ThreadÊÇÓÃÕâ¸ö¡£×î½üѧϰrtthread,ËùÒÔѧϰһÏ£¬Ïà±ÈcmakeÒª¼òµ¥Ò»Ð©¡£