CMakeLists.txt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. cmake_minimum_required(VERSION 3.8)
  2. project(LotroDat)
  3. set(CMAKE_CXX_STANDARD 17)
  4. set(PROJECT_BINARY_DIR bin)
  5. set(PROJECT_VERSION 8.0.0)
  6. # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O2")
  7. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O0")
  8. set(CMAKE_CXX_FLAGS_RELEASE "-O0 -DNDEBUG") # !IMPORTANT: O0 should be used because of using of dynamic library!
  9. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
  10. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
  11. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
  12. include_directories(${CMAKE_SOURCE_DIR}/include)
  13. include_directories(${CMAKE_SOURCE_DIR}/Third_party)
  14. SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_OUTPUT_DIR})
  15. SET(LIBRARY_OUTPUT_PATH ${CMAKE_OUTPUT_DIR})
  16. set(HEADER_FILES
  17. ${CMAKE_SOURCE_DIR}/include/binarydata.h
  18. ${CMAKE_SOURCE_DIR}/include/database.h
  19. ${CMAKE_SOURCE_DIR}/include/datexportapi.h
  20. ${CMAKE_SOURCE_DIR}/include/datfile.h
  21. ${CMAKE_SOURCE_DIR}/include/subfile.h
  22. ${CMAKE_SOURCE_DIR}/include/subfiledata.h
  23. ${CMAKE_SOURCE_DIR}/include/subfiles/textsubfile.h
  24. ${CMAKE_SOURCE_DIR}/include/subfiles/jpgsubfile.h
  25. ${CMAKE_SOURCE_DIR}/include/subfiles/ddssubfile.h
  26. ${CMAKE_SOURCE_DIR}/include/subfiles/oggsubfile.h
  27. ${CMAKE_SOURCE_DIR}/include/subfiles/fontsubfile.h
  28. ${CMAKE_SOURCE_DIR}/include/subfiles/wavsubfile.h
  29. ${CMAKE_SOURCE_DIR}/include/subfiles/unknownsubfile.h
  30. ${CMAKE_SOURCE_DIR}/Third_party/SQLite/lotrodat_sqlite3.h
  31. ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.h
  32. )
  33. set(SOURCE_FILES
  34. ${CMAKE_SOURCE_DIR}/src/binarydata.cpp
  35. ${CMAKE_SOURCE_DIR}/src/database.cpp
  36. ${CMAKE_SOURCE_DIR}/src/datexportapi.cpp
  37. ${CMAKE_SOURCE_DIR}/src/datfile.cpp
  38. ${CMAKE_SOURCE_DIR}/src/subfile.cpp
  39. ${CMAKE_SOURCE_DIR}/src/subfiles/textsubfile.cpp
  40. ${CMAKE_SOURCE_DIR}/src/subfiles/jpgsubfile.cpp
  41. ${CMAKE_SOURCE_DIR}/src/subfiles/ddssubfile.cpp
  42. ${CMAKE_SOURCE_DIR}/src/subfiles/oggsubfile.cpp
  43. ${CMAKE_SOURCE_DIR}/src/subfiles/fontsubfile.cpp
  44. ${CMAKE_SOURCE_DIR}/src/subfiles/wavsubfile.cpp
  45. ${CMAKE_SOURCE_DIR}/src/subfiles/unknownsubfile.cpp
  46. ${CMAKE_SOURCE_DIR}/Third_party/SQLite/lotrodat_sqlite3.c
  47. ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.cc
  48. )
  49. # STATIC LIBRARY
  50. add_library(LotroDat_static STATIC ${SOURCE_FILES} ${HEADER_FILES})
  51. # SHARED LIBRARY
  52. add_library(LotroDat SHARED ${SOURCE_FILES} ${HEADER_FILES})
  53. # CONSOLE EXTRACTOR TOOL
  54. add_executable(single_file_import_export ${CMAKE_SOURCE_DIR}/src/utils/single_file_import_export.cpp ${SOURCE_FILES} ${HEADER_FILES})
  55. add_executable(extractor ${CMAKE_SOURCE_DIR}/src/utils/extractor.cpp ${SOURCE_FILES} ${HEADER_FILES})
  56. add_executable(inserter ${CMAKE_SOURCE_DIR}/src/utils/inserter.cpp ${SOURCE_FILES} ${HEADER_FILES})
  57. foreach (TARGET LotroDat_static LotroDat single_file_import_export extractor inserter)
  58. target_link_libraries(${TARGET} optimized ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cpp.a
  59. debug ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cppd.a)
  60. target_link_libraries(${TARGET} -static-libgcc -static-libstdc++ -lpthread -static)
  61. endforeach (TARGET LotroDat_static LotroDat LotRO_dat_test)