diff options
author | Li Jin <dragon-fly@qq.com> | 2021-01-11 14:53:31 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-01-11 14:53:31 +0800 |
commit | 6dc11dccc6c8147b5b71c86be7e458eebc35f8c5 (patch) | |
tree | 3ee6e603d1271b0525df2ab8ceddd71a9c47399c | |
parent | a191b6cd5ba938714203721e342e0af8c0ce569f (diff) | |
download | yuescript-6dc11dccc6c8147b5b71c86be7e458eebc35f8c5.tar.gz yuescript-6dc11dccc6c8147b5b71c86be7e458eebc35f8c5.tar.bz2 yuescript-6dc11dccc6c8147b5b71c86be7e458eebc35f8c5.zip |
add all the compiler specific linker flags.
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | makefile | 4 | ||||
-rw-r--r-- | src/ghc/fs_std.hpp | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7374e1c..1fcb248 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -26,7 +26,7 @@ MESSAGE(STATUS "Lua library: ${LUA_LIBRARIES}") | |||
26 | 26 | ||
27 | enable_language( CXX ) | 27 | enable_language( CXX ) |
28 | include_directories( src ${LUA_INCLUDE_DIR} ) | 28 | include_directories( src ${LUA_INCLUDE_DIR} ) |
29 | add_definitions( -std=c++17 -O3 -fPIC -lstdc++fs -ldl -Wno-unused-command-line-argument ) | 29 | add_definitions( -std=c++17 -O3 -fPIC ) |
30 | 30 | ||
31 | add_library( libmoonp MODULE src/MoonP/ast.cpp src/MoonP/parser.cpp src/MoonP/moon_parser.cpp src/MoonP/moon_compiler.cpp src/MoonP/moonplus.cpp) | 31 | add_library( libmoonp MODULE src/MoonP/ast.cpp src/MoonP/parser.cpp src/MoonP/moon_parser.cpp src/MoonP/moon_compiler.cpp src/MoonP/moonplus.cpp) |
32 | set_target_properties( libmoonp PROPERTIES PREFIX "" ) | 32 | set_target_properties( libmoonp PROPERTIES PREFIX "" ) |
@@ -35,6 +35,9 @@ target_link_libraries( libmoonp ${LUA_LIBRARIES} ) | |||
35 | 35 | ||
36 | add_executable( moonp src/MoonP/ast.cpp src/MoonP/moon_compiler.cpp src/MoonP/moon_parser.cpp src/MoonP/moonplus.cpp src/MoonP/parser.cpp src/moonp.cpp ) | 36 | add_executable( moonp src/MoonP/ast.cpp src/MoonP/moon_compiler.cpp src/MoonP/moon_parser.cpp src/MoonP/moonplus.cpp src/MoonP/parser.cpp src/moonp.cpp ) |
37 | target_link_libraries( moonp ${LUA_LIBRARIES} ) | 37 | target_link_libraries( moonp ${LUA_LIBRARIES} ) |
38 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
39 | target_link_options( moonp PRIVATE -ldl -lpthread -lstdc++fs ) | ||
40 | endif() | ||
38 | 41 | ||
39 | install(CODE "") | 42 | install(CODE "") |
40 | 43 | ||
@@ -53,7 +53,7 @@ endif | |||
53 | 53 | ||
54 | # Add platform related linker flag | 54 | # Add platform related linker flag |
55 | ifneq ($(UNAME_S),Darwin) | 55 | ifneq ($(UNAME_S),Darwin) |
56 | LINK_FLAGS += -lstdc++fs | 56 | LINK_FLAGS += -lstdc++fs -Wl,-E |
57 | endif | 57 | endif |
58 | 58 | ||
59 | # Function used to check variables. Use on the command line: | 59 | # Function used to check variables. Use on the command line: |
@@ -268,7 +268,7 @@ all: $(BIN_PATH)/$(BIN_NAME) | |||
268 | $(BIN_PATH)/$(BIN_NAME): $(OBJECTS) | 268 | $(BIN_PATH)/$(BIN_NAME): $(OBJECTS) |
269 | @echo "Linking: $@" | 269 | @echo "Linking: $@" |
270 | @$(START_TIME) | 270 | @$(START_TIME) |
271 | $(CMD_PREFIX)$(CXX) $(OBJECTS) $(LDFLAGS) -o $@ -Wl,-E | 271 | $(CMD_PREFIX)$(CXX) $(OBJECTS) $(LDFLAGS) -o $@ |
272 | @echo -en "\t Link time: " | 272 | @echo -en "\t Link time: " |
273 | @$(END_TIME) | 273 | @$(END_TIME) |
274 | 274 | ||
diff --git a/src/ghc/fs_std.hpp b/src/ghc/fs_std.hpp index a38f38a..d8e03b8 100644 --- a/src/ghc/fs_std.hpp +++ b/src/ghc/fs_std.hpp | |||
@@ -30,7 +30,7 @@ | |||
30 | // namespace fs. | 30 | // namespace fs. |
31 | //--------------------------------------------------------------------------------------- | 31 | //--------------------------------------------------------------------------------------- |
32 | #ifndef GHC_FILESYSTEM_STD_H | 32 | #ifndef GHC_FILESYSTEM_STD_H |
33 | #if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) | 33 | #if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && (!defined(__GNUC__) || __GNUC__ >= 9) |
34 | #if __has_include(<filesystem>) | 34 | #if __has_include(<filesystem>) |
35 | #define GHC_USE_STD_FS | 35 | #define GHC_USE_STD_FS |
36 | #include <filesystem> | 36 | #include <filesystem> |