Commit fb16aa7c authored by nagayama15's avatar nagayama15

Use shared lib instead of static lib to avoid link error in Windows

parent ea02a066
...@@ -5,7 +5,7 @@ ExternalProject_Add( ...@@ -5,7 +5,7 @@ ExternalProject_Add(
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
CMAKE_ARGS CMAKE_ARGS
-DBUILD_STATIC_LIB=ON -DBUILD_STATIC_LIB=OFF
-DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release
) )
...@@ -14,17 +14,14 @@ ExternalProject_Get_Property(binaryen binary_dir) ...@@ -14,17 +14,14 @@ ExternalProject_Get_Property(binaryen binary_dir)
file(MAKE_DIRECTORY ${source_dir}/src) file(MAKE_DIRECTORY ${source_dir}/src)
add_library(libbinaryen STATIC IMPORTED) add_library(libbinaryen SHARED IMPORTED)
add_dependencies(libbinaryen binaryen) add_dependencies(libbinaryen binaryen)
set(binaryen_SHARED_LIB ${binary_dir}/bin/libbinaryen${CMAKE_SHARED_LIBRARY_SUFFIX})
set_target_properties(libbinaryen set_target_properties(libbinaryen
PROPERTIES PROPERTIES
IMPORTED_LOCATION ${binary_dir}/lib/libbinaryen.a IMPORTED_LOCATION ${binaryen_SHARED_LIB}
IMPORTED_IMPLIB ${binary_dir}/lib/libbinaryen${CMAKE_SHARED_LIBRARY_SUFFIX}.a
INTERFACE_INCLUDE_DIRECTORIES ${source_dir}/src INTERFACE_INCLUDE_DIRECTORIES ${source_dir}/src
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libwasm.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libir.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libcfg.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libpasses.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libsupport.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libasmjs.a
) )
...@@ -5,3 +5,9 @@ add_executable(kyut ...@@ -5,3 +5,9 @@ add_executable(kyut
target_link_libraries(kyut target_link_libraries(kyut
libbinaryen libbinaryen
) )
add_custom_command(TARGET kyut POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${binaryen_SHARED_LIB}
${CMAKE_CURRENT_BINARY_DIR}
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment