Skip to content

Commit

Permalink
Fix symbol exports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Goodman committed Dec 20, 2023
1 parent 9c78db9 commit fdf172a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 151 deletions.
3 changes: 1 addition & 2 deletions bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ target_link_libraries("mx-python"
"gap::gap-core"
"gap::gap-settings"
"std::coroutines"
PRIVATE
"$<LINK_LIBRARY:WHOLE_ARCHIVE,mx-api>"
"$<BUILD_INTERFACE:mx-api>"
)

# Slightly horrible way of "installing" multiplier as a Python extension, that
Expand Down
4 changes: 2 additions & 2 deletions include/multiplier/IR/Operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Value;
// An operation is like an 'instruction', but can contain arbitrary
// complexity in the form or one or more regions, each of which can
// embed their own control-flow graphs of blocks containing operations.
class Operation {
class MX_EXPORT Operation {
private:
friend class Attribute;
friend class Block;
Expand Down Expand Up @@ -196,7 +196,7 @@ inline Operation Operation::producing(const Result &res) {
}

// A use of a value by a specific operation.
class Operand {
class MX_EXPORT Operand {
private:
friend class Block;
friend class Label;
Expand Down
61 changes: 22 additions & 39 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ file(GLOB frontend_sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/Frontend
file(GLOB ast_headers CONFIGURE_DEPENDS "${MX_BOOTSTRAP_INCLUDE_DIR}/AST/*.h")
file(GLOB ast_sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/AST/*.cpp")

set(ir_source_include_dir "${PROJECT_SOURCE_DIR}/include/${lower_project_name}/IR")

file(GLOB_RECURSE ir_sources CONFIGURE_DEPENDS RELATIVE_PATH "${CMAKE_CURRENT_LIST_DIR}" "*.cpp")
file(GLOB_RECURSE ir_headers CONFIGURE_DEPENDS RELATIVE_PATH "${ir_source_include_dir}" "*.h")

# Configure the version to include the git hash.
#
# TODO(pag): This only tracks the hash that was present at CMake configure time.
Expand Down Expand Up @@ -49,38 +54,6 @@ target_link_libraries("mx-serialize"
"CapnProto::capnp"
)

add_subdirectory("IR")

add_library("mx-frontend" INTERFACE)
set_target_properties("mx-frontend"
PROPERTIES
LINKER_LANGUAGE
CXX
PUBLIC_HEADER
"${frontend_headers}"
VISIBILITY_INLINES_HIDDEN
YES
CXX_VISIBILITY_PRESET
hidden
POSITION_INDEPENDENT_CODE
YES
)

add_library("mx-ast" INTERFACE)
set_target_properties("mx-ast"
PROPERTIES
LINKER_LANGUAGE
CXX
PUBLIC_HEADER
"${ast_headers}"
VISIBILITY_INLINES_HIDDEN
YES
CXX_VISIBILITY_PRESET
hidden
POSITION_INDEPENDENT_CODE
YES
)

# Generate the commands to copy the headers into the binary include directory.
set(copied_headers "")
set(copy_headers_commands "")
Expand Down Expand Up @@ -135,11 +108,12 @@ set(api_headers
"${source_include_dir}/Types.h"
)

add_library("mx-api" STATIC
add_library("mx-api" OBJECT
${api_headers}

${frontend_sources} # Auto-generated
${ast_sources} # Auto-generated
${ir_sources} # Auto-generated

$<BUILD_INTERFACE:${source_include_dir}/Database.h>
$<BUILD_INTERFACE:${MX_BOOTSTRAP_INCLUDE_VISITOR_INC_H}>
Expand Down Expand Up @@ -204,7 +178,6 @@ add_library("mx-api" STATIC
# Auto-generated.
${copied_headers}


"${PROJECT_BINARY_DIR}/lib/Version.cpp"
)

Expand All @@ -214,9 +187,6 @@ add_dependencies("mx-api"

target_link_libraries("mx-api"
PUBLIC
"mx-frontend"
"mx-ast"
"mx-mlir"
"gap::gap"
"gap::gap-core"
"gap::gap-settings"
Expand All @@ -226,6 +196,13 @@ target_link_libraries("mx-api"
"mx-sqlite"
"zstd::zstd"
"concurrentqueue"
${MLIR_LIBS}
${VAST_LIBS}
)

target_link_directories("mx-api"
PRIVATE
"$<BUILD_INTERFACE:${MLIR_LIB_DIR}>"
)

target_compile_definitions("mx-api"
Expand Down Expand Up @@ -261,6 +238,7 @@ target_include_directories("mx-api"
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${MX_INSTALL_INCLUDE_DIR}>
PRIVATE
"$<BUILD_INTERFACE:${LLVM_INCLUDE_DIRS};${LLVM_INCLUDE_DIR};${MLIR_INCLUDE_DIRS}>"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
)
Expand Down Expand Up @@ -300,8 +278,7 @@ target_link_libraries("multiplier"
"gap::gap-core"
"gap::gap-settings"
"std::coroutines"
PRIVATE
"$<LINK_LIBRARY:WHOLE_ARCHIVE,mx-api>"
"$<BUILD_INTERFACE:mx-api>"
)

set_target_properties("multiplier"
Expand Down Expand Up @@ -351,6 +328,12 @@ if(MX_ENABLE_INSTALL AND NOT MX_ENABLE_BOOTSTRAP)
DESTINATION
"${MX_INSTALL_INCLUDE_DIR}/${lower_project_name}"
)
install(
DIRECTORY
"${ir_source_include_dir}"
DESTINATION
"${MX_INSTALL_INCLUDE_DIR}/multiplier"
)
install(
TARGETS
"multiplier"
Expand Down
108 changes: 0 additions & 108 deletions lib/IR/CMakeLists.txt

This file was deleted.

0 comments on commit fdf172a

Please sign in to comment.