FreeImage correctly included

I gave up and am directly including FreeImage in this project. I need to add proper licensing soon.
This commit is contained in:
Jack 2024-08-23 23:35:47 -04:00
parent 33c121764b
commit 34e0974eb3
3 changed files with 1185 additions and 13 deletions

View File

@ -10,15 +10,6 @@ find_package(glfw3 CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(assimp CONFIG REQUIRED)
# Direct linking to FreeImage libraries for now
if (WIN32)
set(FreeImage_INCLUDE_DIR $ENV{VCPKG_ROOT}/packages/freeimage_x64-windows/include)
set(FreeImage_LIBRARIES $ENV{VCPKG_ROOT}/packages/freeimage_x64-windows/lib/)
else()
set(FreeImage_INCLUDE_DIR $ENV{VCPKG_ROOT}/installed/x64-linux/include)
set(FreeImage_LIBRARIES $ENV{VCPKG_ROOT}/installed/x64-linux/lib)
endif()
# Set Debug and Release directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}")
@ -32,20 +23,23 @@ file(GLOB IMGUI_SOURCES
"${CMAKE_SOURCE_DIR}/imgui/backends/imgui_impl_glfw.cpp"
"${CMAKE_SOURCE_DIR}/imgui/backends/imgui_impl_opengl3.cpp"
)
file(GLOB FREEIMAGE_HEADER "${CMAKE_SOURCE_DIR}/dependencies/FreeImage/include/*.h")
# Add the executable
add_executable(TerraVisor ${SOURCES} ${HEADERS} ${IMGUI_SOURCES} )
add_executable(TerraVisor ${SOURCES} ${HEADERS} ${IMGUI_SOURCES} ${FREEIMAGE_HEADER})
# Include directories (handled by find_package now)
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/imgui
${CMAKE_SOURCE_DIR}/imgui/backends
${FreeImage_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/dependencies/FreeImage/include
)
link_directories(${CMAKE_SOURCE_DIR}/dependencies/FreeImage/lib)
# Link libraries using vcpkg
target_link_libraries(TerraVisor PRIVATE GLEW::GLEW glfw glm::glm assimp::assimp ${FreeImage_LIBRARIES})
target_link_libraries(TerraVisor PRIVATE GLEW::GLEW glfw glm::glm assimp::assimp ${CMAKE_SOURCE_DIR}/dependencies/FreeImage/lib/FreeImage.lib)
# Custom targets
add_custom_target(copy_shaders ALL
@ -56,6 +50,15 @@ add_custom_target(copy_hgt ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/hgt ${CMAKE_BINARY_DIR}/hgt
)
# Set paths for FreeImage DLL
set(FREEIMAGE_DLL_PATH "${CMAKE_SOURCE_DIR}/dependencies/FreeImage/bin/FreeImage.dll")
# Add custom command to copy FreeImage.dll to the output directory for both Debug and Release
add_custom_command(TARGET TerraVisor POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${FREEIMAGE_DLL_PATH}
$<TARGET_FILE_DIR:TerraVisor>
)
# Set subsystem based on build type
if (WIN32)

View File

@ -672,3 +672,9 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
---
This project also includes third-party software with different licenses:
- FreeImage is licensed under the FreeImage Public License (FIPL). See `licenses/LICENSE-FreeImage.txt` for details.

1163
dependencies/FreeImage/include/FreeImage.h vendored Normal file

File diff suppressed because it is too large Load Diff