CMakeLists.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. cmake_minimum_required(VERSION 3.8)
  2. project(LotroDat)
  3. set(CMAKE_CXX_STANDARD 14)
  4. set(PROJECT_BINARY_DIR bin)
  5. set(PROJECT_VERSION 7.2.1)
  6. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O2")
  7. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
  8. if (MSVS)
  9. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE} /MT /SAFESEH:NO")
  10. endif (MSVS)
  11. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
  12. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
  13. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
  14. include_directories(${CMAKE_SOURCE_DIR}/include)
  15. include_directories(${CMAKE_SOURCE_DIR}/Third_party)
  16. SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_OUTPUT_DIR})
  17. SET(LIBRARY_OUTPUT_PATH ${CMAKE_OUTPUT_DIR})
  18. set(HEADER_FILES
  19. ${CMAKE_SOURCE_DIR}/include/LotroDat.h
  20. ${CMAKE_SOURCE_DIR}/include/SubfileData.h
  21. ${CMAKE_SOURCE_DIR}/include/DatFile.h
  22. ${CMAKE_SOURCE_DIR}/include/BinaryData.h
  23. ${CMAKE_SOURCE_DIR}/include/Database.h
  24. ${CMAKE_SOURCE_DIR}/include/Subfile.h
  25. ${CMAKE_SOURCE_DIR}/include/SubDirectory.h
  26. ${CMAKE_SOURCE_DIR}/include/Subfiles/TextSubfile.h
  27. ${CMAKE_SOURCE_DIR}/include/Subfiles/JpgSubfile.h
  28. ${CMAKE_SOURCE_DIR}/include/Subfiles/DdsSubfile.h
  29. ${CMAKE_SOURCE_DIR}/include/Subfiles/OggSubfile.h
  30. ${CMAKE_SOURCE_DIR}/include/Subfiles/FontSubfile.h
  31. ${CMAKE_SOURCE_DIR}/include/Subfiles/WavSubfile.h
  32. ${CMAKE_SOURCE_DIR}/include/Subfiles/UnknownSubfile.h
  33. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatBackupManager.h
  34. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatExporter.h
  35. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatFileSystem.h
  36. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatIO.h
  37. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatLocaleManager.h
  38. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatPatcher.h
  39. ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatStatus.h)
  40. set(SOURCE_FILES
  41. ${CMAKE_SOURCE_DIR}/src/DatFile.cpp
  42. ${CMAKE_SOURCE_DIR}/src/BinaryData.cpp
  43. ${CMAKE_SOURCE_DIR}/src/Database.cpp
  44. ${CMAKE_SOURCE_DIR}/src/Subfile.cpp
  45. ${CMAKE_SOURCE_DIR}/src/SubDirectory.cpp
  46. ${CMAKE_SOURCE_DIR}/src/Subfiles/TextSubfile.cpp
  47. ${CMAKE_SOURCE_DIR}/src/Subfiles/JpgSubfile.cpp
  48. ${CMAKE_SOURCE_DIR}/src/Subfiles/DdsSubfile.cpp
  49. ${CMAKE_SOURCE_DIR}/src/Subfiles/OggSubfile.cpp
  50. ${CMAKE_SOURCE_DIR}/src/Subfiles/FontSubfile.cpp
  51. ${CMAKE_SOURCE_DIR}/src/Subfiles/WavSubfile.cpp
  52. ${CMAKE_SOURCE_DIR}/src/Subfiles/UnknownSubfile.cpp
  53. ${CMAKE_SOURCE_DIR}/Third_party/SQLite/sqlite3.c
  54. ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.cc
  55. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatBackupManager.cpp
  56. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatExporter.cpp
  57. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatFileSystem.cpp
  58. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatIO.cpp
  59. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatLocaleManager.cpp
  60. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatPatcher.cpp
  61. ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatStatus.cpp)
  62. set(CompilerFlags
  63. CMAKE_CXX_FLAGS
  64. CMAKE_CXX_FLAGS_DEBUG
  65. CMAKE_CXX_FLAGS_RELEASE
  66. CMAKE_CXX_FLAGS_MINSIZEREL
  67. CMAKE_CXX_FLAGS_RELWITHDEBINFO
  68. CMAKE_C_FLAGS
  69. CMAKE_C_FLAGS_DEBUG
  70. CMAKE_C_FLAGS_RELEASE
  71. CMAKE_C_FLAGS_MINSIZEREL
  72. CMAKE_C_FLAGS_RELWITHDEBINFO
  73. )
  74. foreach (CompilerFlag ${CompilerFlags})
  75. string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
  76. endforeach ()
  77. # STATIC LIBRARY
  78. add_library(LotroDat_static STATIC ${SOURCE_FILES} ${HEADER_FILES})
  79. # SHARED LIBRARY
  80. add_library(LotroDat SHARED ${SOURCE_FILES} ${HEADER_FILES})
  81. # CONSOLE EXTRACTOR TOOL
  82. add_executable(LotRO_dat_extractor ${CMAKE_SOURCE_DIR}/src/Examples/extractor_example.cpp ${SOURCE_FILES} ${HEADER_FILES})
  83. # CONSOLE PATCHER TOOL
  84. add_executable(LotRO_dat_patcher ${CMAKE_SOURCE_DIR}/src/Examples/patcher_example.cpp ${SOURCE_FILES} ${HEADER_FILES})
  85. # FILE INFO GATHERER
  86. add_executable(LotRO_dat_info_gatherer ${SOURCE_FILES} ${HEADER_FILES} ${CMAKE_SOURCE_DIR}/src/Examples/info_gatherer.cpp)
  87. foreach (TARGET LotroDat_static LotroDat LotRO_dat_extractor LotRO_dat_patcher LotRO_dat_info_gatherer)
  88. target_link_libraries(${TARGET} optimized ${CMAKE_SOURCE_DIR}/Third_Party/lib/libzlibstatic.a
  89. debug ${CMAKE_SOURCE_DIR}/Third_Party/lib/libzlibstaticd.a
  90. )
  91. target_link_libraries(${TARGET} optimized ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cpp.a
  92. debug ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cppd.a)
  93. target_link_libraries(${TARGET} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic)
  94. endforeach (TARGET LotroDat_static LotroDat LotRO_dat_extractor LotRO_dat_patcher)