cmake_minimum_required(VERSION 3.8) project(LotroDat) set(CMAKE_CXX_STANDARD 14) set(PROJECT_BINARY_DIR bin) set(PROJECT_VERSION 7.2.1) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O2") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}") if (MSVS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE} /MT /SAFESEH:NO") endif (MSVS) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_SOURCE_DIR}/Third_party) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_OUTPUT_DIR}) SET(LIBRARY_OUTPUT_PATH ${CMAKE_OUTPUT_DIR}) set(HEADER_FILES ${CMAKE_SOURCE_DIR}/include/LotroDat.h ${CMAKE_SOURCE_DIR}/include/SubfileData.h ${CMAKE_SOURCE_DIR}/include/DatFile.h ${CMAKE_SOURCE_DIR}/include/BinaryData.h ${CMAKE_SOURCE_DIR}/include/Database.h ${CMAKE_SOURCE_DIR}/include/Subfile.h ${CMAKE_SOURCE_DIR}/include/SubDirectory.h ${CMAKE_SOURCE_DIR}/include/Subfiles/TextSubfile.h ${CMAKE_SOURCE_DIR}/include/Subfiles/JpgSubfile.h ${CMAKE_SOURCE_DIR}/include/Subfiles/DdsSubfile.h ${CMAKE_SOURCE_DIR}/include/Subfiles/OggSubfile.h ${CMAKE_SOURCE_DIR}/include/Subfiles/FontSubfile.h ${CMAKE_SOURCE_DIR}/include/Subfiles/WavSubfile.h ${CMAKE_SOURCE_DIR}/include/Subfiles/UnknownSubfile.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatBackupManager.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatExporter.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatFileSystem.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatIO.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatLocaleManager.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatPatcher.h ${CMAKE_SOURCE_DIR}/include/DatSubsystems/DatStatus.h) set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/DatFile.cpp ${CMAKE_SOURCE_DIR}/src/BinaryData.cpp ${CMAKE_SOURCE_DIR}/src/Database.cpp ${CMAKE_SOURCE_DIR}/src/Subfile.cpp ${CMAKE_SOURCE_DIR}/src/SubDirectory.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/TextSubfile.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/JpgSubfile.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/DdsSubfile.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/OggSubfile.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/FontSubfile.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/WavSubfile.cpp ${CMAKE_SOURCE_DIR}/src/Subfiles/UnknownSubfile.cpp ${CMAKE_SOURCE_DIR}/Third_party/SQLite/sqlite3.c ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.cc ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatBackupManager.cpp ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatExporter.cpp ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatFileSystem.cpp ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatIO.cpp ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatLocaleManager.cpp ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatPatcher.cpp ${CMAKE_SOURCE_DIR}/src/DatSubsystems/DatStatus.cpp) set(CompilerFlags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO ) foreach (CompilerFlag ${CompilerFlags}) string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") endforeach () # STATIC LIBRARY add_library(LotroDat_static STATIC ${SOURCE_FILES} ${HEADER_FILES}) # SHARED LIBRARY add_library(LotroDat SHARED ${SOURCE_FILES} ${HEADER_FILES}) # CONSOLE EXTRACTOR TOOL add_executable(LotRO_dat_extractor ${CMAKE_SOURCE_DIR}/src/Examples/extractor_example.cpp ${SOURCE_FILES} ${HEADER_FILES}) # CONSOLE PATCHER TOOL add_executable(LotRO_dat_patcher ${CMAKE_SOURCE_DIR}/src/Examples/patcher_example.cpp ${SOURCE_FILES} ${HEADER_FILES}) # FILE INFO GATHERER add_executable(LotRO_dat_info_gatherer ${SOURCE_FILES} ${HEADER_FILES} ${CMAKE_SOURCE_DIR}/src/Examples/info_gatherer.cpp) foreach (TARGET LotroDat_static LotroDat LotRO_dat_extractor LotRO_dat_patcher LotRO_dat_info_gatherer) target_link_libraries(${TARGET} optimized ${CMAKE_SOURCE_DIR}/Third_Party/lib/libzlibstatic.a debug ${CMAKE_SOURCE_DIR}/Third_Party/lib/libzlibstaticd.a ) target_link_libraries(${TARGET} optimized ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cpp.a debug ${CMAKE_SOURCE_DIR}/Third_Party/lib/libyaml-cppd.a) target_link_libraries(${TARGET} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic) endforeach (TARGET LotroDat_static LotroDat LotRO_dat_extractor LotRO_dat_patcher)