diff --git a/README.md b/README.md index d9bbb5dd6..e52b85416 100644 --- a/README.md +++ b/README.md @@ -331,18 +331,60 @@ target_include_directories(${PROJECT_NAME} $<$:${IRR_INSTALL_DIR}/debug/include> $<$:${IRR_INSTALL_DIR}/relwithdebinfo/include> $<$:${IRR_INSTALL_DIR}/include> + # these are needed because we haven't cleaned up the API properly yet + $<$:${IRR_INSTALL_DIR}/debug/source/Irrlicht> + $<$:${IRR_INSTALL_DIR}/relwithdebinfo/source/Irrlicht> + $<$:${IRR_INSTALL_DIR}/source/Irrlicht> ) -target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Core Qt5::Gui opengl32.lib) target_link_libraries(${PROJECT_NAME} $<$:${IRR_INSTALL_DIR}/debug/lib/Irrlicht_debug.lib> $<$:${IRR_INSTALL_DIR}/relwithdebinfo/lib/Irrlicht_rwdi.lib> $<$:${IRR_INSTALL_DIR}/lib/Irrlicht.lib> - # these are needed because we haven't cleaned up the API properly yet - $<$:${IRR_INSTALL_DIR}/debug/source/Irrlicht> - $<$:${IRR_INSTALL_DIR}/relwithdebinfo/source/Irrlicht> - $<$:${IRR_INSTALL_DIR}/source/Irrlicht> ) - +function(link_irr_dependency DEPENDENCY_NAME) + target_link_libraries(${PROJECT_NAME} + $<$:${IRR_INSTALL_DIR}/debug/lib/${DEPENDENCY_NAME}d.lib> + $<$:${IRR_INSTALL_DIR}/relwithdebinfo/lib/${DEPENDENCY_NAME}.lib> + $<$:${IRR_INSTALL_DIR}/lib/${DEPENDENCY_NAME}.lib> + ) +endfunction() +function(link_irr_dependency_ DEPENDENCY_NAME) + target_link_libraries(${PROJECT_NAME} + $<$:${IRR_INSTALL_DIR}/debug/lib/${DEPENDENCY_NAME}_d.lib> + $<$:${IRR_INSTALL_DIR}/relwithdebinfo/lib/${DEPENDENCY_NAME}.lib> + $<$:${IRR_INSTALL_DIR}/lib/${DEPENDENCY_NAME}.lib> + ) +endfunction() +link_irr_dependency(glslang) +link_irr_dependency_(jpeg) +link_irr_dependency_(IlmImf-2_4) +link_irr_dependency_(IexMath-2_4) +link_irr_dependency_(Iex-2_4) +link_irr_dependency_(IlmThread-2_4) +link_irr_dependency_(Half-2_4) +link_irr_dependency_(Imath-2_4) +link_irr_dependency(libpng16_static) +# OpenSSL only ever exists in the Release variant +if(WIN32) + target_link_libraries(${PROJECT_NAME} + ${IRR_INSTALL_DIR}/lib/libeay32.lib + ${IRR_INSTALL_DIR}/lib/ssleay32.lib + ) +else() + target_link_libraries(${PROJECT_NAME} + ${IRR_INSTALL_DIR}/lib/libcrypto.lib + ${IRR_INSTALL_DIR}/lib/libssl.lib + ) +endif() +link_irr_dependency_(shaderc) +link_irr_dependency_(shaderc_util) +link_irr_dependency(SPIRV) +link_irr_dependency_(SPIRV-Tools) +link_irr_dependency_(SPIRV-Tools-opt) +link_irr_dependency(OGLCompiler) +link_irr_dependency(OSDependent) +link_irr_dependency(HLSL) +link_irr_dependency(zlibstatic) ``` If you want to use git (without a submodule) then you can use `ExternalProject_Add` with the `GIT_` properties instead. diff --git a/src/irr/CMakeLists.txt b/src/irr/CMakeLists.txt index beb0774f1..b806517a9 100644 --- a/src/irr/CMakeLists.txt +++ b/src/irr/CMakeLists.txt @@ -427,14 +427,7 @@ if(IRR_PCH) target_precompile_headers(Irrlicht PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/pch.h") endif() -set_target_properties(Irrlicht PROPERTIES DEBUG_POSTFIX _debug) -set_target_properties(Irrlicht PROPERTIES RELWITHDEBDINFO_POSTFIX _relwithdebinfo) -macro(irr_install_static_lib _TRGT) - install(TARGETS ${_TRGT} ARCHIVE DESTINATION lib CONFIGURATIONS Release) - install(TARGETS ${_TRGT} ARCHIVE DESTINATION debug/lib CONFIGURATIONS Debug) - install(TARGETS ${_TRGT} ARCHIVE DESTINATION relwithdebinfo/lib CONFIGURATIONS RelWithDebInfo) -endmacro() if(IRR_EMBED_BUILTIN_RESOURCES) add_custom_target(builtin_resources DEPENDS ${CMAKE_BINARY_DIR}/include/irr/builtin/builtinResources.h ${CMAKE_CURRENT_BINARY_DIR}/builtin/builtinResourceData.cpp) @@ -445,9 +438,53 @@ elseif() endforeach() endif() -irr_install_static_lib(Irrlicht) + set(IRRLICHT_HEADERS_TO_INSTALL ${IRRLICHT_HEADERS_PUBLIC} ) irr_install_headers("${IRRLICHT_HEADERS_TO_INSTALL}" "${IRR_ROOT_PATH}/include") -irr_install_config_header(BuildConfigOptions.h) \ No newline at end of file +irr_install_config_header(BuildConfigOptions.h) + + +macro(irr_install_lib _TRGT) + install(TARGETS ${_TRGT} ARCHIVE DESTINATION lib CONFIGURATIONS Release) + install(TARGETS ${_TRGT} ARCHIVE DESTINATION debug/lib CONFIGURATIONS Debug) + install(TARGETS ${_TRGT} ARCHIVE DESTINATION relwithdebinfo/lib CONFIGURATIONS RelWithDebInfo) +endmacro() +# Install main lib +set_target_properties(Irrlicht PROPERTIES DEBUG_POSTFIX _debug) +set_target_properties(Irrlicht PROPERTIES RELWITHDEBDINFO_POSTFIX _relwithdebinfo) +irr_install_lib(Irrlicht) + +#install dependencies +irr_install_lib(glslang) +irr_install_lib(jpeg) +irr_install_lib(Half) +irr_install_lib(HLSL) +irr_install_lib(Iex) +irr_install_lib(IexMath) +irr_install_lib(IlmImf) +irr_install_lib(IlmThread) +irr_install_lib(Imath) +irr_install_lib(png_static) +if(WIN32) + install(FILES + "$/build/lib/libeay32.lib" + "$/build/lib/ssleay32.lib" + DESTINATION lib + ) +else() + install(FILES + "$/build/lib/libcrypto.a" + "$/build/lib/libssl.a" + DESTINATION lib + ) +endif() +irr_install_lib(shaderc) +irr_install_lib(shaderc_util) +irr_install_lib(SPIRV) +irr_install_lib(SPIRV-Tools) +irr_install_lib(SPIRV-Tools-opt) +irr_install_lib(OGLCompiler) +irr_install_lib(OSDependent) +irr_install_lib(zlibstatic) \ No newline at end of file