1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- cmake_minimum_required(VERSION 3.8)
- project(LotRO_dat_library)
- set(CMAKE_CXX_STANDARD 11)
- set(PROJECT_BINARY_DIR bin)
- set(PROJECT_VERSION 0.1.0)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" )
- 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(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}/Third_party/SQLite/sqlite3.c
- ${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
- )
- 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})
- # SHARED LIBRARY
- add_library(LotroDat SHARED ${SOURCE_FILES})
- # CONSOLE EXTRACTOR TOOL
- add_executable(LotRO_dat_extract_tester ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/src/Examples/extractor_example.cpp)
- # CONSOLE PATCHER TOOL
- add_executable(LotRO_dat_pat_tester ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/src/Examples/patcher_example.cpp)
- foreach(TARGET LotroDat_static LotroDat LotRO_dat_extract_tester LotRO_dat_pat_tester)
- if(MSVC)
- target_link_libraries(${TARGET} ${CMAKE_SOURCE_DIR}/Third_Party/Zlib/zlibstatic.lib)
- target_link_libraries(${TARGET} ${CMAKE_SOURCE_DIR}/Third_Party/Yaml-cpp/libyaml-cppmt.lib)
- target_link_libraries(${TARGET} vcruntime.lib MSVCRT.lib)
- else(MSVC)
- target_link_libraries(${TARGET} ${CMAKE_SOURCE_DIR}/Third_Party/Zlib/libzlibstatic.a)
- target_link_libraries(${TARGET} ${CMAKE_SOURCE_DIR}/Third_Party/Yaml-cpp/libyaml-cpp.a)
- target_link_libraries(${TARGET} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic)
- endif(MSVC)
- endforeach(TARGET LotroDat_static LotroDat LotRO_dat_extract_tester LotRO_dat_pat_tester)
|