diff --git a/.travis.yml b/.travis.yml index b4e4ea8f..ed77ee85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ matrix: - /usr/bin/yes | pip2 uninstall numpy # see https://github.com/travis-ci/travis-ci/issues/6688 - brew upgrade python - brew upgrade - - brew install boost cmake bullet ffmpeg glm openal-soft qt5 sdl2 jack + - brew install boost cmake bullet ffmpeg glm openal-soft qt5 sdl2 jack freetype - export PATH="/usr/local/opt/qt/bin:$PATH" script: - mkdir -p "$TRAVIS_BUILD_DIR/build" diff --git a/CMakeLists.txt b/CMakeLists.txt index 576167b3..be2cbc7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,9 @@ else() if(BUILD_TESTS) find_package(Boost COMPONENTS unit_test_framework REQUIRED) endif() + if(BUILD_TOOLS) + find_package(Freetype REQUIRED) + endif() # Do not link to SDL2main library set(SDL2_BUILDING_LIBRARY True) diff --git a/cmake/ctest/build.ctest b/cmake/ctest/build.ctest index 7d75eac2..ffa60618 100644 --- a/cmake/ctest/build.ctest +++ b/cmake/ctest/build.ctest @@ -8,6 +8,7 @@ set(_ARGS_BOOL USE_CONAN DEBUG CHECK_INCLUDES + BUILD_TOOLS BUILD_VIEWER RUN_TESTS @@ -142,6 +143,7 @@ else() endif() set(_CONFIGURE_OPTIONS + "-DBUILD_TOOLS=${BUILD_TOOLS}" "-DBUILD_VIEWER=${BUILD_VIEWER}" "-DBUILD_TESTS=TRUE" "-DTESTS_NODATA=${TESTS_NODATA}" diff --git a/cmake/ctest/configure_darwin.ctest b/cmake/ctest/configure_darwin.ctest index 4aca514e..39cdab58 100644 --- a/cmake/ctest/configure_darwin.ctest +++ b/cmake/ctest/configure_darwin.ctest @@ -1,6 +1,7 @@ set(CMAKE_GENERATOR "Xcode") set(DEBUG FALSE) set(CONFIGURE_EXTRA_OPTIONS ";") +set(BUILD_TOOLS TRUE) set(BUILD_VIEWER TRUE) set(COVERAGE_COMMAND gcov) set(CHECK_INCLUDES FALSE) diff --git a/cmake/ctest/configure_linux.ctest b/cmake/ctest/configure_linux.ctest index a6d6d19c..0690718c 100644 --- a/cmake/ctest/configure_linux.ctest +++ b/cmake/ctest/configure_linux.ctest @@ -1,6 +1,7 @@ set(CMAKE_GENERATOR "Unix Makefiles") set(DEBUG FALSE) set(CONFIGURE_EXTRA_OPTIONS ";") +set(BUILD_TOOLS TRUE) set(BUILD_VIEWER TRUE) set(COVERAGE_COMMAND gcov) set(CHECK_INCLUDES FALSE) diff --git a/cmake/ctest/configure_windows.ctest b/cmake/ctest/configure_windows.ctest index a3d4281b..2b9080b3 100644 --- a/cmake/ctest/configure_windows.ctest +++ b/cmake/ctest/configure_windows.ctest @@ -35,6 +35,7 @@ endif() set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/windows") set(CONAN_ARCH "x86_64") +set(BUILD_TOOLS TRUE) set(BUILD_VIEWER TRUE) set(COVERAGE_COMMAND "echo") #FIXME: ENABLE set(CHECK_INCLUDES FALSE) #FIXME: ENABLE diff --git a/cmake/modules/WrapTargets.cmake b/cmake/modules/WrapTargets.cmake index c4e36991..34579d45 100644 --- a/cmake/modules/WrapTargets.cmake +++ b/cmake/modules/WrapTargets.cmake @@ -47,6 +47,9 @@ function(rwdep_wrap_find_packages) if(Boost_UNIT_TEST_FRAMEWORK_FOUND) rwdep_wrap_find_package(boost_unit_test_framework "${Boost_INCLUDE_DIRS}" "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}") endif() + if(FREETYPE_FOUND) + rwdep_wrap_find_package(freetype "${FREETYPE_INCLUDE_DIRS}" "${FREETYPE_LIBRARIES}") + endif() endfunction() function(rwdep_wrap_conan_target TARGET CONAN_NAME) @@ -66,4 +69,7 @@ function(rwdep_wrap_conan_targets) rwdep_wrap_conan_target(glm glm) rwdep_wrap_conan_target(ffmpeg ffmpeg) rwdep_wrap_conan_target(SDL2 sdl2) + if(BUILD_TOOLS) + rwdep_wrap_conan_target(freetype freetype) + endif() endfunction() diff --git a/rwtools/rwfont/CMakeLists.txt b/rwtools/rwfont/CMakeLists.txt index 57608113..0425402c 100644 --- a/rwtools/rwfont/CMakeLists.txt +++ b/rwtools/rwfont/CMakeLists.txt @@ -1,5 +1,4 @@ # fixme: conan support -find_package(Freetype REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Gui) add_executable(rwfontmap rwfontmap.cpp @@ -7,8 +6,8 @@ add_executable(rwfontmap target_link_libraries(rwfontmap PUBLIC - rwlib - Freetype::Freetype + rwcore + rwdep::freetype + rwdep::boost_program_options Qt5::Gui - Boost::program_options ) diff --git a/rwtools/rwfont/rwfontmap.cpp b/rwtools/rwfont/rwfontmap.cpp index 1fdf779f..8850ce03 100644 --- a/rwtools/rwfont/rwfontmap.cpp +++ b/rwtools/rwfont/rwfontmap.cpp @@ -183,9 +183,9 @@ public: } void write(const rwfs::path &bitmap_path, const rwfs::path &advance_path) { - QImageWriter writer(bitmap_path.c_str()); + QImageWriter writer(QString::fromStdString(bitmap_path.string())); writer.write(m_texture); - std::ofstream ofs(advance_path.c_str(), std::ios_base::out); + std::ofstream ofs(advance_path.string(), std::ios_base::out); ofs << m_aspectratio << '\n'; for (auto adv : m_advances) { ofs << int(adv) << '\n'; diff --git a/scripts/conan/darwin b/scripts/conan/darwin index a57148d2..75a54c8d 100644 --- a/scripts/conan/darwin +++ b/scripts/conan/darwin @@ -1,6 +1,7 @@ include(default) [options] +openrw:tools=True openrw:viewer=True # https://github.com/bincrafters/community/issues/120 ffmpeg:vdpau=False diff --git a/scripts/conan/linux b/scripts/conan/linux index 26f24058..d42b330e 100644 --- a/scripts/conan/linux +++ b/scripts/conan/linux @@ -1,6 +1,7 @@ include(default) [options] +openrw:tools=True openrw:viewer=True sdl2:esd=False sdl2:wayland=True diff --git a/scripts/conan/windows b/scripts/conan/windows index d75443aa..1eccbc8e 100644 --- a/scripts/conan/windows +++ b/scripts/conan/windows @@ -1,5 +1,6 @@ include(default) [options] +openrw:tools=True openrw:viewer=True ffmpeg:qsv=False diff --git a/scripts/docker/arch_latest.docker b/scripts/docker/arch_latest.docker index 89e82079..40378719 100644 --- a/scripts/docker/arch_latest.docker +++ b/scripts/docker/arch_latest.docker @@ -10,6 +10,7 @@ RUN pacman -Syy --noconfirm \ community/glm \ extra/openal \ extra/sdl2 \ - extra/qt5-base + extra/qt5-base \ + extra/freetype2 CMD ["/bin/bash"] diff --git a/scripts/docker/fedora_latest.docker b/scripts/docker/fedora_latest.docker index 4cad6257..f190f4f2 100644 --- a/scripts/docker/fedora_latest.docker +++ b/scripts/docker/fedora_latest.docker @@ -17,6 +17,7 @@ RUN dnf update -y \ openal-soft-devel \ SDL2-devel \ qt5-devel \ + freetype-devel \ libasan CMD ["/bin/bash"] diff --git a/scripts/docker/ubuntu_latest.docker b/scripts/docker/ubuntu_latest.docker index 811b61be..5fbfad23 100644 --- a/scripts/docker/ubuntu_latest.docker +++ b/scripts/docker/ubuntu_latest.docker @@ -16,6 +16,7 @@ RUN apt-get update \ libsdl2-dev \ libboost-test-dev \ libqt5opengl5-dev \ + libfreetype6-dev \ iwyu \ qt5-default