-
Notifications
You must be signed in to change notification settings - Fork 2
/
xed.cmake
76 lines (66 loc) · 1.9 KB
/
xed.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
find_package(Python3 COMPONENTS Interpreter REQUIRED)
message(STATUS "Python3: ${Python3_EXECUTABLE}")
# Reference: /Users/admin/Projects/cxx-common/ports/xed/portfile.cmake
# TODO: pass compiler flags
set(MFILE_ARGS
"install"
"--install-dir=install"
"--cc=${CMAKE_C_COMPILER}"
"--cxx=${CMAKE_CXX_COMPILER}"
)
if(CMAKE_OSX_SYSROOT)
list(APPEND MFILE_ARGS "--extra-ccflags=-isysroot ${CMAKE_OSX_SYSROOT}")
list(APPEND MFILE_ARGS "--extra-cxxflags=-isysroot ${CMAKE_OSX_SYSROOT}")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
list(APPEND MFILE_ARGS "--extra-ccflags=${ADDITIONAL_FLAGS}")
list(APPEND MFILE_ARGS "--extra-cxxflags=${ADDITIONAL_FLAGS}")
endif()
if(BUILD_SHARED_LIBS)
list(APPEND MFILE_ARGS "--shared")
else()
list(APPEND MFILE_ARGS "--static")
endif()
if(CMAKE_AR)
list(APPEND MFILE_ARGS "--ar=${CMAKE_AR}")
endif()
ExternalProject_Add(mbuild
GIT_REPOSITORY
"https://github.com/intelxed/mbuild"
GIT_TAG
"v2022.07.28"
GIT_PROGRESS
ON
GIT_SHALLOW
ON
CONFIGURE_COMMAND
"${CMAKE_COMMAND}" -E true
BUILD_COMMAND
"${CMAKE_COMMAND}" -E true
INSTALL_COMMAND
"${CMAKE_COMMAND}" -E true
PREFIX
xed-prefix
)
ExternalProject_Add(xed
GIT_REPOSITORY
"https://github.com/intelxed/xed"
GIT_TAG
"v2022.10.11"
GIT_PROGRESS
ON
GIT_SHALLOW
ON
CMAKE_CACHE_ARGS
${CMAKE_ARGS}
CONFIGURE_COMMAND
"${CMAKE_COMMAND}" -E true
BUILD_COMMAND
"${Python3_EXECUTABLE}" "<SOURCE_DIR>/mfile.py" ${MFILE_ARGS}
INSTALL_COMMAND
"${CMAKE_COMMAND}" -E copy_directory <BINARY_DIR>/install "${CMAKE_INSTALL_PREFIX}"
PREFIX
xed-prefix
)
# TODO: generate XEDVersion.cmake as well file
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/XEDConfig.cmake.in" "${CMAKE_INSTALL_PREFIX}/lib/cmake/XED/XEDConfig.cmake" @ONLY)