mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 12:06:49 +08:00
[Irrlicht] Add new port (#5431)
This commit is contained in:
parent
7befb86005
commit
ecff2997f6
208
ports/irrlicht/CMakeLists.txt
Normal file
208
ports/irrlicht/CMakeLists.txt
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
#
|
||||||
|
# Irrlicht 3D engine
|
||||||
|
#
|
||||||
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
project(Irrlicht)
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
# Irrlicht directories
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
set(IRR_ROOT_DIR "")
|
||||||
|
set(IRR_SRC_DIR "source/Irrlicht")
|
||||||
|
set(IRR_INC_DIR "include")
|
||||||
|
|
||||||
|
# Options
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
set(DXSDK "")
|
||||||
|
if(DEFINED ENV{DXSDK_DIR})
|
||||||
|
set(DXSDK "ENV{DXSDK_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(IRR_FAST_MATH 0 CACHE BOOL "Whether to enable fast maths (at the expense of precision)")
|
||||||
|
set(IRR_SHARED_LIB 1 CACHE BOOL "Whether to generate shared libraries instead of static libraries")
|
||||||
|
set(IRR_DIRECTX_SDK ${DXSDK} CACHE PATH "Path to the DirectX SDK (for DirectX 9, this folder should contain /Include, /Lib)")
|
||||||
|
set(IRR_BUILD_TOOLS 0 CACHE BOOL "Whether to generate the tools")
|
||||||
|
|
||||||
|
# Some helper functions
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
function(glob_c_cpp_sources result folder)
|
||||||
|
file(GLOB res
|
||||||
|
"${folder}/*.c"
|
||||||
|
"${folder}/*.cpp"
|
||||||
|
"${folder}/*.h"
|
||||||
|
"${folder}/*.hpp"
|
||||||
|
"${folder}/*.rc")
|
||||||
|
set(${result} ${res} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Source files
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
glob_c_cpp_sources(IRR_SRC_FILES ${IRR_SRC_DIR})
|
||||||
|
glob_c_cpp_sources(IRR_SRC_FILES_INTERFACE ${IRR_INC_DIR})
|
||||||
|
glob_c_cpp_sources(IRR_SRC_FILES_AESGLADMAN ${IRR_SRC_DIR}/aesGladman)
|
||||||
|
glob_c_cpp_sources(IRR_SRC_FILES_LZMA ${IRR_SRC_DIR}/lzma)
|
||||||
|
|
||||||
|
glob_c_cpp_sources(IRR_TOOL_FILES_FILE_TO_HEADER ${IRR_ROOT_DIR}/tools/FileToHeader/)
|
||||||
|
glob_c_cpp_sources(IRR_TOOL_FILES_GUI_EDITOR ${IRR_ROOT_DIR}/tools/GUIEditor/)
|
||||||
|
glob_c_cpp_sources(IRR_TOOL_FILES_FONT_TOOL ${IRR_ROOT_DIR}/tools/IrrFontTool/newFontTool/)
|
||||||
|
glob_c_cpp_sources(IRR_TOOL_FILES_MESH_CONVERTER ${IRR_ROOT_DIR}/tools/MeshConverter/)
|
||||||
|
|
||||||
|
# Group files
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
source_group(Irrlicht\\engine FILES ${IRR_SRC_FILES})
|
||||||
|
source_group(Irrlicht\\interface FILES ${IRR_SRC_FILES_INTERFACE})
|
||||||
|
source_group(Irrlicht\\libs\\aesGladman FILES ${IRR_SRC_FILES_AESGLADMAN})
|
||||||
|
source_group(Irrlicht\\libs\\lzma FILES ${IRR_SRC_FILES_LZMA})
|
||||||
|
|
||||||
|
# Library files
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
find_package(JPEG REQUIRED)
|
||||||
|
find_package(BZip2 REQUIRED)
|
||||||
|
#find_package(LIBLZMA REQUIRED) # LIBLZMA does not export _LzmaDecode
|
||||||
|
|
||||||
|
# Irrlicht target
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
set(IRR_ALL_SRC_FILES
|
||||||
|
${IRR_SRC_FILES}
|
||||||
|
${IRR_SRC_FILES_INTERFACE}
|
||||||
|
${IRR_SRC_FILES_AESGLADMAN}
|
||||||
|
${IRR_SRC_FILES_LZMA}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${IRR_SHARED_LIB})
|
||||||
|
add_library(Irrlicht SHARED ${IRR_ALL_SRC_FILES})
|
||||||
|
else()
|
||||||
|
add_library(Irrlicht STATIC ${IRR_ALL_SRC_FILES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(Irrlicht PRIVATE
|
||||||
|
${ZLIB_LIBRARY}
|
||||||
|
${PNG_LIBRARY}
|
||||||
|
${JPEG_LIBRARY}
|
||||||
|
${BZIP2_LIBRARY}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(IRR_BUILD_TOOLS)
|
||||||
|
add_executable(FileToHeader ${IRR_TOOL_FILES_FILE_TO_HEADER})
|
||||||
|
|
||||||
|
add_executable(GUIEditor ${IRR_TOOL_FILES_GUI_EDITOR})
|
||||||
|
target_link_libraries(GUIEditor Irrlicht)
|
||||||
|
|
||||||
|
add_executable(FontTool ${IRR_TOOL_FILES_FONT_TOOL})
|
||||||
|
target_link_libraries(FontTool Irrlicht)
|
||||||
|
|
||||||
|
add_executable(MeshConverter ${IRR_TOOL_FILES_MESH_CONVERTER})
|
||||||
|
target_link_libraries(MeshConverter Irrlicht)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Target properties (for compilation & export)
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
target_include_directories(Irrlicht
|
||||||
|
PRIVATE ${IRR_SRC_DIR}
|
||||||
|
PRIVATE ${IRR_SRC_DIR}/aesGladman
|
||||||
|
PRIVATE ${BZIP2_INCLUDE_DIR}
|
||||||
|
PRIVATE ${JPEG_INCLUDE_DIR}
|
||||||
|
PRIVATE ${LIBPNG_INCLUDE_DIR}
|
||||||
|
PRIVATE ${IRR_SRC_DIR}/lzma
|
||||||
|
PRIVATE ${ZLIB_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# I dont realy understand why this is necesary or what it is doing,
|
||||||
|
# but it is necesarry to build and export a package.
|
||||||
|
# See: https://cmake.org/cmake/help/v3.8/command/target_include_directories.html
|
||||||
|
target_include_directories(Irrlicht PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
$<INSTALL_INTERFACE:include/irrlicht> # <prefix>/include/irrlicht
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT ${IRR_DIRECTX_SDK} STREQUAL "")
|
||||||
|
target_include_directories(Irrlicht PRIVATE ${IRR_DIRECTX_SDK}/Include)
|
||||||
|
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
|
||||||
|
set(DX_LIBS ${IRR_DIRECTX_SDK}/Lib/x86)
|
||||||
|
else()
|
||||||
|
set(DX_LIBS ${IRR_DIRECTX_SDK}/Lib/x64)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(Irrlicht
|
||||||
|
PRIVATE ${DX_LIBS}/d3dx9.lib
|
||||||
|
PRIVATE ${DX_LIBS}/dinput8.lib
|
||||||
|
PRIVATE ${DX_LIBS}/dxguid.lib)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(Irrlicht PRIVATE NO_IRR_COMPILE_WITH_DIRECT3D_9_)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT ${IRR_SHARED_LIB})
|
||||||
|
target_compile_definitions(Irrlicht PUBLIC _IRR_STATIC_LIB_)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Per platform config
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Export symbols
|
||||||
|
target_compile_definitions(Irrlicht PRIVATE IRRLICHT_EXPORTS)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# Import the symbols of bzip2
|
||||||
|
target_compile_definitions(Irrlicht PRIVATE BZ_IMPORT)
|
||||||
|
|
||||||
|
# Disable the ton of warnings from standard library
|
||||||
|
target_compile_definitions(Irrlicht PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||||
|
|
||||||
|
# Multi processor compilation
|
||||||
|
target_compile_options(Irrlicht PRIVATE /MP)
|
||||||
|
|
||||||
|
# Fast math options
|
||||||
|
if(${IRR_FAST_MATH})
|
||||||
|
target_compile_options(Irrlicht PRIVATE /fp:fast)
|
||||||
|
message("Fast Math Enabled")
|
||||||
|
# SSE2 is automatically activated on x64
|
||||||
|
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
|
||||||
|
target_compile_options(Irrlicht PRIVATE /arch:SSE2)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif(UNIX)
|
||||||
|
# Standard mode
|
||||||
|
target_compile_options(Irrlicht
|
||||||
|
PRIVATE -Wall
|
||||||
|
PRIVATE -pipe
|
||||||
|
PRIVATE -fno-exceptions
|
||||||
|
PRIVATE -fno-strict-aliasing)
|
||||||
|
|
||||||
|
# Disable RTTI on C++ files only (no sense for C files)
|
||||||
|
set_source_files_properties(${IRR_SRC_FILES} ${IRR_SRC_FILES_AESGLADMAN}
|
||||||
|
PROPERTIES COMPILE_FLAGS -fno-rtti)
|
||||||
|
|
||||||
|
# Debug macro
|
||||||
|
target_compile_options(Irrlicht PRIVATE $<$<CONFIG:Debug>:-D_DEBUG>)
|
||||||
|
|
||||||
|
# X11 and OpenGL
|
||||||
|
target_link_libraries(Irrlicht
|
||||||
|
PRIVATE X11
|
||||||
|
PRIVATE GL
|
||||||
|
PRIVATE Xxf86vm)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
install(
|
||||||
|
TARGETS Irrlicht
|
||||||
|
EXPORT Irrlicht
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES ${IRR_SRC_FILES_INTERFACE} DESTINATION "include/irrlicht" CONFIGURATIONS Release)
|
||||||
|
|
||||||
|
if(IRR_BUILD_TOOLS)
|
||||||
|
install(
|
||||||
|
TARGETS FileToHeader GUIEditor FontTool MeshConverter
|
||||||
|
RUNTIME DESTINATION tools/irrlicht/
|
||||||
|
CONFIGURATIONS Release
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(EXPORT Irrlicht FILE irrlicht-targets.cmake DESTINATION share/irrlicht)
|
10
ports/irrlicht/CONTROL
Normal file
10
ports/irrlicht/CONTROL
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Source: irrlicht
|
||||||
|
Version: 1.8.4
|
||||||
|
Description: Irrlicht lightning fast 3d engine
|
||||||
|
Build-Depends: zlib, libpng, bzip2, libjpeg-turbo
|
||||||
|
|
||||||
|
Feature: fast-fpu
|
||||||
|
Description: Enable fast maths (at the expense of precision)
|
||||||
|
|
||||||
|
Feature: tools
|
||||||
|
Description: Build the Tools FileToHeader, FontTool, GUIEditor and MeshConverter
|
94
ports/irrlicht/portfile.cmake
Normal file
94
ports/irrlicht/portfile.cmake
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# Common Ambient Variables:
|
||||||
|
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
|
||||||
|
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
|
||||||
|
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
|
||||||
|
# PORT = current port name (zlib, etc)
|
||||||
|
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
|
||||||
|
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
|
||||||
|
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
|
||||||
|
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
|
||||||
|
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
|
||||||
|
#
|
||||||
|
|
||||||
|
include(vcpkg_common_functions)
|
||||||
|
|
||||||
|
vcpkg_download_distfile(ARCHIVE
|
||||||
|
URLS "https://downloads.sourceforge.net/project/irrlicht/Irrlicht%20SDK/1.8/1.8.4/irrlicht-1.8.4.zip"
|
||||||
|
FILENAME "irrlicht-1.8.4.zip"
|
||||||
|
SHA512 de69ddd2c6bc80a1b27b9a620e3697b1baa552f24c7d624076d471f3aecd9b15f71dce3b640811e6ece20f49b57688d428e3503936a7926b3e3b0cc696af98d1
|
||||||
|
)
|
||||||
|
|
||||||
|
vcpkg_extract_source_archive_ex(
|
||||||
|
OUT_SOURCE_PATH SOURCE_PATH
|
||||||
|
ARCHIVE ${ARCHIVE}
|
||||||
|
REF "1.8.4"
|
||||||
|
# [NO_REMOVE_ONE_LEVEL]
|
||||||
|
# [WORKING_DIRECTORY <${CURRENT_BUILDTREES_DIR}/src>]
|
||||||
|
# [PATCHES <a.patch>...]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Copy CMakeLists.txt to the source, because Irrlicht does not have one.
|
||||||
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||||
|
|
||||||
|
set(FAST_MATH FALSE)
|
||||||
|
if("fast-fpu" IN_LIST FEATURES)
|
||||||
|
set(FAST_MATH TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(BUILD_TOOLS FALSE)
|
||||||
|
if("tools" IN_LIST FEATURES)
|
||||||
|
set(BUILD_TOOLS TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(SHARED_LIB TRUE)
|
||||||
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||||
|
set(SHARED_LIB FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
vcpkg_configure_cmake(
|
||||||
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
|
PREFER_NINJA # Disable this option if project cannot be built with Ninja
|
||||||
|
OPTIONS
|
||||||
|
-DIRR_SHARED_LIB=${SHARED_LIB}
|
||||||
|
-DIRR_FAST_MATH=${FAST_MATH}
|
||||||
|
-DIRR_BUILD_TOOLS=${BUILD_TOOLS}
|
||||||
|
# OPTIONS_RELEASE -DOPTIMIZE=1
|
||||||
|
# OPTIONS_DEBUG -DDEBUGGABLE=1
|
||||||
|
)
|
||||||
|
|
||||||
|
vcpkg_install_cmake()
|
||||||
|
|
||||||
|
vcpkg_fixup_cmake_targets()
|
||||||
|
|
||||||
|
if(BUILD_TOOLS)
|
||||||
|
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/irrlicht/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/irrlicht/irrlicht-config.cmake "include(\${CMAKE_CURRENT_LIST_DIR}/irrlicht-targets.cmake)")
|
||||||
|
# Handle copyright
|
||||||
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/irrlicht/copyright "
|
||||||
|
The Irrlicht Engine License
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Copyright (C) 2002-2015 Nikolaus Gebhardt
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgement in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be clearly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.")
|
||||||
|
|
||||||
|
vcpkg_copy_pdbs()
|
||||||
|
|
||||||
|
# Post-build test for cmake libraries
|
||||||
|
vcpkg_test_cmake(PACKAGE_NAME irrlicht)
|
Loading…
Reference in New Issue
Block a user