Archived
1
Fork 0
This repository has been archived on 2025-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
libxiv/CMakeLists.txt

78 lines
1.9 KiB
Text
Raw Normal View History

2022-03-15 15:33:57 -04:00
project(libxiv)
2022-03-27 21:48:50 -04:00
include(FetchContent)
find_package(fmt QUIET)
if(TARGET fmt::fmt)
message("Using system library for fmt")
set(LIBRARIES fmt::fmt ${LIBRARIES})
else()
message("Using built-in fmt")
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG master
)
2022-03-27 21:48:50 -04:00
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(fmt)
set(LIBRARIES fmt::fmt ${LIBRARIES})
endif()
# note: unshield does not work on windows per maintainer notice in README, so we might as well not even attempt to look
# for it.
if(NOT WIN32)
2022-04-10 18:08:07 -04:00
find_package(PkgConfig REQUIRED)
pkg_check_modules(libunshield REQUIRED libunshield)
set(LIBRARIES ${libunshield_LIBRARIES} ${LIBRARIES})
set(LIB_DIRS ${libunshield_LIBRARY_DIRS})
endif()
find_package(ZLIB QUIET)
if(TARGET ZLIB::ZLIB)
message("Using system library for zlib")
set(LIBRARIES ZLIB::ZLIB ${LIBRARIES})
else()
message("Using built-in zlib")
FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG master
)
2022-03-27 21:48:50 -04:00
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(zlib)
2022-03-27 21:48:50 -04:00
# welcome to hell, cmake.
include_directories(${CMAKE_BINARY_DIR}/_deps/zlib-src)
# NO REALLY, HELL IS THIS WAY
include_directories(${CMAKE_BINARY_DIR}/_deps/zlib-build)
2022-03-27 21:48:50 -04:00
set(LIBRARIES zlibstatic ${LIBRARIES})
endif()
2022-03-16 18:02:39 -04:00
2022-03-15 15:33:57 -04:00
add_library(libxiv STATIC
src/fiinparser.cpp
src/indexparser.cpp
2022-03-27 21:48:50 -04:00
src/crc32checksum.cpp
2022-03-15 15:33:57 -04:00
src/gamedata.cpp
2022-03-16 00:02:07 -04:00
src/compression.cpp
src/exhparser.cpp
2022-03-16 18:02:39 -04:00
src/exdparser.cpp
src/installextract.cpp
src/patch.cpp
src/exlparser.cpp
src/mdlparser.cpp)
2022-03-16 18:02:39 -04:00
target_include_directories(libxiv PUBLIC include PRIVATE src)
2022-04-10 18:08:07 -04:00
target_link_libraries(libxiv PUBLIC ${LIBRARIES})
target_link_directories(libxiv PUBLIC ${LIB_DIRS})