CMakeLists.txt 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # 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/EasyLogging++/easylogging++.h
  31. )
  32. set(SOURCE_FILES
  33. ${CMAKE_SOURCE_DIR}/src/binarydata.cpp
  34. ${CMAKE_SOURCE_DIR}/src/database.cpp
  35. ${CMAKE_SOURCE_DIR}/src/datexportapi.cpp
  36. ${CMAKE_SOURCE_DIR}/src/datfile.cpp
  37. ${CMAKE_SOURCE_DIR}/src/subfile.cpp
  38. ${CMAKE_SOURCE_DIR}/src/subfiles/textsubfile.cpp
  39. ${CMAKE_SOURCE_DIR}/src/subfiles/jpgsubfile.cpp
  40. ${CMAKE_SOURCE_DIR}/src/subfiles/ddssubfile.cpp
  41. ${CMAKE_SOURCE_DIR}/src/subfiles/oggsubfile.cpp
  42. ${CMAKE_SOURCE_DIR}/src/subfiles/fontsubfile.cpp
  43. ${CMAKE_SOURCE_DIR}/src/subfiles/wavsubfile.cpp
  44. ${CMAKE_SOURCE_DIR}/src/subfiles/unknownsubfile.cpp
  45. ${CMAKE_SOURCE_DIR}/Third_party/SQLite/sqlite3.c
  46. ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.cc
  47. )
  48. # STATIC LIBRARY
  49. add_library(LotroDat_static STATIC ${SOURCE_FILES} ${HEADER_FILES})
  50. # SHARED LIBRARY
  51. add_library(LotroDat SHARED ${SOURCE_FILES} ${HEADER_FILES})
  52. # CONSOLE EXTRACTOR TOOL
  53. add_executable(single_file_import_export ${CMAKE_SOURCE_DIR}/src/utils/single_file_import_export.cpp ${SOURCE_FILES} ${HEADER_FILES})
  54. add_executable(extractor ${CMAKE_SOURCE_DIR}/src/utils/extractor.cpp ${SOURCE_FILES} ${HEADER_FILES})
  55. add_executable(inserter ${CMAKE_SOURCE_DIR}/src/utils/inserter.cpp ${SOURCE_FILES} ${HEADER_FILES})
  56. foreach (TARGET LotroDat_static LotroDat single_file_import_export extractor inserter)
  57. target_link_libraries(${TARGET} optimized ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cpp.a
  58. debug ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cppd.a)
  59. target_link_libraries(${TARGET} -static-libgcc -static-libstdc++ -lpthread -static)
  60. endforeach (TARGET LotroDat_static LotroDat LotRO_dat_test)