mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
cmake: do not use rwdep::xxx targets
This commit is contained in:
parent
7dece398f4
commit
b545b79a4b
@ -71,3 +71,16 @@ endif()
|
|||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIR)
|
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()
|
||||||
|
@ -30,36 +30,36 @@
|
|||||||
# License text for the above reference.)
|
# License text for the above reference.)
|
||||||
|
|
||||||
# default search dirs
|
# default search dirs
|
||||||
SET(_glm_HEADER_SEARCH_DIRS
|
set(_glm_HEADER_SEARCH_DIRS
|
||||||
"/usr/include"
|
"/usr/include"
|
||||||
"/usr/local/include")
|
"/usr/local/include")
|
||||||
|
|
||||||
# check environment variable
|
# 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)
|
if(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
|
||||||
SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
|
set(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
|
||||||
ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
|
endif(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
|
||||||
|
|
||||||
# put user specified location at beginning of search
|
# put user specified location at beginning of search
|
||||||
IF(GLM_ROOT_DIR)
|
if(GLM_ROOT_DIR)
|
||||||
SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
|
set(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
|
||||||
"${GLM_ROOT_DIR}/include"
|
"${GLM_ROOT_DIR}/include"
|
||||||
${_glm_HEADER_SEARCH_DIRS})
|
${_glm_HEADER_SEARCH_DIRS})
|
||||||
ENDIF(GLM_ROOT_DIR)
|
endif()
|
||||||
|
|
||||||
# locate header
|
# locate header
|
||||||
FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
|
find_path(GLM_INCLUDE_DIR "glm/glm.hpp"
|
||||||
PATHS ${_glm_HEADER_SEARCH_DIRS})
|
PATHS ${_glm_HEADER_SEARCH_DIRS})
|
||||||
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
|
find_package_handle_standard_args(GLM DEFAULT_MSG
|
||||||
GLM_INCLUDE_DIR)
|
GLM_INCLUDE_DIR)
|
||||||
|
|
||||||
IF(GLM_FOUND)
|
if(GLM_FOUND)
|
||||||
SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
|
set(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
|
||||||
|
add_library(glm INTERFACE)
|
||||||
IF(NOT GLM_FIND_QUIETLY)
|
target_include_directories(glm SYSTEM
|
||||||
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
|
INTERFACE "${GLM_INCLUDE_DIR}")
|
||||||
ENDIF(NOT GLM_FIND_QUIETLY)
|
add_library(glm::glm ALIAS glm)
|
||||||
ENDIF(GLM_FOUND)
|
endif()
|
||||||
|
@ -194,3 +194,16 @@ IF(SDL2_STATIC)
|
|||||||
SET(SDL2_LIBRARY ${SDL2_LINK_FLAGS})
|
SET(SDL2_LIBRARY ${SDL2_LINK_FLAGS})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(SDL2_STATIC)
|
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()
|
||||||
|
@ -1,61 +1,35 @@
|
|||||||
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)
|
function(rwdep_wrap_find_packages)
|
||||||
if(BULLET_FOUND)
|
if(BULLET_FOUND AND NOT TARGET bullet::bullet)
|
||||||
rwdep_wrap_find_package(bullet "${BULLET_INCLUDE_DIR}" "${BULLET_LIBRARIES}")
|
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()
|
endif()
|
||||||
|
|
||||||
if(FFMPEG_FOUND)
|
if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL)
|
||||||
rwdep_wrap_find_package(ffmpeg "${FFMPEG_INCLUDE_DIR}" "${FFMPEG_LIBRARIES}")
|
add_library(OpenAL INTERFACE)
|
||||||
endif()
|
target_link_libraries(OpenAL
|
||||||
|
INTERFACE
|
||||||
if(GLM_FOUND)
|
"${OPENAL_LIBRARY}"
|
||||||
rwdep_wrap_find_package(glm "${GLM_INCLUDE_DIR}" "")
|
)
|
||||||
endif()
|
target_include_directories(OpenAL SYSTEM
|
||||||
|
INTERFACE
|
||||||
if(OPENAL_FOUND)
|
"${OPENAL_INCLUDE_DIR}"
|
||||||
rwdep_wrap_find_package(OpenAL "${OPENAL_INCLUDE_DIR}" "${OPENAL_LIBRARY}")
|
)
|
||||||
endif()
|
add_library(OpenAL::OpenAL ALIAS OpenAL)
|
||||||
|
|
||||||
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}")
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(rwdep_wrap_conan_target TARGET CONAN_NAME)
|
function(rwdep_wrap_conan_target TARGET CONAN_NAME)
|
||||||
add_library("_rwdep_${TARGET}" INTERFACE)
|
add_library("CONAN_${CONAN_NAME}" INTERFACE)
|
||||||
target_link_libraries("_rwdep_${TARGET}" INTERFACE "CONAN_PKG::${CONAN_NAME}")
|
target_link_libraries("CONAN_${CONAN_NAME}" INTERFACE "CONAN_PKG::${CONAN_NAME}")
|
||||||
add_library("rwdep::${TARGET}" ALIAS "_rwdep_${TARGET}")
|
add_library("${TARGET}" ALIAS "CONAN_${CONAN_NAME}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(rwdep_wrap_conan_targets)
|
function(rwdep_wrap_conan_targets)
|
||||||
@ -64,12 +38,12 @@ function(rwdep_wrap_conan_targets)
|
|||||||
rwdep_wrap_conan_target(boost_filesystem boost)
|
rwdep_wrap_conan_target(boost_filesystem boost)
|
||||||
rwdep_wrap_conan_target(boost_unit_test_framework boost)
|
rwdep_wrap_conan_target(boost_unit_test_framework boost)
|
||||||
|
|
||||||
rwdep_wrap_conan_target(OpenAL openal)
|
rwdep_wrap_conan_target(OpenAL::OpenAL openal)
|
||||||
rwdep_wrap_conan_target(bullet bullet)
|
rwdep_wrap_conan_target(bullet::bullet bullet)
|
||||||
rwdep_wrap_conan_target(glm glm)
|
rwdep_wrap_conan_target(glm::glm glm)
|
||||||
rwdep_wrap_conan_target(ffmpeg ffmpeg)
|
rwdep_wrap_conan_target(ffmpeg::ffmpeg ffmpeg)
|
||||||
rwdep_wrap_conan_target(SDL2 sdl2)
|
rwdep_wrap_conan_target(SDL2::SDL2 sdl2)
|
||||||
if(BUILD_TOOLS)
|
if(BUILD_TOOLS)
|
||||||
rwdep_wrap_conan_target(freetype freetype)
|
rwdep_wrap_conan_target(Freetype::Freetype freetype)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -86,7 +86,7 @@ elseif(FILESYSTEM_LIBRARY STREQUAL "CXXTS")
|
|||||||
elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST")
|
elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST")
|
||||||
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=2")
|
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=2")
|
||||||
target_link_libraries(rw_interface INTERFACE
|
target_link_libraries(rw_interface INTERFACE
|
||||||
rwdep::boost_filesystem
|
Boost::filesystem
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Illegal FILESYSTEM_LIBRARY option. (was '${FILESYSTEM_LIBRARY}')")
|
message(FATAL_ERROR "Illegal FILESYSTEM_LIBRARY option. (was '${FILESYSTEM_LIBRARY}')")
|
||||||
|
@ -51,8 +51,8 @@ target_include_directories(rwcore
|
|||||||
|
|
||||||
target_link_libraries(rwcore
|
target_link_libraries(rwcore
|
||||||
PUBLIC
|
PUBLIC
|
||||||
rwdep::boost
|
Boost::boost
|
||||||
rwdep::glm
|
glm::glm
|
||||||
openrw::interface
|
openrw::interface
|
||||||
PRIVATE
|
PRIVATE
|
||||||
OpenGL::GL
|
OpenGL::GL
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
###########################################################
|
|
||||||
## RWENGINE
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
set(RWENGINE_SOURCES
|
set(RWENGINE_SOURCES
|
||||||
src/ai/AIGraph.cpp
|
src/ai/AIGraph.cpp
|
||||||
src/ai/AIGraph.hpp
|
src/ai/AIGraph.hpp
|
||||||
@ -147,10 +143,10 @@ add_library(rwengine
|
|||||||
target_link_libraries(rwengine
|
target_link_libraries(rwengine
|
||||||
PUBLIC
|
PUBLIC
|
||||||
rwcore
|
rwcore
|
||||||
rwdep::bullet
|
bullet::bullet
|
||||||
rwdep::ffmpeg
|
ffmpeg::ffmpeg
|
||||||
rwdep::glm
|
glm::glm
|
||||||
rwdep::OpenAL
|
OpenAL::OpenAL
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(rwengine
|
target_include_directories(rwengine
|
||||||
|
@ -45,14 +45,14 @@ add_executable(rwgame
|
|||||||
|
|
||||||
target_include_directories(rwgame
|
target_include_directories(rwgame
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${CMAKE_SOURCE_DIR}/rwgame"
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(rwgame
|
target_link_libraries(rwgame
|
||||||
PRIVATE
|
PRIVATE
|
||||||
rwengine
|
rwengine
|
||||||
rwdep::boost_program_options
|
Boost::program_options
|
||||||
rwdep::SDL2
|
SDL2::SDL2
|
||||||
)
|
)
|
||||||
|
|
||||||
openrw_target_apply_options(TARGET rwgame)
|
openrw_target_apply_options(TARGET rwgame)
|
||||||
|
@ -7,8 +7,8 @@ add_executable(rwfontmap
|
|||||||
target_link_libraries(rwfontmap
|
target_link_libraries(rwfontmap
|
||||||
PUBLIC
|
PUBLIC
|
||||||
rwcore
|
rwcore
|
||||||
rwdep::freetype
|
Freetype::Freetype
|
||||||
rwdep::boost_program_options
|
Boost::program_options
|
||||||
Qt5::Gui
|
Qt5::Gui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
##############################################################################
|
|
||||||
# Unit Tests
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
set(TESTS
|
set(TESTS
|
||||||
Animation
|
Animation
|
||||||
Archive
|
Archive
|
||||||
@ -47,9 +43,9 @@ set(TEST_SOURCES
|
|||||||
test_Globals.hpp
|
test_Globals.hpp
|
||||||
|
|
||||||
# Hack in rwgame sources until there's a per-target test suite
|
# Hack in rwgame sources until there's a per-target test suite
|
||||||
"${CMAKE_SOURCE_DIR}/rwgame/GameConfig.cpp"
|
"${PROJECT_SOURCE_DIR}/rwgame/GameConfig.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/rwgame/GameWindow.cpp"
|
"${PROJECT_SOURCE_DIR}/rwgame/GameWindow.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/rwgame/GameInput.cpp"
|
"${PROJECT_SOURCE_DIR}/rwgame/GameInput.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(TEST ${TESTS})
|
foreach(TEST ${TESTS})
|
||||||
@ -67,16 +63,16 @@ target_compile_definitions(rwtests
|
|||||||
|
|
||||||
target_include_directories(rwtests
|
target_include_directories(rwtests
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${CMAKE_SOURCE_DIR}/tests"
|
"${PROJECT_SOURCE_DIR}/tests"
|
||||||
"${CMAKE_SOURCE_DIR}/rwgame"
|
"${PROJECT_SOURCE_DIR}/rwgame"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(rwtests
|
target_link_libraries(rwtests
|
||||||
PRIVATE
|
PRIVATE
|
||||||
rwengine
|
rwengine
|
||||||
rwdep::SDL2
|
SDL2::SDL2
|
||||||
rwdep::boost_filesystem
|
Boost::filesystem
|
||||||
rwdep::boost_unit_test_framework
|
Boost::unit_test_framework
|
||||||
)
|
)
|
||||||
|
|
||||||
openrw_target_apply_options(TARGET rwtests)
|
openrw_target_apply_options(TARGET rwtests)
|
||||||
|
Loading…
Reference in New Issue
Block a user