Merge pull request 'Fixed build on windows, added libjpeg-turbo' (#21) from windows_build_fix into master
Reviewed-on: https://git.madvoxel.net/OpenVulkano/OpenVulkano/pulls/21 Reviewed-by: Georg Hagen <georg.hagen@madvoxel.com>
This commit is contained in:
16
3rdParty/CMakeLists.txt
vendored
16
3rdParty/CMakeLists.txt
vendored
@@ -1,3 +1,5 @@
|
||||
include(ExternalProject)
|
||||
|
||||
add_subdirectory(glm)
|
||||
if (NOT ANDROID AND NOT IOS)
|
||||
add_subdirectory(glfw)
|
||||
@@ -16,6 +18,7 @@ add_subdirectory(imgui)
|
||||
add_subdirectory(tracy)
|
||||
add_subdirectory(libstud-uuid)
|
||||
add_subdirectory(rapidyaml)
|
||||
add_subdirectory(libjpeg-turbo)
|
||||
|
||||
|
||||
#TODO move into a different file
|
||||
@@ -28,7 +31,12 @@ if (NOT DEFINED LibArchive_LIBRARIES)
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/deps
|
||||
RESULT_VARIABLE build_result
|
||||
)
|
||||
if (NOT ${build_result} EQUAL "0")
|
||||
message(FATAL_ERROR "Failed to build lib archive!")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps/INSTALL)
|
||||
else ()
|
||||
message("Using system LibArchive")
|
||||
@@ -44,5 +52,11 @@ function(LinkLibArchive TARGET)
|
||||
find_package(BZip2 QUIET)
|
||||
find_package(LibLZMA QUIET)
|
||||
target_include_directories(${TARGET} PRIVATE ${LibArchive_INCLUDE_DIR})
|
||||
target_link_libraries(${TARGET} PRIVATE ${LibArchive_LIBRARIES} ${ZLIB_LIBRARIES} ${zstd_LIBRARIES} ${LZ4_LIBRARIES} ${LIBLZMA_LIBRARIES} ${BZIP2_LIBRARIES})
|
||||
target_link_libraries(${TARGET} PRIVATE ${LibArchive_LIBRARIES} ${ZLIB_LIBRARIES} ${zstd_LIBRARIES} ${LZ4_LIBRARIES})
|
||||
if (BZIP2_LIBRARIES)
|
||||
target_link_libraries(${TARGET} PRIVATE ${BZIP2_LIBRARIES})
|
||||
endif()
|
||||
if (LIBLZMA_LIBRARIES)
|
||||
target_link_libraries(${TARGET} PRIVATE ${LIBLZMA_LIBRARIES})
|
||||
endif()
|
||||
endfunction()
|
||||
7
3rdParty/assimp/CMakeLists.txt
vendored
7
3rdParty/assimp/CMakeLists.txt
vendored
@@ -1,5 +1,6 @@
|
||||
include(FetchContent)
|
||||
|
||||
unset(assimp_FOUND)
|
||||
find_package(assimp QUIET)
|
||||
if (assimp_FOUND)
|
||||
message("Using system assimp")
|
||||
@@ -25,15 +26,15 @@ elseif (USE_ASSIMP)
|
||||
|
||||
FetchContent_MakeAvailable(assimp)
|
||||
|
||||
set(assimp_FOUND ON PARENT_SCOPE)
|
||||
set(assimp_BUILT "fetched assimp found" CACHE INTERNAL ON)
|
||||
endif ()
|
||||
|
||||
|
||||
function(LinkAssimp TARGET)
|
||||
if (NOT assimp_FOUND)
|
||||
if (NOT assimp_BUILT)
|
||||
find_package(assimp QUIET)
|
||||
endif ()
|
||||
if (assimp_FOUND)
|
||||
if (assimp_FOUND OR assimp_BUILT)
|
||||
target_link_libraries(${TARGET} PUBLIC assimp)
|
||||
endif ()
|
||||
endfunction()
|
||||
2
3rdParty/libarchive/CMakeLists.txt
vendored
2
3rdParty/libarchive/CMakeLists.txt
vendored
@@ -31,7 +31,7 @@ ExternalProject_Add(zlib
|
||||
|
||||
ExternalProject_Add(zstd
|
||||
GIT_REPOSITORY ${ZSTD_REPO}
|
||||
GIT_TAG v1.5.6
|
||||
GIT_TAG v1.5.5
|
||||
GIT_SHALLOW TRUE
|
||||
SOURCE_DIR zstd
|
||||
SOURCE_SUBDIR build/cmake
|
||||
|
||||
30
3rdParty/libjpeg-turbo/CMakeLists.txt
vendored
Normal file
30
3rdParty/libjpeg-turbo/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
include(FetchContent)
|
||||
|
||||
Find_Package(libjpeg-turbo QUIET)
|
||||
if (libjpeg-turbo_FOUND)
|
||||
message("Using system libjpeg-turbo")
|
||||
else ()
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/deps_ljt)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} -DTOOLCHAIN_FILE=${TOOLCHAIN_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/ext
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/deps_ljt
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/deps_ljt
|
||||
RESULT_VARIABLE build_result
|
||||
)
|
||||
if (NOT ${build_result} EQUAL "0")
|
||||
message(FATAL_ERROR "Failed to build libjpeg-turbo!")
|
||||
endif()
|
||||
|
||||
set(libjpeg-turbo_BUILT "built libjpeg-turbo" CACHE INTERNAL ON)
|
||||
endif ()
|
||||
|
||||
|
||||
function(LinkLibJpegTurbo TARGET)
|
||||
if (libjpeg-turbo_BUILT)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps_ljt/INSTALL/lib/cmake)
|
||||
endif()
|
||||
find_package(libjpeg-turbo REQUIRED)
|
||||
target_link_libraries(${TARGET} PUBLIC libjpeg-turbo::turbojpeg-static)
|
||||
endfunction()
|
||||
22
3rdParty/libjpeg-turbo/ext/CMakeLists.txt
vendored
Normal file
22
3rdParty/libjpeg-turbo/ext/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(build_libjpeg-turbo)
|
||||
include(ExternalProject)
|
||||
|
||||
if(NOT DEFINED LIBJPEGTURBO_REPO)
|
||||
set(LIBJPEGTURBO_REPO https://github.com/libjpeg-turbo/libjpeg-turbo.git)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(libjpegturbo
|
||||
GIT_REPOSITORY ${LIBJPEGTURBO_REPO}
|
||||
GIT_TAG 3.0.3
|
||||
GIT_SHALLOW TRUE
|
||||
SOURCE_DIR libjpegturbo
|
||||
BINARY_DIR libjpegturbo-build
|
||||
CMAKE_GENERATOR ${CMAKE_GENERATOR}
|
||||
CMAKE_ARGS
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
-DENABLE_SHARED:BOOL=OFF
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${TOOLCHAIN_FILE}
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/INSTALL
|
||||
-DCMAKE_BUILD_TYPE:STRING=Release
|
||||
)
|
||||
Reference in New Issue
Block a user