Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac build changes #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"_UNICODE"
],
"windowsSdkVersion": "10.0.22000.0",
"cStandard": "c23",
"cppStandard": "c++23",
"cStandard": "c20",
"cppStandard": "c++20",
"configurationProvider": "mesonbuild"
}
],
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "Build",
"group": "build",
"type": "process",
"command": "C:\\msys64\\ucrt64.exe",
"command": "bash",
"args": [
"./build.sh"
],
Expand Down
15 changes: 10 additions & 5 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
python ./src/spider_navigator/navigator.py
python3 ./src/spider_navigator/navigator.py

# If this doesn't work, add C:/msys64/ucrt64/bin to your PATH
meson compile -C build
Expand All @@ -8,13 +8,18 @@ status=$?
[ $status -ne 0 ] && read -p "meson compile: error $status Press enter to continue..."

# TODO: Move into meson.build file?
cp /ucrt64/bin/libfltk.dll /ucrt64/bin/libfltk_images.dll /ucrt64/bin/libpng16-16.dll --target=./build/src/
cp /ucrt64/bin/libfltk.dll /ucrt64/bin/libfltk_images.dll /ucrt64/bin/libpng16-16.dll ./build/src/

cp ./src/database/citizens.db --target=./build/src
cp ./src/database/citizens.db ./build/src

cp -r ./assets/ --target=./build/src
cp -r ./assets/ ./build/src

cd ./build/src/
gdb spider-880.exe

if command -v gdb > /dev/null; then
gdb spider-880
else
lldb spider-880
fi
status=$?
[ $status -ne 0 ] && read -p ".exe: error $status Press enter to exit..."
Empty file added citizens.db
Empty file.
Empty file modified install.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('spider-880', 'cpp',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++23'])
default_options : ['warning_level=3', 'cpp_std=c++20'])
# If this doesn't work, you need to do `meson configure build -Dcpp_std=c++23`.

# Avoids `UINT does not name a type.` on Windows for builds >=C++20.
Expand Down
2 changes: 1 addition & 1 deletion src/database/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

incdir = include_directories(['../'])
databaselib = static_library('database', ['database.cpp', 'database_window.cpp'], include_directories: incdir)
databaselib = static_library('database', ['database.cpp', 'database_window.cpp'], include_directories: [incdir, '/opt/homebrew/include'])
8 changes: 2 additions & 6 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ links = flags.stdout().strip().split(' ')
links += '-lfltk_images'
links += '-lsqlite3'


incdir = include_directories('./spider_navigator/pages')

# TODO: Make this a custom install script? Instead of having to search for it.
# https://mesonbuild.com/Installing.html
fltk = meson.get_compiler('cpp').find_library('fltk', required: true)
fltk = meson.get_compiler('cpp').find_library('fltk', dirs: '/opt/homebrew/lib/', required: true)

# incdir = include_directories('util')

src = ['main.cpp']
windows = import('windows')
if build_machine.system() == 'windows'
src += windows.compile_resources('./icon.rc')
endif

exe = executable('spider-880', src, link_args : links, include_directories:incdir, dependencies: [fltk], link_with: [utillib, pageslib, databaselib], cpp_args: '')
exe = executable('spider-880', src, link_args : links, include_directories:['./spider_navigator/pages', '/opt/homebrew/include'], dependencies: [fltk], link_with: [utillib, pageslib, databaselib], cpp_args: '')

test('basic', exe)
5 changes: 3 additions & 2 deletions src/spider_navigator/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python = find_program('python')
python = find_program('python3')

cpp_files = run_command('cat', 'list.txt')
files = cpp_files.stdout().strip()
Expand All @@ -8,5 +8,6 @@ incdir = include_directories(['../', './pages'])
to_compile = ['page.cpp', 'tags.cpp']
to_compile += files.split('\n')

fltk_dirs = include_directories('/opt/homebrew/lib/')
# Modify python script to just instead write to here?
pageslib = static_library('pages', to_compile, build_by_default: true, include_directories: incdir)
pageslib = static_library('pages', to_compile, build_by_default: true, include_directories: [incdir, '/opt/homebrew/include'])
2 changes: 1 addition & 1 deletion src/spider_navigator/navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def close(self):

self.cpp_stream.write(f"{self.namespace}::{self.namespace}(int x, int y, int w, int h) : HTMLWindow({self.namespace}Namespace::html_1, x, y, w, h) {{\n{linked_page_str}\n}}\n")

header = open(path.join(self.path, f"../{header_name}"), "w")
header = open(path.abspath(path.join(self.path, f"../{header_name}")), "w")
header.write("#pragma once\n")

for include in self.includes:
Expand Down
3 changes: 2 additions & 1 deletion src/util/meson.build
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
utillib = static_library('util', ['color.cpp', 'image_box.cpp', 'window_management.cpp'])

utillib = static_library('util', ['color.cpp', 'image_box.cpp', 'window_management.cpp'], include_directories: '/opt/homebrew/include')