From e359e97b27e3485d1ca91ae7e655713907313cba Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu, 30 Sep 2021 23:00:55 +0800 Subject: [PATCH 1/4] cmake file added --- .gitignore | 1 + CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 1635a1a..d063dbe 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ *.out *.slo *.so +build/ Makefile Makefile.in aclocal.m4 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4646caa --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.10) + +project(marisa) + +if(UNIX) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Weffc++ -Wextra -Wconversion") +endif() + +set(MARISA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) + +option(Marisa_FOUND "marisa found" ON) +set(Marisa_INCLUDE_PATH ${MARISA_ROOT}/include CACHE INTERNAL "marisa public include path" FORCE) + +set(MARISA_INCLUDE_DIRS + ${MARISA_ROOT}/lib + ${MARISA_ROOT}/include) + +set(MARISA_SRC + ${MARISA_ROOT}/lib/marisa/grimoire/io/reader.cc + ${MARISA_ROOT}/lib/marisa/grimoire/io/mapper.cc + ${MARISA_ROOT}/lib/marisa/grimoire/io/writer.cc + ${MARISA_ROOT}/lib/marisa/grimoire/trie/tail.cc + ${MARISA_ROOT}/lib/marisa/grimoire/trie/louds-trie.cc + ${MARISA_ROOT}/lib/marisa/grimoire/vector/bit-vector.cc + ${MARISA_ROOT}/lib/marisa/trie.cc + ${MARISA_ROOT}/lib/marisa/agent.cc + ${MARISA_ROOT}/lib/marisa/keyset.cc +) + +include_directories( ${MARISA_INCLUDE_DIRS} ) + +add_library( marisa ${MARISA_SRC} ) + +install(TARGETS marisa + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +set(include_headers ${MARISA_ROOT}/include/marisa.h) +file(GLOB libmarisa_include_headers ${MARISA_ROOT}/include/marisa/*.h) +install(FILES ${include_headers} DESTINATION include) +install(FILES ${libmarisa_include_headers} DESTINATION include/marisa) From 57b84b7693ee180e1139ab6627e35c310be3d443 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Fri, 1 Oct 2021 00:16:02 +0800 Subject: [PATCH 2/4] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4646caa..f8e5726 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(MARISA_SRC include_directories( ${MARISA_INCLUDE_DIRS} ) -add_library( marisa ${MARISA_SRC} ) +add_library( marisa STATIC ${MARISA_SRC} ) install(TARGETS marisa RUNTIME DESTINATION bin From 23ea23da75ab2b27730ca9cc7d604606b9c92fe1 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Fri, 1 Oct 2021 01:02:56 +0800 Subject: [PATCH 3/4] Update CMakeLists.txt --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8e5726..e6e304f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ set(MARISA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) option(Marisa_FOUND "marisa found" ON) set(Marisa_INCLUDE_PATH ${MARISA_ROOT}/include CACHE INTERNAL "marisa public include path" FORCE) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + set(MARISA_INCLUDE_DIRS ${MARISA_ROOT}/lib ${MARISA_ROOT}/include) @@ -29,7 +31,7 @@ set(MARISA_SRC include_directories( ${MARISA_INCLUDE_DIRS} ) -add_library( marisa STATIC ${MARISA_SRC} ) +add_library( marisa SHARED ${MARISA_SRC} ) install(TARGETS marisa RUNTIME DESTINATION bin From eea4173adea1939942477215e4c0bfa571b2553a Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Fri, 8 Oct 2021 16:07:31 +0000 Subject: [PATCH 4/4] cmake --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6e304f..4440436 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(marisa) if(UNIX) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Weffc++ -Wextra -Wconversion") + add_compile_options( -fPIC ) endif() set(MARISA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) @@ -31,7 +32,7 @@ set(MARISA_SRC include_directories( ${MARISA_INCLUDE_DIRS} ) -add_library( marisa SHARED ${MARISA_SRC} ) +add_library( marisa STATIC ${MARISA_SRC} ) install(TARGETS marisa RUNTIME DESTINATION bin