add windows fst library

This commit is contained in:
Eyck Jentzsch 2023-02-27 18:34:27 +01:00
parent 1efb574a98
commit c45d7b5024
6 changed files with 29 additions and 5 deletions

View File

@ -77,4 +77,11 @@ http://www.eclipse.org/legal/epl-v10.html
version="0.0.0"
unpack="false"/>
<plugin
id="com.minres.scviewer.database.fst"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@ -5,4 +5,5 @@ bin.includes = META-INF/,\
lib/jna-5.13.0.jar,\
lib/jna-jpms-5.13.0.jar,\
linux-x86-64/,\
win32-x86-64/,\
OSGI-INF/

View File

@ -3,11 +3,24 @@ cmake_minimum_required (VERSION 3.0)
project (fstlib VERSION 1.0.0)
set(BUILD_SHARED_LIBS ON)
find_package(ZLIB REQUIRED)
#find_package(ZLIB REQUIRED)
include(FetchContent)
FetchContent_Declare(
zlib
URL https://www.zlib.net/zlib-1.2.13.tar.gz
https://www.zlib.net/fossils/zlib-1.2.13.tar.gz
https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz
URL_HASH MD5=9b8aa094c4e5765dabf4da391f00d15c
)
FetchContent_Populate(zlib)
add_subdirectory(${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} EXCLUDE_FROM_ALL)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
target_include_directories(zlibstatic INTERFACE ${zlib_BINARY_DIR} ${zlib_SOURCE_DIR})
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_library(fstapi fstapi.c lz4.c fastlz.c fst_helper.c)
target_include_directories(fstapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(fstapi PRIVATE ${ZLIB_LIBRARIES})
#target_include_directories(fstapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(fstapi PRIVATE zlibstatic)
# hack to avoid creating dummy config.h
target_compile_definitions(fstapi PRIVATE -DFST_CONFIG_INCLUDE="fstapi.h")
@ -18,4 +31,5 @@ if(MSVC)
endif()
install(TARGETS fstapi
LIBRARY DESTINATION .)
LIBRARY DESTINATION .
RUNTIME DESTINATION .)

View File

@ -0,0 +1,2 @@
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=../../win32-x86-64
cmake --build build --target install --config Release

View File

@ -1,2 +1,2 @@
cmake -B build -S . -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../linux-x86-64
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=../../linux-x86-64 -DCMAKE_BUILD_TYPE=Release
cmake --build build --target install