aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/replxx/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-03 17:45:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-03 17:45:58 +0100
commit669cd52f685282289590200daed3fc89466e7206 (patch)
tree792c26273dd54dab61b5e94693e1895ff9c5440c /contrib/replxx/CMakeLists.txt
parent8a240656d8378ac20e4c4c3ae61d1a9c33488a20 (diff)
downloadrspamd-669cd52f685282289590200daed3fc89466e7206.tar.gz
rspamd-669cd52f685282289590200daed3fc89466e7206.zip
[Rework] Replace linenoise with replxx
Source: https://github.com/AmokHuginnsson/replxx
Diffstat (limited to 'contrib/replxx/CMakeLists.txt')
-rw-r--r--contrib/replxx/CMakeLists.txt82
1 files changed, 82 insertions, 0 deletions
diff --git a/contrib/replxx/CMakeLists.txt b/contrib/replxx/CMakeLists.txt
new file mode 100644
index 000000000..a2dcf2dd1
--- /dev/null
+++ b/contrib/replxx/CMakeLists.txt
@@ -0,0 +1,82 @@
+# -*- mode: CMAKE; -*-
+
+cmake_minimum_required(VERSION 3.0)
+
+project( replxx VERSION 0.0.2 LANGUAGES CXX C )
+message(STATUS "Build mode: ${CMAKE_BUILD_TYPE}")
+
+# INFO
+set(REPLXX_DISPLAY_NAME "replxx")
+set(REPLXX_URL_INFO_ABOUT "https://github.com/AmokHuginnsson/replxx")
+set(REPLXX_CONTACT "amok@codestation.org")
+set(REPLXX_FRIENDLY_STRING "replxx - Read Evaluate Print Loop library")
+
+# compiler options
+if(CMAKE_COMPILER_IS_GNUCXX)
+ message(STATUS "Compiler type GNU: ${CMAKE_CXX_COMPILER}")
+ set(BASE_COMPILER_OPTIONS "-std=c++11 -Wall -D_GNU_SOURCE -pthread")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILER_OPTIONS}")
+ set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS} ${BASE_COMPILER_OPTIONS} -O0 --coverage -fno-inline -fno-default-inline -fno-inline-small-functions")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${BASE_COMPILER_OPTIONS} -O0 -g -ggdb -g3 -ggdb3")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${BASE_COMPILER_OPTIONS} -Os")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${BASE_COMPILER_OPTIONS} -O3 -fomit-frame-pointer")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${BASE_COMPILER_OPTIONS} -O3 -g")
+ set(CMAKE_C_FLAGS "-std=c99")
+elseif(CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ # using regular Clang or AppleClang
+ message(STATUS "Compiler type CLANG: ${CMAKE_CXX_COMPILER}")
+ set(BASE_COMPILER_OPTIONS "-std=c++11 -Wall -Wextra -D_GNU_SOURCE -pthread")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILER_OPTIONS}")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${BASE_COMPILER_OPTIONS} -O0 -g")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${BASE_COMPILER_OPTIONS} -Os")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${BASE_COMPILER_OPTIONS} -O3 -fomit-frame-pointer")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${BASE_COMPILER_OPTIONS} -O3 -g")
+ set(CMAKE_C_FLAGS "-std=c99")
+elseif(MSVC)
+ message(STATUS "Compiler type MSVC: ${CMAKE_CXX_COMPILER}")
+ add_definitions("-D_CRT_SECURE_NO_WARNINGS=1")
+
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /LTCG /ignore:4099")
+ set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /SUBSYSTEM:CONSOLE /ignore:4099")
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SUBSYSTEM:CONSOLE /ignore:4099")
+ set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /SUBSYSTEM:CONSOLE /ignore:4099")
+else()
+ # unknown compiler
+ message(STATUS "Compiler type UNKNOWN: ${CMAKE_CXX_COMPILER}")
+ set(BASE_COMPILER_OPTIONS "-std=c++11 -Wall -pthread")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILER_OPTIONS}")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${BASE_COMPILER_OPTIONS} -O0 -g")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${BASE_COMPILER_OPTIONS} -Os")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${BASE_COMPILER_OPTIONS} -O3 -fomit-frame-pointer")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${BASE_COMPILER_OPTIONS} -O3 -g")
+ set(CMAKE_C_FLAGS "-std=c99")
+endif()
+
+# build libreplxx
+set(
+ REPLXX_SOURCES
+ src/conversion.cxx
+ src/ConvertUTF.cpp
+ src/escape.cxx
+ src/history.cxx
+ src/replxx_impl.cxx
+ src/io.cxx
+ src/prompt.cxx
+ src/replxx.cxx
+ src/util.cxx
+ src/wcwidth.cpp
+ src/windows.cxx
+)
+
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+add_library(rspamd-replxx SHARED ${REPLXX_SOURCES})
+
+target_include_directories(
+ rspamd-replxx
+ PUBLIC ${PROJECT_SOURCE_DIR}/include
+ PRIVATE ${PROJECT_SOURCE_DIR}/src
+)
+set( TARGETS ${TARGETS} rspamd-replxx )
+target_compile_definitions(rspamd-replxx PRIVATE REPLXX_BUILDING_DLL)
+
+install( TARGETS ${TARGETS} LIBRARY DESTINATION ${RSPAMD_LIBDIR}) \ No newline at end of file