Fixed and updated CMake configuration
This commit is contained in:
parent
b086f93a36
commit
50d1a1c275
|
|
@ -18,3 +18,4 @@ bin/*.lib
|
||||||
output.png
|
output.png
|
||||||
out/
|
out/
|
||||||
build/
|
build/
|
||||||
|
/cmake-gen.bat
|
||||||
|
|
|
||||||
|
|
@ -1,60 +1,59 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
option(MSDF_ATLAS_GEN_BUILD_STANDALONE "Build the msdf-atlas-gen standalone executable" ON)
|
||||||
|
option(MSDF_ATLAS_GEN_MSDFGEN_EXTERNAL "Do not build the msdfgen submodule but find it as an external package" OFF)
|
||||||
|
if(NOT MSDF_ATLAS_GEN_MSDFGEN_EXTERNAL)
|
||||||
|
set(MSDFGEN_BUILD_STANDALONE OFF CACHE BOOL "Build the msdfgen standalone executable")
|
||||||
|
set(MSDFGEN_USE_OPENMP OFF CACHE INTERNAL "Build with OpenMP support for multithreaded code (disabled for atlas gen)" FORCE)
|
||||||
|
set(MSDFGEN_USE_CPP11 ON CACHE INTERNAL "Build with C++11 enabled (always enabled for atlas gen)" FORCE)
|
||||||
|
set(MSDFGEN_INSTALL OFF CACHE BOOL "Generate installation target for msdfgen")
|
||||||
|
endif()
|
||||||
|
|
||||||
project(msdf-atlas-gen VERSION 1.2 LANGUAGES CXX)
|
project(msdf-atlas-gen VERSION 1.2 LANGUAGES CXX)
|
||||||
option(MSDF_ATLAS_GEN_BUILD_STANDALONE "Build the msdf-atlas-gen standalone executable" ON)
|
|
||||||
set(MSDFGEN_BUILD_MSDFGEN_STANDALONE OFF CACHE BOOL "Build the msdfgen standalone executable")
|
|
||||||
set(MSDFGEN_USE_OPENMP OFF CACHE INTERNAL "Build with OpenMP support for multithreaded code (disabled for atlas gen)" FORCE)
|
|
||||||
set(MSDFGEN_USE_CPP11 ON CACHE INTERNAL "Build with C++11 enabled (always enabled for atlas gen)" FORCE)
|
|
||||||
set(MSDFGEN_INSTALL OFF CACHE BOOL "Generate installation target for msdfgen")
|
|
||||||
add_subdirectory(msdfgen)
|
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
file(GLOB_RECURSE msdf-atlas-gen_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
if(MSDF_ATLAS_GEN_MSDFGEN_EXTERNAL)
|
||||||
"msdf-atlas-gen/*.h"
|
find_package(msdfgen REQUIRED)
|
||||||
"msdf-atlas-gen/*.hpp"
|
else()
|
||||||
)
|
add_subdirectory(msdfgen)
|
||||||
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE msdf-atlas-gen_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
file(GLOB_RECURSE MSDF_ATLAS_GEN_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "msdf-atlas-gen/*.h" "msdf-atlas-gen/*.hpp")
|
||||||
"msdf-atlas-gen/*.cpp"
|
file(GLOB_RECURSE MSDF_ATLAS_GEN_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "msdf-atlas-gen/*.cpp")
|
||||||
)
|
|
||||||
|
|
||||||
# msdf-atlas-gen library
|
# msdf-atlas-gen library
|
||||||
add_library(msdf-atlas-gen ${msdf-atlas-gen_SOURCES} ${msdf-atlas-gen_HEADERS})
|
add_library(msdf-atlas-gen ${MSDF_ATLAS_GEN_HEADERS} ${MSDF_ATLAS_GEN_SOURCES})
|
||||||
add_library(msdf-atlas-gen::msdf-atlas-gen ALIAS msdf-atlas-gen)
|
add_library(msdf-atlas-gen::msdf-atlas-gen ALIAS msdf-atlas-gen)
|
||||||
set_target_properties(msdf-atlas-gen PROPERTIES PUBLIC_HEADER "${msdf-atlas-gen_HEADERS}")
|
set_target_properties(msdf-atlas-gen PROPERTIES PUBLIC_HEADER "${MSDF_ATLAS_GEN_HEADERS}")
|
||||||
target_include_directories(msdf-atlas-gen
|
target_include_directories(msdf-atlas-gen
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/msdfgen/include # for lodepng.h
|
${CMAKE_CURRENT_SOURCE_DIR}/msdfgen/include # for lodepng.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/artery-font-format
|
${CMAKE_CURRENT_SOURCE_DIR}/artery-font-format
|
||||||
)
|
)
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
target_compile_definitions(msdf-atlas-gen PUBLIC _CRT_SECURE_NO_WARNINGS)
|
|
||||||
endif()
|
|
||||||
target_compile_features(msdf-atlas-gen PUBLIC cxx_std_11)
|
target_compile_features(msdf-atlas-gen PUBLIC cxx_std_11)
|
||||||
target_link_libraries(msdf-atlas-gen PUBLIC Threads::Threads msdfgen::msdfgen msdfgen::msdfgen-ext)
|
target_link_libraries(msdf-atlas-gen PUBLIC Threads::Threads msdfgen::msdfgen)
|
||||||
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdf-atlas-gen)
|
||||||
# TODO make these public in msdfgen so that this doesn't have to be repeated here
|
|
||||||
if(FREETYPE_WITH_PNG)
|
|
||||||
find_package(ZLIB REQUIRED)
|
|
||||||
find_package(PNG REQUIRED)
|
|
||||||
target_link_libraries(msdf-atlas-gen PUBLIC ZLIB::ZLIB PNG::PNG)
|
|
||||||
endif()
|
|
||||||
if(FREETYPE_WITH_HARFBUZZ)
|
|
||||||
# No FindHarfBuzz.cmake available so falling back to CMAKE_LIBRARY_PATH
|
|
||||||
find_library(FREETYPE_HARFBUZZ_LIB "harfbuzz")
|
|
||||||
target_link_libraries(msdf-atlas-gen PUBLIC "${FREETYPE_HARFBUZZ_LIB}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# msdf-atlas-gen standalone executable
|
# msdf-atlas-gen standalone executable
|
||||||
if(MSDF_ATLAS_GEN_BUILD_STANDALONE)
|
if(MSDF_ATLAS_GEN_BUILD_STANDALONE)
|
||||||
add_executable(msdf-atlas-gen-standalone msdf-atlas-gen/main.cpp)
|
set(MSDF_ATLAS_GEN_STANDALONE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/msdf-atlas-gen/main.cpp")
|
||||||
set_target_properties(msdf-atlas-gen-standalone PROPERTIES ARCHIVE_OUTPUT_DIRECTORY archive OUTPUT_NAME msdf-atlas-gen)
|
if(MSVC)
|
||||||
|
set(MSDF_ATLAS_GEN_STANDALONE_SOURCES ${MSDF_ATLAS_GEN_STANDALONE_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/msdf-atlas-gen.rc")
|
||||||
|
endif()
|
||||||
|
add_executable(msdf-atlas-gen-standalone ${MSDF_ATLAS_GEN_STANDALONE_SOURCES})
|
||||||
target_compile_definitions(msdf-atlas-gen-standalone PUBLIC MSDF_ATLAS_STANDALONE)
|
target_compile_definitions(msdf-atlas-gen-standalone PUBLIC MSDF_ATLAS_STANDALONE)
|
||||||
target_compile_features(msdf-atlas-gen-standalone PUBLIC cxx_std_11)
|
set_target_properties(msdf-atlas-gen-standalone PROPERTIES
|
||||||
|
OUTPUT_NAME msdf-atlas-gen
|
||||||
|
ARCHIVE_OUTPUT_NAME msdf-atlas-gen-standalone
|
||||||
|
# Avoid deleting msdf-atlas-gen.lib during clean
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
)
|
||||||
target_link_libraries(msdf-atlas-gen-standalone PUBLIC msdf-atlas-gen::msdf-atlas-gen)
|
target_link_libraries(msdf-atlas-gen-standalone PUBLIC msdf-atlas-gen::msdf-atlas-gen)
|
||||||
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdf-atlas-gen-standalone)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio 14
|
||||||
VisualStudioVersion = 14.0.25420.1
|
VisualStudioVersion = 14.0.25420.1
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Msdfgen", "msdfgen\Msdfgen.vcxproj", "{84BE2D91-F071-4151-BE12-61460464C494}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msdfgen", "msdfgen\msdfgen.vcxproj", "{84BE2D91-F071-4151-BE12-61460464C494}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msdf-atlas-gen", "msdf-atlas-gen.vcxproj", "{223EDB94-5B35-45F2-A584-273DE6E45F6F}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msdf-atlas-gen", "msdf-atlas-gen.vcxproj", "{223EDB94-5B35-45F2-A584-273DE6E45F6F}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
|
|
||||||
2
msdfgen
2
msdfgen
|
|
@ -1 +1 @@
|
||||||
Subproject commit 64a91eec3ca3787e6f78b4c99fcd3052ad3e37c0
|
Subproject commit 4e8ff2321ea9696801675c908a4822c4d8e71eb8
|
||||||
Loading…
Reference in New Issue