2022-03-15 15:33:57 -04:00
|
|
|
project(libxiv)
|
|
|
|
|
2022-03-27 21:48:50 -04:00
|
|
|
include(FetchContent)
|
|
|
|
|
2022-03-27 21:06:14 -04:00
|
|
|
find_package(fmt QUIET)
|
|
|
|
|
|
|
|
if(TARGET fmt::fmt)
|
|
|
|
message("Using system library for fmt")
|
|
|
|
|
|
|
|
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
|
|
|
else()
|
2022-04-15 21:01:17 -04:00
|
|
|
message("Using downloaded fmt")
|
2022-03-27 21:06:14 -04:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2022-03-27 21:06:14 -04:00
|
|
|
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})
|
2022-03-27 21:06:14 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package(ZLIB QUIET)
|
|
|
|
|
|
|
|
if(TARGET ZLIB::ZLIB)
|
|
|
|
message("Using system library for zlib")
|
|
|
|
|
|
|
|
set(LIBRARIES ZLIB::ZLIB ${LIBRARIES})
|
|
|
|
else()
|
2022-04-15 21:01:17 -04:00
|
|
|
message("Using downloaded zlib")
|
2022-03-27 21:06:14 -04:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2022-03-27 21:06:14 -04:00
|
|
|
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:06:14 -04:00
|
|
|
|
2022-03-27 21:48:50 -04:00
|
|
|
set(LIBRARIES zlibstatic ${LIBRARIES})
|
|
|
|
endif()
|
2022-03-16 18:02:39 -04:00
|
|
|
|
2022-04-15 21:01:17 -04:00
|
|
|
find_package(pugixml QUIET)
|
|
|
|
|
|
|
|
if(TARGET pugixml::pugixml)
|
|
|
|
message("Using system library for zlib")
|
|
|
|
else()
|
|
|
|
message("Using downloaded pugixml")
|
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
pugixml
|
|
|
|
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
|
|
|
GIT_TAG master
|
|
|
|
)
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(pugixml)
|
|
|
|
endif()
|
2022-04-14 16:25:48 -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
|
2022-03-17 00:58:18 -04:00
|
|
|
src/installextract.cpp
|
2022-04-11 10:18:29 -04:00
|
|
|
src/patch.cpp
|
2022-04-11 20:02:20 -04:00
|
|
|
src/exlparser.cpp
|
2022-04-12 23:27:21 -04:00
|
|
|
src/mdlparser.cpp
|
|
|
|
src/havokxmlparser.cpp)
|
2022-03-16 18:02:39 -04:00
|
|
|
target_include_directories(libxiv PUBLIC include PRIVATE src)
|
2022-04-14 16:25:48 -04:00
|
|
|
target_link_libraries(libxiv PUBLIC ${LIBRARIES} pugixml::pugixml)
|
2022-04-13 09:26:52 -04:00
|
|
|
target_link_directories(libxiv PUBLIC ${LIB_DIRS})
|
|
|
|
target_compile_features(libxiv PUBLIC cxx_std_17)
|
|
|
|
set_target_properties(libxiv PROPERTIES CXX_EXTENSIONS OFF)
|
2022-04-13 09:40:36 -04:00
|
|
|
|
2022-04-14 16:25:48 -04:00
|
|
|
if(NOT WIN32)
|
|
|
|
target_compile_definitions(libxiv PUBLIC UNSHIELD_SUPPORTED)
|
|
|
|
endif()
|
|
|
|
|
2022-04-13 09:40:36 -04:00
|
|
|
install(TARGETS libxiv
|
|
|
|
DESTINATION "${INSTALL_LIB_PATH}")
|