-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial build of ClamBCLogicalCompiler (#37)
- Loading branch information
Showing
4 changed files
with
208 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Copyright (C) 2021 Cisco Systems, Inc. and/or its affiliates. All rights reserved. | ||
|
||
# | ||
# The clambclogicalcompiler object library | ||
# | ||
add_library(clambclogicalcompiler_obj OBJECT) | ||
target_sources(clambclogicalcompiler_obj | ||
PRIVATE | ||
ClamBCLogicalCompiler.cpp | ||
) | ||
|
||
target_include_directories(clambclogicalcompiler_obj | ||
PRIVATE | ||
${CMAKE_BINARY_DIR} # For clambc-version.h (generated file) | ||
. # For Common/clambc.h | ||
.. # For clambc.h #TODO: change all passes to use "Common" and then delete this line. | ||
${LLVM_INCLUDE_DIRS} | ||
) | ||
|
||
set_target_properties(clambclogicalcompiler_obj PROPERTIES COMPILE_FLAGS "${WARNCXXFLAGS}") | ||
|
||
# | ||
# For testing | ||
# | ||
#target_compile_definitions(clambclogicalcompiler_obj -DLOG_BEFORE_AFTER=1) | ||
|
||
# | ||
# The clambclogicalcompiler shared library. | ||
# | ||
add_library( clambclogicalcompiler SHARED ) | ||
target_link_libraries( clambclogicalcompiler | ||
PUBLIC | ||
clambclogicalcompiler_obj ) | ||
set_target_properties( clambclogicalcompiler PROPERTIES | ||
VERSION ${LIBCLAMBC_VERSION} | ||
SOVERSION ${LIBCLAMBC_SOVERSION} ) | ||
|
||
target_link_directories(clambclogicalcompiler PRIVATE ${LLVM_LIBRARY_DIRS}) | ||
target_link_libraries(clambclogicalcompiler PUBLIC ${LLVM_LIBS}) | ||
|
||
if(WIN32) | ||
install(TARGETS clambclogicalcompiler DESTINATION .) | ||
|
||
# Also install shared library (DLL) dependencies | ||
install(CODE [[ | ||
file(GET_RUNTIME_DEPENDENCIES | ||
LIBRARIES | ||
$<TARGET_FILE:clambclogicalcompiler> | ||
RESOLVED_DEPENDENCIES_VAR _r_deps | ||
UNRESOLVED_DEPENDENCIES_VAR _u_deps | ||
DIRECTORIES | ||
${LLVM_LIBRARY_DIRS} | ||
) | ||
foreach(_file ${_r_deps}) | ||
string(TOLOWER ${_file} _file_lower) | ||
if(NOT ${_file_lower} MATCHES "c:[\\/]windows[\\/]system32.*") | ||
file(INSTALL | ||
DESTINATION "${CMAKE_INSTALL_PREFIX}" | ||
TYPE SHARED_LIBRARY | ||
FOLLOW_SYMLINK_CHAIN | ||
FILES "${_file}" | ||
) | ||
endif() | ||
endforeach() | ||
#message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}") | ||
]]) | ||
else() | ||
install(TARGETS clambclogicalcompiler DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters