-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add CMake Package integration tests
- Loading branch information
Showing
5 changed files
with
65 additions
and
0 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,5 @@ | ||
# Fizzy: A fast WebAssembly interpreter | ||
# Copyright 2020 The Fizzy Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_subdirectory(cmake_package) |
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,38 @@ | ||
# Fizzy: A fast WebAssembly interpreter | ||
# Copyright 2020 The Fizzy Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set(INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/install) | ||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build) | ||
set(USE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/use) | ||
|
||
file(MAKE_DIRECTORY ${BUILD_DIR} ${USE_BUILD_DIR}) | ||
|
||
set(PREFIX ${PROJECT_NAME}/cmake_packge) | ||
|
||
add_test( | ||
NAME ${PREFIX}/configure | ||
COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} ${PROJECT_SOURCE_DIR} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} | ||
WORKING_DIRECTORY ${BUILD_DIR} | ||
) | ||
|
||
add_test( | ||
NAME ${PREFIX}/install | ||
COMMAND ${CMAKE_COMMAND} --build ${BUILD_DIR} --target install | ||
) | ||
set_tests_properties(${PREFIX}/install PROPERTIES DEPENDS ${PREFIX}/configure) | ||
|
||
|
||
add_test( | ||
NAME ${PREFIX}/use/configure | ||
COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} ${CMAKE_CURRENT_SOURCE_DIR}/use_fizzy -DCMAKE_PREFIX_PATH=${INSTALL_DIR} | ||
WORKING_DIRECTORY ${USE_BUILD_DIR} | ||
) | ||
set_tests_properties(${PREFIX}/use/configure PROPERTIES DEPENDS ${PREFIX}/install) | ||
|
||
add_test( | ||
NAME ${PREFIX}/use/build | ||
COMMAND ${CMAKE_COMMAND} --build ${USE_BUILD_DIR} | ||
) | ||
set_tests_properties(${PREFIX}/use/build PROPERTIES DEPENDS ${PREFIX}/use/configure) | ||
|
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,11 @@ | ||
# Fizzy: A fast WebAssembly interpreter | ||
# Copyright 2020 The Fizzy Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This example shows how to use the fizzy library from the fizzy CMake package. | ||
cmake_minimum_required(VERSION 3.15) | ||
project(use_fizzy LANGUAGES CXX) | ||
find_package(fizzy CONFIG REQUIRED) | ||
|
||
add_executable(use_fizzy use_fizzy.cpp) | ||
target_link_libraries(use_fizzy PRIVATE fizzy::fizzy) |
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,10 @@ | ||
// Fizzy: A fast WebAssembly interpreter | ||
// Copyright 2020 The Fizzy Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <fizzy/fizzy.h> | ||
|
||
int main() | ||
{ | ||
return fizzy_validate(nullptr, 0) ? 0 : 1; | ||
} |