diff options
author | Li Jin <dragon-fly@qq.com> | 2022-11-15 17:23:46 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-11-15 17:52:09 +0800 |
commit | 94f8330613877b3582d32bd11abd83a97b4399ad (patch) | |
tree | 5359de314be1ebde17f8d1e48632a97d18f9e50f /CMakeLists.txt | |
parent | 60f8f00a022ac08701792b2897b72d8c99b50f52 (diff) | |
download | yuescript-94f8330613877b3582d32bd11abd83a97b4399ad.tar.gz yuescript-94f8330613877b3582d32bd11abd83a97b4399ad.tar.bz2 yuescript-94f8330613877b3582d32bd11abd83a97b4399ad.zip |
adding -w option to Yuescript tool.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 108 |
1 files changed, 105 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 031af18..7532f81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -31,14 +31,116 @@ enable_language(CXX) | |||
31 | include_directories(src src/3rdParty ${LUA_INCLUDE_DIR}) | 31 | include_directories(src src/3rdParty ${LUA_INCLUDE_DIR}) |
32 | add_definitions(-std=c++17 -O3 -fPIC) | 32 | add_definitions(-std=c++17 -O3 -fPIC) |
33 | 33 | ||
34 | add_library(libyue MODULE src/yuescript/ast.cpp src/yuescript/parser.cpp src/yuescript/yue_parser.cpp src/yuescript/yue_compiler.cpp src/yuescript/yuescript.cpp) | 34 | add_library(libyue MODULE |
35 | src/yuescript/ast.cpp | ||
36 | src/yuescript/parser.cpp | ||
37 | src/yuescript/yue_parser.cpp | ||
38 | src/yuescript/yue_compiler.cpp | ||
39 | src/yuescript/yuescript.cpp | ||
40 | ) | ||
35 | set_target_properties(libyue PROPERTIES PREFIX "") | 41 | set_target_properties(libyue PROPERTIES PREFIX "") |
36 | set_target_properties(libyue PROPERTIES OUTPUT_NAME "yue") | 42 | set_target_properties(libyue PROPERTIES OUTPUT_NAME "yue") |
37 | target_link_libraries(libyue ${LUA_LIBRARIES}) | 43 | target_link_libraries(libyue ${LUA_LIBRARIES}) |
38 | 44 | ||
45 | add_executable(yue | ||
46 | src/yuescript/ast.cpp | ||
47 | src/yuescript/yue_compiler.cpp | ||
48 | src/yuescript/yue_parser.cpp | ||
49 | src/yuescript/yuescript.cpp | ||
50 | src/yuescript/parser.cpp | ||
51 | src/yue.cpp | ||
52 | ) | ||
53 | |||
54 | target_sources(yue PRIVATE | ||
55 | src/3rdParty/efsw/Debug.cpp | ||
56 | src/3rdParty/efsw/DirectorySnapshot.cpp | ||
57 | src/3rdParty/efsw/DirectorySnapshotDiff.cpp | ||
58 | src/3rdParty/efsw/DirWatcherGeneric.cpp | ||
59 | src/3rdParty/efsw/FileInfo.cpp | ||
60 | src/3rdParty/efsw/FileSystem.cpp | ||
61 | src/3rdParty/efsw/FileWatcher.cpp | ||
62 | src/3rdParty/efsw/FileWatcherCWrapper.cpp | ||
63 | src/3rdParty/efsw/FileWatcherGeneric.cpp | ||
64 | src/3rdParty/efsw/FileWatcherImpl.cpp | ||
65 | src/3rdParty/efsw/Log.cpp | ||
66 | src/3rdParty/efsw/Mutex.cpp | ||
67 | src/3rdParty/efsw/String.cpp | ||
68 | src/3rdParty/efsw/System.cpp | ||
69 | src/3rdParty/efsw/Thread.cpp | ||
70 | src/3rdParty/efsw/Watcher.cpp | ||
71 | src/3rdParty/efsw/WatcherGeneric.cpp | ||
72 | ) | ||
73 | |||
74 | if (WIN32) | ||
75 | target_sources(yue PRIVATE | ||
76 | src/3rdParty/efsw/platform/win/FileSystemImpl.cpp | ||
77 | src/3rdParty/efsw/platform/win/MutexImpl.cpp | ||
78 | src/3rdParty/efsw/platform/win/SystemImpl.cpp | ||
79 | src/3rdParty/efsw/platform/win/ThreadImpl.cpp | ||
80 | ) | ||
81 | else () | ||
82 | target_sources(yue PRIVATE | ||
83 | src/3rdParty/efsw/platform/posix/FileSystemImpl.cpp | ||
84 | src/3rdParty/efsw/platform/posix/MutexImpl.cpp | ||
85 | src/3rdParty/efsw/platform/posix/SystemImpl.cpp | ||
86 | src/3rdParty/efsw/platform/posix/ThreadImpl.cpp | ||
87 | ) | ||
88 | endif() | ||
89 | |||
90 | if (APPLE) | ||
91 | target_sources(yue PRIVATE | ||
92 | src/3rdParty/efsw/FileWatcherFSEvents.cpp | ||
93 | src/3rdParty/efsw/FileWatcherKqueue.cpp | ||
94 | src/3rdParty/efsw/WatcherFSEvents.cpp | ||
95 | src/3rdParty/efsw/WatcherKqueue.cpp | ||
96 | ) | ||
97 | |||
98 | if (NOT CMAKE_SYSTEM_VERSION GREATER 9) | ||
99 | target_compile_definitions(yue PRIVATE EFSW_FSEVENTS_NOT_SUPPORTED) | ||
100 | endif() | ||
101 | elseif (WIN32) | ||
102 | target_sources(yue PRIVATE | ||
103 | src/3rdParty/efsw/FileWatcherWin32.cpp | ||
104 | src/3rdParty/efsw/WatcherWin32.cpp | ||
105 | ) | ||
106 | elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
107 | target_sources(yue PRIVATE | ||
108 | src/3rdParty/efsw/FileWatcherInotify.cpp | ||
109 | src/3rdParty/efsw/WatcherInotify.cpp | ||
110 | ) | ||
111 | |||
112 | if (NOT EXISTS "/usr/include/sys/inotify.h" AND NOT EXISTS "/usr/local/include/sys/inotify.h") | ||
113 | target_compile_definitions(yue PRIVATE EFSW_INOTIFY_NOSYS) | ||
114 | endif() | ||
115 | elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") | ||
116 | target_sources(yue PRIVATE | ||
117 | src/3rdParty/efsw/FileWatcherKqueue.cpp | ||
118 | src/3rdParty/efsw/WatcherKqueue.cpp | ||
119 | ) | ||
120 | endif() | ||
121 | |||
122 | if (MSVC) | ||
123 | target_compile_definitions(yue PRIVATE _SCL_SECURE_NO_WARNINGS) | ||
124 | else () | ||
125 | target_compile_options(yue PRIVATE -Wall -Wno-long-long -fPIC) | ||
126 | endif() | ||
127 | |||
128 | if (${CMAKE_BUILD_TYPE} MATCHES "Debug") | ||
129 | target_compile_definitions(yue PRIVATE DEBUG) | ||
130 | elseif (${CMAKE_BUILD_TYPE} MATCHES "Release") | ||
131 | target_compile_definitions(yue PRIVATE NDEBUG) | ||
132 | endif() | ||
133 | |||
39 | find_package(Threads REQUIRED) | 134 | find_package(Threads REQUIRED) |
40 | add_executable(yue src/yuescript/ast.cpp src/yuescript/yue_compiler.cpp src/yuescript/yue_parser.cpp src/yuescript/yuescript.cpp src/yuescript/parser.cpp src/yue.cpp) | 135 | if (APPLE) |
41 | target_link_libraries(yue ${LUA_LIBRARIES} Threads::Threads) | 136 | set(MAC_LIBS "-framework CoreFoundation" "-framework CoreServices") |
137 | target_link_libraries(yue PRIVATE ${LUA_LIBRARIES} ${MAC_LIBS} Threads::Threads) | ||
138 | elseif (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Haiku") AND NOT WIN32) | ||
139 | target_link_libraries(yue PRIVATE ${LUA_LIBRARIES} Threads::Threads) | ||
140 | else () | ||
141 | target_link_libraries(yue PRIVATE ${LUA_LIBRARIES}) | ||
142 | endif() | ||
143 | |||
42 | IF(CMAKE_DL_LIBS) | 144 | IF(CMAKE_DL_LIBS) |
43 | target_link_libraries(yue ${CMAKE_DL_LIBS}) | 145 | target_link_libraries(yue ${CMAKE_DL_LIBS}) |
44 | ENDIF(CMAKE_DL_LIBS) | 146 | ENDIF(CMAKE_DL_LIBS) |