aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-11-15 17:23:46 +0800
committerLi Jin <dragon-fly@qq.com>2022-11-15 17:52:09 +0800
commit94f8330613877b3582d32bd11abd83a97b4399ad (patch)
tree5359de314be1ebde17f8d1e48632a97d18f9e50f /CMakeLists.txt
parent60f8f00a022ac08701792b2897b72d8c99b50f52 (diff)
downloadyuescript-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.txt108
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)
31include_directories(src src/3rdParty ${LUA_INCLUDE_DIR}) 31include_directories(src src/3rdParty ${LUA_INCLUDE_DIR})
32add_definitions(-std=c++17 -O3 -fPIC) 32add_definitions(-std=c++17 -O3 -fPIC)
33 33
34add_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) 34add_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)
35set_target_properties(libyue PROPERTIES PREFIX "") 41set_target_properties(libyue PROPERTIES PREFIX "")
36set_target_properties(libyue PROPERTIES OUTPUT_NAME "yue") 42set_target_properties(libyue PROPERTIES OUTPUT_NAME "yue")
37target_link_libraries(libyue ${LUA_LIBRARIES}) 43target_link_libraries(libyue ${LUA_LIBRARIES})
38 44
45add_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
54target_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
74if (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 )
81else ()
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 )
88endif()
89
90if (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()
101elseif (WIN32)
102 target_sources(yue PRIVATE
103 src/3rdParty/efsw/FileWatcherWin32.cpp
104 src/3rdParty/efsw/WatcherWin32.cpp
105 )
106elseif (${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()
115elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
116 target_sources(yue PRIVATE
117 src/3rdParty/efsw/FileWatcherKqueue.cpp
118 src/3rdParty/efsw/WatcherKqueue.cpp
119 )
120endif()
121
122if (MSVC)
123 target_compile_definitions(yue PRIVATE _SCL_SECURE_NO_WARNINGS)
124else ()
125 target_compile_options(yue PRIVATE -Wall -Wno-long-long -fPIC)
126endif()
127
128if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
129 target_compile_definitions(yue PRIVATE DEBUG)
130elseif (${CMAKE_BUILD_TYPE} MATCHES "Release")
131 target_compile_definitions(yue PRIVATE NDEBUG)
132endif()
133
39find_package(Threads REQUIRED) 134find_package(Threads REQUIRED)
40add_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) 135if (APPLE)
41target_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)
138elseif (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Haiku") AND NOT WIN32)
139 target_link_libraries(yue PRIVATE ${LUA_LIBRARIES} Threads::Threads)
140else ()
141 target_link_libraries(yue PRIVATE ${LUA_LIBRARIES})
142endif()
143
42IF(CMAKE_DL_LIBS) 144IF(CMAKE_DL_LIBS)
43 target_link_libraries(yue ${CMAKE_DL_LIBS}) 145 target_link_libraries(yue ${CMAKE_DL_LIBS})
44ENDIF(CMAKE_DL_LIBS) 146ENDIF(CMAKE_DL_LIBS)