From e854894a3cf58936eb447e4476fb863cb05ea3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 5 May 2017 01:34:01 +0200 Subject: [PATCH] GH-1876 turn pack200 into a shared library --- api/logic/CMakeLists.txt | 2 +- libraries/pack200/CMakeLists.txt | 12 +++++++----- libraries/pack200/include/unpack200.h | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index d85d9403..24db362e 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -469,7 +469,7 @@ set_target_properties(MultiMC_logic PROPERTIES CXX_VISIBILITY_PRESET hidden VISI generate_export_header(MultiMC_logic) # Link -target_link_libraries(MultiMC_logic xz-embedded unpack200 systeminfo ${QUAZIP_LIBRARIES} ${NBT_NAME} ${ZLIB_LIBRARIES}) +target_link_libraries(MultiMC_logic xz-embedded MultiMC_unpack200 systeminfo ${QUAZIP_LIBRARIES} ${NBT_NAME} ${ZLIB_LIBRARIES}) qt5_use_modules(MultiMC_logic Core Xml Network Concurrent) add_dependencies(MultiMC_logic QuaZIP) diff --git a/libraries/pack200/CMakeLists.txt b/libraries/pack200/CMakeLists.txt index b060905b..85f32408 100644 --- a/libraries/pack200/CMakeLists.txt +++ b/libraries/pack200/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(unpack200) +project(MultiMC_unpack200) option(PACK200_BUILD_BINARY "Build a tiny utility that decompresses pack200 streams" OFF) @@ -28,12 +28,14 @@ set(PACK200_SRC set(CMAKE_POSITION_INDEPENDENT_CODE ON) -add_library(unpack200 STATIC ${PACK200_SRC}) -target_include_directories(unpack200 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" PRIVATE ${ZLIB_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/src") +add_library(MultiMC_unpack200 SHARED ${PACK200_SRC}) +target_include_directories(MultiMC_unpack200 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}" PRIVATE ${ZLIB_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/src") +target_link_libraries(MultiMC_unpack200 ${ZLIB_LIBRARIES}) -target_link_libraries(unpack200 ${ZLIB_LIBRARIES}) +set_target_properties(MultiMC_unpack200 PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN 1) +generate_export_header(MultiMC_unpack200) if(PACK200_BUILD_BINARY) add_executable(anti200 anti200.cpp) - target_link_libraries(anti200 unpack200) + target_link_libraries(anti200 MultiMC_unpack200) endif() diff --git a/libraries/pack200/include/unpack200.h b/libraries/pack200/include/unpack200.h index 9c3eda2d..30ce6656 100644 --- a/libraries/pack200/include/unpack200.h +++ b/libraries/pack200/include/unpack200.h @@ -24,7 +24,8 @@ */ #pragma once -#include + +#include "multimc_unpack200_export.h" /** * @brief Unpack a PACK200 file @@ -33,4 +34,4 @@ * @param output_path Path to the output file in PACK200 format. System native string encoding. * @throw std::runtime_error for any error encountered */ -void unpack_200(FILE * input_path, FILE * output_path); +MULTIMC_UNPACK200_EXPORT void unpack_200(FILE * input_path, FILE * output_path);