Skip to content
Open
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
57 changes: 57 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: macos

on:
push:
branches: [ 'main' ]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ 'main' ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: macos-latest

steps:
- name: 'Checkout'
uses: actions/checkout@v4

- name: 'Configure'
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAPP_VERSION="${{github.ref_name}}"

- name: 'Build'
run: cmake --build build --config ${{env.BUILD_TYPE}}

- name: 'Artifact'
uses: actions/upload-artifact@v4
with:
name: 'objcurses-macos'
path: |
build/objcurses

release-to-github:
if: github.ref_type == 'tag'
needs:
- build
runs-on: macos-latest

permissions:
contents: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: 'objcurses-macos'
path: build/

- name: Zip
run: zip -j -r objcurses-macos-v${{github.ref_name}}.zip ./build/objcurses

- name: Release
uses: softprops/action-gh-release@v2
with:
files: objcurses-macos-v${{github.ref_name}}.zip
57 changes: 57 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: ubuntu

on:
push:
branches: [ 'main' ]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ 'main' ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 'Checkout'
uses: actions/checkout@v4

- name: 'Configure'
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAPP_VERSION="${{github.ref_name}}"

- name: 'Build'
run: cmake --build build --config ${{env.BUILD_TYPE}}

- name: 'Artifact'
uses: actions/upload-artifact@v4
with:
name: 'objcurses-linux'
path: |
build/objcurses

release-to-github:
if: github.ref_type == 'tag'
needs:
- build
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: 'objcurses-linux'
path: build/

- name: Zip
run: zip -j -r objcurses-linux-v${{github.ref_name}}.zip ./build/objcurses

- name: Release
uses: softprops/action-gh-release@v2
with:
files: objcurses-linux-v${{github.ref_name}}.zip
84 changes: 84 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: windows|mingw64

on:
push:
branches: [ 'main' ]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ 'main' ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}

steps:
- name: 'Checkout'
uses: actions/checkout@v4

- name: 'Setup mingw64'
uses: msys2/setup-msys2@v2
id: msys2
with:
msystem: MINGW64
update: true
install: >-
ncurses
ncurses-devel
pacboy: >-
toolchain:p
cmake:p
ninja:p

- name: 'Configure'
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAPP_VERSION="${{github.ref_name}}"

- name: 'Build'
run: cmake --build build --config ${{env.BUILD_TYPE}}

- name: 'Run'
run: ./build/objcurses.exe --help

- name: 'Package'
run: |
cp /mingw64/bin/libgcc_s_seh-1.dll ./build/
cp /mingw64/bin/libstdc++-6.dll ./build/
cp /mingw64/bin/libwinpthread-1.dll ./build/

- name: 'Artifact'
uses: actions/upload-artifact@v4
with:
name: 'objcurses-windows'
path: |
build/*.exe
build/*.dll

release-to-github:
if: github.ref_type == 'tag'
needs:
- build
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: 'objcurses-windows'
path: build/

- name: Zip
run: zip -j -r objcurses-windows-v${{github.ref_name}}.zip ./build/*.exe ./build/*.dll

- name: Release
uses: softprops/action-gh-release@v2
with:
files: objcurses-windows-v${{github.ref_name}}.zip
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# build directory
/build/
/cmake-build-debug/
/cmake-build-release/
/cmake-build-sanitize/
Expand All @@ -7,4 +8,7 @@
/package/

# ide settings
/.idea
/.idea

# other
*.zip
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,26 @@ if(SANITIZE)
add_compile_definitions(ASAN_OPTIONS="detect_leaks=1:strict_string_checks=1:check_initialization_order=1:detect_stack_use_after_return=1:detect_container_overflow=1:abort_on_error=1")
endif()

if (NOT DEFINED APP_VERSION)
set(APP_VERSION "0.0.0")
endif()

# generate the version.h
configure_file(version.h.in version.h)

# collect all source files recursively, excluding build directory
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/*.cpp")
list(FILTER SOURCES EXCLUDE REGEX ".*/.*build.*/.*")

# creating executable
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
target_compile_definitions(${PROJECT_NAME} PRIVATE "NCURSES_STATIC")

# linking ncurses library
find_package(Curses REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CURSES_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CURSES_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${CURSES_INCLUDE_DIR} ${CURSES_INCLUDE_DIR}/ncurses)

# linking math library
target_link_libraries(${PROJECT_NAME} PRIVATE m)
Expand Down
2 changes: 1 addition & 1 deletion version.h → version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
#pragma once

inline constexpr auto APP_NAME = "objcurses";
inline constexpr auto APP_VERSION = "2.2.1";
#cmakedefine APP_VERSION "@APP_VERSION@"