Update cppformat v2 to fmtlib v4

* I did this mainly to remove some build warnings that were showing up
in cppformat v2 underneath clang (the default macOS compiler)
* At this point, WUT will build on macOS with no warnings whatsoever.
This commit is contained in:
CreeperMario 2017-08-27 18:41:08 +09:30
parent 5829abb4ef
commit d44b7f774e
8 changed files with 28 additions and 28 deletions

6
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "tools/ext/zlib"]
path = externals/zlib
url = https://github.com/madler/zlib.git
[submodule "tools/ext/cppformat"]
path = externals/cppformat
url = https://github.com/cppformat/cppformat.git
[submodule "tools/ext/excmd"]
path = externals/excmd
url = https://github.com/exjam/excmd
[submodule "externals/fmt"]
path = externals/fmt
url = https://github.com/fmtlib/fmt

View File

@ -1,10 +1,10 @@
project(libraries)
include(ExternalProject)
# cppformat
set(CPPFORMAT_DIR "cppformat")
externalproject_add(cppformat
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${CPPFORMAT_DIR}"
# fmtlib
set(FMTLIB_DIR "fmt")
externalproject_add(fmtlib
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${FMTLIB_DIR}"
CMAKE_CACHE_ARGS
-DCMAKE_C_COMPILER:string=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS:string=${CMAKE_C_FLAGS}
@ -14,28 +14,28 @@ externalproject_add(cppformat
-DFMT_INSTALL:string=off
-DFMT_TEST:string=off
INSTALL_COMMAND "")
externalproject_get_property(cppformat BINARY_DIR)
set_target_properties(cppformat PROPERTIES FOLDER libraries)
externalproject_get_property(fmtlib BINARY_DIR)
set_target_properties(fmtlib PROPERTIES FOLDER libraries)
if(MSVC)
set(CPPFORMAT_IMPORTED_LOCATION
IMPORTED_LOCATION_DEBUG "${BINARY_DIR}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}"
IMPORTED_LOCATION_RELEASE "${BINARY_DIR}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}"
IMPORTED_LOCATION_RELWITHDEBINFO "${BINARY_DIR}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}"
IMPORTED_LOCATION_MINSIZEREL "${BINARY_DIR}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}")
set(FMTLIB_IMPORTED_LOCATION
IMPORTED_LOCATION_DEBUG "${BINARY_DIR}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}fmt${CMAKE_FIND_LIBRARY_SUFFIXES}"
IMPORTED_LOCATION_RELEASE "${BINARY_DIR}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}fmt${CMAKE_FIND_LIBRARY_SUFFIXES}"
IMPORTED_LOCATION_RELWITHDEBINFO "${BINARY_DIR}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}fmt${CMAKE_FIND_LIBRARY_SUFFIXES}"
IMPORTED_LOCATION_MINSIZEREL "${BINARY_DIR}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}fmt${CMAKE_FIND_LIBRARY_SUFFIXES}")
else()
set(CPPFORMAT_IMPORTED_LOCATION
IMPORTED_LOCATION "${BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat.a")
set(FMTLIB_IMPORTED_LOCATION
IMPORTED_LOCATION "${BINARY_DIR}/fmt/${CMAKE_FIND_LIBRARY_PREFIXES}fmt.a")
endif()
add_library(cppformat_import STATIC IMPORTED GLOBAL)
add_dependencies(cppformat_import cppformat)
set_target_properties(cppformat_import PROPERTIES ${CPPFORMAT_IMPORTED_LOCATION})
add_library(fmtlib_import STATIC IMPORTED GLOBAL)
add_dependencies(fmtlib_import fmtlib)
set_target_properties(fmtlib_import PROPERTIES ${FMTLIB_IMPORTED_LOCATION})
add_library(cppformat_final INTERFACE)
target_include_directories(cppformat_final INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/${CPPFORMAT_DIR}")
target_link_libraries(cppformat_final INTERFACE cppformat_import)
set(CPPFORMAT_LINK cppformat_final PARENT_SCOPE)
add_library(fmtlib_final INTERFACE)
target_include_directories(fmtlib_final INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/${FMTLIB_DIR}")
target_link_libraries(fmtlib_final INTERFACE fmtlib_import)
set(FMTLIB_LINK fmtlib_final PARENT_SCOPE)
# excmd
set(EXCMD_DIR "excmd")

1
externals/cppformat vendored

@ -1 +0,0 @@
Subproject commit 804ad8f4df7e01259374a1d2f458775f1b2d1164

1
externals/fmt vendored Submodule

@ -0,0 +1 @@
Subproject commit 398343897f98b88ade80bbebdcbe82a36c65a980

View File

@ -7,8 +7,8 @@ add_executable(implcheck ${SOURCE_FILES} ${HEADER_FILES})
set_target_properties(implcheck PROPERTIES FOLDER tools)
target_link_libraries(implcheck PRIVATE
${CPPFORMAT_LINK}
${EXCMD_LINK}
${FMTLIB_LINK}
${ZLIB_LINK})
install(TARGETS implcheck RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -1,6 +1,6 @@
#include <algorithm>
#include <excmd.h>
#include <format.h>
#include <fmt/format.h>
#include <fstream>
#include <iostream>
#include <vector>

View File

@ -7,8 +7,8 @@ add_executable(readrpl ${SOURCE_FILES} ${HEADER_FILES})
set_target_properties(readrpl PROPERTIES FOLDER tools)
target_link_libraries(readrpl PRIVATE
${CPPFORMAT_LINK}
${EXCMD_LINK}
${FMTLIB_LINK}
${ZLIB_LINK})
install(TARGETS readrpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -1,5 +1,5 @@
#include <excmd.h>
#include <format.h>
#include <fmt/format.h>
#include <fstream>
#include <iostream>
#include <vector>