Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozg committed Nov 13, 2024
1 parent b4ddd8c commit 82ce57d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
52 changes: 28 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,33 +262,37 @@ foreach(TARGET_NAME ${ACTIVE_TARGETS})
endif()
endforeach()

add_executable(test src/test.c src/luv.c)
if(WIN32 OR CYGWIN)
if (LUA)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES})
else (LUA)
if(LUAJIT_LIBRARIES OR LUA_LIBRARIES)
add_executable(test src/test.c src/luv.c)
if(WIN32 OR CYGWIN)
if (LUA)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES})
else (LUA)
if (USE_LUAJIT)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES})
else (USE_LUAJIT)
if (LUA_BUILD_TYPE STREQUAL System)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES})
else (LUA_BUILD_TYPE STREQUAL System)
target_link_libraries(test ${LIBUV_LIBRARIES} lualib)
endif (LUA_BUILD_TYPE STREQUAL System)
endif (USE_LUAJIT)
endif (LUA)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
if (USE_LUAJIT)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES} rt)
else ()
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES} rt)
endif ()
else()
if (USE_LUAJIT)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES})
else (USE_LUAJIT)
if (LUA_BUILD_TYPE STREQUAL System)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES})
else (LUA_BUILD_TYPE STREQUAL System)
target_link_libraries(test ${LIBUV_LIBRARIES} lualib)
endif (LUA_BUILD_TYPE STREQUAL System)
endif (USE_LUAJIT)
endif (LUA)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
if (USE_LUAJIT)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES} rt)
else ()
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES} rt)
endif ()
else ()
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES})
endif ()
endif()
else()
if (USE_LUAJIT)
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES})
else ()
target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES})
endif ()
message(STATUS "Lua/LuaJIT libraries not found, test not built.")
endif()

if (NOT LUA)
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ clean:

test: luv
${LUABIN} tests/run.lua
build/test tests/manual-test-external-loop.lua
@if [ -f $(BUILD_DIR)/test ]; then \
echo "$(BUILD_DIR)/test exists."; \
$(BUILD_DIR)/test tests/manual-test-external-loop.lua; \
fi

reset:
git submodule update --init --recursive && \
Expand Down

0 comments on commit 82ce57d

Please sign in to comment.