Skip to content

Commit

Permalink
meson test
Browse files Browse the repository at this point in the history
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
  • Loading branch information
FlyGoat committed Sep 6, 2024
1 parent ffc0bcc commit 6f3e821
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 15 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ jobs:

- uses: ilammy/msvc-dev-cmd@v1

- name: Install Meson
run: |
choco install meson
choco install ninja
#don't use run-cmake for windows because only one build should add warnings to pull request
- name: Build Debug
run: |
mkdir debug
cd debug
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
nmake
meson setup debug --buildtype=debug --backend=vs
meson compile -C debug
- name: Upload ryzenadj debug
uses: actions/upload-artifact@v2
Expand All @@ -32,10 +35,8 @@ jobs:
- name: Build Release
run: |
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
nmake
meson setup build --buildtype=release --backend=vs
meson compile -C build
- name: Prepair Release Folder
run: |
Expand Down Expand Up @@ -104,14 +105,10 @@ jobs:
sudo apt-get update
sudo apt-get install libpci-dev
- name: run-cmake #with support for inline error reporting
uses: lukka/run-cmake@v3.3

- name: Test make like readme
- name: Meson Build
run: |
mkdir build && cd build
cmake DCMAKE_BUILD_TYPE=Release ..
make
meson setup build --buildtype=release
meson compile -C build
# - name: Test Scripts
# shell: bash
Expand Down
48 changes: 48 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Define the project
project('ryzenadj', 'c',
version : '1.0', # You can set the version of your project here
default_options : ['c_visibilty=hidden']
)

add_project_arguments('-D_LIBRYZENADJ_INTERNAL', language : 'c')

# Include directories
inc_dirs = include_directories('.') # Adjust this if your include path is different

# Source directories
lib_srcs = files(
'lib/nb_smu_ops.c',
'lib/api.c',
'lib/cpuid.c'
)

# OS-specific settings
if host_machine.system() == 'windows'
lib_srcs += files('lib/osdep_win32.c')
os_deps = declare_dependency(link_with: find_library('WinRing0x64', dirs: ['win32']))
elif host_machine.system() == 'linux'
lib_srcs += files('lib/osdep_linux.c')
os_deps = dependency('libpci', required : true)
else
error('Unsupported OS')
endif

cli_srcs = files(
'argparse.c',
'main.c',
)
cli_inc_dirs = include_directories('lib')

# Define executable
executable('ryzenadj', [lib_srcs, cli_srcs],
include_directories: cli_inc_dirs,
dependencies: os_deps,
install: true)

# Define library
libryzenadj = library('libryzenadj', lib_srcs,
dependencies: os_deps,
install: true)
install_headers('lib/ryzenadj.h', subdir : 'ryzenadj')
pkg = import('pkgconfig')
pkg.generate(libryzenadj)

0 comments on commit 6f3e821

Please sign in to comment.