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