From e1d13df4a0cdeeefd15f98db3cf7bab1d1944530 Mon Sep 17 00:00:00 2001 From: Walter Schell Date: Sun, 12 Mar 2023 11:55:17 -0400 Subject: [PATCH] First attempt at testing CMake Pacage. Will be squashed --- .github/workflows/build-linux.yml | 17 ++++++++++++++++- lua-config-package-tests/CMakeLists.txt | 14 ++++++++++++++ .../lua-config-package-build-test.c | 10 ++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 lua-config-package-tests/CMakeLists.txt create mode 100644 lua-config-package-tests/lua-config-package-build-test.c diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index abe5748..d94d9bb 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -43,7 +43,22 @@ jobs: # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE + - name: Install + working-directory: ${{github.workspace}}/build + shell: bash + run: cmake --install . --prefix $GITHUB_WORKSPACE/sysroot + - name: Test working-directory: ${{github.workspace}}/build shell: bash - run: ctest -V \ No newline at end of file + run: ctest -V + + - name: Configure Test of CMake Package + working-directory: ${{github.workspace}} + shell: bash + run: cmake -S $GITHUB_WORKSPACE/lua-config-package-tests -B build-pkg-test -DCMAKE_PREFIX=$GITHUB_WORKSPACE/sysroot + + - name: Build Test of CMake Package + working-directory: ${{github.workspace}} + shell: bash + run: cmake --build build-pkg-test \ No newline at end of file diff --git a/lua-config-package-tests/CMakeLists.txt b/lua-config-package-tests/CMakeLists.txt new file mode 100644 index 0000000..138139e --- /dev/null +++ b/lua-config-package-tests/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(lua-config-package-test C) + +find_package(Lua REQUIRED CONFIG) + +add_executable(lua-config-package-build-test-using-static-target "./lua-config-package-build-test.c") +target_link_libraries(lua-config-package-build-test-using-static-target Lua::lua_static) + +add_executable(lua-config-package-build-test-using-shared-target "./lua-config-package-build-test.c") +target_link_libraries(lua-config-package-build-test-using-shared-target Lua::lua_static) + +add_executable(lua-config-package-build-test-using-variables "./lua-config-package-build-test.c") +target_link_libraries(lua-config-package-build-test-using-variables ${LUA_LIBRARIES}) + diff --git a/lua-config-package-tests/lua-config-package-build-test.c b/lua-config-package-tests/lua-config-package-build-test.c new file mode 100644 index 0000000..c4109a2 --- /dev/null +++ b/lua-config-package-tests/lua-config-package-build-test.c @@ -0,0 +1,10 @@ +#include +#include +#include + +int main() +{ + lua_State *l = luaL_newstate(); + double lversion = lua_version(l); + printf("Lua version is %f\n", lversion); +} \ No newline at end of file