diff --git a/CMakeLists.txt b/CMakeLists.txt index feef0a06..d19014e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,14 @@ cmake_minimum_required(VERSION 2.8) project(ldep) set(DEP_ZLIB_VER "1.2.8") +set(DEP_PHYSFS_VER "2.0.3") + +set(ZLIB_FOUND TRUE) +set(ZLIB_LIBRARY zlibstatic) +set(ZLIB_INCLUDE_DIR .) add_subdirectory("libs/zlib-${DEP_ZLIB_VER}" ${CMAKE_BINARY_DIR}/zlib) +add_subdirectory("libs/physfs-${DEP_PHYSFS_VER}" ${CMAKE_BINARY_DIR}/physfs) add_executable(ldeptest src/test.cpp) -target_link_libraries(ldeptest zlibstatic) +target_link_libraries(ldeptest zlibstatic physfs-static) diff --git a/src/test.cpp b/src/test.cpp index 258f8d00..ecbeb3fd 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1,14 +1,56 @@ +#include #include +#include +#include + #include +#include + +typedef std::stringstream strs; +typedef std::function vfunc; + +std::string pad(std::string s, size_t size = 16) +{ + while (s.length() < size) + s.append(" "); + + return s; +} int main(int argc, const char **argv) { - const char *prefix = " -- "; + vfunc zlib = [](strs &c, strs &l) + { + c << ZLIB_VERSION; + l << zlibVersion(); + return "zlib"; + }; - std::cout << prefix << "Starting test" << std::endl; - std::cout << prefix << "zlib version: " << zlibVersion() << std::endl; - std::cout << prefix << "Ending test" << std::endl; + vfunc physfs = [](strs &c, strs &l) + { + PHYSFS_Version compiled; + PHYSFS_Version linked; + + PHYSFS_VERSION(&compiled); + PHYSFS_getLinkedVersion(&linked); - return 0; + c << (int)compiled.major << "." << (int)compiled.minor << "." << (int)compiled.patch; + l << (int)linked.major << "." << (int)linked.minor << "." << (int)linked.patch; + return "PhysicsFS"; + }; + + std::vector funcs; + funcs.push_back(zlib); + funcs.push_back(physfs); + + for (size_t i = 0; i < funcs.size(); ++i) + { + vfunc f = funcs[i]; + strs c, l; + std::string name = f(c, l); + std::cout << "-- " << pad(name) << " compiled: " << pad(c.str(), 7) << " linked: " << pad(l.str(), 7) << std::endl; + } + + return getchar(); }