Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

2021 Linux & Windows CMake & C Cleanup #1

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
de2aeaa
Create cmake.yml
vltmedia Jun 7, 2021
e24e49c
Create msbuild.yml
vltmedia Jun 7, 2021
412c6c2
cmake
vltmedia Jun 7, 2021
0947a56
updated mem.h and cmake
vltmedia Jun 7, 2021
34033b4
attempted to fix strcmp
vltmedia Jun 7, 2021
4e2da79
added linker for math.h
vltmedia Jun 7, 2021
acd4140
tryin gto fix linker
vltmedia Jun 7, 2021
dcec29b
Added Buildcheck
vltmedia Jun 7, 2021
505e92e
Test Normalmap Exec
vltmedia Jun 7, 2021
a47f55f
added release linux
vltmedia Jun 7, 2021
37c3da4
removed normalmap check
vltmedia Jun 7, 2021
a8cc3ff
Changed Release linux to another
vltmedia Jun 7, 2021
8c8c41a
added naming change
vltmedia Jun 7, 2021
b864629
Updated title
vltmedia Jun 7, 2021
76a0136
added new getbranch action
vltmedia Jun 7, 2021
c58aed2
changed get Branch Info
vltmedia Jun 7, 2021
0be0f1f
Updated Tags release
vltmedia Jun 7, 2021
4d46fec
Update cmake.yml
vltmedia Jun 7, 2021
64f89b9
added tag combine
vltmedia Jun 7, 2021
33f37c9
added env.
vltmedia Jun 7, 2021
fa6e4a7
updated set envname
vltmedia Jun 7, 2021
e6d46c3
updated linux build env
vltmedia Jun 7, 2021
1da7dd9
added new tag reader
vltmedia Jun 7, 2021
c671077
removed automatic release tag
vltmedia Jun 7, 2021
69dcc62
added automatic release tag
vltmedia Jun 7, 2021
0b1c836
added new tag name
vltmedia Jun 7, 2021
a3920d5
updated formatting in readme
vltmedia Jun 7, 2021
fa49e83
added GetTagCheck
vltmedia Jun 7, 2021
5cef22d
added How To Update
vltmedia Jun 7, 2021
135a3bc
Revert "added How To Update"
vltmedia Jun 7, 2021
7dd88e6
add How to Update
vltmedia Jun 7, 2021
24f918f
updated hardcoded v0.2.0 tag
vltmedia Jun 7, 2021
108a4cf
Deleted uneeded Github Actions
vltmedia Jun 7, 2021
546fae9
Merge branch 'master' of https://github.com/vltmedia/normalmap
vltmedia Jun 7, 2021
ad60c83
added Windows build
vltmedia Jun 7, 2021
5fe1371
updated naming on the github action
vltmedia Jun 7, 2021
f39483a
Added Windows src folder and fixed the struct for windows usage
vltmedia Jun 7, 2021
8b50091
Fixed Linux Github Action building
vltmedia Jun 7, 2021
59e48b2
updated Windows to build windows 64folder
vltmedia Jun 7, 2021
866f381
updated path slashes
vltmedia Jun 7, 2021
d8042cc
added hardcoded release exe
vltmedia Jun 7, 2021
435154f
added new windows build release
vltmedia Jun 7, 2021
1182f08
added tag to windows release
vltmedia Jun 7, 2021
e7073fb
updated the release with date
vltmedia Jun 7, 2021
6f7d237
updated current date
vltmedia Jun 7, 2021
6d6b895
updated windows artifact uploading
vltmedia Jun 7, 2021
6530338
fixed formatting on cmake linx
vltmedia Jun 7, 2021
178ae0d
updated conditional push
vltmedia Jun 7, 2021
aa4923d
attempting to fix tag naming
vltmedia Jun 7, 2021
f3f89f0
updated envname
vltmedia Jun 7, 2021
cabb3e4
updated env name
vltmedia Jun 7, 2021
ed9128d
added quotes
vltmedia Jun 7, 2021
6571e11
moved branch-name up
vltmedia Jun 7, 2021
f6b3e1b
updated naming for release
vltmedia Jun 7, 2021
d594186
set conditional to push tags only
vltmedia Jun 7, 2021
aebc86a
made conditional on tags
vltmedia Jun 7, 2021
9bd1a2a
Updated naming convention
vltmedia Jun 7, 2021
fa872ba
Updated naming convention
vltmedia Jun 7, 2021
25e2b07
updated naming to add seconds and remove windows
vltmedia Jun 7, 2021
1eccb75
updated time naming convention
vltmedia Jun 7, 2021
67d5815
fixed datetime bug
vltmedia Jun 7, 2021
91646fc
fixed datetime bug
vltmedia Jun 7, 2021
0f4b6b6
Added Changelog and added that to releases
vltmedia Jun 7, 2021
07200dc
Added Changelog and added that to releases
vltmedia Jun 7, 2021
274d588
removed Generate changelog
vltmedia Jun 8, 2021
4267cd7
removed Changelog
vltmedia Jun 8, 2021
92bc2d3
added changelog
vltmedia Jun 8, 2021
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
94 changes: 94 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CMake

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set current version as env variable
id: versionnumb
run: echo "::set-output name=currentversion::v0.2.0"

- name: Get branch names
id: branch-name
uses: tj-actions/[email protected]

- name: Set current os as env variable
id: oschoice
run: echo "::set-output name=choice::linux"

- name: Set current date as env variable
id: datee
run: echo "::set-output name=currentdate::$(date +'%Y-%m-%d_%H%M%S')"

- name: Set env
id: envname
run: echo "::set-output name=outname::${{ steps.branch-name.outputs.current_branch }}-${{ steps.oschoice.outputs.choice }}-${{ steps.datee.outputs.currentdate }}"

- name: Echo current env
run: echo ${{ steps.envname.outputs.outname }}


- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}


- name: CheckBuildFolder
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ls

- uses: little-core-labs/[email protected]
id: tagName
with:
tagRegex: "v*" # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
tagRegexGroup: 1 # Optional. Default is 1.



- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: ${{ steps.envname.outputs.outname }}
tag_name: ${{ steps.envname.outputs.outname }}
body_path: ${{github.workspace}}/CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}


- name: upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/normalmap
asset_name: normalmap
asset_content_type: application/x-executable


89 changes: 89 additions & 0 deletions .github/workflows/cmake_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CMake_Windows

on:
push:
tags:
- "v*"


env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Get branch names
id: branch-name
uses: tj-actions/[email protected]

- name: Set current version as env variable
id: versionnumb
run: echo "::set-output name=currentversion::v0.2.0"

- name: Set current os as env variable
id: oschoice
run: echo "::set-output name=choice::windows64"

- name: Set current date as env variable
id: datee
run: echo "::set-output name=currentdate::$(date +'%Y-%m-%d_%H%M%S')"

- name: Set env
id: envname
run: echo "::set-output name=outname::${{ steps.branch-name.outputs.current_branch }}-${{ steps.oschoice.outputs.choice }}-${{ steps.datee.outputs.currentdate }}"

- name: Echo current env
run: echo ${{ steps.envname.outputs.outname }}


- name: Configure CMake
working-directory: ${{github.workspace}}/win64
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/win64/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
working-directory: ${{github.workspace}}/win64
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/win64/build --config ${{env.BUILD_TYPE}}




- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: ${{ steps.envname.outputs.outname }}
tag_name: ${{ steps.envname.outputs.outname }}
body_path: ${{github.workspace}}/CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Echo current release
run: echo "v0.2.0-win64-$(date +'%Y-%m-%d')"



- name: Upload Windows Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./win64/build/Release/normalmap.exe
asset_name: normalmap.exe
asset_content_type: application/vnd.microsoft.portable-executable



2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

# CMake
cmake-build-*/
build/


# IDE
.idea/
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#531C02",
"titleBar.activeBackground": "#742803",
"titleBar.activeForeground": "#FFFBFA"
},
"window.title": "${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName} ${separator} [Branch: master]"
}
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Released]

## [0.1.0a] - 2017-01-07
- Initial original version

## [0.2.0] - 2021-06-07
### Added
- win64 source folder for building win64 separately.
- Github Actions for automatically building Windows and Linux versions every new tag
- This Changelog

### Fixed

- linux CMake building
- win64 CMake building

5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ include_directories(include)

set(SOURCE_FILES
include/stb_image.h
include/mem.h
src/main.c
src/stb_image.c
src/normalmap.c
include/normalmap.h include/stb_image_write.h src/stb_image_write.c)

add_executable(normalmap ${SOURCE_FILES})
add_executable(normalmap ${SOURCE_FILES})

target_link_libraries(normalmap PRIVATE m)
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# normalmap

Command line utility to convert height maps to DU-DV normal maps.

## Platforms
Expand All @@ -15,6 +16,7 @@ The height will be taken from the red channel of the source image. RGBA PNGs are

The output will be an unfiltered, 8-bit unsigned du/dv map, which can be used as a normal map in rendering applications. The heightmap sampler is a 2x2 box.

## How to Update
The underlying normal map generation code is inherited from The GIMP and is considerably more flexible. In this version, you must update `main.c` and rebuild to change the following settings:

* Scale *default = 2.0*
Expand All @@ -33,3 +35,11 @@ The underlying normal map generation code is inherited from The GIMP and is cons
* true "normalized" normal

Note that the effect of du/dv output being unnormalized is that normal vectors constructed by sampling the map will require normalization in your shader or image loader, which means in turn that the effect of the scale parameter above is less pronounced than it would be otherwise.








Loading