diff --git a/cmake/ctest/build.ctest b/cmake/ctest/build.ctest index ffa60618..41de75fe 100644 --- a/cmake/ctest/build.ctest +++ b/cmake/ctest/build.ctest @@ -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) diff --git a/cmake/ctest/configure_darwin.ctest b/cmake/ctest/configure_darwin.ctest index 39cdab58..c1d27493 100644 --- a/cmake/ctest/configure_darwin.ctest +++ b/cmake/ctest/configure_darwin.ctest @@ -14,4 +14,3 @@ else() endif() set(CONAN_ARCH "x86_64") -set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/darwin") diff --git a/cmake/ctest/configure_linux.ctest b/cmake/ctest/configure_linux.ctest index 0690718c..ce509023 100644 --- a/cmake/ctest/configure_linux.ctest +++ b/cmake/ctest/configure_linux.ctest @@ -14,4 +14,3 @@ else() endif() set(CONAN_ARCH "x86_64") -set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/linux") diff --git a/cmake/ctest/configure_windows.ctest b/cmake/ctest/configure_windows.ctest index 2b9080b3..bd5d709a 100644 --- a/cmake/ctest/configure_windows.ctest +++ b/cmake/ctest/configure_windows.ctest @@ -32,7 +32,6 @@ 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) diff --git a/cmake/modules/WrapTargets.cmake b/cmake/modules/WrapTargets.cmake index d0d8c151..f17b46d9 100644 --- a/cmake/modules/WrapTargets.cmake +++ b/cmake/modules/WrapTargets.cmake @@ -27,17 +27,14 @@ function(rwdep_wrap_find_packages) endfunction() function(rwdep_wrap_conan_target TARGET CONAN_NAME) - add_library("CONAN_${CONAN_NAME}" INTERFACE) - target_link_libraries("CONAN_${CONAN_NAME}" INTERFACE "CONAN_PKG::${CONAN_NAME}") - add_library("${TARGET}" ALIAS "CONAN_${CONAN_NAME}") + 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 openal) rwdep_wrap_conan_target(bullet::bullet bullet) rwdep_wrap_conan_target(glm::glm glm) @@ -46,4 +43,10 @@ function(rwdep_wrap_conan_targets) if(BUILD_TOOLS) 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() diff --git a/cmake_configure.cmake b/cmake_configure.cmake index 62aee2b2..3f14f595 100644 --- a/cmake_configure.cmake +++ b/cmake_configure.cmake @@ -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) @@ -92,14 +104,6 @@ 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 diff --git a/conanfile.py b/conanfile.py index b9dd4b58..2c1844b0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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) diff --git a/rwtools/rwfont/CMakeLists.txt b/rwtools/rwfont/CMakeLists.txt index 32663e53..35e9404b 100644 --- a/rwtools/rwfont/CMakeLists.txt +++ b/rwtools/rwfont/CMakeLists.txt @@ -1,4 +1,3 @@ -# fixme: conan support find_package(Qt5 REQUIRED COMPONENTS Gui) add_executable(rwfontmap rwfontmap.cpp @@ -15,4 +14,3 @@ target_link_libraries(rwfontmap install(TARGETS rwfontmap RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ) - \ No newline at end of file diff --git a/scripts/conan/create_vs_solution.py b/scripts/conan/create_vs_solution.py index 4177d05c..05dc90b6 100755 --- a/scripts/conan/create_vs_solution.py +++ b/scripts/conan/create_vs_solution.py @@ -10,7 +10,6 @@ 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', @@ -28,13 +27,14 @@ def to_cmake_generator(vs_version, arch): 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.install(path=openrw_path, generators=('cmake_multi',), build=['missing', ], + settings=('build_type=Debug', ), install_folder=path) + conan.install(path=openrw_path, generators=('cmake_multi',), build=['missing', ], + settings=('build_type=Release', ), 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) diff --git a/scripts/conan/darwin b/scripts/conan/darwin deleted file mode 100644 index 75a54c8d..00000000 --- a/scripts/conan/darwin +++ /dev/null @@ -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 diff --git a/scripts/conan/linux b/scripts/conan/linux deleted file mode 100644 index d42b330e..00000000 --- a/scripts/conan/linux +++ /dev/null @@ -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 diff --git a/scripts/conan/windows b/scripts/conan/windows deleted file mode 100644 index 1eccbc8e..00000000 --- a/scripts/conan/windows +++ /dev/null @@ -1,6 +0,0 @@ -include(default) - -[options] -openrw:tools=True -openrw:viewer=True -ffmpeg:qsv=False diff --git a/scripts/docker/conan_base.docker b/scripts/docker/conan_base.docker index 93af3812..688ea9db 100644 --- a/scripts/docker/conan_base.docker +++ b/scripts/docker/conan_base.docker @@ -11,6 +11,7 @@ RUN apt-get update \ python3-distutils \ python3-setuptools \ python3-wheel \ + wget \ # packet build requirements \ git \ autoconf \ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2f72c855..2e7de1ee 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -69,10 +69,10 @@ target_include_directories(rwtests target_link_libraries(rwtests PRIVATE + Boost::unit_test_framework rwengine SDL2::SDL2 Boost::filesystem - Boost::unit_test_framework ) openrw_target_apply_options(TARGET rwtests)