Skip to content

Commit 03c036b

Browse files
Applying Konst's suggestion
1 parent 8081fec commit 03c036b

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

sycl/plugins/esimd_emulator/CMakeLists.txt

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include_directories(${OpenCL_INCLUDE_DIR})
1414
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build)
1515
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)
1616

17-
if (MSVC)
17+
if (WIN32)
1818
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_emulator_deps/lib/libcm${CMAKE_STATIC_LIBRARY_SUFFIX})
1919
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emulator_deps/lib/igfxcmrt64_emu${CMAKE_STATIC_LIBRARY_SUFFIX})
2020
else()
@@ -25,13 +25,19 @@ endif()
2525
set (DEFAULT_CM_EMU_PREBUILT_PACKAGE "https://github.com/intel/cm-cpu-emulation/releases/download/v2022-02-11/intel-cmemu-1.0.20.u20.04-release.x86_64.tar.xz")
2626
set (DEFAULT_CM_EMU_SOURCE_URL "https://github.com/intel/cm-cpu-emulation.git")
2727

28-
if (DEFINED USE_DEFAULT_CM_EMU_SOURCE)
29-
if ((DEFINED USE_LOCAL_CM_EMU_SOURCE) OR (DEFINED USE_CM_EMU_PREBUILT_PACKAGE))
30-
message(FATAL_ERROR "Configuration failure : Building CM_EMU library with local source or using pre-built one with online-building of CM_EMU")
28+
if ((DEFINED USE_DEFAULT_CM_EMU_SOURCE) OR (DEFINED USE_LOCAL_CM_EMU_SOURCE))
29+
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE)
30+
message(FATAL_ERROR "Configuration failure : Pre-built package and On-line building of CM_EMU library package cannot be applied together")
3131
endif()
32-
if (MSVC)
33-
message(FATAL_ERROR "Online-building of CM_EMU library is not supported under Windows environment")
34-
else()
32+
if ((DEFINED USE_DEFAULT_CM_EMU_SOURCE) AND (DEFINED USE_LOCAL_CM_EMU_SOURCE))
33+
message(FATAL_ERROR "Configuration failure : Either default CM_EMU source or local source can be used for on-line CM building - not together")
34+
endif()
35+
if (WIN32)
36+
message(FATAL_ERROR "Configuration failure : Online-building of CM_EMU library is not supported under Windows environment")
37+
endif()
38+
39+
if (DEFINED USE_DEFAULT_CM_EMU_SOURCE)
40+
message(STATUS "CM_EMU library package will be built online with source codes downloaded from ${DEFAULT_CM_EMU_SOURCE_URL}")
3541
ExternalProject_Add(cm-emu
3642
GIT_REPOSITORY ${DEFAULT_CM_EMU_SOURCE_URL}
3743
GIT_TAG f9d167edbcb995e713d5a8
@@ -42,14 +48,8 @@ if (DEFINED USE_DEFAULT_CM_EMU_SOURCE)
4248
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
4349
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU}
4450
)
45-
endif()
46-
elseif (DEFINED USE_LOCAL_CM_EMU_SOURCE)
47-
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE)
48-
message(FATAL_ERROR "Configuration failure : Using pre-built CM_EMU package with online-building of it")
49-
endif()
50-
if (MSVC)
51-
message(FATAL_ERROR "Building of CM_EMU library is not supported under Windows environment")
52-
else()
51+
elseif (DEFINED USE_LOCAL_CM_EMU_SOURCE)
52+
message(STATUS "CM_EMU library package will be built online with source codes from ${USE_LOCAL_CM_EMU_SOURCE}")
5353
ExternalProject_Add(cm-emu
5454
DOWNLOAD_COMMAND ""
5555
SOURCE_DIR ${USE_LOCAL_CM_EMU_SOURCE}
@@ -65,6 +65,8 @@ else()
6565
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${DEFAULT_CM_EMU_PREBUILT_PACKAGE})
6666
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE)
6767
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${USE_CM_EMU_PREBUILT_PACKAGE})
68+
else()
69+
message(STATUS "Neither of USE_DEFAULT_CM_EMU_SOURCE, USE_LOCAL_CM_EMU_SOURCE, USE_CM_EMU_PREBUILT_PACKAGE is set, using prebuilt libCM from ${DEFAULT_CM_EMU_PREBUILT_PACKAGE}")
6870
endif()
6971
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)
7072
ExternalProject_Add(cm-emu
@@ -94,7 +96,7 @@ set(CMAKE_CXX_STANDARD 17)
9496

9597
# Compilation option modification to prevent build termination caused by
9698
# warnings from CM-imported files
97-
if (MSVC)
99+
if (WIN32)
98100
string(REPLACE "/W4" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
99101
else()
100102
string(REPLACE "-pedantic" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -124,7 +126,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/include/libcm/cm
124126
)
125127

126128
# Copy '.so' files to '$(INSTALL)/lib'
127-
if (MSVC)
129+
if (WIN32)
128130
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/lib/
129131
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
130132
COMPONENT libcmrt-libs

0 commit comments

Comments
 (0)