Skip to content

Commit

Permalink
switch to CMake as build system and Woodpecker CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bingmann committed Dec 22, 2024
1 parent 5cfcaf7 commit 62e5e26
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .woodpecker/build-test-mxe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
when:
- event: pull_request
- event: manual
- event: push
repo: bingmann/sound-of-sorting
branch: master

matrix:
include:
- IMAGE: mxe-24.04-1
BUILD_TYPE: Release
C_COMPILER: gcc
CXX_COMPILER: g++
CXX_FLAGS:
CMAKE_FLAGS:

steps:
- name: build
image: docker.io/bingmann/dev:${IMAGE}
commands:
- /opt/mxe/usr/bin/i686-w64-mingw32.static-cmake --version
- mkdir build && cd build
- /opt/mxe/usr/bin/i686-w64-mingw32.static-cmake ${CMAKE_FLAGS}
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
-DCMAKE_CXX_COMPILER="${CXX_COMPILER}"
-DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
-DCMAKE_C_COMPILER="${C_COMPILER}"
..
- make VERBOSE=1 -j4
38 changes: 38 additions & 0 deletions .woodpecker/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
when:
- event: pull_request
- event: manual
- event: push
repo: bingmann/sound-of-sorting
branch: master

matrix:
include:
- IMAGE: ubuntu-24.04
BUILD_TYPE: Debug
C_COMPILER: gcc
CXX_COMPILER: g++
CXX_FLAGS:
CMAKE_FLAGS:

- IMAGE: ubuntu-24.04
BUILD_TYPE: Release
C_COMPILER: gcc
CXX_COMPILER: g++
CXX_FLAGS:
CMAKE_FLAGS:

steps:
- name: build
image: docker.io/bingmann/dev:${IMAGE}
commands:
- cmake --version
- mkdir build && cd build
- cmake ${CMAKE_FLAGS}
-G Ninja
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
-DCMAKE_CXX_COMPILER="${CXX_COMPILER}"
-DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
-DCMAKE_C_COMPILER="${C_COMPILER}"
..
- ninja
- ninja test
63 changes: 63 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# CMakeLists.txt
#
# Build script for The Sound of Sorting
#
###############################################################################
# Copyright (C) 2024 Timo Bingmann <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################

cmake_minimum_required(VERSION 3.5)

project(sound-of-sorting)

add_definitions(-DPACKAGE_VERSION="0.7.0")

# custom cmake scripts
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# prohibit in-source builds
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif()

# default to Debug building for single-config generators
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Defaulting CMAKE_BUILD_TYPE to Debug")
set(CMAKE_BUILD_TYPE "Debug")
endif()

# enable warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall")

# enable use of "make test"
enable_testing()

### Find wxGTK Libraries ###

find_package(wxWidgets REQUIRED COMPONENTS adv core base)
if(wxWidgets_USE_FILE)
include(${wxWidgets_USE_FILE})
endif()

### Find SDL2 Libraries ###

find_package(SDL2 REQUIRED)

### Done with Libraries ###

# descend into source
add_subdirectory(src)
58 changes: 58 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
###############################################################################
# CMakeLists.txt
#
# Build script for The Sound of Sorting
#
###############################################################################
# Copyright (C) 2024 Timo Bingmann <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################

include_directories(${SDL2_INCLUDE_DIRS})

add_library(sorting-algorithms
SortAlgo.cpp
SortAlgo.h
SortArray.cpp
SortArray.h
SortSound.cpp
algorithms/timsort.cpp
algorithms/wikisort.cpp
)

add_executable(sound-of-sorting
WMain.cpp
WMain.h
WSortView.cpp
WSortView.h
wxClickText.cpp
wxClickText.h
wxg/WAbout_wxg.cpp
wxg/WAbout_wxg.h
wxg/WMain_wxg.cpp
wxg/WMain_wxg.h
)

target_link_libraries(sound-of-sorting
sorting-algorithms ${wxWidgets_LIBRARIES} ${SDL2_LIBRARIES})

add_executable(sorting-test
SortTest.cpp
)

target_link_libraries(sorting-test
sorting-algorithms ${wxWidgets_LIBRARIES})

add_test(sorting-test sorting-test)

0 comments on commit 62e5e26

Please sign in to comment.