Skip to content

Commit e24154f

Browse files
committed
Merge branch 'automated-builds'
2 parents f6865c4 + 8ba2b39 commit e24154f

File tree

8 files changed

+3013
-23
lines changed

8 files changed

+3013
-23
lines changed

.github/workflows/build.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
Ubuntu:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install dependencies
11+
run: |
12+
sudo apt-get update
13+
sudo apt-get install -y cmake
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Build
17+
run: |
18+
mkdir pe-resource-loader && cd pe-resource-loader
19+
cmake -DCMAKE_BUILD_TYPE=Release ..
20+
cmake --build .
21+
strip --strip-unneeded bin/pe_string_loader bin/pe_bitmap_loader lib/libpe_resource_loader.a lib/libpe_resource_loader.so
22+
cp -r ../LICENSE.txt ../README.md ../include ./
23+
- name: Publish artifacts
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: pe-resource-loader-ubuntu
27+
path: |
28+
pe-resource-loader/bin
29+
pe-resource-loader/lib
30+
pe-resource-loader/include
31+
pe-resource-loader/LICENSE.txt
32+
pe-resource-loader/README.md
33+
34+
MacOS:
35+
runs-on: macos-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
- name: Build
40+
run: |
41+
mkdir pe-resource-loader && cd pe-resource-loader
42+
cmake -DCMAKE_BUILD_TYPE=Release ..
43+
cmake --build .
44+
strip bin/pe_string_loader bin/pe_bitmap_loader lib/libpe_resource_loader.a lib/libpe_resource_loader.dylib
45+
cp -r ../LICENSE.txt ../README.md ../include ./
46+
- name: Publish artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: pe-resource-loader-macos
50+
path: |
51+
pe-resource-loader/bin
52+
pe-resource-loader/lib
53+
pe-resource-loader/include
54+
pe-resource-loader/LICENSE.txt
55+
pe-resource-loader/README.md
56+
57+
Windows:
58+
runs-on: windows-latest
59+
defaults:
60+
run:
61+
shell: msys2 {0}
62+
steps:
63+
- name: Install dependencies
64+
uses: msys2/setup-msys2@v2
65+
with:
66+
msystem: MINGW64
67+
install: >-
68+
mingw-w64-x86_64-gcc
69+
mingw-w64-x86_64-binutils
70+
mingw-w64-x86_64-make
71+
mingw-w64-x86_64-cmake
72+
update: true
73+
- name: Checkout
74+
uses: actions/checkout@v4
75+
- name: Build
76+
run: |
77+
mkdir pe-resource-loader && cd pe-resource-loader
78+
cmake -DCMAKE_BUILD_TYPE=Release ..
79+
cmake --build .
80+
strip --strip-unneeded bin/pe_string_loader.exe bin/pe_bitmap_loader.exe bin/libpe_resource_loader.dll lib/libpe_resource_loader.a
81+
cp -r ../LICENSE.txt ../README.md ../include ./
82+
- name: Publish artifacts
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: pe-resource-loader-windows
86+
path: |
87+
pe-resource-loader/bin
88+
pe-resource-loader/lib
89+
pe-resource-loader/include
90+
pe-resource-loader/LICENSE.txt
91+
pe-resource-loader/README.md
92+
93+
Release:
94+
needs: [Ubuntu, MacOS, Windows]
95+
if: ${{ github.ref_type == 'tag' }}
96+
runs-on: ubuntu-latest
97+
strategy:
98+
matrix:
99+
build: [ubuntu, macos, windows]
100+
steps:
101+
- uses: actions/download-artifact@v3
102+
- name: Zip artifacts
103+
run: |
104+
zip -r pe-resource-loader-${{matrix.build}}.zip pe-resource-loader-${{matrix.build}}
105+
- name: Release
106+
uses: softprops/action-gh-release@v1
107+
with:
108+
files: pe-resource-loader-${{matrix.build}}.zip
109+
prerelease: true
110+
name: pe-resource-loader ${{ github.ref_name }}
111+
tag_name: ${{ github.ref_name }}
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/doxygen.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Doxygen
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
packages: write
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Doxygen documentation generation
21+
uses: mattnotmitt/doxygen-action@v1
22+
- name: Deploy
23+
uses: peaceiris/actions-gh-pages@v3
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: ./dist/html
27+
force_orphan: true

CMakeLists.txt

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,80 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(pe_resource_loader)
3+
project(pe_resource_loader VERSION 1.0.0)
44

55
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic")
66
set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG=1")
77

8-
add_library(pe_resource_loader src/pe_resource_loader.c src/tm_unicode.h)
9-
target_include_directories(pe_resource_loader PRIVATE
10-
include/
11-
)
8+
set(SOURCES src/pe_resource_loader.c;src/tm_unicode.h)
9+
10+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/")
11+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/")
12+
if(WIN32)
13+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/")
14+
else()
15+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/")
16+
endif()
17+
18+
option(BUILD_SHARED_LIBS "Build shared library." ON)
19+
if(BUILD_SHARED_LIBS)
20+
add_library(pe_resource_loader_shared SHARED ${SOURCES})
21+
set_target_properties(pe_resource_loader_shared PROPERTIES OUTPUT_NAME pe_resource_loader)
22+
target_include_directories(pe_resource_loader_shared PRIVATE
23+
include/
24+
)
25+
endif(BUILD_SHARED_LIBS)
26+
27+
option(BUILD_STATIC_LIBS "Build static library." ON)
28+
if(BUILD_STATIC_LIBS)
29+
add_library(pe_resource_loader_static STATIC ${SOURCES})
30+
set_target_properties(pe_resource_loader_static PROPERTIES OUTPUT_NAME pe_resource_loader)
31+
target_include_directories(pe_resource_loader_static PRIVATE
32+
include/
33+
)
34+
endif(BUILD_STATIC_LIBS)
1235

1336
option(PE_STRING_LOADER "If the pe_string_loader program should be build as well" ON)
14-
if(PE_STRING_LOADER)
37+
if(PE_STRING_LOADER AND (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
1538
add_executable(pe_string_loader pe_string_loader/main.c)
1639
target_include_directories(pe_string_loader PRIVATE
1740
include/
1841
)
19-
target_link_libraries(pe_string_loader pe_resource_loader)
20-
endif(PE_STRING_LOADER)
42+
if(BUILD_STATIC_LIBS)
43+
target_link_libraries(pe_string_loader pe_resource_loader_static)
44+
elseif(BUILD_SHARED_LIBS)
45+
target_link_libraries(pe_string_loader pe_resource_loader_shared)
46+
endif()
47+
endif(PE_STRING_LOADER AND (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
2148

2249
option(PE_BITMAP_LOADER "If the pe_bitmap_loader program should be build as well" ON)
23-
if(PE_BITMAP_LOADER)
50+
if(PE_BITMAP_LOADER AND (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
2451
add_executable(pe_bitmap_loader pe_bitmap_loader/main.c pe_bitmap_loader/stb_image_write.h)
2552
target_include_directories(pe_bitmap_loader PRIVATE
2653
include/
2754
)
28-
target_link_libraries(pe_bitmap_loader pe_resource_loader)
29-
endif(PE_BITMAP_LOADER)
55+
if(BUILD_STATIC_LIBS)
56+
target_link_libraries(pe_bitmap_loader pe_resource_loader_static)
57+
elseif(BUILD_SHARED_LIBS)
58+
target_link_libraries(pe_bitmap_loader pe_resource_loader_shared)
59+
endif()
60+
endif(PE_BITMAP_LOADER AND (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
61+
62+
include(GNUInstallDirs)
63+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pe-resource-loader.pc.in"
64+
"${CMAKE_CURRENT_BINARY_DIR}/lib/pkgconfig/pe-resource-loader.pc" @ONLY)
3065

3166
if (NOT WIN32)
32-
install(TARGETS pe_resource_loader DESTINATION lib)
67+
if(BUILD_SHARED_LIBS)
68+
install(TARGETS pe_resource_loader_shared EXPORT pe-resource-loaderTargets DESTINATION lib)
69+
install(EXPORT pe-resource-loaderTargets FILE pe-resource-loaderTargets.cmake DESTINATION lib/cmake/pe-resource-loader)
70+
endif(BUILD_SHARED_LIBS)
71+
if(BUILD_STATIC_LIBS)
72+
install(TARGETS pe_resource_loader_static EXPORT pe-resource-loader-staticTargets DESTINATION lib)
73+
install(EXPORT pe-resource-loader-staticTargets FILE pe-resource-loader-staticTargets.cmake DESTINATION lib/cmake/pe-resource-loader)
74+
endif(BUILD_STATIC_LIBS)
3375
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pe_resource_loader.h DESTINATION include/)
3476
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt DESTINATION share/licenses/pe_resource_loader/)
77+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/pkgconfig/pe-resource-loader.pc DESTINATION lib/pkgconfig/)
3578

3679
if(PE_STRING_LOADER)
3780
install(TARGETS pe_string_loader DESTINATION bin)

0 commit comments

Comments
 (0)