@@ -5,24 +5,21 @@ fn main() {
55 build_lua_seri ( ) ;
66 build_lpeglabel ( ) ;
77 cfg ! ( windows) . then ( || build_setfilemode ( ) ) ;
8+ build_emmyluacodestyle ( ) ;
89}
910
1011fn build_lua ( ) {
1112 cc:: Build :: new ( )
1213 . include ( "3rd/lua" )
13- . files (
14- std:: fs:: read_dir ( "3rd/lua" )
15- . unwrap ( )
16- . filter_map ( |entry| {
17- let entry = entry. unwrap ( ) ;
18- let path = entry. path ( ) ;
19- if path. extension ( ) ?. to_str ( ) ? == "c" {
20- Some ( path)
21- } else {
22- None
23- }
24- } ) ,
25- )
14+ . files ( std:: fs:: read_dir ( "3rd/lua" ) . unwrap ( ) . filter_map ( |entry| {
15+ let entry = entry. unwrap ( ) ;
16+ let path = entry. path ( ) ;
17+ if path. extension ( ) ?. to_str ( ) ? == "c" {
18+ Some ( path)
19+ } else {
20+ None
21+ }
22+ } ) )
2623 . compile ( "lua" ) ;
2724}
2825
@@ -83,4 +80,43 @@ fn build_setfilemode() {
8380 } ) ,
8481 )
8582 . compile ( "setfilemode" ) ;
86- }
83+ }
84+
85+ fn build_emmyluacodestyle ( ) {
86+ let mut builder = cc:: Build :: new ( ) ;
87+ builder. cpp ( true ) ;
88+ builder
89+ . include ( "3rd/EmmyLuaCodeStyle/Util/include" )
90+ . include ( "3rd/EmmyLuaCodeStyle/CodeFormatCore/include" )
91+ . include ( "3rd/EmmyLuaCodeStyle/LuaParser/include" )
92+ . include ( "3rd/EmmyLuaCodeStyle/3rd/wildcards/include" )
93+ . include ( "3rd/lua" ) ;
94+
95+ let file_patterns = vec ! [
96+ "3rd/EmmyLuaCodeStyle/CodeFormatLib/src/*.cpp" ,
97+ "3rd/EmmyLuaCodeStyle/LuaParser/src/**/*.cpp" ,
98+ "3rd/EmmyLuaCodeStyle/Util/src/StringUtil.cpp" ,
99+ "3rd/EmmyLuaCodeStyle/Util/src/Utf8.cpp" ,
100+ "3rd/EmmyLuaCodeStyle/Util/src/SymSpell/*.cpp" ,
101+ "3rd/EmmyLuaCodeStyle/Util/src/InfoTree/*.cpp" ,
102+ "3rd/EmmyLuaCodeStyle/CodeFormatCore/src/**/*.cpp" ,
103+ ] ;
104+
105+ for pattern in file_patterns {
106+ if pattern. contains ( "*" ) {
107+ builder. files ( glob:: glob ( pattern) . unwrap ( ) . filter_map ( |path| path. ok ( ) ) ) ;
108+ } else {
109+ builder. file ( pattern) ;
110+ }
111+ }
112+
113+ if cfg ! ( windows) {
114+ builder. flag ( "/utf-8" ) ;
115+ builder. flag ( "/std:c++17" ) ;
116+ }
117+ else {
118+ builder. flag ( "-std=c++17" ) ;
119+ }
120+
121+ builder. compile ( "EmmyLuaCodeStyle" ) ;
122+ }
0 commit comments