CMakeLists.txt 1.8 KB
Newer Older
1 2 3
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
4

5
project(apphost)	
6
set(DOTNET_PROJECT_NAME "apphost")
7 8 9 10 11 12 13 14 15 16 17

# Add RPATH to the apphost binary that allows using local copies of shared libraries
# dotnet core depends on for special scenarios when system wide installation of such 
# dependencies is not possible for some reason.
# This cannot be enabled for MacOS (Darwin) since its RPATH works in a different way,
# doesn't apply to libraries loaded via dlopen and most importantly, it is not transitive.
if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
    set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
    set(CMAKE_INSTALL_RPATH "\$ORIGIN/netcoredeps")
endif()

18
set(SKIP_VERSIONING 1)
19 20

set(SOURCES
21
    ../fxr/fx_ver.cpp
22 23
    ./bundle/file_entry.cpp
    ./bundle/manifest.cpp
24 25
    ./bundle/header.cpp
    ./bundle/marker.cpp
26 27 28 29
    ./bundle/reader.cpp
    ./bundle/extractor.cpp
    ./bundle/runner.cpp
    ./bundle/dir_utils.cpp
30 31
)

32 33
set(HEADERS
    ../fxr/fx_ver.h
34 35 36
    ./bundle/file_type.h
    ./bundle/file_entry.h
    ./bundle/manifest.h
37 38
    ./bundle/header.h
    ./bundle/marker.h
39 40 41 42
    ./bundle/reader.h
    ./bundle/extractor.h
    ./bundle/runner.h
    ./bundle/dir_utils.h
43 44
)

45 46 47 48 49 50 51 52
if(WIN32)
    list(APPEND SOURCES
        apphost.windows.cpp)

    list(APPEND HEADERS
        apphost.windows.h)
endif()

53
include(../exe.cmake)
54

55 56
add_definitions(-DFEATURE_APPHOST=1)

57 58 59 60 61
# Disable manifest generation into the file .exe on Windows
if(WIN32)
    set_property(TARGET ${PROJECT_NAME} PROPERTY 
            LINK_FLAGS "/MANIFEST:NO" 
        ) 
62 63 64 65
endif()

# Specify non-default Windows libs to be used for Arm/Arm64 builds
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
66
    target_link_libraries(apphost Advapi32.lib shell32.lib)
67
endif()