mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-10 12:54:50 -04:00
Give up on fetching libjpeg-turbo ourselves, rely on find_package and user providing it at build time
This commit is contained in:
+11
-9
@@ -21,6 +21,15 @@ option(DUSK_BUILD_WARNINGS "If off, compiler warnings will be suppressed")
|
||||
option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled with optimizations on Debug, intending to make the game run at 30 FPS. Note for MSVC: you will need to remove '/RTC1' from your debug flags in CMake.")
|
||||
option(DUSK_MOVIE_SUPPORT "If on, compile against libjpeg-turbo to enable THP file decoding" ON)
|
||||
|
||||
find_package(libjpeg-turbo)
|
||||
set(DUSK_MOVIE_SUPPORT_REAL ${DUSK_MOVIE_SUPPORT})
|
||||
if (DUSK_MOVIE_SUPPORT AND NOT libjpeg-turbo_FOUND)
|
||||
message(WARNING "libjpeg-turbo not found but DUSK_MOVIE_SUPPORT set, movie playback will not be available!")
|
||||
set(DUSK_MOVIE_SUPPORT_REAL OFF)
|
||||
endif ()
|
||||
|
||||
message(WARNING "FOUND: ${libjpeg-turbo_FOUND}")
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
# -Wno-multichar: Multi-character constants ('ABCD') are implementation-defined but all compilers
|
||||
# (CW, GCC, Clang, MSVC) encode them identically in big-endian order.
|
||||
@@ -54,10 +63,6 @@ endif ()
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
include(ExternalProject)
|
||||
endif ()
|
||||
|
||||
message(STATUS "dusk: Fetching cxxopts")
|
||||
FetchContent_Declare(
|
||||
cxxopts
|
||||
@@ -67,9 +72,6 @@ FetchContent_Declare(
|
||||
|
||||
FetchContent_MakeAvailable(cxxopts)
|
||||
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
include(cmake/libjpeg.cmake)
|
||||
endif ()
|
||||
include(files.cmake)
|
||||
|
||||
# TODO: version handling for res includes
|
||||
@@ -116,8 +118,8 @@ add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${J
|
||||
src/dusk/imgui/ImGuiAudio.cpp)
|
||||
|
||||
target_link_libraries(game PRIVATE game_debug cxxopts::cxxopts)
|
||||
if (DUSK_MOVIE_SUPPORT)
|
||||
target_link_libraries(game PRIVATE libjpeg-turbo-lib)
|
||||
if (DUSK_MOVIE_SUPPORT_REAL)
|
||||
target_link_libraries(game PRIVATE libjpeg-turbo::turbojpeg-static)
|
||||
target_compile_definitions(game PRIVATE MOVIE_SUPPORT=1)
|
||||
endif ()
|
||||
target_compile_definitions(game PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
ExternalProject_Add(
|
||||
libjpeg-turbo
|
||||
URL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/3.1.90.tar.gz
|
||||
URL_HASH SHA256=076ef1431f2803a91f07e0f92433d4dcf39bc9113226c4f46ba3d3d54f514c9d
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property(libjpeg-turbo INSTALL_DIR)
|
||||
add_library(libjpeg-turbo-lib STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(libjpeg-turbo-lib PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/turbojpeg-static.lib)
|
||||
target_include_directories(libjpeg-turbo-lib INTERFACE ${INSTALL_DIR}/include)
|
||||
Reference in New Issue
Block a user