cmake_minimum_required(VERSION 3.8) project(LotroDat) set(CMAKE_CXX_STANDARD 17) set(PROJECT_BINARY_DIR bin) set(PROJECT_VERSION 8.0.0) # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O2") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O0") set(CMAKE_CXX_FLAGS_RELEASE "-O0 -DNDEBUG") # !IMPORTANT: O0 should be used because of using of dynamic library! 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/binarydata.h ${CMAKE_SOURCE_DIR}/include/database.h ${CMAKE_SOURCE_DIR}/include/datexportapi.h ${CMAKE_SOURCE_DIR}/include/datfile.h ${CMAKE_SOURCE_DIR}/include/subfile.h ${CMAKE_SOURCE_DIR}/include/subfiledata.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}/Third_party/SQLite/lotrodat_sqlite3.h ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.h ) set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/binarydata.cpp ${CMAKE_SOURCE_DIR}/src/database.cpp ${CMAKE_SOURCE_DIR}/src/datexportapi.cpp ${CMAKE_SOURCE_DIR}/src/datfile.cpp ${CMAKE_SOURCE_DIR}/src/subfile.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/lotrodat_sqlite3.c ${CMAKE_SOURCE_DIR}/Third_party/EasyLogging++/easylogging++.cc ) # 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(single_file_import_export ${CMAKE_SOURCE_DIR}/src/utils/single_file_import_export.cpp ${SOURCE_FILES} ${HEADER_FILES}) add_executable(extractor ${CMAKE_SOURCE_DIR}/src/utils/extractor.cpp ${SOURCE_FILES} ${HEADER_FILES}) add_executable(inserter ${CMAKE_SOURCE_DIR}/src/utils/inserter.cpp ${SOURCE_FILES} ${HEADER_FILES}) foreach (TARGET LotroDat_static LotroDat single_file_import_export extractor inserter) 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++ -lpthread -static) endforeach (TARGET LotroDat_static LotroDat LotRO_dat_test)