1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00

Merge pull request #594 from madebr/conan

Conan updates
This commit is contained in:
Daniel Evans 2018-08-20 22:45:42 +01:00 committed by GitHub
commit d9255cb5df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 266 additions and 196 deletions

View File

@ -48,5 +48,5 @@ build_script:
after_build:
- cd "%APPVEYOR_BUILD_FOLDER%\build"
- cpack -C Release -G TXZ
- cpack -C %CONFIGURATION% -G TXZ
- appveyor PushArtifact OpenRW-%COMMIT_HASH:~0,8%.tar.xz

View File

@ -16,7 +16,7 @@ matrix:
script:
- scripts/docker/docker_travis.sh "fedora_latest.docker"
- os: linux
env: NAME="Arch Linux (Latest)" NAME_SUFFIX="arch"
env: NAME="Arch Linux (Latest)" NAME_SUFFIX="arch" DEBUG=1
services: docker
script:
- scripts/docker/docker_travis.sh "arch_latest.docker"

View File

@ -51,10 +51,6 @@ else()
rwdep_wrap_find_packages()
endif()
if(CHECK_INCLUDES)
find_package(IncludeWhatYouUse REQUIRED)
endif()
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)

View File

@ -7,7 +7,7 @@
set(_ARGS_BOOL
USE_CONAN
DEBUG
CHECK_INCLUDES
CHECK_IWYU
BUILD_TOOLS
BUILD_VIEWER
@ -32,7 +32,6 @@ set(_ARGS_ONEVAL
BUILD_NAME
CONAN_ARCH
CONAN_PROFILE
CMAKE_GENERATOR
COVERAGE_COMMAND
@ -115,10 +114,17 @@ if(USE_CONAN)
set(CONAN_CONFIGURATION "Release")
endif()
if(BUILD_VIEWER)
set(_BUILD_VIEWER True)
else()
set(_BUILD_VIEWER False)
endif()
execute_process(
COMMAND
"${CONAN_BIN}" install "${CTEST_SOURCE_DIRECTORY}" -pr "${CONAN_PROFILE}"
-s arch=${CONAN_ARCH} -s build_type=${CONAN_CONFIGURATION} --build missing
"${CONAN_BIN}" install "${CTEST_SOURCE_DIRECTORY}"
-s arch=${CONAN_ARCH} -s build_type=${CONAN_CONFIGURATION}
-o viewer=${_BUILD_VIEWER} --build missing
WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
RESULT_VARIABLE RES
)
@ -129,6 +135,16 @@ if(USE_CONAN)
list(APPEND CONFIGURE_EXTRA_OPTIONS
"-DBOOST_STATIC=True"
)
execute_process(
COMMAND
"${CONAN_BIN}" remove -f -b -s "*"
WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
RESULT_VARIABLE RES
)
if(RES)
message(FATAL_ERROR "conan remove failed")
endif()
endif()
# CTEST_CONFIGURATION_TYPE is needed on Windows (no leading underscore)
@ -149,7 +165,7 @@ set(_CONFIGURE_OPTIONS
"-DTESTS_NODATA=${TESTS_NODATA}"
"-DTEST_COVERAGE=${RUN_COVERAGE}"
"-DSEPARATE_TEST_SUITES=${SEPARATE_TEST_SUITES}"
"-DCHECK_INCLUDES=${CHECK_INCLUDES}"
"-DCHECK_IWYU=${CHECK_IWYU}"
"-DCMAKE_BUILD_TYPE=${_CMAKE_BUILD_TYPE}"
"-DENABLE_SANITIZERS=${ENABLE_SANITIZERS}"
"-DUSE_CONAN=${USE_CONAN}"
@ -217,9 +233,9 @@ if(_NB_BUILD_ERRORS)
endif()
if(_TEST_RESULT)
list(APPEND WARNING_MESSAGES "Test failure detected!")
list(APPEND ERROR_MESSAGES "Test failure detected!")
endif()
if(_SUBMIT_RESULT)
list(APPEND ERROR_MESSAGES "Test submission failure detected!")
list(APPEND WARNING_MESSAGES "Test submission failure detected!")
endif()

View File

@ -1,17 +1,20 @@
set(CMAKE_GENERATOR "Xcode")
set(DEBUG FALSE)
if(ENV{DEBUG})
set(DEBUG "$ENV{DEBUG}")
else()
set(DEBUG FALSE)
endif()
set(CONFIGURE_EXTRA_OPTIONS ";")
set(BUILD_TOOLS TRUE)
set(BUILD_VIEWER TRUE)
set(COVERAGE_COMMAND gcov)
set(CHECK_INCLUDES FALSE)
set(CHECK_IWYU FALSE)
set(ENABLE_SANITIZERS "")
if(MODEL_NAME STREQUAL "EXPERIMENTAL")
set(CHECK_INCLUDES FALSE)
set(CHECK_IWYU FALSE)
else()
set(CHECK_INCLUDES FALSE)
set(CHECK_IWYU FALSE)
endif()
set(CONAN_ARCH "x86_64")
set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/darwin")

View File

@ -1,17 +1,20 @@
set(CMAKE_GENERATOR "Unix Makefiles")
set(DEBUG FALSE)
if($ENV{DEBUG})
set(DEBUG "$ENV{DEBUG}")
else()
set(DEBUG FALSE)
endif()
set(CONFIGURE_EXTRA_OPTIONS ";")
set(BUILD_TOOLS TRUE)
set(BUILD_VIEWER TRUE)
set(COVERAGE_COMMAND gcov)
set(CHECK_INCLUDES FALSE)
set(CHECK_IWYU FALSE)
set(ENABLE_SANITIZERS "address")
if(MODEL_NAME STREQUAL "EXPERIMENTAL")
set(CHECK_INCLUDES FALSE)
set(CHECK_IWYU FALSE)
else()
set(CHECK_INCLUDES FALSE)
set(CHECK_IWYU FALSE)
endif()
set(CONAN_ARCH "x86_64")
set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/linux")

View File

@ -32,11 +32,10 @@ else()
message(FATAL_ERROR "Unknown configuration '${CONFIGURATION}'")
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
set(CHECK_IWYU FALSE) #FIXME: ENABLE
set(ENABLE_SANITIZERS "")

View File

@ -71,3 +71,16 @@ endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFmpeg DEFAULT_MSG FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIR)
if(FFMPEG_FOUND)
add_library(ffmpeg INTERFACE)
target_link_libraries(ffmpeg
INTERFACE
${FFMPEG_LIBRARIES}
)
target_include_directories(ffmpeg SYSTEM
INTERFACE
"${FFMPEG_INCLUDE_DIR}"
)
add_library(ffmpeg::ffmpeg ALIAS ffmpeg)
endif()

View File

@ -30,36 +30,36 @@
# License text for the above reference.)
# default search dirs
SET(_glm_HEADER_SEARCH_DIRS
set(_glm_HEADER_SEARCH_DIRS
"/usr/include"
"/usr/local/include")
# check environment variable
SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
set(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
if(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
set(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
endif(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
# put user specified location at beginning of search
IF(GLM_ROOT_DIR)
SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
if(GLM_ROOT_DIR)
set(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
"${GLM_ROOT_DIR}/include"
${_glm_HEADER_SEARCH_DIRS})
ENDIF(GLM_ROOT_DIR)
endif()
# locate header
FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
find_path(GLM_INCLUDE_DIR "glm/glm.hpp"
PATHS ${_glm_HEADER_SEARCH_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLM DEFAULT_MSG
GLM_INCLUDE_DIR)
IF(GLM_FOUND)
SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
IF(NOT GLM_FIND_QUIETLY)
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
ENDIF(NOT GLM_FIND_QUIETLY)
ENDIF(GLM_FOUND)
if(GLM_FOUND)
set(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
add_library(glm INTERFACE)
target_include_directories(glm SYSTEM
INTERFACE "${GLM_INCLUDE_DIR}")
add_library(glm::glm ALIAS glm)
endif()

View File

@ -194,3 +194,16 @@ IF(SDL2_STATIC)
SET(SDL2_LIBRARY ${SDL2_LINK_FLAGS})
ENDIF()
ENDIF(SDL2_STATIC)
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
add_library(SDL2 INTERFACE)
target_link_libraries(SDL2
INTERFACE
${SDL2_LIBRARY}
)
target_include_directories(SDL2 SYSTEM
INTERFACE
"${SDL2_INCLUDE_DIR}"
)
add_library(SDL2::SDL2 ALIAS SDL2)
endif()

View File

@ -1,75 +1,52 @@
function(rwdep_wrap_find_package TARGET INCLUDE_DIRS LINK_LIBS)
add_library("TMP_${TARGET}" INTERFACE)
target_include_directories("TMP_${TARGET}" SYSTEM
INTERFACE
${INCLUDE_DIRS}
)
target_link_libraries("TMP_${TARGET}"
INTERFACE
${LINK_LIBS}
)
add_library("rwdep::${TARGET}" ALIAS "TMP_${TARGET}")
endfunction()
function(rwdep_wrap_find_packages)
if(BULLET_FOUND)
rwdep_wrap_find_package(bullet "${BULLET_INCLUDE_DIR}" "${BULLET_LIBRARIES}")
if(BULLET_FOUND AND NOT TARGET bullet::bullet)
add_library(bullet INTERFACE)
target_link_libraries(bullet
INTERFACE
${BULLET_LIBRARIES}
)
target_include_directories(bullet SYSTEM
INTERFACE
"${BULLET_INCLUDE_DIR}"
)
add_library(bullet::bullet ALIAS bullet)
endif()
if(FFMPEG_FOUND)
rwdep_wrap_find_package(ffmpeg "${FFMPEG_INCLUDE_DIR}" "${FFMPEG_LIBRARIES}")
endif()
if(GLM_FOUND)
rwdep_wrap_find_package(glm "${GLM_INCLUDE_DIR}" "")
endif()
if(OPENAL_FOUND)
rwdep_wrap_find_package(OpenAL "${OPENAL_INCLUDE_DIR}" "${OPENAL_LIBRARY}")
endif()
if(SDL2_FOUND)
rwdep_wrap_find_package(SDL2 "${SDL2_INCLUDE_DIR}" "${SDL2_LIBRARY}")
endif()
if(Boost_FOUND)
rwdep_wrap_find_package(boost "${Boost_INCLUDE_DIRS}" "")
endif()
if(Boost_SYSTEM_FOUND)
rwdep_wrap_find_package(boost_system "${Boost_INCLUDE_DIRS}" "${Boost_SYSTEM_LIBRARY}")
endif()
if(Boost_FILESYSTEM_FOUND)
rwdep_wrap_find_package(boost_filesystem "${Boost_INCLUDE_DIRS}" "${Boost_FILESYSTEM_LIBRARY};rwdep::boost_system")
endif()
if(Boost_PROGRAM_OPTIONS_FOUND)
rwdep_wrap_find_package(boost_program_options "${Boost_INCLUDE_DIRS}" "${Boost_PROGRAM_OPTIONS_LIBRARY};rwdep::boost_system")
endif()
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}")
if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL)
add_library(OpenAL INTERFACE)
target_link_libraries(OpenAL
INTERFACE
"${OPENAL_LIBRARY}"
)
target_include_directories(OpenAL SYSTEM
INTERFACE
"${OPENAL_INCLUDE_DIR}"
)
add_library(OpenAL::OpenAL ALIAS OpenAL)
endif()
endfunction()
function(rwdep_wrap_conan_target TARGET CONAN_NAME)
add_library("_rwdep_${TARGET}" INTERFACE)
target_link_libraries("_rwdep_${TARGET}" INTERFACE "CONAN_PKG::${CONAN_NAME}")
add_library("rwdep::${TARGET}" ALIAS "_rwdep_${TARGET}")
string(RANDOM RND)
set(TGT "CONAN_${CONAN_NAME}_${RND}")
add_library("${TGT}" INTERFACE)
target_link_libraries("${TGT}" INTERFACE "CONAN_PKG::${CONAN_NAME}")
add_library("${TARGET}" ALIAS "${TGT}")
endfunction()
function(rwdep_wrap_conan_targets)
rwdep_wrap_conan_target(boost boost)
rwdep_wrap_conan_target(boost_program_options boost)
rwdep_wrap_conan_target(boost_filesystem boost)
rwdep_wrap_conan_target(boost_unit_test_framework boost)
rwdep_wrap_conan_target(OpenAL openal)
rwdep_wrap_conan_target(bullet bullet)
rwdep_wrap_conan_target(glm glm)
rwdep_wrap_conan_target(ffmpeg ffmpeg)
rwdep_wrap_conan_target(SDL2 sdl2)
rwdep_wrap_conan_target(OpenAL::OpenAL openal)
rwdep_wrap_conan_target(bullet::bullet bullet)
rwdep_wrap_conan_target(glm::glm glm)
rwdep_wrap_conan_target(ffmpeg::ffmpeg ffmpeg)
rwdep_wrap_conan_target(SDL2::SDL2 sdl2)
if(BUILD_TOOLS)
rwdep_wrap_conan_target(freetype freetype)
rwdep_wrap_conan_target(Freetype::Freetype freetype)
endif()
rwdep_wrap_conan_target(Boost::boost boost)
rwdep_wrap_conan_target(Boost::filesystem boost)
rwdep_wrap_conan_target(Boost::program_options boost)
rwdep_wrap_conan_target(Boost::system boost)
rwdep_wrap_conan_target(Boost::unit_test_framework boost)
endfunction()

View File

@ -64,6 +64,18 @@ else()
message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.")
endif()
target_compile_definitions(rw_interface
INTERFACE
BOOST_ALL_NO_LIB
)
if(NOT BOOST_STATIC)
target_compile_definitions(rw_interface
INTERFACE
BOOST_ALL_DYN_LINK
)
endif()
if(USE_CONAN)
if(CONAN_SETTINGS_COMPILER_LIBCXX STREQUAL "libstdc++11")
target_compile_definitions(rw_interface INTERFACE _GLIBCXX_USE_CXX11_ABI=1)
@ -86,20 +98,12 @@ elseif(FILESYSTEM_LIBRARY STREQUAL "CXXTS")
elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST")
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=2")
target_link_libraries(rw_interface INTERFACE
rwdep::boost_filesystem
Boost::filesystem
)
else()
message(FATAL_ERROR "Illegal FILESYSTEM_LIBRARY option. (was '${FILESYSTEM_LIBRARY}')")
endif()
if(NOT BOOST_STATIC)
target_compile_definitions(rw_interface
INTERFACE
BOOST_ALL_DYN_LINK
)
endif()
if(ENABLE_SCRIPT_DEBUG)
target_compile_definitions(rw_interface
INTERFACE

View File

@ -1,9 +1,6 @@
from conans import ConanFile, CMake
from conans.errors import ConanException
# FIXME:
# - no sound in cutscenes. Also no subtitles.
class OpenrwConan(ConanFile):
name = 'openrw'
@ -20,11 +17,9 @@ class OpenrwConan(ConanFile):
default_options = (
'test_data=False',
'viewer=False',
'tools=False',
'viewer=True',
'tools=True',
'bullet:shared=False',
'ffmpeg:iconv=False',
'libalsa:disable_python=True', # https://github.com/conan-community/community/issues/3
'sdl2:sdl2main=False',
)
@ -42,13 +37,17 @@ class OpenrwConan(ConanFile):
'boost/1.67.0@conan/stable',
),
'viewer': (
'Qt/5.11@bincrafters/stable',
'Qt/5.11.1@bincrafters/stable',
),
'tools': (
'freetype/2.9.0@bincrafters/stable',
),
}
def configure(self):
if self.options.viewer:
self.options['Qt'].opengl = 'desktop'
def requirements(self):
for dep in self._rw_dependencies['game']:
self.requires(dep)

View File

@ -44,6 +44,14 @@ add_library(rwcore
loaders/LoaderTXD.cpp
)
if(WIN32)
target_sources(rwcore
PRIVATE
platform/RWWindows.hpp
platform/RWWindows.cpp
)
endif()
target_include_directories(rwcore
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
@ -51,8 +59,8 @@ target_include_directories(rwcore
target_link_libraries(rwcore
PUBLIC
rwdep::boost
rwdep::glm
Boost::boost
glm::glm
openrw::interface
PRIVATE
OpenGL::GL

View File

@ -0,0 +1,30 @@
#include "RWWindows.hpp"
#include "rw/Debug.hpp"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
std::string wideStringToACP(const wchar_t* wString) {
std::string returnValue;
bool result = true;
int nbChars = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wString, -1,
nullptr, 0, nullptr, nullptr);
if (nbChars == 0) {
if (GetLastError() != ERROR_SUCCESS) {
RW_ERROR("Unable to calculate length of wide string");
return returnValue;
}
}
returnValue.resize(nbChars);
nbChars =
WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wString, -1,
&returnValue.front(), nbChars, nullptr, nullptr);
if (nbChars == 0) {
returnValue.resize(0);
return returnValue;
}
returnValue.resize(nbChars - 1);
return returnValue;
}

View File

@ -0,0 +1,14 @@
#ifndef _RWCORE_PLATFORM_RWWINDOWS_HPP_
#define _RWCORE_PLATFORM_RWWINDOWS_HPP_
#include <string>
/**
* @brief Convert a wide string to a ACP string (=active code page)
* This function converts to the active code page instead of utf8
* because Windows functions need to understand the encoding.
* @param str The wide string to convert
*/
std::string wideStringToACP(const wchar_t* str);
#endif

View File

@ -2,6 +2,7 @@
#define _LIBRW_CASTS_HPP_
#include <cstring> // memcpy
#include <string>
#include "rw/debug.hpp"

View File

@ -1,7 +1,3 @@
###########################################################
## RWENGINE
###########################################################
set(RWENGINE_SOURCES
src/ai/AIGraph.cpp
src/ai/AIGraph.hpp
@ -149,10 +145,10 @@ add_library(rwengine
target_link_libraries(rwengine
PUBLIC
rwcore
rwdep::bullet
rwdep::ffmpeg
rwdep::glm
rwdep::OpenAL
bullet::bullet
ffmpeg::ffmpeg
glm::glm
OpenAL::OpenAL
)
target_include_directories(rwengine

View File

@ -45,14 +45,14 @@ add_executable(rwgame
target_include_directories(rwgame
PUBLIC
"${CMAKE_SOURCE_DIR}/rwgame"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
target_link_libraries(rwgame
PRIVATE
rwengine
rwdep::boost_program_options
rwdep::SDL2
Boost::program_options
SDL2::SDL2
)
openrw_target_apply_options(TARGET rwgame)

View File

@ -1,13 +1,20 @@
#include "GameConfig.hpp"
#include <algorithm>
#include <rw/debug.hpp>
#include <rw/filesystem.hpp>
#include <algorithm>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree.hpp>
namespace pt = boost::property_tree;
#ifdef RW_WINDOWS
#include <Shlobj.h>
#include <winerror.h>
#include <platform/RWWindows.hpp>
#endif
const std::string kConfigDirectoryName("OpenRW");
void GameConfig::loadFile(const rwfs::path &path) {
@ -44,9 +51,16 @@ rwfs::path GameConfig::getDefaultConfigPath() {
#elif defined(RW_OSX)
char *home = getenv("HOME");
if (home)
return rwfs::path(home) / "Library/Preferences/" /
kConfigDirectoryName;
return rwfs::path(home) / "Library/Preferences/" / kConfigDirectoryName;
#elif defined(RW_WINDOWS)
wchar_t *widePath;
auto res = SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DEFAULT,
nullptr, &widePath);
if (SUCCEEDED(res)) {
auto utf8Path = wideStringToACP(widePath);
return rwfs::path(utf8Path) / kConfigDirectoryName;
}
#else
return rwfs::path();
#endif
@ -343,7 +357,7 @@ void GameConfig::ParseResult::failInputFile(size_t line,
}
void GameConfig::ParseResult::markGood() {
this-> m_result = ParseResult::ErrorType::GOOD;
this->m_result = ParseResult::ErrorType::GOOD;
}
void GameConfig::ParseResult::failArgument() {

View File

@ -867,7 +867,7 @@ void RWGame::renderProfile() {
float xscale = renderer.getRenderer()->getViewport().x / upperlimit;
TextRenderer::TextInfo ti;
ti.align = TextRenderer::TextInfo::Left;
ti.align = TextRenderer::TextInfo::TextAlignment::Left;
ti.font = FONT_ARIAL;
ti.size = lineHeight - 2.f;
ti.baseColour = glm::u8vec3(255);

View File

@ -1,4 +1,3 @@
# fixme: conan support
find_package(Qt5 REQUIRED COMPONENTS Gui)
add_executable(rwfontmap
rwfontmap.cpp
@ -7,12 +6,11 @@ add_executable(rwfontmap
target_link_libraries(rwfontmap
PUBLIC
rwcore
rwdep::freetype
rwdep::boost_program_options
Freetype::Freetype
Boost::program_options
Qt5::Gui
)
install(TARGETS rwfontmap
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

View File

@ -4,7 +4,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Widgets REQUIRED)
add_executable(rwviewer WIN32
add_executable(rwviewer
main.cpp
ViewerWindow.hpp

View File

@ -10,31 +10,37 @@ from conans.client import conan_api
openrw_path = Path(__file__).resolve().parents[2]
windows_profile = openrw_path / 'scripts' / 'conan' / 'windows'
cmake_generator_lookup = {
2015: 'Visual Studio 14 2015',
2017: 'Visual Studio 15 2017',
}
architectures = ['x64', 'x86']
conan_arch_map = {
'x86': 'x86',
'x64': 'x86_64',
}
def to_cmake_generator(vs_version, arch):
cmake_generator = cmake_generator_lookup[vs_version]
if arch == 'x64':
cmake_generator = '{} Win64'.format(cmake_generator)
return cmake_generator
def create_solution(path, vs_version, arch):
conan, _, _ = conan_api.ConanAPIV1.factory()
conan.remote_add(remote='bincrafters', url='https://api.bintray.com/conan/bincrafters/public-conan', force=True)
conan.install(path=openrw_path, profile_name=windows_profile, generators=('cmake_multi',),
options=('openrw:viewer=False', ), settings=('build_type=Debug', ), install_folder=path)
conan.install(path=openrw_path, profile_name=windows_profile, generators=('cmake_multi',),
options=('openrw:viewer=False', ), settings=('build_type=Release', ), install_folder=path)
conan_arch = conan_arch_map[arch]
conan.install(path=openrw_path, generators=('cmake_multi',), build=['missing', ],
settings=('build_type=Debug', 'arch={}'.format(conan_arch), ), install_folder=path)
conan.install(path=openrw_path, generators=('cmake_multi',), build=['missing', ],
settings=('build_type=Release', 'arch={}'.format(conan_arch), ), install_folder=path)
cmake_generator = to_cmake_generator(vs_version=vs_version, arch=arch)
subprocess.run([
'cmake', '-DUSE_CONAN=1', '-DBOOST_STATIC=TRUE', '-DBUILD_TESTS=1',
'cmake', '-DUSE_CONAN=TRUE', '-DBOOST_STATIC=TRUE',
'-DBUILD_TESTS=TRUE', '-DBUILD_VIEWER=TRUE', '-DBUILD_TOOLS=TRUE',
'-G{}'.format(cmake_generator), str(openrw_path),
], cwd=path, check=True)

View File

@ -1,9 +0,0 @@
include(default)
[options]
openrw:tools=True
openrw:viewer=True
# https://github.com/bincrafters/community/issues/120
ffmpeg:vdpau=False
ffmpeg:vaapi=False
ffmpeg:xcb=False

View File

@ -1,12 +0,0 @@
include(default)
[options]
openrw:tools=True
openrw:viewer=True
sdl2:esd=False
sdl2:wayland=True
sdl2:x11=True
# https://github.com/bincrafters/community/issues/120
ffmpeg:vdpau=False
ffmpeg:vaapi=False
ffmpeg:xcb=False

View File

@ -1,6 +0,0 @@
include(default)
[options]
openrw:tools=True
openrw:viewer=True
ffmpeg:qsv=False

View File

@ -11,6 +11,7 @@ RUN apt-get update \
python3-distutils \
python3-setuptools \
python3-wheel \
wget \
# packet build requirements \
git \
autoconf \

View File

@ -8,7 +8,17 @@ docker=$1
"$curdir/docker_tool.py" build -d "$docker" -t openrw_build_image
# Start docker container + add travis user
"$curdir/docker_tool.py" create -t openrw_build_image -n openrw_builder -U travis -e NAME_SUFFIX=$NAME_SUFFIX XDG_RUNTIME_DIR=/tmp TRAVIS=$TRAVIS TRAVIS_COMMIT=$TRAVIS_COMMIT TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG TRAVIS_BRANCH=$TRAVIS_BRANCH USE_CONAN=$USE_CONAN
"$curdir/docker_tool.py" create -t openrw_build_image -n openrw_builder -U travis \
-e \
NAME_SUFFIX=$NAME_SUFFIX \
TRAVIS=$TRAVIS \
TRAVIS_COMMIT=$TRAVIS_COMMIT \
TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
TRAVIS_BRANCH=$TRAVIS_BRANCH \
USE_CONAN=$USE_CONAN \
DEBUG=$DEBUG \
XDG_RUNTIME_DIR=/tmp
# execute test
"$curdir/docker_tool.py" exec -n openrw_builder -U travis -- /bin/bash -c "ctest -VV -S /src/cmake/ctest/script_ci.ctest -VV"

View File

@ -1,4 +1,4 @@
FROM fedora:branched
FROM fedora:latest
# ffmpeg-devel needs rpmfusion
RUN dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \

View File

@ -1,7 +1,3 @@
##############################################################################
# Unit Tests
##############################################################################
set(TESTS
Animation
Archive
@ -47,9 +43,9 @@ set(TEST_SOURCES
test_Globals.hpp
# Hack in rwgame sources until there's a per-target test suite
"${CMAKE_SOURCE_DIR}/rwgame/GameConfig.cpp"
"${CMAKE_SOURCE_DIR}/rwgame/GameWindow.cpp"
"${CMAKE_SOURCE_DIR}/rwgame/GameInput.cpp"
"${PROJECT_SOURCE_DIR}/rwgame/GameConfig.cpp"
"${PROJECT_SOURCE_DIR}/rwgame/GameWindow.cpp"
"${PROJECT_SOURCE_DIR}/rwgame/GameInput.cpp"
)
foreach(TEST ${TESTS})
@ -67,16 +63,16 @@ target_compile_definitions(rwtests
target_include_directories(rwtests
PRIVATE
"${CMAKE_SOURCE_DIR}/tests"
"${CMAKE_SOURCE_DIR}/rwgame"
"${PROJECT_SOURCE_DIR}/tests"
"${PROJECT_SOURCE_DIR}/rwgame"
)
target_link_libraries(rwtests
PRIVATE
Boost::unit_test_framework
rwengine
rwdep::SDL2
rwdep::boost_filesystem
rwdep::boost_unit_test_framework
SDL2::SDL2
Boost::filesystem
)
openrw_target_apply_options(TARGET rwtests)

View File

@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(test_indexTree) {
BOOST_CHECK(upperpath != truepath);
rwfs::path expected{Global::getGamePath()};
expected /= "data/CULLZONE.DAT";
BOOST_CHECK_EQUAL(truepath.string(), expected.string());
BOOST_CHECK(expected.compare(expected) == 0);
}
{
std::string upperpath{"DATA/MAPS/COMNBTM/COMNBTM.IPL"};
@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(test_indexTree) {
BOOST_CHECK(upperpath != truepath);
rwfs::path expected{Global::getGamePath()};
expected /= "data/maps/comnbtm/comNbtm.ipl";
BOOST_CHECK_EQUAL(truepath.string(), expected.string());
BOOST_CHECK(expected.compare(truepath) == 0);
}
}