Simplify build, document it somewhat.

This commit is contained in:
Pär Winzell 2019-06-01 12:48:16 -07:00
parent a89b7d526f
commit 25ef9167ed
3 changed files with 43 additions and 47 deletions

View File

@ -46,31 +46,13 @@ find_package(Iconv QUIET)
# stuff we get from Conan
find_package(boost_filesystem REQUIRED)
find_package(boost_optional REQUIRED)
find_package(libxml2 REQUIRED)
find_package(zlib REQUIRED)
find_package(fmt REQUIRED)
# create a compilation database for e.g. clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (WIN32)
# this will suffice for now; don't really care about 32-bit
set(LIBXML2_INCLUDE_DIRS ${FBXSDK_INCLUDE_DIR})
set(LIBXML2_LIBRARIES ${FBXSDK_ROOT}/lib/vs2017/x64/release/libxml2-mt.lib)
set(LIBXML2_LIBRARIES_DEBUG ${FBXSDK_ROOT}/lib/vs2017/x64/debug/libxml2-mt.lib)
if (NOT LIBXML2_INCLUDE_DIRS OR NOT LIBXML2_LIBRARIES)
message(FATAL_ERROR "Cannot find libxml2.lib in the expected location.")
endif()
set(ZLIB_INCLUDE_DIRS ${FBXSDK_INCLUDE_DIR})
set(ZLIB_LIBRARIES ${FBXSDK_ROOT}/lib/vs2017/x64/release/zlib-mt.lib)
set(ZLIB_LIBRARIES_DEBUG ${FBXSDK_ROOT}/lib/vs2017/x64/debug/zlib-mt.lib)
if (NOT ZLIB_LIBRARIES)
message(FATAL_ERROR "Cannot find zlib.lib in the expected location.")
endif()
else()
find_package(LibXml2 REQUIRED)
find_package(ZLIB REQUIRED)
endif()
# DRACO
ExternalProject_Add(Draco
GIT_REPOSITORY https://github.com/google/draco
@ -221,6 +203,8 @@ target_link_libraries(libFBX2glTF
boost_filesystem::boost_filesystem
boost_optional::boost_optional
fmt::fmt
libxml2::libxml2
zlib::zlib
${DRACO_LIB}
optimized ${FBXSDK_LIBRARY}
debug ${FBXSDK_LIBRARY_DEBUG}
@ -228,25 +212,13 @@ target_link_libraries(libFBX2glTF
${CMAKE_THREAD_LIBS_INIT}
)
if (WIN32)
target_link_libraries(libFBX2glTF
optimized ${LIBXML2_LIBRARIES}
debug ${LIBXML2_LIBRARIES_DEBUG}
optimized ${ZLIB_LIBRARIES}
debug ${ZLIB_LIBRARIES_DEBUG}
)
else()
target_link_libraries(libFBX2glTF
${LIBXML2_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
target_include_directories(libFBX2glTF PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
boost_filesystem::boost_filesystem
boost_optional::boost_optional
fmt::fmt
libxml2::libxml2
zlib::zlib
)
target_include_directories(libFBX2glTF SYSTEM PUBLIC
@ -257,8 +229,6 @@ target_include_directories(libFBX2glTF SYSTEM PUBLIC
${MATHFU_INCLUDE_DIRS}
${FIFO_MAP_INCLUDE_DIR}
${CPPCODEC_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
)
if (Iconv_FOUND)

View File

@ -9,7 +9,7 @@ a modern runtime asset delivery format.
Precompiled binaries releases for Windows, Mac OS X and Linux may be
found [here](https://github.com/facebookincubator/FBX2glTF/releases).
Bleeding-edge binaries are periodically built and publicly available [here](https://dev.azure.com/parwinzell/FBX2glTF/): click a build (usually the most recent), then the 'Artefacts' dropdown in the upper right.
Bleeding-edge binaries for Windows may be found [here](https://ci.appveyor.com/project/Facebook/fbx2gltf/build/artifacts). Linux and Mac OS X to come; meanwhile, you can [build your own](#building-it-on-your-own).
[![Build Status](https://travis-ci.com/facebookincubator/FBX2glTF.svg?branch=master)](https://travis-ci.com/facebookincubator/FBX2glTF)
[![Build status](https://ci.appveyor.com/api/projects/status/5mq4vbc44vmyec4w?svg=true)](https://ci.appveyor.com/project/Facebook/fbx2gltf)
@ -127,8 +127,6 @@ Some of these switches are not obvious:
## Building it on your own
Building FBX2glTF has become slightly more ornery because <TODO> explanation.
We currently depend on the open source projects
[Draco](https://github.com/google/draco),
[MathFu](https://github.com/google/mathfu),
@ -139,25 +137,51 @@ We currently depend on the open source projects
and [fmt](https://github.com/fmtlib/fmt);
all of which are automatically downloaded and/or built.
You must however manually download and install the
[Autodesk FBX SDK](https://www.autodesk.com/products/fbx/overview) and
accept its license agreement.
**At present, only version 2019.2 of the FBX SDK is supported**. The
build system will not successfully locate any other version.
### Linux and MacOS X
Compilation on Unix machines might look like:
Your development environment will need to have:
- build essentials (gcc for Linux, clang for Mac)
- cmake
- python 3.* and associated pip3/pip command
- zstd
Then, compilation on Unix machines will look something like:
```
<TODO>
# Determine SDK location & build settings for Linux vs (Recent) Mac OS X
> if [[ "$OSTYPE" == "darwin" ]]; then
export CONAN_CONFIG="-s compiler=apple-clang -s compiler.version=10.0 -s compiler.libcxx=libc++"
export FBXSDK_TARBALL="https://github.com/zellski/FBXSDK-Darwin/archive/2019.2.tar.gz"
else
export CONAN_CONFIG="-s compiler.libcxx=libstdc++11"
export FBXSDK_TARBALL="https://github.com/zellski/FBXSDK-Linux/archive/2019.2.tar.gz"
fi
# Fetch Project
> GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/facebookincubator/FBX2glTF.git
> cd FBX2glTF
# Fetch and unpack FBX SDK
> curl -sL "${FBXSDK_TARBALL}" | tar xz --strip-components=1
# Then decompress the contents
> zstd -d -r --rm sdk
# Install and configure Conan, if needed
> pip3 install conan # or sometimes just "pip"; you may need to install Python/PIP
> conan remote add --force bincrafters https://api.bintray.com/conan/bincrafters/public-conan
# Initialize & run build
> conan install . -i build -s build_type=Release ${CONAN_CONFIG}
> conan build . -bf build
```
If all goes well, you will end up with a statically linked executable.
If all goes well, you will end up with a statically linked executable in `./build/FBX2glTF`.
### Windows
<TODO> this needs updating
<TODO> the below is out of date
Windows users may [download](https://cmake.org/download) CMake for Windows,
install it and [run it](https://cmake.org/runningcmake/) on the FBX2glTF

View File

@ -10,6 +10,8 @@ class FBX2glTFConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = (
("boost_filesystem/1.69.0@bincrafters/stable"),
("zlib/1.2.11@conan/stable"),
("libxml2/2.9.9@bincrafters/stable"),
("fmt/5.3.0@bincrafters/stable"),
)
generators = "cmake_find_package", "cmake_paths"