mirror of
https://github.com/ScrelliCopter/tmx2gba.git
synced 2025-02-21 03:29:25 +11:00
Compare commits
3 Commits
0d9d9de370
...
849ff6bcc8
| Author | SHA1 | Date | |
|---|---|---|---|
| 849ff6bcc8 | |||
| b06ad7cd79 | |||
| 320bc19f2d |
4
.github/workflows/cmake.yml
vendored
4
.github/workflows/cmake.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- { name: "Windows MSVC x86", os: windows-latest, artifact: windows-x86, arch: x86 }
|
- { name: "Windows MSVC x86", os: windows-latest, artifact: windows-x86, arch: x86 }
|
||||||
- { name: "Windows MSVC x64", os: windows-latest, artifact: windows-x64 }
|
- { name: "Windows MSVC x64", os: windows-latest, artifact: windows-x64 }
|
||||||
- { name: "Windows MSVC ARM64", os: windows-latest, artifact: windows-arm64, arch: amd64_arm64 }
|
- { name: "Windows MSVC ARM64", os: windows-latest, artifact: windows-arm64, arch: amd64_arm64 }
|
||||||
- { name: "Ubuntu", artifact: "linux", os: ubuntu-latest, extra: "-DUSE_BUNDLED_ZSTD:BOOL=OFF" }
|
- { name: "Ubuntu", artifact: "linux", os: ubuntu-latest, extra: "-DUSE_BUNDLED_ZSTD:BOOL=OFF -DUSE_BUNDLED_PUGIXML:BOOL=OFF" }
|
||||||
runs-on: ${{matrix.config.os}}
|
runs-on: ${{matrix.config.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
if: ${{matrix.config.artifact == 'linux'}}
|
if: ${{matrix.config.artifact == 'linux'}}
|
||||||
with:
|
with:
|
||||||
packages: libzstd-dev
|
packages: libzstd-dev libpugixml-dev
|
||||||
version: 1.0
|
version: 1.0
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ if (ENABLE_ASAN)
|
|||||||
add_link_options(-fsanitize=address -shared-libasan)
|
add_link_options(-fsanitize=address -shared-libasan)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
if (USE_BUNDLED_PUGIXML)
|
if (USE_BUNDLED_PUGIXML)
|
||||||
add_subdirectory(ext/pugixml)
|
add_subdirectory(ext/pugixml)
|
||||||
else()
|
else()
|
||||||
find_package(PUGIXML REQUIRED)
|
find_package(pugixml REQUIRED CONFIG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_ZLIB)
|
if (USE_ZLIB)
|
||||||
@@ -37,16 +37,12 @@ endif()
|
|||||||
if (USE_BUNDLED_ZSTD)
|
if (USE_BUNDLED_ZSTD)
|
||||||
add_subdirectory(ext/zstd)
|
add_subdirectory(ext/zstd)
|
||||||
else()
|
else()
|
||||||
find_package(ZSTD REQUIRED)
|
find_package(Zstd REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(ext/base64)
|
add_subdirectory(ext/base64)
|
||||||
|
|
||||||
if (USE_BUNDLED_TMXLITE)
|
add_subdirectory(ext/tmxlite)
|
||||||
add_subdirectory(ext/tmxlite)
|
|
||||||
else()
|
|
||||||
find_package(TMXLITE REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Main tmx2gba sources
|
# Main tmx2gba sources
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
find_path(PUGIXML_INCLUDE_DIR NAMES pugixml.hpp)
|
|
||||||
find_library(PUGIXML_LIBRARY NAMES pugixml)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(PUGIXML DEFAULT_MSG
|
|
||||||
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
|
|
||||||
|
|
||||||
mark_as_advanced(PUGIXML_INCLUDE_DIR
|
|
||||||
PUGIXML_LIBRARY)
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
# Search for the header file
|
|
||||||
find_path(TMXLITE_INCLUDE_DIR NAMES tmxlite/Config.hpp PATH_SUFFIXES include)
|
|
||||||
|
|
||||||
# Search for the library
|
|
||||||
find_library(TMXLITE_LIBRARIES NAMES tmxlite PATH_SUFFIXES lib)
|
|
||||||
|
|
||||||
# Did we find everything we need?
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(tmxlite DEFAULT_MSG TMXLITE_LIBRARIES TMXLITE_INCLUDE_DIR)
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
#
|
|
||||||
# - Try to find Facebook zstd library
|
|
||||||
# This will define
|
|
||||||
# ZSTD_FOUND
|
|
||||||
# ZSTD_INCLUDE_DIR
|
|
||||||
# ZSTD_LIBRARY
|
|
||||||
#
|
|
||||||
|
|
||||||
find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
|
|
||||||
|
|
||||||
find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
|
|
||||||
find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static)
|
|
||||||
|
|
||||||
include(SelectLibraryConfigurations)
|
|
||||||
SELECT_LIBRARY_CONFIGURATIONS(ZSTD)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
|
||||||
ZSTD DEFAULT_MSG
|
|
||||||
ZSTD_LIBRARY ZSTD_INCLUDE_DIR
|
|
||||||
)
|
|
||||||
|
|
||||||
if (ZSTD_FOUND)
|
|
||||||
message(STATUS "Found Zstd: ${ZSTD_LIBRARY}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
|
|
||||||
171
cmake/modules/FindZstd.cmake
Normal file
171
cmake/modules/FindZstd.cmake
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
# SPDX-License-Identifier: Zlib
|
||||||
|
# SPDX-FileCopyrightText: 2024 a dinosaur
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
FindZstd
|
||||||
|
--------
|
||||||
|
|
||||||
|
Find the Facebook Zstd library.
|
||||||
|
|
||||||
|
Imported Targets
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. variable:: Zstd::Zstd
|
||||||
|
|
||||||
|
:prop_tgt:`IMPORTED` target for using Zstd, if Zstd is found.
|
||||||
|
|
||||||
|
Result Variables
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module defines the following variables:
|
||||||
|
.. variable:: Zstd_FOUND
|
||||||
|
|
||||||
|
True if Zstd was found.
|
||||||
|
|
||||||
|
.. variable:: Zstd_INCLUDE_DIRS
|
||||||
|
|
||||||
|
Path to the directory containing the Zstd headers (zstd.h, etc.)
|
||||||
|
|
||||||
|
.. variable:: Zstd_LIBRARIES
|
||||||
|
|
||||||
|
Location of the Zstd library.
|
||||||
|
|
||||||
|
.. variable:: Zstd_VERSION
|
||||||
|
|
||||||
|
The version of Zstd found.
|
||||||
|
|
||||||
|
Legacy Variables
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The following variables are defined by the official Zstd CMakeLists.txt:
|
||||||
|
|
||||||
|
.. variable:: zstd_VERSION_MAJOR
|
||||||
|
|
||||||
|
The major version of Zstd.
|
||||||
|
|
||||||
|
.. variable:: zstd_VERSION_MINOR
|
||||||
|
|
||||||
|
The minor version of Zstd.
|
||||||
|
|
||||||
|
.. variable:: zstd_VERSION_PATCH
|
||||||
|
|
||||||
|
The patch/release version of Zstd.
|
||||||
|
|
||||||
|
The following variables are provided for compatibility with old find modules:
|
||||||
|
|
||||||
|
.. variable:: ZSTD_INCLUDE_DIR
|
||||||
|
|
||||||
|
Directory containing the Zstd header. (use ``Zstd_INCLUDE_DIRS`` instead)
|
||||||
|
|
||||||
|
.. variable:: ZSTD_LIBRARY
|
||||||
|
|
||||||
|
The Zstd library. (use ``Zstd_LIBRARIES`` instead)
|
||||||
|
|
||||||
|
Hints
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
.. variable:: Zstd_PREFER_STATIC_LIBS
|
||||||
|
|
||||||
|
Set to ``ON`` to prefer static libraries. Defaults to ``OFF``
|
||||||
|
|
||||||
|
Cache Variables
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The following cache variables may also be set,
|
||||||
|
these are transitory and should not be relied upon:
|
||||||
|
|
||||||
|
.. variable:: Zstd_INCLUDE_DIR
|
||||||
|
|
||||||
|
Directory containing the Zstd header.
|
||||||
|
|
||||||
|
.. variable:: Zstd_LIBRARY_DEBUG
|
||||||
|
|
||||||
|
The Zstd debug library if found.
|
||||||
|
|
||||||
|
.. variable:: Zstd_LIBRARY_RELEASE
|
||||||
|
|
||||||
|
The Zstd release library if found.
|
||||||
|
|
||||||
|
.. variable:: Zstd_LIBRARY
|
||||||
|
|
||||||
|
The Zstd library.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
#TODO: define Zstd::static & Zstd::shared and alias Zstd::Zstd based on preference
|
||||||
|
|
||||||
|
find_path(Zstd_INCLUDE_DIR NAMES zstd.h)
|
||||||
|
|
||||||
|
mark_as_advanced(Zstd_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if (Zstd_PREFER_STATIC_LIBS)
|
||||||
|
find_library(Zstd_LIBRARY_DEBUG NAMES zstd_staticd zstdd)
|
||||||
|
find_library(Zstd_LIBRARY_RELEASE NAMES zstd_static zstd)
|
||||||
|
else()
|
||||||
|
find_library(Zstd_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
|
||||||
|
find_library(Zstd_LIBRARY_RELEASE NAMES zstd zstd_static)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
select_library_configurations(Zstd)
|
||||||
|
|
||||||
|
mark_as_advanced(Zstd_LIBRARY Zstd_LIBRARY_DEBUG Zstd_LIBRARY_RELEASE)
|
||||||
|
|
||||||
|
if (Zstd_INCLUDE_DIR AND EXISTS "${Zstd_INCLUDE_DIR}/zstd.h")
|
||||||
|
function (_zstd_read_define _variable _define)
|
||||||
|
set(_file "${Zstd_INCLUDE_DIR}/zstd.h")
|
||||||
|
set(_regex "#define[ \t]+${_define}[ \t]+([0-9]+)")
|
||||||
|
file(STRINGS "${_file}" _line LIMIT_COUNT 1 REGEX "${_regex}")
|
||||||
|
if (CMAKE_VERSION VERSION_LESS "3.29")
|
||||||
|
string(REGEX MATCH "${_regex}" _line "${_line}")
|
||||||
|
endif()
|
||||||
|
set(${_variable} ${CMAKE_MATCH_1} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
_zstd_read_define(zstd_VERSION_MAJOR "ZSTD_VERSION_MAJOR")
|
||||||
|
_zstd_read_define(zstd_VERSION_MINOR "ZSTD_VERSION_MINOR")
|
||||||
|
_zstd_read_define(zstd_VERSION_PATCH "ZSTD_VERSION_RELEASE")
|
||||||
|
set(Zstd_VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}")
|
||||||
|
|
||||||
|
mark_as_advanced(zstd_VERSION_MAJOR zstd_VERSION_MINOR zstd_VERSION_PATCH Zstd_VERSION)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Zstd
|
||||||
|
REQUIRED_VARS Zstd_LIBRARY Zstd_INCLUDE_DIR
|
||||||
|
VERSION_VAR Zstd_VERSION)
|
||||||
|
|
||||||
|
mark_as_advanced(Zstd_FOUND)
|
||||||
|
|
||||||
|
if (Zstd_FOUND)
|
||||||
|
set(Zstd_INCLUDE_DIRS ${Zstd_INCLUDE_DIR})
|
||||||
|
set(Zstd_LIBRARIES ${Zstd_LIBRARY})
|
||||||
|
|
||||||
|
# Legacy variables
|
||||||
|
set(ZSTD_INCLUDE_DIR ${Zstd_INCLUDE_DIR})
|
||||||
|
set(ZSTD_LIBRARY ${Zstd_LIBRARY})
|
||||||
|
mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
|
||||||
|
|
||||||
|
if (NOT TARGET Zstd::Zstd)
|
||||||
|
add_library(Zstd::Zstd UNKNOWN IMPORTED)
|
||||||
|
set_property(TARGET Zstd::Zstd PROPERTY
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${Zstd_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT Zstd_LIBRARY_DEBUG AND NOT Zstd_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET Zstd::Zstd PROPERTY
|
||||||
|
IMPORTED_LOCATION "${Zstd_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if (Zstd_LIBRARY_DEBUG)
|
||||||
|
set_property(TARGET Zstd::Zstd APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
set_property(TARGET Zstd::Zstd PROPERTY
|
||||||
|
IMPORTED_LOCATION_DEBUG "${Zstd_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
if (Zstd_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET Zstd::Zstd APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
set_property(TARGET Zstd::Zstd PROPERTY
|
||||||
|
IMPORTED_LOCATION_RELEASE "${Zstd_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
@@ -1,54 +1,28 @@
|
|||||||
project(tmxlite VERSION 1.3.1)
|
project(tmxlite VERSION 1.3.1)
|
||||||
|
|
||||||
set(USE_RTTI TRUE CACHE BOOL "Use run time type information?")
|
|
||||||
|
|
||||||
# includes the list of source files in the src directory
|
# includes the list of source files in the src directory
|
||||||
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
file(GLOB PROJECT_SRC ${PROJECT_DIR}/*.cpp)
|
file(GLOB PROJECT_SRC ${PROJECT_DIR}/*.cpp)
|
||||||
file(GLOB PROJECT_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
file(GLOB PROJECT_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/tmxlite/*.hpp)
|
||||||
file(GLOB PROJECT_HEADERS_INL ${CMAKE_CURRENT_SOURCE_DIR}/include/*.inl)
|
file(GLOB PROJECT_HEADERS_INL ${CMAKE_CURRENT_SOURCE_DIR}/include/tmxlite/*.inl)
|
||||||
file(GLOB PROJECT_HEADERS_DETAIL ${CMAKE_CURRENT_SOURCE_DIR}/include/detail/*.hpp)
|
file(GLOB PROJECT_HEADERS_DETAIL ${CMAKE_CURRENT_SOURCE_DIR}/include/tmxlite/detail/*.hpp)
|
||||||
set(PROJECT_SRC ${PROJECT_SRC} ${PROJECT_HEADERS} ${PROJECT_HEADERS_INL} ${PROJECT_HEADERS_DETAIL})
|
list(APPEND PROJECT_SRC ${PROJECT_HEADERS} ${PROJECT_HEADERS_INL} ${PROJECT_HEADERS_DETAIL})
|
||||||
|
|
||||||
add_library(tmxlite STATIC ${PROJECT_SRC})
|
add_library(${PROJECT_NAME} STATIC ${PROJECT_SRC})
|
||||||
|
|
||||||
set_target_properties(tmxlite PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
CXX_STANDARD 14
|
CXX_STANDARD 14
|
||||||
CXX_STANDARD_REQUIRED ON)
|
CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
target_compile_definitions(tmxlite PRIVATE $<$<CONFIG:Debug>:_DEBUG_> TMXLITE_STATIC)
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
target_compile_options(tmxlite PRIVATE -Wall)
|
${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
if (NOT USE_RTTI AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
|
|
||||||
target_compile_options(tmxlite PRIVATE -fno-rtti)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# disable msvc warning
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
|
||||||
if (MSVC)
|
|
||||||
target_compile_definitions(tmxlite PRIVATE _CRT_SECURE_NO_WARNINGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(tmxlite base64::base64)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> # disable msvc warning
|
||||||
|
$<$<TARGET_EXISTS:ZLIB::ZLIB>:USE_ZLIB>)
|
||||||
|
|
||||||
if (USE_BUNDLED_PUGIXML)
|
target_link_libraries(${PROJECT_NAME} base64::base64 pugixml Zstd::Zstd
|
||||||
target_link_libraries(tmxlite pugixml::static)
|
$<$<TARGET_EXISTS:ZLIB::ZLIB>:ZLIB::ZLIB>
|
||||||
else()
|
$<$<TARGET_EXISTS:miniz::miniz>:miniz::miniz>)
|
||||||
target_include_directories(tmxlite PRIVATE ${PUGIXML_INCLUDE_DIR})
|
|
||||||
target_link_libraries(tmxlite ZLIB::ZLIB ${PUGIXML_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (USE_ZLIB)
|
|
||||||
target_compile_definitions(tmxlite PRIVATE USE_ZLIB)
|
|
||||||
target_link_libraries(tmxlite ZLIB::ZLIB)
|
|
||||||
else()
|
|
||||||
target_link_libraries(tmxlite miniz::miniz)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(tmxlite PRIVATE USE_ZSTD)
|
|
||||||
if (USE_BUNDLED_ZSTD)
|
|
||||||
target_link_libraries(tmxlite zstd::static)
|
|
||||||
else()
|
|
||||||
target_include_directories(tmxlite PRIVATE ${ZSTD_INCLUDE_DIR})
|
|
||||||
target_link_libraries(tmxlite ZLIB::ZLIB ${ZSTD_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(tmxlite PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|||||||
@@ -27,38 +27,5 @@ source distribution.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//check which platform we're on and create export macros as necessary
|
|
||||||
#if !defined(TMXLITE_STATIC)
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
|
|
||||||
//windows compilers need specific (and different) keywords for export
|
|
||||||
#define TMXLITE_EXPORT_API __declspec(dllexport)
|
|
||||||
|
|
||||||
//for vc compilers we also need to turn off this annoying C4251 warning
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable: 4251)
|
|
||||||
#endif //_MSC_VER
|
|
||||||
|
|
||||||
#else //linux, FreeBSD, Mac OS X
|
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
|
||||||
|
|
||||||
//gcc 4 has special keywords for showing/hiding symbols,
|
|
||||||
//the same keyword is used for both importing and exporting
|
|
||||||
#define TMXLITE_EXPORT_API __attribute__ ((__visibility__ ("default")))
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
//gcc < 4 has no mechanism to explicitly hide symbols, everything's exported
|
|
||||||
#define TMXLITE_EXPORT_API
|
|
||||||
#endif //__GNUC__
|
|
||||||
|
|
||||||
#endif //_WIN32
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
//static build doesn't need import/export macros
|
//static build doesn't need import/export macros
|
||||||
#define TMXLITE_EXPORT_API
|
#define TMXLITE_EXPORT_API
|
||||||
|
|
||||||
#endif //TMXLITE_STATIC
|
|
||||||
@@ -178,13 +178,13 @@ namespace tmx
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#ifndef _DEBUG_
|
#ifdef NDEBUG
|
||||||
#define LOG(message, type)
|
#define LOG(message, type)
|
||||||
#else
|
#else
|
||||||
#define LOG(message, type) {\
|
#define LOG(message, type) {\
|
||||||
std::stringstream ss; \
|
std::stringstream ss; \
|
||||||
ss << message << " (" << __FILE__ << ", " << __LINE__ << ")"; \
|
ss << message << " (" << __FILE__ << ", " << __LINE__ << ")"; \
|
||||||
tmx::Logger::log(ss.str(), type);}
|
tmx::Logger::log(ss.str(), type);}
|
||||||
#endif //_DEBUG_
|
#endif //NDEBUG
|
||||||
|
|
||||||
#endif //TMXLITE_LOGGER_HPP_
|
#endif //TMXLITE_LOGGER_HPP_
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ source distribution.
|
|||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include <pugixml.hpp>
|
#include <pugixml.hpp>
|
||||||
#ifdef USE_ZSTD
|
#include <zstd.h>
|
||||||
# include <zstd.h>
|
|
||||||
#endif
|
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
#include "tmxlite/FreeFuncs.hpp"
|
#include "tmxlite/FreeFuncs.hpp"
|
||||||
#include "tmxlite/TileLayer.hpp"
|
#include "tmxlite/TileLayer.hpp"
|
||||||
@@ -128,7 +126,6 @@ void TileLayer::parseBase64(const pugi::xml_node& node)
|
|||||||
byteData.insert(byteData.end(), dataString.begin(), dataString.end());
|
byteData.insert(byteData.end(), dataString.begin(), dataString.end());
|
||||||
break;
|
break;
|
||||||
case CompressionType::Zstd:
|
case CompressionType::Zstd:
|
||||||
#if defined USE_ZSTD
|
|
||||||
{
|
{
|
||||||
std::size_t dataSize = dataString.length() * sizeof(unsigned char);
|
std::size_t dataSize = dataString.length() * sizeof(unsigned char);
|
||||||
std::size_t result = ZSTD_decompress(byteData.data(), expectedSize, &dataString[0], dataSize);
|
std::size_t result = ZSTD_decompress(byteData.data(), expectedSize, &dataString[0], dataSize);
|
||||||
@@ -140,10 +137,6 @@ void TileLayer::parseBase64(const pugi::xml_node& node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
Logger::log("Library must be built with USE_ZSTD for Zstd compression", Logger::Type::Error);
|
|
||||||
return {};
|
|
||||||
#endif
|
|
||||||
case CompressionType::GZip:
|
case CompressionType::GZip:
|
||||||
#ifndef USE_ZLIB
|
#ifndef USE_ZLIB
|
||||||
Logger::log("Library must be built with USE_ZLIB for GZip compression", Logger::Type::Error);
|
Logger::log("Library must be built with USE_ZLIB for GZip compression", Logger::Type::Error);
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ endif()
|
|||||||
set_source_files_properties(${Sources} PROPERTIES LANGUAGE C)
|
set_source_files_properties(${Sources} PROPERTIES LANGUAGE C)
|
||||||
|
|
||||||
add_library(zstd STATIC ${Sources} ${Headers})
|
add_library(zstd STATIC ${Sources} ${Headers})
|
||||||
add_library(zstd::static ALIAS zstd)
|
add_library(Zstd::static ALIAS zstd)
|
||||||
|
add_library(Zstd::Zstd ALIAS zstd)
|
||||||
|
|
||||||
add_zstd_compilation_flags(zstd)
|
add_zstd_compilation_flags(zstd)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user