2019-12-01 18:23:59 +00:00
|
|
|
|
# UVAtlas Isochart Atlas Library
|
|
|
|
|
#
|
|
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
#
|
|
|
|
|
# http://go.microsoft.com/fwlink/?LinkID=512686
|
|
|
|
|
|
2020-03-29 22:24:52 +00:00
|
|
|
|
cmake_minimum_required (VERSION 3.11)
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
|
|
|
|
project (UVAtlas LANGUAGES CXX)
|
|
|
|
|
|
2020-02-15 07:28:06 +00:00
|
|
|
|
# To build this tool, you need the DirectXTex (http://go.microsoft.com/fwlink/?LinkId=248926) and
|
|
|
|
|
# DirectXMesh (http://go.microsoft.com/fwlink/?LinkID=324981) libraries in the following directory structure:
|
|
|
|
|
#
|
|
|
|
|
# .\DirectXTex\DirectXTex
|
|
|
|
|
# .\DirectXMesh\DirectXMesh
|
|
|
|
|
# .\DirectXMesh\Utilities
|
|
|
|
|
# .\UVAtlas\UVAtlas
|
|
|
|
|
# .\UVAtlas\UVAtlasTool
|
|
|
|
|
#
|
2019-12-14 01:18:02 +00:00
|
|
|
|
option(BUILD_TOOLS "Build UVAtlasTool" ON)
|
|
|
|
|
|
2020-02-10 17:44:45 +00:00
|
|
|
|
# Enable the use of OpenMP
|
|
|
|
|
option(UVATLAS_USE_OPENMP "Build with OpenMP support" ON)
|
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" OFF)
|
|
|
|
|
|
2019-12-01 18:23:59 +00:00
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
2020-08-11 03:15:30 +00:00
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake")
|
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake")
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake")
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
|
|
|
|
add_library (${PROJECT_NAME} STATIC
|
|
|
|
|
UVAtlas/maxheap.hpp
|
|
|
|
|
UVAtlas/pch.h
|
|
|
|
|
UVAtlas/inc/UVAtlas.h
|
|
|
|
|
UVAtlas/geodesics/ApproximateOneToAll.cpp
|
|
|
|
|
UVAtlas/geodesics/ApproximateOneToAll.h
|
|
|
|
|
UVAtlas/geodesics/datatypes.h
|
|
|
|
|
UVAtlas/geodesics/ExactOneToAll.cpp
|
|
|
|
|
UVAtlas/geodesics/ExactOneToAll.h
|
|
|
|
|
UVAtlas/geodesics/mathutils.cpp
|
|
|
|
|
UVAtlas/geodesics/mathutils.h
|
|
|
|
|
UVAtlas/geodesics/minheap.hpp
|
|
|
|
|
UVAtlas/isochart/barycentricparam.cpp
|
|
|
|
|
UVAtlas/isochart/basemeshinfo.cpp
|
|
|
|
|
UVAtlas/isochart/basemeshinfo.h
|
|
|
|
|
UVAtlas/isochart/callbackschemer.h
|
|
|
|
|
UVAtlas/isochart/graphcut.cpp
|
|
|
|
|
UVAtlas/isochart/graphcut.h
|
|
|
|
|
UVAtlas/isochart/imtcomputation.cpp
|
|
|
|
|
UVAtlas/isochart/isochart.cpp
|
|
|
|
|
UVAtlas/isochart/isochart.h
|
|
|
|
|
UVAtlas/isochart/isochartconfig.h
|
|
|
|
|
UVAtlas/isochart/isochartengine.cpp
|
|
|
|
|
UVAtlas/isochart/isochartengine.h
|
|
|
|
|
UVAtlas/isochart/isochartmesh.cpp
|
|
|
|
|
UVAtlas/isochart/isochartmesh.h
|
|
|
|
|
UVAtlas/isochart/isochartutil.cpp
|
|
|
|
|
UVAtlas/isochart/isochartutil.h
|
|
|
|
|
UVAtlas/isochart/isomap.cpp
|
|
|
|
|
UVAtlas/isochart/isomap.h
|
|
|
|
|
UVAtlas/isochart/lscmparam.cpp
|
|
|
|
|
UVAtlas/isochart/mergecharts.cpp
|
|
|
|
|
UVAtlas/isochart/meshapplyisomap.cpp
|
|
|
|
|
UVAtlas/isochart/meshcommon.inl
|
|
|
|
|
UVAtlas/isochart/meshoptimizeboundaries.cpp
|
|
|
|
|
UVAtlas/isochart/meshoptimizestretch.cpp
|
|
|
|
|
UVAtlas/isochart/meshpartitionchart.cpp
|
|
|
|
|
UVAtlas/isochart/packingcharts.cpp
|
|
|
|
|
UVAtlas/isochart/progressivemesh.cpp
|
|
|
|
|
UVAtlas/isochart/progressivemesh.h
|
|
|
|
|
UVAtlas/isochart/sparsematrix.hpp
|
|
|
|
|
UVAtlas/isochart/SymmetricMatrix.hpp
|
|
|
|
|
UVAtlas/isochart/UVAtlas.cpp
|
|
|
|
|
UVAtlas/isochart/UVAtlasRepacker.cpp
|
|
|
|
|
UVAtlas/isochart/UVAtlasRepacker.h
|
|
|
|
|
UVAtlas/isochart/vertiter.cpp
|
|
|
|
|
UVAtlas/isochart/vertiter.h
|
|
|
|
|
UVAtlas/isochart/Vis_Maxflow.cpp
|
|
|
|
|
UVAtlas/isochart/Vis_Maxflow.h
|
|
|
|
|
)
|
|
|
|
|
|
2020-03-29 22:24:52 +00:00
|
|
|
|
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
|
|
|
|
|
target_precompile_headers(${PROJECT_NAME} PRIVATE UVAtlas/pch.h)
|
|
|
|
|
endif()
|
2020-03-29 19:54:48 +00:00
|
|
|
|
|
2019-12-01 18:23:59 +00:00
|
|
|
|
source_group(inc REGULAR_EXPRESSION UVAtlas/inc/*.*)
|
|
|
|
|
source_group(geodesics REGULAR_EXPRESSION UVAtlas/geodesics/*.*)
|
|
|
|
|
source_group(isochart REGULAR_EXPRESSION UVAtlas/isochart/*.*)
|
|
|
|
|
source_group(isochart REGULAR_EXPRESSION UVAtlas/isochart/*.*)
|
|
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PUBLIC UVAtlas/inc)
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE UVAtlas UVAtlas/UVAtlas/geodesics UVAtlas/isochart)
|
|
|
|
|
|
2019-12-02 18:52:46 +00:00
|
|
|
|
if(MSVC)
|
|
|
|
|
# Use higher Warning Level
|
2020-02-25 04:21:26 +00:00
|
|
|
|
string(REPLACE "/W3 " "/Wall " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
|
string(REPLACE "/W3 " "/Wall " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
|
|
|
|
string(REPLACE "/W3 " "/Wall " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
2019-12-02 18:52:46 +00:00
|
|
|
|
|
|
|
|
|
# Not using typeid or dynamic_cast, so disable RTTI to save binary size
|
|
|
|
|
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
|
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
|
|
|
|
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2019-12-12 00:42:55 +00:00
|
|
|
|
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../DirectXMesh/CMakeLists.txt")
|
|
|
|
|
message(FATAL_ERROR "uvatalastool requires DirectXMesh library from http://go.microsoft.com/fwlink/?LinkID=324981" )
|
|
|
|
|
endif()
|
|
|
|
|
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../DirectXTex/CMakeLists.txt")
|
|
|
|
|
message(FATAL_ERROR "uvatalastool requires DirectXTex library from http://go.microsoft.com/fwlink/?LinkId=248926" )
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
2019-12-12 00:42:55 +00:00
|
|
|
|
add_subdirectory(${CMAKE_SOURCE_DIR}/../DirectXMesh ${CMAKE_BINARY_DIR}/bin/CMake/DirectXMesh)
|
|
|
|
|
add_subdirectory(${CMAKE_SOURCE_DIR}/../DirectXTex ${CMAKE_BINARY_DIR}/bin/CMake/DirectXTex)
|
|
|
|
|
|
|
|
|
|
add_executable(uvatlastool
|
|
|
|
|
UVAtlasTool/UVAtlas.cpp
|
|
|
|
|
UVAtlasTool/Mesh.cpp
|
|
|
|
|
UVAtlasTool/Mesh.h
|
|
|
|
|
UVAtlasTool/MeshOBJ.cpp
|
|
|
|
|
UVAtlasTool/SDKMesh.h)
|
2020-08-15 23:12:57 +00:00
|
|
|
|
target_link_libraries(uvatlastool ${PROJECT_NAME} DirectXMesh DirectXTex version.lib)
|
2019-12-12 00:42:55 +00:00
|
|
|
|
target_include_directories(uvatlastool PRIVATE ../DirectXMesh/DirectXMesh ../DirectXMesh/Utilities ../DirectXTex/DirectXTex)
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
2019-12-02 18:52:46 +00:00
|
|
|
|
if(MSVC)
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast)
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2019-12-12 00:42:55 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE /fp:fast)
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
2019-12-02 18:52:46 +00:00
|
|
|
|
if (${CMAKE_SIZEOF_VOID_P} EQUAL "4")
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2)
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2019-12-12 00:42:55 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE /arch:SSE2)
|
|
|
|
|
endif()
|
2019-12-02 18:52:46 +00:00
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|
|
|
|
set(WarningsLib "-Wpedantic" "-Wextra")
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})
|
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2020-08-06 02:28:10 +00:00
|
|
|
|
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-exit-time-destructors" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes")
|
2019-12-12 00:42:55 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE ${WarningsEXE})
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
endif()
|
2019-12-12 00:42:55 +00:00
|
|
|
|
|
2019-12-01 18:23:59 +00:00
|
|
|
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
|
2020-05-20 03:23:06 +00:00
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2020-05-20 03:23:06 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE /permissive- /Zc:__cplusplus)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(ENABLE_CODE_ANALYSIS)
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
|
|
|
|
|
if(BUILD_TOOLS)
|
|
|
|
|
target_compile_options(uvatlastool PRIVATE /analyze)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-05-20 03:23:06 +00:00
|
|
|
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
|
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2020-05-20 03:23:06 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE /Zc:preprocessor /wd5105)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(UVATLAS_USE_OPENMP)
|
2020-02-10 17:44:45 +00:00
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /openmp /Zc:twoPhase-)
|
2020-05-20 03:23:06 +00:00
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2020-05-20 03:23:06 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE /openmp /Zc:twoPhase-)
|
|
|
|
|
endif()
|
2020-02-10 17:44:45 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2020-06-03 21:14:40 +00:00
|
|
|
|
set(WarningsEXE "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045" "/wd4061" "/wd4062" "/wd5219")
|
2019-12-12 00:42:55 +00:00
|
|
|
|
target_compile_options(uvatlastool PRIVATE ${WarningsEXE})
|
|
|
|
|
endif()
|
2019-12-01 18:23:59 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
2019-12-11 23:08:37 +00:00
|
|
|
|
if(MSVC)
|
|
|
|
|
# We use Windows 7 here
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
|
2020-06-05 22:18:07 +00:00
|
|
|
|
if(BUILD_TOOLS)
|
2019-12-12 00:42:55 +00:00
|
|
|
|
target_compile_definitions(uvatlastool PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
|
|
|
|
|
endif()
|
2019-12-11 23:08:37 +00:00
|
|
|
|
endif()
|
2020-08-11 03:15:30 +00:00
|
|
|
|
|
|
|
|
|
if(BUILD_TOOLS)
|
|
|
|
|
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT uvatlastool)
|
|
|
|
|
else()
|
|
|
|
|
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
|
|
|
|
|
endif()
|
|
|
|
|
|