Skip to content

Commit

Permalink
INSTALL target finally works!
Browse files Browse the repository at this point in the history
  • Loading branch information
devshgraphicsprogramming committed Jun 10, 2020
1 parent 013abca commit 651a5ff
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 15 deletions.
54 changes: 48 additions & 6 deletions README.md
Expand Up @@ -331,18 +331,60 @@ target_include_directories(${PROJECT_NAME}
$<$<CONFIG:Debug>:${IRR_INSTALL_DIR}/debug/include>
$<$<CONFIG:RelWithDebInfo>:${IRR_INSTALL_DIR}/relwithdebinfo/include>
$<$<CONFIG:Release>:${IRR_INSTALL_DIR}/include>
# these are needed because we haven't cleaned up the API properly yet
$<$<CONFIG:Debug>:${IRR_INSTALL_DIR}/debug/source/Irrlicht>
$<$<CONFIG:RelWithDebInfo>:${IRR_INSTALL_DIR}/relwithdebinfo/source/Irrlicht>
$<$<CONFIG:Release>:${IRR_INSTALL_DIR}/source/Irrlicht>
)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Core Qt5::Gui opengl32.lib)
target_link_libraries(${PROJECT_NAME}
$<$<CONFIG:Debug>:${IRR_INSTALL_DIR}/debug/lib/Irrlicht_debug.lib>
$<$<CONFIG:RelWithDebInfo>:${IRR_INSTALL_DIR}/relwithdebinfo/lib/Irrlicht_rwdi.lib>
$<$<CONFIG:Release>:${IRR_INSTALL_DIR}/lib/Irrlicht.lib>
# these are needed because we haven't cleaned up the API properly yet
$<$<CONFIG:Debug>:${IRR_INSTALL_DIR}/debug/source/Irrlicht>
$<$<CONFIG:RelWithDebInfo>:${IRR_INSTALL_DIR}/relwithdebinfo/source/Irrlicht>
$<$<CONFIG:Release>:${IRR_INSTALL_DIR}/source/Irrlicht>
)
function(link_irr_dependency DEPENDENCY_NAME)
target_link_libraries(${PROJECT_NAME}
$<$<CONFIG:Debug>:${IRR_INSTALL_DIR}/debug/lib/${DEPENDENCY_NAME}d.lib>
$<$<CONFIG:RelWithDebInfo>:${IRR_INSTALL_DIR}/relwithdebinfo/lib/${DEPENDENCY_NAME}.lib>
$<$<CONFIG:Release>:${IRR_INSTALL_DIR}/lib/${DEPENDENCY_NAME}.lib>
)
endfunction()
function(link_irr_dependency_ DEPENDENCY_NAME)
target_link_libraries(${PROJECT_NAME}
$<$<CONFIG:Debug>:${IRR_INSTALL_DIR}/debug/lib/${DEPENDENCY_NAME}_d.lib>
$<$<CONFIG:RelWithDebInfo>:${IRR_INSTALL_DIR}/relwithdebinfo/lib/${DEPENDENCY_NAME}.lib>
$<$<CONFIG:Release>:${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.
Expand Down
55 changes: 46 additions & 9 deletions src/irr/CMakeLists.txt
Expand Up @@ -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)
Expand All @@ -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)
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
"$<TARGET_PROPERTY:openssl_build,BINARY_DIR>/build/lib/libeay32.lib"
"$<TARGET_PROPERTY:openssl_build,BINARY_DIR>/build/lib/ssleay32.lib"
DESTINATION lib
)
else()
install(FILES
"$<TARGET_PROPERTY:openssl_build,BINARY_DIR>/build/lib/libcrypto.a"
"$<TARGET_PROPERTY:openssl_build,BINARY_DIR>/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)

0 comments on commit 651a5ff

Please sign in to comment.