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

# Add RPATH to the apphost binary that allows using local copies of shared libraries
9
# dotnet core depends on for special scenarios when system wide installation of such
10 11 12
# 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.
13
if (NOT CLR_CMAKE_TARGET_OSX)
14 15 16 17
    set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
    set(CMAKE_INSTALL_RPATH "\$ORIGIN/netcoredeps")
endif()

18
set(SKIP_VERSIONING 1)
19 20

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

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

43
if(CLR_CMAKE_TARGET_WIN32)
44 45 46 47 48 49 50
    list(APPEND SOURCES
        apphost.windows.cpp)

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

51
include(../exe.cmake)
52

53 54
add_definitions(-DFEATURE_APPHOST=1)

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

# Specify non-default Windows libs to be used for Arm/Arm64 builds
63
if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64))
64
    target_link_libraries(apphost Advapi32.lib shell32.lib)
65
endif()