working msdfgen version of loading and building for win
This commit is contained in:
@@ -22,3 +22,4 @@ TRACY_REPO=https://git.madvoxel.net/Mirrors/tracy.git
|
||||
STB_REPO=https://git.madvoxel.net/Mirrors/stb.git
|
||||
UNITS_REPO=https://git.madvoxel.net/Mirrors/units.git
|
||||
ANKERLUD_REPO=https://git.madvoxel.net/Mirrors/ankerl_unordered_dense.git
|
||||
MSDFGEN_REPO=https://git.madvoxel.net/Mirrors/msdfgen.git
|
||||
1
3rdParty/CMakeLists.txt
vendored
1
3rdParty/CMakeLists.txt
vendored
@@ -23,6 +23,7 @@ add_subdirectory(libarchive)
|
||||
add_subdirectory(boost)
|
||||
add_subdirectory(units)
|
||||
add_subdirectory(libjpeg-turbo)
|
||||
add_subdirectory(msdf)
|
||||
if (NOT IOS)
|
||||
add_subdirectory(curl)
|
||||
endif()
|
||||
|
||||
78
3rdParty/msdf/CMakeLists.txt
vendored
Normal file
78
3rdParty/msdf/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
include(FetchContent)
|
||||
|
||||
unset(ASSIMP_FOUND)
|
||||
find_package(ASSIMP QUIET)
|
||||
if (NOT ASSIMP_FOUND)
|
||||
message(FATAL_ERROR "Assimp package is required to build msdfgen")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED MSDFGEN_REPO)
|
||||
set(MSDFGEN_REPO https://github.com/Chlumsky/msdfgen.git)
|
||||
endif ()
|
||||
|
||||
if(NOT DEFINED VCPKG_REPO)
|
||||
set(VCPKG_REPO https://github.com/microsoft/vcpkg.git)
|
||||
endif()
|
||||
|
||||
set(VCPKG_SRC_DIR "${CMAKE_BINARY_DIR}/_deps/vcpkg-src")
|
||||
if (NOT EXISTS ${VCPKG_SRC_DIR} OR VCPKG_EXECUTABLE STREQUAL "" OR NOT DEFINED VCPKG_EXECUTABLE)
|
||||
message("Cloning vcpkg...")
|
||||
FetchContent_Declare(
|
||||
vcpkg
|
||||
EXCLUDE_FROM_ALL
|
||||
GIT_REPOSITORY ${VCPKG_REPO}
|
||||
GIT_TAG master
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(vcpkg)
|
||||
if (WIN32)
|
||||
execute_process(COMMAND "${VCPKG_SRC_DIR}/bootstrap-vcpkg.bat")
|
||||
set(VCPKG_EXECUTABLE "${VCPKG_SRC_DIR}/vcpkg.exe" CACHE INTERNAL "vcpkg executable")
|
||||
else()
|
||||
execute_process(COMMAND bash "${VCPKG_SRC_DIR}/bootstrap-vcpkg.sh")
|
||||
set(VCPKG_EXECUTABLE "${VCPKG_SRC_DIR}/vcpkg" CACHE INTERNAL "vcpkg executable")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# custom triplets (looks like doesn't work)
|
||||
#if (WIN32)
|
||||
# set(VCPKG_TARGET_TRIPLET "${CMAKE_SOURCE_DIR}/cmake/x64-windows-static-triplet" CACHE STRING "VCPKG Target Triplet to use")
|
||||
#elseif(UNIX)
|
||||
# set(VCPKG_TARGET_TRIPLET "${CMAKE_SOURCE_DIR}/cmake/x64-linux-triplet" CACHE STRING "VCPKG Target Triplet to use")
|
||||
#endif()
|
||||
|
||||
if (WIN32)
|
||||
# static win build breaks find_library call. need to specify FREETYPE_LIBRARY and FREETYPE_INCLUDE_DIRS manually.
|
||||
# plain x64-windows will link freetype as dll instead of lib .......
|
||||
set(TRIPLET x64-windows-static)
|
||||
elseif(UNIX)
|
||||
set(TRIPLET x64-linux)
|
||||
elseif(APPLE)
|
||||
set(TRIPLET x64-osx)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown OS, can't build msdfgen")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${VCPKG_EXECUTABLE} install freetype:${TRIPLET})
|
||||
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_BINARY_DIR}/_deps/vcpkg-src/scripts/buildsystems/vcpkg.cmake" CACHE STRING "cmake toolchain")
|
||||
include("${VCPKG_SRC_DIR}/scripts/buildsystems/vcpkg.cmake")
|
||||
|
||||
if(WIN32)
|
||||
set(FREETYPE_LIBRARY "${VCPKG_SRC_DIR}/buildtrees/freetype/${TRIPLET}-rel/freetype.lib" CACHE STRING "freetype lib path on win")
|
||||
set(FREETYPE_INCLUDE_DIRS "${VCPKG_SRC_DIR}/packages/freetype_${TRIPLET}/include" CACHE STRING "freetype include path on win")
|
||||
endif()
|
||||
|
||||
#find_package(Freetype REQUIRED)
|
||||
|
||||
set(MSDFGEN_DISABLE_SVG TRUE CACHE INTERNAL "disable msdfgen svg")
|
||||
set(MSDFGEN_DISABLE_PNG TRUE CACHE INTERNAL "disable msdfgen png")
|
||||
set(MSDFGEN_USE_SKIA OFF CACHE BOOL "use skia" FORCE)
|
||||
|
||||
FetchContent_Declare(
|
||||
msdfgen
|
||||
EXCLUDE_FROM_ALL
|
||||
GIT_REPOSITORY ${MSDFGEN_REPO}
|
||||
GIT_TAG v1.12
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(msdfgen)
|
||||
@@ -118,7 +118,8 @@ endif()
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps/INSTALL)
|
||||
|
||||
target_link_libraries(openVulkanoCpp PRIVATE magic_enum yaml-cpp fmt spdlog glm pugixml stb eigen utf8cpp imgui_internal TracyClient stud-uuid ryml unordered_dense Boost::regex units)
|
||||
target_link_libraries(openVulkanoCpp PRIVATE magic_enum yaml-cpp fmt spdlog glm pugixml stb eigen utf8cpp imgui_internal
|
||||
TracyClient stud-uuid ryml unordered_dense Boost::regex units msdfgen::msdfgen msdfgen::msdfgen-ext)
|
||||
if (NOT IOS)
|
||||
LinkCurl(openVulkanoCpp)
|
||||
endif()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/mesh.h>
|
||||
#include <assimp/postprocess.h>
|
||||
//#define ASSIMP_AVAILABLE
|
||||
#define ASSIMP_AVAILABLE
|
||||
#endif
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user