Skip to content

Commit f123d67

Browse files
committed
Merge pull request #43 from elite-lang/dev
准备发布0.9.2版
2 parents c1eb588 + 4ecc56f commit f123d67

30 files changed

+321
-117
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*.lrsave
66
.clang_complete
77
bin/
8+
lib/
9+
runtime/
810
build/
911
Lex/bin/
1012
Lex/build/

.travis.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
dist: trusty
2-
language: cpp
31
git:
42
depth: 3
53

6-
install:
7-
- sudo apt-get update
8-
- sudo apt-get install -y llvm-3.6-dev libedit-dev flex bison
9-
- sudo sh ./scripts/fix_ubuntu_llvm.sh
4+
compiler:
5+
- gcc
6+
- clang
7+
8+
matrix:
9+
include:
10+
- os: linux
11+
dist: trusty
12+
sudo: required
13+
14+
- os: osx
15+
osx_image: xcode7.3
16+
sudo: required
17+
18+
addons:
19+
apt:
20+
packages:
21+
- llvm-3.6-dev
22+
- libedit-dev
23+
- flex
24+
- bison
25+
26+
before_install:
27+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
28+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install llvm flex bison; fi
29+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo sh ./scripts/fix_ubuntu_llvm.sh; fi
1030
- sudo sh ./scripts/install_gtest.sh
1131
- sudo sh ./scripts/chmod_runnable.sh
1232

Builder/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ cmake_minimum_required(VERSION 2.8)
22
project(Builder)
33

44
if(NOT BUILD_ALL) # BUILD_ALL负责确认是不是所有子项目统一配置构建
5-
SET (CMAKE_BUILD_TYPE Debug)
5+
SET (CMAKE_BUILD_TYPE Debug)
66
SET (CMAKE_CXX_COMPILER_ENV_VAR "clang++")
77
SET (CMAKE_CXX_FLAGS "-std=c++11")
88
SET (CMAKE_CXX_FLAGS_DEBUG "-g")
99
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
1010
SET (CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG")
1111
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
1212
SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
13-
include_directories(../Lex/include
14-
../LR_Scanner/include
15-
../RedApple/includes
13+
include_directories(../Lex/include
14+
../LR_Scanner/include
15+
../RedApple/includes
1616
../MetaScriptRunner/include
1717
)
1818
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
@@ -24,8 +24,8 @@ include_directories(src include ../tools)
2424
file(GLOB_RECURSE source_files ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
2525
if(USE_DYNAMIC)
2626
add_library(builder SHARED ${source_files}) # 使用动态库
27+
install(TARGETS builder RUNTIME DESTINATION bin)
2728
else()
2829
add_library(builder STATIC ${source_files}) # 使用静态库
30+
install(TARGETS builder ARCHIVE DESTINATION lib)
2931
endif()
30-
31-

Builder/src/Builder.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ string Builder::make_default_name(const char* filename) {
239239
str[size+2] = 'c';
240240
str[size+3] = 0;
241241
string s = str;
242-
delete str;
242+
delete[] str;
243243
return s;
244244
}
245245

@@ -281,16 +281,17 @@ int Builder::call_ld(std::string filein, std::string fileout, std::string link_a
281281

282282
#if !defined(_WIN32) && (defined(__linux__) || defined(__APPLE__))
283283
string ld = "clang++";
284+
#else
285+
string ld = "g++";
286+
#endif
284287
string runtime = " -L";
285-
runtime += PathGetter::getEliteToolsPath();
288+
runtime += PathGetter::getEliteHome();
286289
runtime += "/runtime/";
290+
runtime += " -L";
291+
runtime += PathGetter::getEliteHome();
292+
runtime += "/extlib/lib/";
287293
string args = runtime + " -o " + fileout + " " + filein + link_args + " -lruntime -ldyncall_s";
288294
ld += args;
289295
printf("ld: %s\n", ld.c_str());
290296
return system(ld.c_str());
291-
#endif
292-
#if defined(_WIN32)
293-
294-
#endif
295-
return 0;
296297
}

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Change Log
22
===============
33

4+
### v0.9.2
5+
新增添了windows下的打包
6+
增加了mac下的编译和测试
7+
8+
9+
### v0.9.1
10+
添加了新的预处理器
11+
添加了打包脚本
12+
添加了Mac平台的测试
13+
14+
415
### v0.9.0
516

617
添加了GC系统

CMakeLists.txt

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
cmake_minimum_required(VERSION 2.8)
22
project(Elite)
33

4+
SET(VERSION_MAJOR "0")
5+
SET(VERSION_MINOR "9")
6+
SET(VERSION_PATCH "2")
7+
48
SET (CMAKE_BUILD_TYPE Debug) # 默认构建Debug模式
59

610
if(UNIX)
@@ -15,10 +19,10 @@ elseif(WIN32)
1519
include(cmake/WindowsLLVM.cmake) # 寻找LLVM
1620
endif()
1721

18-
19-
2022
## 配置输出目录
21-
SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
23+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin )
24+
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib )
25+
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib )
2226

2327
## include路径配置
2428
include_directories(src extlib/include
@@ -44,6 +48,15 @@ add_subdirectory(RedApple)
4448
add_subdirectory(MetaScriptRunner)
4549
add_subdirectory(Builder)
4650

51+
set_target_properties( runtime
52+
PROPERTIES
53+
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/runtime"
54+
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/runtime"
55+
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/runtime"
56+
)
57+
58+
59+
4760
file(GLOB_RECURSE source_files ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
4861
add_executable(elite ${source_files})
4962

@@ -52,20 +65,25 @@ if(UNIX)
5265
set (dl_lib_link dl)
5366
endif()
5467

55-
target_link_libraries(elite builder meta red scanner lex lua exiconv
56-
${LLVM_LIBS} ${dl_lib_link})
57-
5868
if (CMAKE_BUILD_TYPE EQUAL "Debug")
59-
target_link_libraries(elite oolua_d)
69+
set (oolua_lib oolua_d)
6070
else()
61-
target_link_libraries(elite oolua)
71+
set (oolua_lib oolua)
6272
endif()
6373

6474

75+
target_link_libraries(elite builder meta red scanner lex ${oolua_lib} lua exiconv iconv charsetdetect charset
76+
${LLVM_LIBS} ${dl_lib_link})
77+
78+
79+
80+
6581
## 合并Headers
6682
include(cmake/CombineHeader.cmake)
6783

6884
## 下载第三方库
6985
include(cmake/ThirdPartyBuild.cmake)
7086

7187
add_subdirectory(doc)
88+
89+
include(cmake/Install.cmake)

ExIconv/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
1313

1414
include_directories(../extlib/include)
1515
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../extlib/lib)
16-
16+
1717
endif()
1818

1919

@@ -24,7 +24,9 @@ file(GLOB_RECURSE source_files ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
2424
add_library(exiconv STATIC ${source_files})
2525
target_link_libraries(exiconv iconv charsetdetect)
2626

27+
install(TARGETS exiconv ARCHIVE DESTINATION lib)
28+
2729

2830
if(BUILD_TEST)
2931
add_subdirectory(test)
30-
endif()
32+
endif()

ExIconv/include/DebugMsg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class DebugMsg
3838
static std::ostream& lex_dbg();
3939
static void lex_close();
4040

41+
static std::ostream& lex_save();
42+
static void lex_save_close();
4143
/**
4244
* @brief 获取解析器的debug输出文件流
4345
*/

ExIconv/src/DebugMsg.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ class DebugMsg_Private
1818
bool is_debug_mode;
1919

2020
fstream lex_dbg_fs;
21+
fstream lex_save_fs;
22+
2123
fstream parser_dbg_fs;
2224
fstream parser_save_fs;
25+
2326
fstream red_dbg_fs;
2427

2528
fstream lex_graphviz_fs;
@@ -65,6 +68,20 @@ void DebugMsg::lex_close() {
6568
fs.close();
6669
}
6770

71+
std::ostream& DebugMsg::lex_save() {
72+
auto& fs = getInstance()->lex_save_fs;
73+
if(!fs.is_open()) {
74+
fs.open(getInstance()->dbg_file_path+"/parser.json", std::ios::out);
75+
}
76+
return fs;
77+
}
78+
79+
void DebugMsg::lex_save_close() {
80+
auto& fs = getInstance()->lex_save_fs;
81+
fs.close();
82+
}
83+
84+
6885
/**
6986
* @brief 获取解析器的debug输出文件流
7087
*/

ExIconv/test/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
enable_testing()
22
find_package(GTest REQUIRED)
33

4-
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
4+
include(../../cmake/ClangConf.cmake)
5+
6+
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
57
include_directories (${GTEST_INCLUDE_DIRS})
68
file(GLOB_RECURSE test_source_files ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
79

810
add_executable (estring_test ${test_source_files})
911

10-
target_link_libraries(estring_test exiconv iconv charsetdetect ${GTEST_BOTH_LIBRARIES} pthread)
12+
target_link_libraries(estring_test exiconv iconv charsetdetect charset ${GTEST_BOTH_LIBRARIES} pthread)
1113

1214
add_test(EstringTest estring_test)
1315

@@ -16,4 +18,4 @@ add_custom_target( runtest ALL
1618

1719
add_custom_command(TARGET runtest
1820
POST_BUILD
19-
COMMAND estring_test)
21+
COMMAND estring_test)

0 commit comments

Comments
 (0)