Skip to content

Change testing framework to CMake #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ jobs:

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc make libglfw3-dev libglfw3 xorg build-essential cmake xorg-dev libx11-dev xvfb

- name: Install GLFW
uses: RpxdYTX/install-glfw-deps@v2
sudo apt-get update -qq
sudo apt-get install -y -qq xorg-dev xvfb

- name: Setup x11
- name: Setup virtual screen
run: Xvfb $DISPLAY -screen 0 1280x1024x24 &

- name: Build MLX42 & tests
run: cmake -DBUILD_TESTS=YES -B ${{github.workspace}}/build && cmake --build ${{github.workspace}}/build

- name: Run tests
run: make -C tests run
run: ctest --output-on-failure --test-dir ${{github.workspace}}/build

# Unix
#=============================================================================#
Expand All @@ -64,7 +64,7 @@ jobs:
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update -qq
sudo apt-get install -y -qq gcc make xorg build-essential cmake xorg-dev libx11-dev libglfw3-dev libglfw3
sudo apt-get install -y -qq xorg-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew update
brew install glfw
Expand Down
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,25 @@ elseif(NOT glfw3_FOUND AND NOT GLFW_FETCH)
message(FATAL_ERROR "Unable to build: GLFW can't be found nor fetched.")
endif()

# only link to glfw if it was found
if (glfw3_FOUND)
target_link_libraries(mlx42 ${GLFW3_LIBRARY})
endif()

target_link_libraries(mlx42 OpenGL::GL)

# add correct frameworks for macOS
if(APPLE)
target_link_libraries(mlx42 "-framework Cocoa" "-framework IOKit")
endif()

target_link_libraries(mlx42 OpenGL::GL glfw)

# Testing
# -----------------------------------------------------------------------------
# only build tests if we are the main project or explicitly told to
# this make sure tests are not built when mlx42 included as a subproject, use MLX42_BUILD_TESTS to overwrite this
# use cmake -DBUILD_TESTS=YES/-DMLX42_BUILD_TESTS=YES to build tests
if ((PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME AND BUILD_TESTS) OR MLX42_BUILD_TESTS)
add_subdirectory(tests)
enable_testing()
endif()
202 changes: 0 additions & 202 deletions include/ctest/LICENSE

This file was deleted.

124 changes: 0 additions & 124 deletions include/ctest/README.md

This file was deleted.

Loading