mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
commit
caa1e1eee0
@ -4,21 +4,20 @@ image:
|
||||
clone_depth: 1
|
||||
shallow_clone: false
|
||||
|
||||
# All paths in the environment section should be
|
||||
# cmake-style paths: using forward-slashes (/).
|
||||
cache:
|
||||
- C:\Users\appveyor\.conan -> conanfile.py
|
||||
- C:\.conan -> conanfile.py
|
||||
|
||||
environment:
|
||||
APPVEYOR_SAVE_CACHE_ON_ERROR: true
|
||||
PYTHON: "C:\\Python36-x64"
|
||||
CMAKE_GENERATOR: "Visual Studio 15 2017"
|
||||
BOOST_ROOT: "C:\\Libraries"
|
||||
BOOST_VERSION: "1.65.1"
|
||||
DEP_DIR: "C:\\dependencies"
|
||||
WIN_DEP_NAME: "openrw-windows-dependencies"
|
||||
WIN_DEP_URL: "https://github.com/rwengine/openrw-windows-dependencies"
|
||||
CMAKE_GENERATOR_BASE: "Visual Studio 15 2017"
|
||||
NAME_SUFFIX: "windows"
|
||||
USE_CONAN: 1
|
||||
|
||||
platform:
|
||||
- Win32
|
||||
# - x64
|
||||
# - Win32
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
# - Debug
|
||||
@ -27,14 +26,16 @@ configuration:
|
||||
matrix:
|
||||
fast_finish: false
|
||||
|
||||
cache:
|
||||
- C:\dependencies -> .appveyor.yml, cmake/ctest/script_ci.ctest, cmake/ctest/utils.ctest, , cmake/ctest/configure_windows.ctest
|
||||
clone_folder: C:\projects\openrw
|
||||
|
||||
init:
|
||||
- set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
|
||||
- python --version
|
||||
- cmake --version
|
||||
- msbuild /version
|
||||
- pip3 install conan
|
||||
- conan user
|
||||
- conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
|
||||
|
||||
install:
|
||||
- cd "%APPVEYOR_BUILD_FOLDER%"
|
||||
@ -42,7 +43,7 @@ install:
|
||||
- if NOT "%APPVEYOR_REPO_COMMIT%" == "%COMMIT_HASH%" echo "Appveyor hash does not match checkout out hash" && exit 1
|
||||
|
||||
build_script:
|
||||
- ctest -VV -S cmake/ctest/script_ci.ctest
|
||||
- ctest -VV -S "%APPVEYOR_BUILD_FOLDER%/cmake/ctest/script_ci.ctest"
|
||||
|
||||
after_build:
|
||||
- cd "%APPVEYOR_BUILD_FOLDER%\build"
|
||||
|
@ -20,6 +20,10 @@ matrix:
|
||||
services: docker
|
||||
script:
|
||||
- scripts/docker/docker_travis.sh "arch_latest.docker"
|
||||
- os: linux
|
||||
env: NAME="conan" NAME_SUFFIX="conan" USE_CONAN=1
|
||||
script:
|
||||
- scripts/docker/docker_travis.sh "conan_base.docker"
|
||||
- os: osx
|
||||
env: NAME="Apple macOS" NAME_SUFFIX="mac"
|
||||
osx_image: xcode9.2
|
||||
|
@ -7,26 +7,65 @@ include(GNUInstallDirs)
|
||||
# Read the configuration arguments
|
||||
include("${PROJECT_SOURCE_DIR}/cmake_options.cmake")
|
||||
|
||||
# Create a rw_interface TARGET that holds all compiler options
|
||||
include("${PROJECT_SOURCE_DIR}/cmake_configure.cmake")
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
# Include git hash in source
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
message(STATUS "Building ${CMAKE_PROJECT_NAME} GIT SHA1: ${GIT_SHA1}")
|
||||
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include(WrapTargets)
|
||||
if(USE_CONAN)
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake")
|
||||
message(STATUS "Using conan 'cmake_multi' generator")
|
||||
include("${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake")
|
||||
else()
|
||||
message(STATUS "Using conan 'cmake' generator")
|
||||
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
|
||||
endif()
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
rwdep_wrap_conan_targets()
|
||||
else()
|
||||
find_package(Boost REQUIRED)
|
||||
find_package(Boost COMPONENTS program_options system REQUIRED)
|
||||
if(FILESYSTEM_LIBRARY STREQUAL "BOOST")
|
||||
find_package(Boost COMPONENTS filesystem system REQUIRED)
|
||||
endif()
|
||||
if(BUILD_TESTS)
|
||||
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
|
||||
endif()
|
||||
|
||||
# Do not link to SDL2main library
|
||||
set(SDL2_BUILDING_LIBRARY True)
|
||||
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(Bullet REQUIRED)
|
||||
find_package(GLM REQUIRED)
|
||||
find_package(FFmpeg REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
rwdep_wrap_find_packages()
|
||||
endif()
|
||||
|
||||
if(CHECK_INCLUDES)
|
||||
find_package(IncludeWhatYouUse REQUIRED)
|
||||
endif()
|
||||
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
if(CHECK_CLANGTIDY)
|
||||
find_package(ClangTidy REQUIRED)
|
||||
endif()
|
||||
|
||||
if(CHECK_IWYU)
|
||||
find_package(IncludeWhatYouUse REQUIRED)
|
||||
endif()
|
||||
|
||||
# Create a rw_interface TARGET that holds all compiler options
|
||||
include("${PROJECT_SOURCE_DIR}/cmake_configure.cmake")
|
||||
|
||||
add_subdirectory(rwlib)
|
||||
add_subdirectory(rwengine)
|
||||
add_subdirectory(rwgame)
|
||||
|
@ -1,13 +1,11 @@
|
||||
# This file does:
|
||||
# - check whether all arguments are defined,
|
||||
# - clean the build directory,
|
||||
# - configure, build and test,
|
||||
# - coverage and memcheck,
|
||||
# - submit
|
||||
|
||||
set(_ARGS_BOOL
|
||||
EMPTY_BINARY_DIR
|
||||
|
||||
USE_CONAN
|
||||
DEBUG
|
||||
CHECK_INCLUDES
|
||||
BUILD_VIEWER
|
||||
@ -32,6 +30,9 @@ set(_ARGS_ONEVAL
|
||||
BUILDER_NAME
|
||||
BUILD_NAME
|
||||
|
||||
CONAN_ARCH
|
||||
CONAN_PROFILE
|
||||
|
||||
CMAKE_GENERATOR
|
||||
COVERAGE_COMMAND
|
||||
)
|
||||
@ -55,17 +56,6 @@ set(CTEST_COVERAGE_COMMAND "${COVERAGE_COMMAND}")
|
||||
set(CTEST_SITE "${BUILDER_NAME}")
|
||||
set(CTEST_BUILD_NAME "${BUILD_NAME}")
|
||||
|
||||
set(NUMBER_ERRORS "0")
|
||||
set(NUMBER_WARNINGS "0")
|
||||
|
||||
if(EMPTY_BINARY_DIR)
|
||||
message(STATUS "Removing binary directory '${CTEST_BINARY_DIRECTORY}'...")
|
||||
if(EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
|
||||
message(STATUS "CMakeCache.txt file exists ==> removing")
|
||||
ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_CTEST_START_EXTRA_ARGS)
|
||||
set(_CTEST_CONFIGURE_EXTRA_ARGS)
|
||||
if(APPEND_RESULTS)
|
||||
@ -76,6 +66,70 @@ endif()
|
||||
message(STATUS "Starting test...")
|
||||
ctest_start("${MODEL_NAME}" ${_CTEST_START_EXTRA_ARGS})
|
||||
|
||||
if(USE_CONAN)
|
||||
find_program(CONAN_BIN
|
||||
NAMES conan
|
||||
HINTS
|
||||
"$ENV{HOME}/.local/bin"
|
||||
)
|
||||
if(NOT CONAN_BIN)
|
||||
message(STATUS "Cannot find conan. Installing conan...")
|
||||
execute_process(
|
||||
COMMAND pip3 install --user conan
|
||||
RESULT_VARIABLE RES
|
||||
)
|
||||
if(RES)
|
||||
message(FATAL_ERROR "Installation of conan failed")
|
||||
endif()
|
||||
|
||||
find_program(CONAN_BIN
|
||||
NAMES conan
|
||||
HINTS
|
||||
"$ENV{HOME}/.local/bin"
|
||||
)
|
||||
message(STATUS "Found conan: ${CONAN_BIN}")
|
||||
if(NOT CONAN_BIN)
|
||||
message(FATAL_ERROR "Cannot find conan.")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${CONAN_BIN}" user
|
||||
RESULT_VARIABLE RES
|
||||
)
|
||||
if(RES)
|
||||
message(FATAL_ERROR "Configuration of conan failed")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND "${CONAN_BIN}" remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
|
||||
RESULT_VARIABLE RES
|
||||
)
|
||||
if(RES)
|
||||
message(FATAL_ERROR "Adding bincrafters remote failed")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEBUG)
|
||||
set(CONAN_CONFIGURATION "Debug")
|
||||
else()
|
||||
set(CONAN_CONFIGURATION "Release")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CONAN_BIN}" install "${CTEST_SOURCE_DIRECTORY}" -pr "${CONAN_PROFILE}"
|
||||
-s arch=${CONAN_ARCH} -s build_type=${CONAN_CONFIGURATION} --build missing
|
||||
WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
|
||||
RESULT_VARIABLE RES
|
||||
)
|
||||
if(RES)
|
||||
message(FATAL_ERROR "conan install failed")
|
||||
endif()
|
||||
|
||||
list(APPEND CONFIGURE_EXTRA_OPTIONS
|
||||
"-DBOOST_STATIC=True"
|
||||
)
|
||||
endif()
|
||||
|
||||
# CTEST_CONFIGURATION_TYPE is needed on Windows (no leading underscore)
|
||||
if(DEBUG)
|
||||
set(_CMAKE_BUILD_TYPE "Debug")
|
||||
@ -96,6 +150,7 @@ set(_CONFIGURE_OPTIONS
|
||||
"-DCHECK_INCLUDES=${CHECK_INCLUDES}"
|
||||
"-DCMAKE_BUILD_TYPE=${_CMAKE_BUILD_TYPE}"
|
||||
"-DENABLE_SANITIZERS=${ENABLE_SANITIZERS}"
|
||||
"-DUSE_CONAN=${USE_CONAN}"
|
||||
)
|
||||
|
||||
message(STATUS "Configuring...")
|
||||
@ -113,7 +168,6 @@ message(STATUS "Building...")
|
||||
ctest_build(
|
||||
CONFIGURATION "${_CTEST_BUILD_CONFIGURATION}"
|
||||
NUMBER_ERRORS _NB_BUILD_ERRORS
|
||||
NUMBER_WARNINGS _NB_BUILD_WARNINGS
|
||||
)
|
||||
|
||||
if(RUN_TESTS)
|
||||
|
@ -11,3 +11,6 @@ if(MODEL_NAME STREQUAL "EXPERIMENTAL")
|
||||
else()
|
||||
set(CHECK_INCLUDES FALSE)
|
||||
endif()
|
||||
|
||||
set(CONAN_ARCH "x86_64")
|
||||
set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/darwin")
|
||||
|
@ -11,3 +11,6 @@ if(MODEL_NAME STREQUAL "EXPERIMENTAL")
|
||||
else()
|
||||
set(CHECK_INCLUDES FALSE)
|
||||
endif()
|
||||
|
||||
set(CONAN_ARCH "x86_64")
|
||||
set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/linux")
|
||||
|
@ -1,12 +1,7 @@
|
||||
set(_WIN_NEEDED_VARS
|
||||
BOOST_ROOT
|
||||
BOOST_VERSION
|
||||
CMAKE_GENERATOR
|
||||
CONFIGURATION
|
||||
DEP_DIR
|
||||
CMAKE_GENERATOR_BASE
|
||||
PLATFORM
|
||||
WIN_DEP_NAME
|
||||
WIN_DEP_URL
|
||||
CONFIGURATION
|
||||
)
|
||||
foreach(_WIN_NEEDED_VAR ${_WIN_NEEDED_VARS})
|
||||
set("${_WIN_NEEDED_VAR}" "$ENV{${_WIN_NEEDED_VAR}}")
|
||||
@ -16,90 +11,31 @@ foreach(_WIN_NEEDED_VAR ${_WIN_NEEDED_VARS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
string(REPLACE "." "_" _BOOST_VERSION_UNDERSCORED "${BOOST_VERSION}")
|
||||
set(BOOST_ROOT "${BOOST_ROOT}\\boost_${_BOOST_VERSION_UNDERSCORED}")
|
||||
|
||||
string(TOLOWER "${PLATFORM}" PLATFORM)
|
||||
string(TOLOWER "${ARCH}" ARCH)
|
||||
if(PLATFORM STREQUAL "win32")
|
||||
set(CMAKE_GENERATOR "${CMAKE_GENERATOR}")
|
||||
set(TRIPLET "x86-windows-static")
|
||||
set(CMAKE_GENERATOR "${CMAKE_GENERATOR_BASE}")
|
||||
set(CONAN_ARCH "x86")
|
||||
elseif(PLATFORM STREQUAL "x64")
|
||||
set(CMAKE_GENERATOR "${CMAKE_GENERATOR} Win64")
|
||||
set(TRIPLET "x64-windows-static")
|
||||
set(CMAKE_GENERATOR "${CMAKE_GENERATOR_BASE} Win64")
|
||||
set(CONAN_ARCH "x86_64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown platform (${PLATFORM})")
|
||||
endif()
|
||||
|
||||
string(TOLOWER "${CONFIGURATION}" CONFIGURATION)
|
||||
if(CONFIGURATION STREQUAL "debug")
|
||||
set(CONFIGURE_EXTRA_OPTIONS ";")
|
||||
|
||||
if(CONFIGURATION STREQUAL "Debug")
|
||||
set(DEBUG TRUE)
|
||||
set(_LIBRARY_DIR_INFIX "debug")
|
||||
elseif(CONFIGURATION STREQUAL "release")
|
||||
elseif(CONFIGURATION STREQUAL "Release")
|
||||
set(DEBUG FALSE)
|
||||
set(_LIBRARY_DIR_INFIX "")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown configuration '${CONFIGURATION}'")
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY "${DEP_DIR}")
|
||||
set(_WIN_DEP_DIR "${DEP_DIR}\\${WIN_DEP_NAME}")
|
||||
set(TRIPLET_DIR "${_WIN_DEP_DIR}\\${TRIPLET}")
|
||||
set(CONAN_PROFILE "${CTEST_SOURCE_DIRECTORY}/scripts/conan/windows")
|
||||
set(CONAN_ARCH "x86_64")
|
||||
|
||||
message(STATUS "Checking windows dependency dir '${_WIN_DEP_DIR}'...")
|
||||
if(NOT IS_DIRECTORY "${_WIN_DEP_DIR}")
|
||||
message(STATUS "... does not exist.")
|
||||
message(STATUS "Executing git clone...")
|
||||
execute_process(
|
||||
COMMAND git clone --depth 1 -- "${WIN_DEP_URL}"
|
||||
WORKING_DIRECTORY "${DEP_DIR}"
|
||||
RESULT_VARIABLE GIT_RESULT
|
||||
)
|
||||
if(GIT_RESULT)
|
||||
message(FATAL_ERROR "Failed to clone '${WIN_DEP_URL}'")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "... exists.")
|
||||
message(STATUS "Skipping git clone")
|
||||
endif()
|
||||
|
||||
set(_INCLUDE_PATH
|
||||
"${TRIPLET_DIR}\\include"
|
||||
)
|
||||
set(ENV{OPENALDIR} "${TRIPLET_DIR}\\include\\AL")
|
||||
set(ENV{SDL2DIR} "${TRIPLET_DIR}\\include\\SDL2")
|
||||
|
||||
set(_LIBRARY_PATH
|
||||
"${TRIPLET_DIR}\\${_LIBRARY_DIR_INFIX}\\lib"
|
||||
)
|
||||
|
||||
set(_C_FLAGS "/DWIN32 /D_WINDOWS /W3 /utf-8 /MP")
|
||||
set(_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP")
|
||||
set(_C_FLAGS_DEBUG "/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
|
||||
set(_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
|
||||
set(_C_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /DNDEBUG")
|
||||
set(_C_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /DNDEBUG")
|
||||
|
||||
set(CMAKE_GENERATOR "${CMAKE_GENERATOR}")
|
||||
set(DEBUG "${DEBUG}")
|
||||
set(CONFIGURE_EXTRA_OPTIONS
|
||||
"-DCMAKE_INCLUDE_PATH=${_INCLUDE_PATH}"
|
||||
"-DCMAKE_LIBRARY_PATH=${_LIBRARY_PATH}"
|
||||
"-DCMAKE_C_FLAGS=${_C_FLAGS}"
|
||||
"-DCMAKE_C_FLAGS_DEBUG=${_C_FLAGS_DEBUG}"
|
||||
"-DCMAKE_C_FLAGS_MINSIZEREL=${_C_FLAGS_MINSIZEREL}"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=${_C_FLAGS_RELEASE}"
|
||||
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=${_C_FLAGS_RELWITHDEBINFO}"
|
||||
"-DCMAKE_CXX_FLAGS=${_CXX_FLAGS}"
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=${_C_FLAGS_DEBUG}"
|
||||
"-DCMAKE_CXX_FLAGS_MINSIZEREL=${_C_FLAGS_MINSIZEREL}"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=${_C_FLAGS_RELEASE}"
|
||||
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${_C_FLAGS_RELWITHDEBINFO}"
|
||||
"-DBOOST_ROOT=${BOOST_ROOT}"
|
||||
"-DBoost_USE_STATIC_LIBS=TRUE"
|
||||
"-DBoost_USE_STATIC_RUNTIME=TRUE"
|
||||
)
|
||||
|
||||
set(BUILD_VIEWER FALSE) #FIXME: ENABLE
|
||||
set(BUILD_VIEWER TRUE)
|
||||
set(COVERAGE_COMMAND "echo") #FIXME: ENABLE
|
||||
set(CHECK_INCLUDES FALSE) #FIXME: ENABLE
|
||||
set(ENABLE_SANITIZERS "")
|
||||
|
@ -12,9 +12,19 @@ else()
|
||||
endif()
|
||||
set(CTEST_COMMAND "${CMAKE_CTEST_COMMAND}")
|
||||
|
||||
message(STATUS "CTEST_SOURCE_DIRECTORY=${CTEST_SOURCE_DIRECTORY}")
|
||||
message(STATUS "CTEST_BINARY_DIRECTORY=${CTEST_BINARY_DIRECTORY}")
|
||||
|
||||
openrw_build_name(BUILDER_NAME_BASE BUILD_NAME)
|
||||
set(BUILDER_NAME_BASE "${BUILDER_NAME_BASE}-$ENV{NAME_SUFFIX}")
|
||||
|
||||
message(STATUS "Removing binary directory '${CTEST_BINARY_DIRECTORY}'...")
|
||||
if(EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
|
||||
message(STATUS "CMakeCache.txt file exists ==> removing")
|
||||
ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
|
||||
endif()
|
||||
file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
message(STATUS "Linux detected")
|
||||
|
||||
@ -34,15 +44,20 @@ endif()
|
||||
set(WARNING_MESSAGES)
|
||||
set(ERROR_MESSAGES)
|
||||
|
||||
if($ENV{USE_CONAN})
|
||||
set(USE_CONAN TRUE)
|
||||
else()
|
||||
set(USE_CONAN FALSE)
|
||||
endif()
|
||||
|
||||
set(SEPARATE_TEST_SUITES FALSE)
|
||||
set(RUN_COVERAGE FALSE)
|
||||
set(RUN_MEMCHECK FALSE)
|
||||
set(SUBMIT TRUE)
|
||||
openrw_should_submit_ci(SUBMIT)
|
||||
|
||||
# Build with no data and test
|
||||
set(BUILDER_NAME "${BUILDER_NAME_BASE}-nodata")
|
||||
set(APPEND_RESULTS FALSE)
|
||||
set(EMPTY_BINARY_DIR TRUE)
|
||||
set(TESTS_NODATA TRUE)
|
||||
set(RUN_TESTS TRUE)
|
||||
|
||||
@ -51,7 +66,6 @@ include("${CTEST_SCRIPT_DIRECTORY}/build.ctest")
|
||||
# Build with data and do not test
|
||||
set(BUILDER_NAME "${BUILDER_NAME_BASE}-data")
|
||||
set(APPEND_RESULTS FALSE)
|
||||
set(EMPTY_BINARY_DIR FALSE)
|
||||
set(TESTS_NODATA FALSE)
|
||||
set(RUN_TESTS FALSE)
|
||||
|
||||
|
@ -12,8 +12,18 @@ else()
|
||||
endif()
|
||||
set(CTEST_COMMAND "${CMAKE_CTEST_COMMAND}")
|
||||
|
||||
message(STATUS "CTEST_SOURCE_DIRECTORY=${CTEST_SOURCE_DIRECTORY}")
|
||||
message(STATUS "CTEST_BINARY_DIRECTORY=${CTEST_BINARY_DIRECTORY}")
|
||||
|
||||
openrw_build_name(BUILDER_NAME BUILD_NAME)
|
||||
|
||||
message(STATUS "Removing binary directory '${CTEST_BINARY_DIRECTORY}'...")
|
||||
if(EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
|
||||
message(STATUS "CMakeCache.txt file exists ==> removing")
|
||||
ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
|
||||
endif()
|
||||
file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
message(STATUS "Linux detected")
|
||||
|
||||
@ -33,6 +43,12 @@ endif()
|
||||
set(WARNING_MESSAGES)
|
||||
set(ERROR_MESSAGES)
|
||||
|
||||
if($ENV{USE_CONAN})
|
||||
set(USE_CONAN TRUE)
|
||||
else()
|
||||
set(USE_CONAN FALSE)
|
||||
endif()
|
||||
|
||||
set(SEPARATE_TEST_SUITES TRUE)
|
||||
|
||||
if($ENV{RUN_COVERAGE})
|
||||
@ -43,13 +59,12 @@ endif()
|
||||
set(RUN_MEMCHECK FALSE) #TODO
|
||||
|
||||
set(APPEND_RESULTS FALSE)
|
||||
if($ENV{SUBMIT})
|
||||
set(SUBMIT TRUE)
|
||||
if($ENV{USE_CONAN})
|
||||
set(RES TRUE)
|
||||
else()
|
||||
set(SUBMIT FALSE)
|
||||
set(RES FALSE)
|
||||
endif()
|
||||
|
||||
set(EMPTY_BINARY_DIR TRUE)
|
||||
set(TESTS_NODATA FALSE)
|
||||
set(RUN_TESTS TRUE)
|
||||
|
||||
|
@ -50,6 +50,7 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES)
|
||||
set(REPO_BRANCH "$ENV{TRAVIS_BRANCH}")
|
||||
set(GIT_HASH "$ENV{TRAVIS_COMMIT}")
|
||||
set(_EVENT_TYPE "$ENV{TRAVIS_EVENT_TYPE}")
|
||||
set(SUBMIT TRUE)
|
||||
elseif("$ENV{APPVEYOR}")
|
||||
message(STATUS "AppVeyor detected")
|
||||
set(BUILDER_NAME "AppVeyor")
|
||||
@ -61,8 +62,15 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES)
|
||||
else()
|
||||
set(_EVENT_TYPE "push")
|
||||
endif()
|
||||
set(SUBMIT TRUE)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown CI")
|
||||
message("Unknown CI")
|
||||
set(BUILDER_NAME "unknown")
|
||||
set(REPO_NAME "repo_name")
|
||||
set(REPO_BRANCH "branch")
|
||||
set(GIT_HASH "git_hash")
|
||||
set(_EVENT_TYPE "nop")
|
||||
set(SUBMIT FALSE)
|
||||
endif()
|
||||
string(SUBSTRING "${GIT_HASH}" 0 8 GIT_HASH_SHORT)
|
||||
set(BUILD_NAME "${REPO_NAME}/${REPO_BRANCH}/${_EVENT_TYPE}/${GIT_HASH_SHORT}")
|
||||
@ -75,3 +83,14 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES)
|
||||
set("${BUILDER_NAME_RES}" "${BUILDER_NAME}" PARENT_SCOPE)
|
||||
set("${BUILD_NAME_RES}" "${BUILD_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(openrw_should_submit_ci SHOULD_SUBMIT)
|
||||
if("$ENV{TRAVIS}")
|
||||
set(RES TRUE)
|
||||
elseif("$ENV{APPVEYOR}")
|
||||
set(RES TRUE)
|
||||
else()
|
||||
set(RES FALSE)
|
||||
endif()
|
||||
set("${SHOULD_SUBMIT}" "${RES}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
@ -1,17 +0,0 @@
|
||||
# Override CMake's FindBullet module:
|
||||
# - create a bullet::bullet TARGET
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/FindBullet.cmake")
|
||||
|
||||
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()
|
@ -69,16 +69,3 @@ endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIR)
|
||||
|
||||
if(FFMPEG_FOUND AND NOT TARGET ffmpeg::ffmpeg)
|
||||
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()
|
||||
|
@ -63,12 +63,3 @@ IF(GLM_FOUND)
|
||||
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
|
||||
ENDIF(NOT GLM_FIND_QUIETLY)
|
||||
ENDIF(GLM_FOUND)
|
||||
|
||||
if(GLM_FOUND AND NOT TARGET glm::glm)
|
||||
add_library(glm INTERFACE)
|
||||
target_include_directories(glm SYSTEM
|
||||
INTERFACE
|
||||
"${GLM_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(glm::glm ALIAS glm)
|
||||
endif()
|
||||
|
@ -1,17 +0,0 @@
|
||||
# Override CMake's FindOpenAL module:
|
||||
# - create a OpenAL::OpenAL target
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/FindOpenAL.cmake")
|
||||
|
||||
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()
|
@ -1,17 +0,0 @@
|
||||
# Override CMake's FindOpenGL module:
|
||||
# - create a OPENGL::GL TARGET
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/FindOpenGL.cmake")
|
||||
|
||||
if(OPENGL_FOUND AND NOT TARGET OpenGL::GL)
|
||||
add_library(OpenGL INTERFACE)
|
||||
target_link_libraries(OpenGL
|
||||
INTERFACE
|
||||
${OPENGL_LIBRARIES}
|
||||
)
|
||||
target_include_directories(OpenGL SYSTEM
|
||||
INTERFACE
|
||||
"${OPENGL_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(OpenGL::GL ALIAS OpenGL)
|
||||
endif()
|
@ -194,16 +194,3 @@ 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()
|
||||
|
69
cmake/modules/WrapTargets.cmake
Normal file
69
cmake/modules/WrapTargets.cmake
Normal file
@ -0,0 +1,69 @@
|
||||
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}")
|
||||
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()
|
||||
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}")
|
||||
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)
|
||||
endfunction()
|
@ -48,8 +48,6 @@ target_compile_definitions(rw_interface
|
||||
"RW_PROFILER=$<BOOL:${ENABLE_PROFILING}>"
|
||||
)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
target_compile_definitions(rw_interface INTERFACE "RW_LINUX")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
@ -66,6 +64,14 @@ else()
|
||||
message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.")
|
||||
endif()
|
||||
|
||||
if(USE_CONAN)
|
||||
if(CONAN_SETTINGS_COMPILER_LIBCXX STREQUAL "libstdc++11")
|
||||
target_compile_definitions(rw_interface INTERFACE _GLIBCXX_USE_CXX11_ABI=1)
|
||||
elseif(CONAN_SETTINGS_COMPILER_LIBCXX STREQUAL "libstdc++")
|
||||
target_compile_definitions(rw_interface INTERFACE _GLIBCXX_USE_CXX11_ABI=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FILESYSTEM_LIBRARY STREQUAL "CXX17")
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=0")
|
||||
@ -78,17 +84,22 @@ elseif(FILESYSTEM_LIBRARY STREQUAL "CXXTS")
|
||||
target_link_libraries(rw_interface INTERFACE "stdc++fs")
|
||||
endif()
|
||||
elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST")
|
||||
find_package(Boost COMPONENTS system filesystem REQUIRED)
|
||||
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=2")
|
||||
target_include_directories(rw_interface INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries(rw_interface INTERFACE
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
rwdep::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
|
||||
@ -151,10 +162,6 @@ endforeach()
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
if(CHECK_IWYU)
|
||||
find_package(IncludeWhatYouUse REQUIRED)
|
||||
endif()
|
||||
|
||||
function(openrw_target_apply_options)
|
||||
set(IWYU_MAPPING "${PROJECT_SOURCE_DIR}/openrw_iwyu.imp")
|
||||
cmake_parse_arguments("OPENRW_APPLY" "" "TARGET" "" ${ARGN})
|
||||
|
@ -19,11 +19,14 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
option(CHECK_IWYU "Enable IncludeWhatYouUse (Analyze #includes in C and C++ source files)")
|
||||
|
||||
option(CHECK_CLANGTIDY "Enable clang-tidy (A clang-based C++ linter tool)")
|
||||
option(CHECK_CLANGTIDY_FIX "Apply fixes from clang-tidy (!!!RUN ON CLEAN GIT TREE!!!)")
|
||||
|
||||
set(ENABLE_SANITIZERS "" CACHE STRING "Enable selected sanitizer.")
|
||||
|
||||
option(TEST_COVERAGE "Enable coverage analysis (implies CMAKE_BUILD_TYPE=Debug)")
|
||||
option(SEPARATE_TEST_SUITES "Add each test suite as separate test to CTest")
|
||||
|
||||
set(ENABLE_SANITIZERS "" CACHE STRING "Enable selected sanitizer.")
|
||||
option(BOOST_STATIC "Link against static Boost libraries")
|
||||
|
||||
option(USE_CONAN "Use Conan as package manager")
|
||||
|
82
conanfile.py
Normal file
82
conanfile.py
Normal file
@ -0,0 +1,82 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conans.errors import ConanException
|
||||
|
||||
# FIXME:
|
||||
# - no sound in cutscenes. Also no subtitles.
|
||||
|
||||
|
||||
class OpenrwConan(ConanFile):
|
||||
name = 'openrw'
|
||||
version = 'master'
|
||||
license = 'GPL3'
|
||||
url = 'https://github.com/rwengine/openrw'
|
||||
description = "OpenRW 'Open ReWrite' is an un-official open source recreation of the classic Grand Theft Auto III game executable"
|
||||
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||
options = {
|
||||
'test_data': [True, False],
|
||||
'viewer': [True, False],
|
||||
}
|
||||
|
||||
default_options = (
|
||||
'test_data=False',
|
||||
'viewer=False',
|
||||
'bullet:shared=False',
|
||||
'ffmpeg:iconv=False',
|
||||
'libalsa:disable_python=True', # https://github.com/conan-community/community/issues/3
|
||||
'sdl2:sdl2main=False',
|
||||
)
|
||||
|
||||
generators = 'cmake',
|
||||
exports_sources = 'CMakeLists.txt', 'cmake_configure.cmake', 'cmake_options.cmake', 'COPYING', \
|
||||
'cmake/modules/*', 'benchmarks', 'rwlib/*', 'rwengine/*', 'rwgame/*', 'rwviewer/*', 'tests/*'
|
||||
|
||||
_rw_dependencies = {
|
||||
'game': (
|
||||
'openal/1.18.2@bincrafters/stable',
|
||||
'bullet/2.87@bincrafters/stable',
|
||||
'glm/0.9.9.0@g-truc/stable',
|
||||
'ffmpeg/4.0@bincrafters/stable',
|
||||
'sdl2/2.0.8@bincrafters/stable',
|
||||
'boost/1.67.0@conan/stable',
|
||||
),
|
||||
'viewer': (
|
||||
'Qt/5.11@bincrafters/stable',
|
||||
)
|
||||
}
|
||||
|
||||
def requirements(self):
|
||||
for dep in self._rw_dependencies['game']:
|
||||
self.requires(dep)
|
||||
if self.options.viewer:
|
||||
for dep in self._rw_dependencies['viewer']:
|
||||
self.requires(dep)
|
||||
|
||||
def _configure_cmake(self):
|
||||
cmake = CMake(self)
|
||||
defs = {
|
||||
'BUILD_SHARED_LIBS': False,
|
||||
'CMAKE_BUILD_TYPE': self.settings.build_type,
|
||||
'BUILD_TESTS': True,
|
||||
'BUILD_VIEWER': self.options.viewer,
|
||||
'TESTS_NODATA': not self.options.test_data,
|
||||
'USE_CONAN': True,
|
||||
'BOOST_STATIC': not self.options['boost'].shared,
|
||||
}
|
||||
|
||||
cmake.configure(defs=defs)
|
||||
return cmake
|
||||
|
||||
def build(self):
|
||||
cmake = self._configure_cmake()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
if self.options.viewer:
|
||||
# FIXME: https://github.com/osechet/conan-qt/issues/6 and https://github.com/conan-io/conan/issues/2619
|
||||
self.copy('qt.conf', dst='bin', src='rwviewer')
|
||||
cmake = self._configure_cmake()
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ['rwengine', 'rwlib']
|
||||
self.cpp_info.stdcpp = 14
|
@ -149,10 +149,10 @@ add_library(rwengine
|
||||
target_link_libraries(rwengine
|
||||
PUBLIC
|
||||
rwlib
|
||||
bullet::bullet
|
||||
ffmpeg::ffmpeg
|
||||
glm::glm
|
||||
OpenAL::OpenAL
|
||||
rwdep::bullet
|
||||
rwdep::ffmpeg
|
||||
rwdep::glm
|
||||
rwdep::OpenAL
|
||||
)
|
||||
|
||||
target_include_directories(rwengine
|
||||
|
@ -1,5 +1,3 @@
|
||||
find_package(Boost COMPONENTS program_options REQUIRED)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" @ONLY)
|
||||
|
||||
set(RWGAME_SOURCES
|
||||
@ -45,12 +43,6 @@ add_executable(rwgame
|
||||
${RWGAME_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories(rwgame
|
||||
SYSTEM
|
||||
PRIVATE
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_include_directories(rwgame
|
||||
PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/rwgame"
|
||||
@ -59,8 +51,8 @@ target_include_directories(rwgame
|
||||
target_link_libraries(rwgame
|
||||
PRIVATE
|
||||
rwengine
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
SDL2::SDL2
|
||||
rwdep::boost_program_options
|
||||
rwdep::SDL2
|
||||
)
|
||||
|
||||
openrw_target_apply_options(TARGET rwgame)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef RWGAME_GAMEINPUT_HPP
|
||||
#define RWGAME_GAMEINPUT_HPP
|
||||
#include "engine/GameState.hpp"
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL.h>
|
||||
|
||||
namespace GameInput {
|
||||
void updateGameInputState(GameInputState* state, const SDL_Event& event);
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <render/ViewCamera.hpp>
|
||||
#include "GameWindow.hpp"
|
||||
#include "MenuSystem.hpp"
|
||||
#include "SDL.h"
|
||||
#include "SDL_events.h"
|
||||
#include <SDL.h>
|
||||
#include <SDL_events.h>
|
||||
|
||||
class RWGame;
|
||||
class GameWorld;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <iostream>
|
||||
#include "RWGame.hpp"
|
||||
#include "SDL.h"
|
||||
#include <SDL.h>
|
||||
|
||||
#include <core/Logger.hpp>
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
## RWLIB
|
||||
###########################################################
|
||||
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
SET(RWLIB_SOURCES
|
||||
# GL stuff is only here temporarily, hoping to move it back to rwengine
|
||||
source/gl/gl_core_3_3.c
|
||||
@ -49,15 +47,10 @@ target_include_directories(rwlib
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/source"
|
||||
)
|
||||
|
||||
target_include_directories(rwlib
|
||||
SYSTEM
|
||||
PRIVATE
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(rwlib
|
||||
PUBLIC
|
||||
glm::glm
|
||||
rwdep::boost
|
||||
rwdep::glm
|
||||
openrw::interface
|
||||
PRIVATE
|
||||
OpenGL::GL
|
||||
|
@ -27,6 +27,7 @@ add_executable(rwviewer WIN32
|
||||
)
|
||||
|
||||
target_link_libraries(rwviewer
|
||||
PRIVATE
|
||||
rwengine
|
||||
Qt5::OpenGL
|
||||
Qt5::Widgets
|
||||
@ -37,3 +38,8 @@ openrw_target_apply_options(TARGET rwviewer)
|
||||
install(TARGETS rwviewer
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
|
||||
if(USE_CONAN)
|
||||
set(QT5_ROOT "${CONAN_QT_ROOT}")
|
||||
configure_file(qt.conf.in qt.conf)
|
||||
endif()
|
||||
|
@ -163,7 +163,7 @@ void ViewerWindow::openRecent() {
|
||||
}
|
||||
|
||||
void ViewerWindow::showObjectModel(uint16_t) {
|
||||
#warning implement me
|
||||
#pragma message("implement me")
|
||||
}
|
||||
|
||||
void ViewerWindow::updateRecentGames() {
|
||||
|
2
rwviewer/qt.conf.in
Normal file
2
rwviewer/qt.conf.in
Normal file
@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Prefix = @QT5_ROOT@
|
68
scripts/conan/create_vs_solution.py
Executable file
68
scripts/conan/create_vs_solution.py
Executable file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
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']
|
||||
|
||||
|
||||
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)
|
||||
cmake_generator = to_cmake_generator(vs_version=vs_version, arch=arch)
|
||||
subprocess.run([
|
||||
'cmake', '-DUSE_CONAN=1', '-DBOOST_STATIC=TRUE', '-DBUILD_TESTS=1',
|
||||
'-G{}'.format(cmake_generator), str(openrw_path),
|
||||
], cwd=path, check=True)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Create a Visual Studio solution for OpenRW.')
|
||||
parser.add_argument('path', nargs='?', default=Path(), metavar='PATH', type=Path, help='Location to the solution')
|
||||
parser.add_argument('-v', default=max(cmake_generator_lookup.keys()), choices=list(cmake_generator_lookup.keys()),
|
||||
type=int, metavar='VERSION', dest='vs_version',
|
||||
help='Version of Visual Studio (choices={})'.format(list(cmake_generator_lookup.keys())))
|
||||
parser.add_argument('-a', default=architectures[0], choices=architectures, metavar='ARCH', dest='arch',
|
||||
help='Architecture to build (choices={})'.format(architectures))
|
||||
ns = parser.parse_args()
|
||||
|
||||
if platform.system() != 'Windows':
|
||||
print('This script can only generate Visual Studio solutions for Windows.', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
path = ns.path.resolve()
|
||||
arch = ns.arch
|
||||
vs_version = ns.vs_version
|
||||
|
||||
print('Solution directory: {}'.format(path))
|
||||
print('Architecture: {}'.format(arch))
|
||||
print('Visual Studio version: {}'.format(vs_version))
|
||||
|
||||
create_solution(path=path, vs_version=vs_version, arch=arch)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
8
scripts/conan/darwin
Normal file
8
scripts/conan/darwin
Normal file
@ -0,0 +1,8 @@
|
||||
include(default)
|
||||
|
||||
[options]
|
||||
openrw:viewer=True
|
||||
# https://github.com/bincrafters/community/issues/120
|
||||
ffmpeg:vdpau=False
|
||||
ffmpeg:vaapi=False
|
||||
ffmpeg:xcb=False
|
11
scripts/conan/linux
Normal file
11
scripts/conan/linux
Normal file
@ -0,0 +1,11 @@
|
||||
include(default)
|
||||
|
||||
[options]
|
||||
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
|
5
scripts/conan/windows
Normal file
5
scripts/conan/windows
Normal file
@ -0,0 +1,5 @@
|
||||
include(default)
|
||||
|
||||
[options]
|
||||
openrw:viewer=True
|
||||
ffmpeg:qsv=False
|
66
scripts/docker/conan_base.docker
Normal file
66
scripts/docker/conan_base.docker
Normal file
@ -0,0 +1,66 @@
|
||||
FROM ubuntu:rolling
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends --no-upgrade -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
gcc-8 \
|
||||
g++-8 \
|
||||
# scripts to install conan \
|
||||
python3-pip \
|
||||
python3-distutils \
|
||||
python3-setuptools \
|
||||
python3-wheel \
|
||||
# packet build requirements \
|
||||
git \
|
||||
autoconf \
|
||||
automake \
|
||||
autotools-dev \
|
||||
libtool \
|
||||
m4 \
|
||||
sudo \
|
||||
# conan-qt5 dependencies https://github.com/bincrafters/conan-qt/blob/stable/5.11/conanfile.py \
|
||||
libx11-6 \
|
||||
libfontconfig1-dev \
|
||||
libxrender-dev \
|
||||
libxcursor-dev \
|
||||
libxext-dev \
|
||||
libxfixes-dev \
|
||||
libxft-dev \
|
||||
libxi-dev \
|
||||
libgl1-mesa-dev \
|
||||
libxcb1 \
|
||||
libxcb1-dev \
|
||||
libxrandr-dev \
|
||||
libx11-xcb1 \
|
||||
libx11-xcb-dev \
|
||||
libxcb-keysyms1 \
|
||||
libxcb-keysyms1-dev \
|
||||
libxcb-image0 \
|
||||
libxcb-image0-dev \
|
||||
libxcb-shm0 \
|
||||
libxcb-shm0-dev \
|
||||
libxcb-icccm4 \
|
||||
libx11-dev \
|
||||
libxcb-icccm4-dev \
|
||||
libxcb-sync1 \
|
||||
libxcb-sync-dev \
|
||||
libxcb-xfixes0-dev \
|
||||
libxcb-shape0-dev \
|
||||
libxcb-render-util0-dev \
|
||||
libxcb-randr0-dev \
|
||||
libxcb-render-util0 \
|
||||
libxcb-glx0-dev \
|
||||
libxcb-xinerama0 \
|
||||
libxcb-xinerama0-dev \
|
||||
# conan-ffmpeg dependencies https://github.com/bincrafters/conan-ffmpeg/blob/stable/3.4/conanfile.py \
|
||||
libasound2-dev \
|
||||
libpulse-dev \
|
||||
# conan-sdl2 dependencies https://github.com/bincrafters/conan-sdl2/blob/stable/2.0.8/conanfile.py\
|
||||
libxinerama-dev \
|
||||
libxkbcommon-dev \
|
||||
&& apt-get clean
|
||||
|
||||
# RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 50 --slave /usr/bin/g++ g++ /usr/bin/g++-8
|
||||
|
||||
CMD [ /bin/bash ]
|
@ -44,6 +44,9 @@ def create(ns: argparse.Namespace):
|
||||
'--uid', str(ns.uid), '-g', ns.username, ns.username])
|
||||
sub_run(['docker', 'exec', ns.name, 'chown', '{0}:{0}'.format(ns.username),
|
||||
'/build'])
|
||||
sub_run(['docker', 'exec', ns.name, 'usermod', '-a', '-G', 'sudo', ns.username])
|
||||
sub_run(['docker', 'exec', ns.name, '/bin/bash', '-c', 'printf "{0}:{0}" | chpasswd'.format(ns.username)])
|
||||
sub_run(['docker', 'exec', ns.name, '/bin/bash', '-c', 'printf "{0} ALL= NOPASSWD: ALL\n" >> /etc/sudoers'.format(ns.username)])
|
||||
|
||||
|
||||
def exec(ns: argparse.Namespace):
|
||||
|
@ -8,7 +8,7 @@ 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
|
||||
"$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
|
||||
|
||||
# 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"
|
||||
|
@ -2,8 +2,6 @@
|
||||
# Unit Tests
|
||||
##############################################################################
|
||||
|
||||
find_package(Boost COMPONENTS filesystem unit_test_framework system REQUIRED)
|
||||
|
||||
set(TESTS
|
||||
Animation
|
||||
Archive
|
||||
@ -66,19 +64,6 @@ target_compile_definitions(rwtests
|
||||
"RW_TEST_WITH_DATA=$<NOT:$<BOOL:${TESTS_NODATA}>>"
|
||||
)
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_compile_definitions(rwtests
|
||||
PRIVATE
|
||||
"BOOST_TEST_DYN_LINK"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(rwtests
|
||||
SYSTEM
|
||||
PRIVATE
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_include_directories(rwtests
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/tests"
|
||||
@ -88,10 +73,9 @@ target_include_directories(rwtests
|
||||
target_link_libraries(rwtests
|
||||
PRIVATE
|
||||
rwengine
|
||||
SDL2::SDL2
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
rwdep::SDL2
|
||||
rwdep::boost_filesystem
|
||||
rwdep::boost_unit_test_framework
|
||||
)
|
||||
|
||||
openrw_target_apply_options(TARGET rwtests)
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define _TESTGLOBALS_HPP_
|
||||
|
||||
#include <btBulletDynamicsCommon.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
#include <GameWindow.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <core/Logger.hpp>
|
||||
|
Loading…
Reference in New Issue
Block a user