Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 52 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")
# *****************************************************************************
# Packages / Libs
# *****************************************************************************
# Before we begin loading packages wholesale, we have to check which package
# provider is available. Normally, OTClient developers prefer vcpkg.
# However if that is not available, we can check if PkgConfig is available.
# PkgConfig is only intended for package maintainers.
# *****************************************************************************
if(NOT DEFINED VCPKG_TARGET_TRIPLET)
find_package(PkgConfig REQUIRED)
endif()
find_package(OpenSSL QUIET)
find_package(PhysFS REQUIRED)
find_package(ZLIB REQUIRED)
Expand All @@ -143,7 +151,12 @@ find_package(ZLIB REQUIRED)
find_package(httplib CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(utf8cpp REQUIRED)
find_package(unofficial-inih CONFIG REQUIRED)
if(DEFINED VCPKG_TARGET_TRIPLET)
find_package(unofficial-inih CONFIG REQUIRED)
else()
pkg_check_modules(INIReader REQUIRED IMPORTED_TARGET INIReader)
add_library(unofficial::inih::inireader ALIAS PkgConfig::INIReader)
endif()
find_package(Freetype REQUIRED)

find_path(CPPCODEC_INCLUDE_DIRS "cppcodec/base32_crockford.hpp")
Expand Down Expand Up @@ -177,9 +190,30 @@ if(TOGGLE_FRAMEWORK_SOUND)
if(NOT WASM)
find_package(OpenAL CONFIG REQUIRED)
endif()
find_package(VorbisFile REQUIRED)
find_package(Vorbis CONFIG REQUIRED)
find_package(Ogg CONFIG REQUIRED)
if(DEFINED VCPKG_TARGET_TRIPLET)
find_package(VorbisFile REQUIRED)
find_package(Vorbis CONFIG REQUIRED)
find_package(Ogg CONFIG REQUIRED)
else()
pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
add_library(Vorbis::vorbisfile INTERFACE IMPORTED)
set_target_properties(Vorbis::vorbisfile PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${VORBISFILE_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${VORBISFILE_LIBRARIES}"
)
pkg_check_modules(VORBIS REQUIRED vorbis)
add_library(Vorbis::vorbis INTERFACE IMPORTED)
set_target_properties(Vorbis::vorbis PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${VORBIS_LIBRARIES}"
)
pkg_check_modules(OGG REQUIRED ogg)
add_library(Ogg::ogg INTERFACE IMPORTED)
set_target_properties(Ogg::ogg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${OGG_LIBRARIES}"
)
endif()
endif()
if(ANDROID)
set(LUA_LIBRARY ${LUA_LIBRARY} ${Android_LIBRARIES}/liblua.a)
Expand All @@ -193,7 +227,20 @@ if(ANDROID)
else()
if(NOT WASM)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
if(DEFINED VCPKG_TARGET_TRIPLET)
find_package(GLEW REQUIRED)
else()
pkg_check_modules(GLEW REQUIRED IMPORTED_TARGET glew)
add_library(GLEW::GLEW ALIAS PkgConfig::GLEW)
# *****************************************************************************
# GLEW_LIBRARY seems to be missing from PkgConfig::GLEW, so
# we're gonna declare it with the value of GLEW_LIBRARIES to make the rest
# of the recipe hold it together.
# *****************************************************************************
if(NOT DEFINED GLEW_LIBRARY AND DEFINED GLEW_LIBRARIES)
set(GLEW_LIBRARY "${GLEW_LIBRARIES}")
endif()
endif()
find_package(LuaJIT REQUIRED)
else()
set(LUA_LIBRARY ${LUA_LIBRARY} ${CMAKE_SOURCE_DIR}/browser/include/lua51/liblua.a)
Expand Down
Loading