Compare commits
258 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
d5ac2a853b | |
![]() |
e82ae7bb13 | |
![]() |
20b82d8ab7 | |
![]() |
8d26b4f49f | |
![]() |
3fdc30f7d7 | |
![]() |
57211ddc77 | |
![]() |
2de7efd9eb | |
![]() |
5b4559f4ee | |
![]() |
6178526cd9 | |
![]() |
c8a1d8eb2e | |
![]() |
6e3883937b | |
![]() |
8dd647914a | |
![]() |
0dae126a29 | |
![]() |
5038cd7ba5 | |
![]() |
ddd8fca044 | |
![]() |
25c85a83d9 | |
![]() |
32dd410954 | |
![]() |
e4f17d33ce | |
![]() |
2ab707c0ca | |
![]() |
4dba928765 | |
![]() |
3d6550d161 | |
![]() |
3cf12f2594 | |
![]() |
de1ec01c78 | |
![]() |
295abb9cd0 | |
![]() |
8260b62482 | |
![]() |
d18c6f115f | |
![]() |
d36f80b5e6 | |
![]() |
44aa859e6d | |
![]() |
5a2d3a6f95 | |
![]() |
d6b939c428 | |
![]() |
8b8be7d4a8 | |
![]() |
72364fd1a4 | |
![]() |
c6da07feb3 | |
![]() |
94979eff97 | |
![]() |
e8494b56d1 | |
![]() |
c85397518b | |
![]() |
cf2339822d | |
![]() |
dcb9ccca90 | |
![]() |
a8ec85d536 | |
![]() |
611f3a3409 | |
![]() |
b6da6c490c | |
![]() |
9d20ce9b59 | |
![]() |
709a322337 | |
![]() |
cdfd37fc4e | |
![]() |
4f8d0a8867 | |
![]() |
b22e9fb709 | |
![]() |
4e2799b582 | |
![]() |
7fa90531e6 | |
![]() |
e1c2ecc584 | |
![]() |
4c450ab360 | |
![]() |
d5e1a1f36b | |
![]() |
821b9176bd | |
![]() |
9031103c9a | |
![]() |
557f897ead | |
![]() |
c8a4f66cf8 | |
![]() |
ddc93ec6e1 | |
![]() |
ab38ae8f24 | |
![]() |
d337688fa7 | |
![]() |
3eea90afb6 | |
![]() |
b3952d74a8 | |
![]() |
be09125d52 | |
![]() |
f264e7f807 | |
![]() |
fe0791762a | |
![]() |
61f427dec1 | |
![]() |
d619ee2bb1 | |
![]() |
7128e6dd08 | |
![]() |
0decffea8d | |
![]() |
9b60e17746 | |
![]() |
26207038c9 | |
![]() |
90867bc802 | |
![]() |
7f49cd33ad | |
![]() |
d8342d3d67 | |
![]() |
12e840a8fa | |
![]() |
6ca609ac7e | |
![]() |
2b8f9f71ff | |
![]() |
e76cef79d2 | |
![]() |
7f06428df8 | |
![]() |
e4a9340409 | |
![]() |
5d7023a5d6 | |
![]() |
3bd7c918cc | |
![]() |
67e4944cdb | |
![]() |
df4ff16e2c | |
![]() |
d4805065b3 | |
![]() |
e39b1f2c53 | |
![]() |
73b65a6553 | |
![]() |
9e556e6a56 | |
![]() |
11e73f2c61 | |
![]() |
e97b0448b7 | |
![]() |
aa6ed14b2a | |
![]() |
2ce20c4f59 | |
![]() |
e4ef4aa625 | |
![]() |
cf5cb40cb9 | |
![]() |
c450d14311 | |
![]() |
41572be3f2 | |
![]() |
4f8da1c574 | |
![]() |
32091669d4 | |
![]() |
abd72a5b2e | |
![]() |
7e6349b19f | |
![]() |
0782be749e | |
![]() |
a7b545ab1a | |
![]() |
1a564f900c | |
![]() |
3d4e03f85f | |
![]() |
fc17209ac7 | |
![]() |
38877ef209 | |
![]() |
8691a15be8 | |
![]() |
961fd0304c | |
![]() |
e2cf6ecba6 | |
![]() |
7a0826a60c | |
![]() |
d516683a77 | |
![]() |
834c7de86c | |
![]() |
4f1a5dd726 | |
![]() |
5766b9b9c7 | |
![]() |
5d8426d317 | |
![]() |
63ec3528f1 | |
![]() |
f646c3848c | |
![]() |
09433875bc | |
![]() |
05c09ff506 | |
![]() |
7f78fbb3c5 | |
![]() |
261e26f488 | |
![]() |
ed820708af | |
![]() |
5b8b6a0b47 | |
![]() |
8809ce26b3 | |
![]() |
a48625855b | |
![]() |
55c1477d69 | |
![]() |
2d7a1ea25b | |
![]() |
244149c00e | |
![]() |
c0bcf3bfdf | |
![]() |
13756bcbf9 | |
![]() |
fc82e06270 | |
![]() |
df89beb256 | |
![]() |
82eda48e8f | |
![]() |
b47787b317 | |
![]() |
c9668d9a88 | |
![]() |
90a56c6937 | |
![]() |
d377f7abff | |
![]() |
1fac129746 | |
![]() |
af7d5f7b89 | |
![]() |
28f7c2010b | |
![]() |
486330f23d | |
![]() |
1ae78a04a8 | |
![]() |
c776da7120 | |
![]() |
d543784a3d | |
![]() |
902c6c8e4b | |
![]() |
d32be9ddbe | |
![]() |
b776509287 | |
![]() |
56eb97c846 | |
![]() |
9f46c575fd | |
![]() |
e0402a9b0b | |
![]() |
3e30f54d5f | |
![]() |
d73085a88c | |
![]() |
8eb6a6900f | |
![]() |
3615137c12 | |
![]() |
bbd5b76f2a | |
![]() |
bb3604f333 | |
![]() |
18a0067ca7 | |
![]() |
cfdbdc4ec2 | |
![]() |
32ca2ae42f | |
![]() |
bad96cf91e | |
![]() |
62294702e4 | |
![]() |
72c4f33d63 | |
![]() |
3fe57f540d | |
![]() |
1e1a369c8d | |
![]() |
cc65ef2849 | |
![]() |
32627f6b85 | |
![]() |
41952d0625 | |
![]() |
0c39a5ba7a | |
![]() |
1b77d6594c | |
![]() |
8d08223dbc | |
![]() |
af6028a9dd | |
![]() |
ff3b5ee042 | |
![]() |
b52edf52ff | |
![]() |
6766b9ca54 | |
![]() |
8eae2e5b90 | |
![]() |
50d17363ea | |
![]() |
795f25bb85 | |
![]() |
647be137f6 | |
![]() |
8abe3e79da | |
![]() |
710ffeb1b2 | |
![]() |
a855ff54f4 | |
![]() |
dbb5e534e4 | |
![]() |
753956963c | |
![]() |
b00e23f5b5 | |
![]() |
8ef9a66b74 | |
![]() |
0e503a525e | |
![]() |
b4b020401c | |
![]() |
f4835674ed | |
![]() |
4104a3d179 | |
![]() |
1e1ec2e330 | |
![]() |
ff21f8da21 | |
![]() |
775a571f75 | |
![]() |
64abd3e8dc | |
![]() |
56320ec6d1 | |
![]() |
311b232ee5 | |
![]() |
0e13cc9346 | |
![]() |
b455de01c6 | |
![]() |
c3053d3819 | |
![]() |
c8106573d8 | |
![]() |
047ad27777 | |
![]() |
ecd16a21dc | |
![]() |
1594fda1b6 | |
![]() |
de9b3a211b | |
![]() |
045c98d8fa | |
![]() |
4ace296b3a | |
![]() |
011adce23e | |
![]() |
cc99ec0c14 | |
![]() |
1d652edf83 | |
![]() |
db08ca93af | |
![]() |
3518dc6a05 | |
![]() |
cc9a03ce48 | |
![]() |
8576733c0d | |
![]() |
c6da7e384e | |
![]() |
98abb8c2e8 | |
![]() |
0556192238 | |
![]() |
d9432ebb14 | |
![]() |
f57cad67c4 | |
![]() |
ce7cc4e223 | |
![]() |
8183a005af | |
![]() |
75a34cd098 | |
![]() |
23e1573442 | |
![]() |
98b51910eb | |
![]() |
c3f0aa2edf | |
![]() |
ea596e4cb0 | |
![]() |
68adb14b07 | |
![]() |
a565cea8e9 | |
![]() |
6ac95d373f | |
![]() |
d4430ca440 | |
![]() |
000c7f854c | |
![]() |
047bd935ea | |
![]() |
33cb9a66d4 | |
![]() |
f8374b52a8 | |
![]() |
2f10e71f1d | |
![]() |
8f92d99968 | |
![]() |
ce12db1e06 | |
![]() |
d8a1886ccb | |
![]() |
1d051d0e6e | |
![]() |
f96e42fe04 | |
![]() |
aa59d94490 | |
![]() |
07e490254c | |
![]() |
18b97b4342 | |
![]() |
b45a4066b1 | |
![]() |
1fff5cb1f7 | |
![]() |
13a16eb79c | |
![]() |
69769c1bef | |
![]() |
e998a4016a | |
![]() |
f17a9855f3 | |
![]() |
85b7cf7aec | |
![]() |
f46da1c525 | |
![]() |
404e9a1a55 | |
![]() |
3ec8960f1a | |
![]() |
613bd4038a | |
![]() |
ecb69a240a | |
![]() |
215e3c5ae9 | |
![]() |
e5aa685f70 | |
![]() |
53e1f44a69 | |
![]() |
9e4c8e1753 | |
![]() |
5f853b99ad | |
![]() |
e7d135dbf1 | |
![]() |
60fc096f1a |
.github
.gitmodulesCHANGELOG.mdCMakeLists.txtDEVELOPER-MANUAL.mdREADME.mdcmake-variants.yamlcmake
Architecture.cmakeCMakeASM_NASMInformation.cmakeCMakeDetermineASM_NASMCompiler.cmakeCMakeTestASM_NASMCompiler.cmakeDependencies.cmakeFindGettext.cmakeFindOpenAL.cmakeFindSDL2.cmakeFindSFML.cmakeFindSSP.cmakeGetGitRevisionDescription.cmakeGitTagVersion.cmakeLLVMToolchain.cmakeMacPackageManagers.cmakeMakeReleaseCommitAndTag.cmakeOptions.cmakePathRun.cmakeSet-Toolchain-vcpkg.cmakeSetCompilerLinkerFlags.cmakeToolchain-asan.cmakeToolchain-gcc-clang.cmakeToolchain-mingw.cmakeToolchain-msvc.cmakeToolchain.cmakeUpdateAppcast.cmakeUseGCCBinUtilsWrappers.cmakeVbamFunctions.cmakedoctest.cmakedoctestAddTests.cmake
default.nixdependenciesdoc
fex
installdepspo
CMakeLists.txt
snapcraft.yamlwxvbam
src
|
@ -0,0 +1 @@
|
|||
github: rkitover
|
|
@ -11,7 +11,7 @@ body:
|
|||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please try the nightly build from: https://nightly.vba-m.com and factory resetting the emulator from the Help menu.
|
||||
Please try the nightly build from: https://nightly.visualboyadvance-m.org and factory resetting the emulator from the Help menu.
|
||||
On Linux build master from source or use the edge snap.
|
||||
And last but not least, search for existing reports via the filters bar on the issues page.
|
||||
- type: markdown
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: VBA-M Forum
|
||||
url: https://board.vba-m.com/
|
||||
url: https://board.visualboyadvance-m.org/
|
||||
about: For general questions and support please join our forum or our
|
||||
- name: VBA-M IRC Channel
|
||||
url: https://web.libera.chat/#vba-m
|
||||
|
|
|
@ -14,7 +14,7 @@ body:
|
|||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please try a nightly build from: https://nightly.vba-m.com to see if your idea has already been implemented.
|
||||
Please try a nightly build from: https://nightly.visualboyadvance-m.org to see if your idea has already been implemented.
|
||||
On Linux build master from source or use the edge snap.
|
||||
And last but not least, search for existing requests via the filters bar on the issues page.
|
||||
- type: textarea
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
name: Libretro Devkitpro
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
target_name: [ngc, wii, wiiu, switch]
|
||||
build_type: [release, debug]
|
||||
include:
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
- devkit_container: 'devkitpro/devkitppc:latest'
|
||||
target_name: ngc
|
||||
- devkit_container: 'devkitpro/devkitppc:latest'
|
||||
target_name: wii
|
||||
- devkit_container: 'devkitpro/devkitppc:latest'
|
||||
target_name: wiiu
|
||||
- devkit_container: 'devkitpro/devkita64:latest'
|
||||
target_name: switch
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{ matrix.devkit_container }}
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Libretro build
|
||||
- name: Build libretro core
|
||||
run: make -C src/libretro ${{ matrix.libretro_build }} platform=${{ matrix.target_name }}
|
|
@ -1,27 +1,63 @@
|
|||
name: macOS Latest Build
|
||||
name: macOS Latest
|
||||
on: [push, pull_request]
|
||||
#on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only, libretro]
|
||||
include:
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
build_options: libretro
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
build_options: libretro
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM: 1
|
||||
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install nix
|
||||
uses: cachix/install-nix-action@v22
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: Configure
|
||||
|
||||
# Cmake build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Configure CMake
|
||||
run: >-
|
||||
nix-shell --command 'cmake -B build -G Ninja ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}'
|
||||
- name: Build
|
||||
nix-shell --command 'cmake -B build -G Ninja ${{ matrix.cmake_build }} -DENABLE_LTO=OFF ${{ matrix.cmake_options }}'
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Build
|
||||
run: >-
|
||||
nix-shell --command 'ninja -C build'
|
||||
|
||||
# Libretro build
|
||||
- if: matrix.build_options == 'libretro'
|
||||
name: Build libretro core
|
||||
run: >-
|
||||
nix-shell --command 'make -C src/libretro ${{ matrix.libretro_build }}'
|
||||
|
||||
# Run tests
|
||||
- if: matrix.build_options == 'default'
|
||||
name: Run tests
|
||||
run: >-
|
||||
nix-shell --command 'cd build && ctest -j --output-on-failure'
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
name: MSYS2 Build
|
||||
name: MSYS2
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only, libretro]
|
||||
include:
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
build_options: libretro
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
build_options: libretro
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
MSYSTEM: CLANG64
|
||||
|
@ -16,7 +35,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Setup msys2
|
||||
|
@ -27,11 +46,19 @@ jobs:
|
|||
- name: Install deps
|
||||
run: >-
|
||||
bash installdeps
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
- name: Build
|
||||
run: ninja -C build
|
||||
|
||||
- name: Install
|
||||
# CMake build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Configure CMake
|
||||
run: cmake -B build -G Ninja ${{ matrix.cmake_build }} -DENABLE_LTO=OFF ${{ matrix.cmake_options }}
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Build
|
||||
run: ninja -C build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Install
|
||||
run: ninja -C build install
|
||||
|
||||
# Libretro build
|
||||
- if: matrix.build_options == 'libretro'
|
||||
name: Build libretro core
|
||||
run: make -C src/libretro ${{ matrix.libretro_build }} CC=clang CXX=clang++
|
||||
|
|
|
@ -1,30 +1,71 @@
|
|||
name: Ubuntu Latest Build
|
||||
name: Ubuntu Latest
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
cmake_compiler: ['-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++', '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++']
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_compiler: [gcc, clang]
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only, libretro]
|
||||
include:
|
||||
- cmake_compiler: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++'
|
||||
build_compiler: gcc
|
||||
- cmake_compiler: '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'
|
||||
build_compiler: clang
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
build_options: libretro
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
build_options: libretro
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
- build_type: release
|
||||
build_options: translations_only
|
||||
build_compiler: clang
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Dependencies
|
||||
run: >-
|
||||
bash installdeps; if [ "${{ matrix.compiler }}" = clang ]; then sudo apt -y install clang; fi
|
||||
bash installdeps; if [ "${{ matrix.build_compiler }}" = clang ]; then sudo apt -y install clang; fi
|
||||
|
||||
- name: Configure
|
||||
- name: Install xvfb
|
||||
run: sudo apt -y install xvfb
|
||||
|
||||
# CMake build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Configure CMake
|
||||
run: >-
|
||||
cmake -B build -G Ninja ${{ matrix.cmake_compiler }} ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
|
||||
- name: Build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Build
|
||||
run: ninja -C build
|
||||
|
||||
- name: Install
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Install
|
||||
run: sudo ninja -C build install
|
||||
|
||||
# Libretro build
|
||||
- if: matrix.build_options == 'libretro'
|
||||
name: Build libretro core
|
||||
run: make -C src/libretro ${{ matrix.libretro_build }}
|
||||
|
||||
# Run tests
|
||||
- if: matrix.build_options == 'default'
|
||||
name: Run tests
|
||||
run: cd build && xvfb-run ctest -j --output-on-failure
|
||||
|
|
|
@ -1,36 +1,60 @@
|
|||
name: Visual Studio Build
|
||||
name: Visual Studio
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
msvc_arch: ['x64', 'x64_x86']
|
||||
msvc_arch: ['x64', 'amd64_x86', 'amd64_arm64']
|
||||
# TODO: Re-add "Visual Studio 17 2022" once it's working.
|
||||
cmake_generator: ['Ninja']
|
||||
# cmake_generator: ['Ninja', '"Visual Studio 17 2022"']
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only]
|
||||
include:
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- cmake_vcpkg_triplet: 'x64-windows-static'
|
||||
msvc_arch: x64
|
||||
- cmake_vcpkg_triplet: 'x86-windows-static'
|
||||
msvc_arch: amd64_x86
|
||||
- cmake_vcpkg_triplet: 'arm64-windows-static'
|
||||
msvc_arch: amd64_arm64
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
- build_type: release
|
||||
build_options: translations_only
|
||||
msvc_arch: amd64_x86
|
||||
- build_type: release
|
||||
build_options: translations_only
|
||||
msvc_arch: amd64_arm64
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare Visual Studio environment
|
||||
uses: ilammy/msvc-dev-cmd@v1.12.0
|
||||
uses: ilammy/msvc-dev-cmd@v1.13.0
|
||||
with:
|
||||
arch: ${{ matrix.msvc_arch }}
|
||||
|
||||
- name: Configure (x64)
|
||||
if: matrix.msvc_arch == 'x64'
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x64-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
|
||||
- name: Configure (x86)
|
||||
if: matrix.msvc_arch == 'x64_x86'
|
||||
run: >-
|
||||
cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x86-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=${{ matrix.cmake_vcpkg_triplet }} ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
|
||||
# Run tests
|
||||
- if: matrix.build_options == 'default' && matrix.msvc_arch != 'amd64_arm64'
|
||||
name: Run tests
|
||||
run: cd build && ctest -j --output-on-failure
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
[submodule "dependencies"]
|
||||
path = dependencies
|
||||
url = https://github.com/visualboyadvance-m/dependencies.git
|
||||
branch = master
|
||||
[submodule "win32-deps"]
|
||||
path = win32-deps
|
||||
url = https://github.com/visualboyadvance-m/win32-deps.git
|
||||
[submodule "third_party/googletest"]
|
||||
path = third_party/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
|
|
64
CHANGELOG.md
64
CHANGELOG.md
|
@ -4,7 +4,69 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.1.9] - 2024-03-02
|
||||
## [2.1.11] - 2024-09-15
|
||||
|
||||
==========================
|
||||
* 3eea90af - build: set BUILD_TESTING=OFF when not git checkout [rkitover]
|
||||
* b3952d74 - build: fix ENABLE_LIRC=ON [rkitover]
|
||||
* f264e7f8 - Fix Help -> Translations URL [rkitover]
|
||||
* 61f427de - Write shortcuts in the proper section (#1335) [Steelskin]
|
||||
* d619ee2b - build: fix installing GoogleTest [rkitover]
|
||||
* 26207038 - Update WinSparkle to 0.8.1 and add ARM64 [rkitover]
|
||||
|
||||
## [2.1.10] - 2024-09-08
|
||||
|
||||
==========================
|
||||
* 7f06428d - Disable dialog position save/restore on wxGTK (#1331) [Steelskin]
|
||||
* e4ef4aa6 - Propagate key events (#1323) [Steelskin]
|
||||
* e2cf6ecb - Add option to mute sound during speedup [rkitover]
|
||||
* d516683a - build: fix for wx using GTK2 [rkitover]
|
||||
* 834c7de8 - build: update macOS builder dists [rkitover]
|
||||
* fc82e062 - build: do not build SDL bin on Windows or macOS [rkitover]
|
||||
* d543784a - [UserInput] Filter key events globally [steelskin]
|
||||
* 902c6c8e - [UserInput] Only process shortcut commands once [steelskin]
|
||||
* b7765092 - [bindings] Set default shortcut for recent file 3 [steelskin]
|
||||
* cc65ef28 - doc: add system requirements to README.md [danialhorton]
|
||||
* 32627f6b - [Dialogs] Save and restore dialog positions [steelskin]
|
||||
* 41952d06 - build: update macOS linker tool to 1.5 [rkitover]
|
||||
* 0c39a5ba - build: override FindGettext to not update po files [rkitover]
|
||||
* 1b77d659 - build: update macOS build to ffmpeg 7.0 [rkitover]
|
||||
* 8d08223d - build: fix compatibility with older ffmpeg [rkitover]
|
||||
* af6028a9 - build: fix build for nix on macOS [rkitover]
|
||||
* b52edf52 - build: fix building on macOS with Homebrew [rkitover]
|
||||
* 6766b9ca - build: fix ffmpeg 7.x compat [rkitover]
|
||||
* 795f25bb - build: fix nix deps for OpenGL [rkitover]
|
||||
* 647be137 - gba: set cpsr=spsr when switching to FIQ mode [40356555+Aikku93]
|
||||
* 8abe3e79 - build: remove -lgcc from static link flags [rkitover]
|
||||
* f4835674 - [Audio] Rework audio devices enumeration [steelskin]
|
||||
* 775a571f - build: fix detecting Visual Studio default vcpkg [rkitover]
|
||||
* 64abd3e8 - [Audio] Remove manual memory allocations [steelskin]
|
||||
* 047ad277 - [Dialogs] Prevent viewers from causing a crash [steelskin]
|
||||
* 045c98d8 - build: only use -Werror=lto-type-mismatch on gcc [rkitover]
|
||||
* 3518dc6a - build: fix LTO on Linux [rkitover]
|
||||
* cc9a03ce - Add toggle: SDL GameController mode for joysticks [rkitover]
|
||||
* 8576733c - [Build] Remove lingering references to OpenAl [steelskin]
|
||||
* 05561922 - build: fix MSYS2 check [rkitover]
|
||||
* d9432ebb - build: fix build on MINGW{64,32}/UCRT64 on MSYS2 [rkitover]
|
||||
* f57cad67 - build: fix static linking on MSYS2 CLANG64 [rkitover]
|
||||
* 23e15734 - build: set wxWidgets_DIR with vcpkg [rkitover]
|
||||
* 98b51910 - [Build] Remove ENABLE_NLS, fix TRANSLATIONS_ONLY [steelskin]
|
||||
* a565cea8 - [Build] Remove the OpenGL check [steelskin]
|
||||
* f96e42fe - build: cmake refactor and improvements [Steelskin]
|
||||
* 07e49025 - Fix most remaining release warnings (#1243) [Steelskin]
|
||||
* 18b97b43 - Fix various build warnings (#1242) [Steelskin]
|
||||
* 13a16eb7 - Fix various warnings in filters and headers (#1241) [Steelskin]
|
||||
* f46da1c5 - build: remove our version of FindSDL2.cmake [rkitover]
|
||||
* 404e9a1a - build: add clang to ./installdeps for MSYS2 [rkitover]
|
||||
* 613bd403 - Make menu more reasonably organized (#1230) [wwrustc]
|
||||
* 215e3c5a - build: use find_program() to find powershell [rkitover]
|
||||
* e5aa685f - build: don't use wx utils as UNIX cmds on Windows [rkitover]
|
||||
* 9e4c8e17 - build: fix gentoo dependency namespaces [68k]
|
||||
* 5f853b99 - Update metainfo.xml to new standards [jhonny.oliveira]
|
||||
* e7d135db - Update links to new domain visualboyadvance-m.org [rkitover]
|
||||
* 60fc096f - build: add libglu-devel for solus in installdeps [rkitover]
|
||||
|
||||
## [2.1.9] - 2024-02-03
|
||||
=======================
|
||||
* 84b0a3e3 - Remove SDL sound driver [rkitover]
|
||||
* 2ad7dd1a - Fix wav audio recording [40356555+Aikku93]
|
||||
|
|
1234
CMakeLists.txt
1234
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
|
@ -9,17 +9,15 @@
|
|||
- [Commit Message](#commit-message)
|
||||
- [Collaboration on a Branch](#collaboration-on-a-branch)
|
||||
- [Commits from Maintainers](#commits-from-maintainers)
|
||||
- [Strings, Character Sets and Translations](#strings-character-sets-and-translations)
|
||||
- [Pulling Updated Translations](#pulling-updated-translations)
|
||||
- [Translations Message Catalog](#translations-message-catalog)
|
||||
- [Interaction with non-wxWidgets Code](#interaction-with-non-wxwidgets-code)
|
||||
- [Windows Native Development Environment Setup](#windows-native-development-environment-setup)
|
||||
- [Miscellaneous](#miscellaneous)
|
||||
- [Debug Messages](#debug-messages)
|
||||
- [Release Process](#release-process)
|
||||
- [Environment](#environment)
|
||||
- [Certificates](#certificates)
|
||||
- [Release Commit and Tag](#release-commit-and-tag)
|
||||
- [64-bit Windows Binary](#64-bit-windows-binary)
|
||||
- [32-bit Windows Binary](#32-bit-windows-binary)
|
||||
- [64-bit Mac Binary](#64-bit-mac-binary)
|
||||
- [ARM64 Windows Binary](#arm64-windows-binary)
|
||||
- [macOS Binary](#macos-binary)
|
||||
- [Final steps](#final-steps)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
@ -53,11 +51,12 @@ Follow the following steps to process newly submitted issues:
|
|||
- An issue is resolved by closing it in github. A commit that fixes the issue
|
||||
should have the following line near the end of the body of the commit message:
|
||||
```
|
||||
- Fix #999.
|
||||
Fix #999.
|
||||
```
|
||||
This will automatically close the issue and assign the closing commit in the
|
||||
github metadata when it is merged to master. The issue can be reopened if
|
||||
needed.
|
||||
|
||||
- A commit that is work towards resolving an issue, should have the issue number
|
||||
preceded by a pound sign either at the end of a commit message title, if it is
|
||||
of primary relevance to the issue, or the body otherwise.
|
||||
|
@ -70,7 +69,7 @@ Follow these guidelines always:
|
|||
|
||||
https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
|
||||
the description of your work should be in the **commit message NOT the pull
|
||||
, the description of your work should be in the **commit message NOT the pull
|
||||
request description**.
|
||||
|
||||
The title line must be no more than 50 characters and the description must be
|
||||
|
@ -95,16 +94,21 @@ other projects, fewer is better.
|
|||
The commit title line should be prefixed with an area, unless it involves the
|
||||
wxWidgets GUI app, in which case it should **NOT** have a prefix.
|
||||
|
||||
If the commit is a user-facing functionality change or enhancement, the title
|
||||
line of the commit must be a non-technical description of this change. For
|
||||
example "Mute on speedup" because this will go into the changelog.
|
||||
|
||||
The text after the area prefix should not be capitalized.
|
||||
|
||||
Please use one of these area prefixes otherwise:
|
||||
Please use one of these area prefixes for non-main-GUI-app commits:
|
||||
|
||||
- doc: documentation, README.md etc.
|
||||
- build: cmake, installdeps, preprocessor compatibility defines, etc.
|
||||
- gb-core: the GameBoy emulator core
|
||||
- gba-core: the GameBoy Advance emulator core
|
||||
- build: cmake, installdeps, preprocessor compatibility defines, compatibility
|
||||
headers, etc.
|
||||
- gb: the GameBoy emulator core
|
||||
- gba: the GameBoy Advance emulator core
|
||||
- libretro: the libretro core glue and build
|
||||
- sdl-app: anything for the SDL app
|
||||
- sdl: anything for the SDL port
|
||||
- translations: anything related to translations
|
||||
|
||||
. Add other areas here if needed.
|
||||
|
@ -138,137 +142,79 @@ things in mind:
|
|||
better to edit the history than to add more commits. Never add commits fixing
|
||||
previous commits, only improving or adding to them.
|
||||
|
||||
- To update when someone else (very rudely you might say) did a `push -f`, `pull
|
||||
--rebase` will **USUALLY** work. Verify the log, and if necessary do this
|
||||
instead:
|
||||
|
||||
- To update when someone else updated the branch with a `push -f`
|
||||
```bash
|
||||
git status # should be clean, with your work having been already pushed
|
||||
git fetch --all --prune
|
||||
git reset --hard origin/<branch-name>
|
||||
```
|
||||
.
|
||||
|
||||
While actively working on a branch, keep it rebased on top of master.
|
||||
- While actively working on a branch, keep it rebased on top of master.
|
||||
|
||||
#### Commits from Maintainers
|
||||
|
||||
Maintainers have the power to commit directly to master. This power must be
|
||||
used responsibly, something I fail to do myself often, and will try to improve
|
||||
upon.
|
||||
Maintainers and project members have the power to commit directly to master.
|
||||
This power must be used responsibly.
|
||||
|
||||
Make your most earnest attempt to follow these general guidelines to keep our
|
||||
Make your best attempt to follow these general guidelines to keep our
|
||||
history clean:
|
||||
|
||||
- Things that are a straight fix or improvement that does not require discussion
|
||||
- Things that are a minor fix or improvement that does not require discussion
|
||||
can be committed directly, keeping the following guidelines in mind.
|
||||
|
||||
- Bigger new features, code refactors and changes in architecture should go
|
||||
through the PR process.
|
||||
|
||||
- Push code changes to a branch first, so they can run through the CI.
|
||||
Differences in what different compilers allow is a problem that comes up
|
||||
**VERY** frequently. As well as incompatibilities between different
|
||||
configurations for both the C++ code and any supporting code.
|
||||
- Push code changes to a branch first, so they can run through the CI. When you
|
||||
open the commit in GitHub there is a little icon in the upper left corner that
|
||||
shows the CI status for this commit. Differences in what different compilers
|
||||
allow is a problem that comes up **VERY** frequently. As well as
|
||||
incompatibilities between different configurations for both the C++ code and
|
||||
any supporting code.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
### Strings, Character Sets and Translations
|
||||
#### Debug Messages
|
||||
|
||||
#### Pulling Updated Translations
|
||||
We have an override for `wxLogDebug()` to make it work even in non-debug builds
|
||||
of wx and on windows, even in mintty.
|
||||
|
||||
Once in a while it is necessary to pull new and updated translations from
|
||||
transifex.
|
||||
|
||||
For this you need the transifex client, available for Windows as well from
|
||||
chocolatey as `transifex-client`.
|
||||
|
||||
To pull translations run:
|
||||
|
||||
```bash
|
||||
tx pull -af
|
||||
```
|
||||
|
||||
then check `git status` and if any message catalogs were updated, commit the
|
||||
result as:
|
||||
|
||||
```bash
|
||||
git commit -a --signoff -S -m'Transifex pull.'
|
||||
git push
|
||||
```
|
||||
|
||||
#### Translations Message Catalog
|
||||
|
||||
Strings that need to be translated by our wonderful translators on transifex
|
||||
(thank you guys very much) need to be enclosed in `_("...")`, for example:
|
||||
It works like `printf()`, e.g.:
|
||||
|
||||
```cpp
|
||||
wxLogError(_("error: something very wrong"));
|
||||
int foo = 42;
|
||||
wxLogDebug(wxT("the value of foo = %d"), foo);
|
||||
```
|
||||
|
||||
The next time you run cmake after adding a string to be translated, the `.pot`
|
||||
message catalog source will be regenerated, and you will see a loud message
|
||||
telling you to push to transifex.
|
||||
|
||||
Strings in the XRC XML GUI definition files are automatically added to the
|
||||
message catalog as well.
|
||||
|
||||
If you are working on a branch or a PR, don't push to transifex until it has
|
||||
been merged to master.
|
||||
|
||||
Once it is, push it with:
|
||||
|
||||
```bash
|
||||
tx push -s
|
||||
```
|
||||
|
||||
#### Interaction with non-wxWidgets Code
|
||||
|
||||
Use our `UTF8(...)` function to force any `wxString` to UTF-8 for use by other
|
||||
libraries, screen output or OS APIs. For example:
|
||||
From the core etc. the usual:
|
||||
|
||||
```cpp
|
||||
fprintf(STDERR, "Error: %s\n", UTF8(err_msg));
|
||||
fprintf(stderr, "...", ...);
|
||||
```
|
||||
, will work fine.
|
||||
|
||||
There is one exception to this, when using `wxString::Printf()` and such, you
|
||||
can't pass another `wxString` to the `%s` format directly, use something like
|
||||
this:
|
||||
|
||||
```cpp
|
||||
wxString err;
|
||||
err.Printf("Cannot read file: %s", fname.wc_str());
|
||||
```
|
||||
|
||||
this uses the `wchar_t` UTF-16 representation on Windows and does nothing
|
||||
elsewhere.
|
||||
|
||||
For calling Windows APIs with strings, use the wide char `W` variants and the
|
||||
`wc_str()` method as well.
|
||||
|
||||
### Windows Native Development Environment Setup
|
||||
|
||||
This guide has been moved to:
|
||||
|
||||
https://github.com/rkitover/windows-dev-guide
|
||||
You need a debug build for this to work or to even have a console on Windows.
|
||||
Pass `-DCMAKE_BUILD_TYPE=Debug` to cmake.
|
||||
|
||||
### Release Process
|
||||
|
||||
#### Environment
|
||||
#### GnuPG Key
|
||||
|
||||
The variable `VBAM_NO_PAUSE`, if set, will cause cmake to not pause before gpg
|
||||
signing operations, you want to set this if you've disabled your gpg passphrase
|
||||
to not require interaction during release builds.
|
||||
You will need to create a GnuPG key for signing your commits and release tags,
|
||||
and upload it to a keyserver.
|
||||
|
||||
gpg set up with your key is helpful for the release process on all environments
|
||||
where a binary is built, but you can also make the detached signature files
|
||||
yourself at the end of the process.
|
||||
Make sure to install GnuPG on all environments where you will be making commits
|
||||
and tags.
|
||||
|
||||
For codesigning windows binaries, put your certificate into
|
||||
`~/.codesign/windows_comodo.pkcs12`.
|
||||
#### Certificates
|
||||
|
||||
On Mac the 'Developer ID Application' certificate stored in your login keychain
|
||||
is used, `keychain unlock` will prompt you for your login keychain password, to
|
||||
avoid that set the `LOGIN_KEYCHAIN_PASSWORD` environment variable to your
|
||||
password.
|
||||
Make sure you have set up a Windows code signing certificate with the right
|
||||
password and a Mac 'Developer ID Application' certificate.
|
||||
|
||||
Put the Windows certificate into `~/.codesign/windows_comodo.pkcs12` as a PKCS12
|
||||
file that is password protected, and put the password for it into
|
||||
`~/.codesign/windows_comodo.pkcs12.password`.
|
||||
|
||||
#### Release Commit and Tag
|
||||
|
||||
|
@ -280,8 +226,10 @@ tag:
|
|||
mkdir build && cd build
|
||||
cmake .. -DTAG_RELEASE=TRUE
|
||||
```
|
||||
, follow the instructions to edit the `CHANGELOG.md` and then push the release:
|
||||
|
||||
then push the release:
|
||||
To reiterate, **make sure you edit the `CHANGELOG.md`** to remove any
|
||||
non-user-facing changes before you make the release commit.
|
||||
|
||||
```bash
|
||||
git push
|
||||
|
@ -296,84 +244,126 @@ cmake .. -DTAG_RELEASE=UNDO
|
|||
|
||||
#### 64-bit Windows Binary
|
||||
|
||||
For this you will preferably need the powershell environment setup described
|
||||
earlier, however you can use a regular Visual Studio 64 bit native developer
|
||||
command prompt as well.
|
||||
For this you will preferably need the PowerShell environment setup described
|
||||
[here](https://github.com/rkitover/windows-dev-guide), or by starting the `x64
|
||||
Native Tools Command Prompt` from your Start Menu.
|
||||
|
||||
```powershell
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=Release -DUPSTREAM_RELEASE=TRUE -G Ninja
|
||||
mkdir build-msvc64
|
||||
cd build-msvc64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DUPSTREAM_RELEASE=TRUE -G Ninja
|
||||
ninja
|
||||
```
|
||||
|
||||
Collect the following files for the release:
|
||||
|
||||
- `visualboyadvance-m-Win-64bit.zip`
|
||||
- `visualboyadvance-m-Win-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-x86_64.zip`
|
||||
- `translations.zip`
|
||||
- `translations.zip.asc`
|
||||
|
||||
Repeat the process for the debug build, with `-DCMAKE_BUILD_TYPE=Debug` and
|
||||
collect this file:
|
||||
|
||||
- `visualboyadvance-m-Win-x86_64-debug.zip`
|
||||
.
|
||||
|
||||
#### 32-bit Windows Binary
|
||||
|
||||
For this the optimal environment is a linux distribution with the mingw
|
||||
toolchain, I use fedora.
|
||||
The 32-bit build is a legacy build for Windows XP compatibility. You will need
|
||||
the MinGW toolchain to build it. The easiest method is to use the MINGW32 MSYS2
|
||||
environment.
|
||||
|
||||
You can set up a shell on a fedora distribution with docker as described here:
|
||||
Make sure the Visual Studio `signtool.exe` is in your path, you can start MSYS2
|
||||
with an inherited `PATH` from a Visual Studio enabled environment or add it to
|
||||
your shell configuration.
|
||||
|
||||
https://gist.github.com/rkitover/6379764c619c10e829e4b2fa0ae243fd
|
||||
|
||||
If using fedora, the cross script will install all necessary dependencies, if
|
||||
not install the base toolchain (mingw gcc, binutils, winpthreads) using the
|
||||
preferred method for your distribution, you can also use mxe for this.
|
||||
|
||||
https://mxe.cc/
|
||||
First install dependencies with:
|
||||
|
||||
```bash
|
||||
sh tools/win/linux-cross-builder -32
|
||||
./installdeps
|
||||
```
|
||||
|
||||
You can also use msys2 on Windows, this is not recommended:
|
||||
. Then build the 32-bit binary as follows:
|
||||
|
||||
```bash
|
||||
sh tools/win/msys2-builder -32
|
||||
mkdir build-mingw32
|
||||
cd build-mingw32
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DUPSTREAM_RELEASE=TRUE -G Ninja
|
||||
ninja
|
||||
```
|
||||
. Collect this file for the release:
|
||||
|
||||
To set up msys2, see this guide:
|
||||
- `visualboyadvance-m-Win-x86_32.zip`
|
||||
|
||||
https://gist.github.com/rkitover/d008324309044fc0cc742bdb16064454
|
||||
. Then repeat the process for the debug build with `-DCMAKE_BUILD_TYPE=Debug`,
|
||||
and collect this file:
|
||||
|
||||
Collect the following files from `~/vbam-build-mingw32/project` if using linux,
|
||||
or `~/vbam-build-msys2-x86_64/project` if using msys2:
|
||||
- `visualboyadvance-m-Win-x86_32-debug.zip`
|
||||
.
|
||||
|
||||
- `visualboyadvance-m-Win-32bit.zip`
|
||||
- `visualboyadvance-m-Win-32bit.zip.asc`
|
||||
#### ARM64 Windows Binary
|
||||
|
||||
#### 64-bit Mac Binary
|
||||
You will need the MSVC ARM64 cross toolchain to build this binary, if you used
|
||||
the install script from [here](https://github.com/rkitover/windows-dev-guide)
|
||||
you will have it installed, otherwise run Visual Studio Installer and install
|
||||
the component.
|
||||
|
||||
To enter the ARM64 cross environment, edit the PowerShell profile described
|
||||
[here](https://github.com/rkitover/windows-dev-guide) or use the `vcvarsall.bat`
|
||||
script with the `amd64_arm64` argument as described
|
||||
[here](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170).
|
||||
|
||||
From there the process is the same as for the 64-bit build, collect the
|
||||
following files for the release:
|
||||
|
||||
- `visualboyadvance-m-Win-arm64.zip`
|
||||
- 'visualboyadvance-m-Win-arm64-debug.zip'
|
||||
.
|
||||
|
||||
#### macOS Binary
|
||||
|
||||
Install the latest Xcode for your OS.
|
||||
|
||||
You will need bash and (optionally) gpg from homebrew (which you will also need
|
||||
to install):
|
||||
|
||||
```bash
|
||||
brew install bash gnupg
|
||||
```
|
||||
You will need bash from Homebrew/nix/MacPorts/whatever to run the build script.
|
||||
|
||||
You will need a codesigning certificate from Apple, which you will be able to
|
||||
generate once you join their developer program. This is the certificate of the
|
||||
type 'Developer ID Application' stored in your login keychain. `keychain
|
||||
unlock` will prompt you for your login keychain password, to avoid that set the
|
||||
`LOGIN_KEYCHAIN_PASSWORD` environment variable to your password.
|
||||
generate once you join their developer program from XCode. This is the
|
||||
certificate of the type 'Developer ID Application' stored in your login
|
||||
keychain.
|
||||
|
||||
If you are not using a GUI session, you will need to use a method to unlock your
|
||||
login keychain before building so that your codesigning certificate can be used.
|
||||
Adding the certificate and key to the System keychain is also a method that some
|
||||
people use.
|
||||
|
||||
To unlock your keychain on login, you can add something like this to your
|
||||
`~/.zshrc`:
|
||||
|
||||
```bash
|
||||
/usr/local/bin/bash tools/osx/builder -64
|
||||
security unlock-keychain -p "$(cat ~/.login-keychain-password)" login.keychain
|
||||
```
|
||||
, with your login password in that file.
|
||||
|
||||
For notarization to work, you will need to create an app-specific password on
|
||||
https://appleid.apple.com , get your Team ID from your Apple Developer account,
|
||||
and store them with this command:
|
||||
|
||||
```bash
|
||||
xcrun notarytool store-credentials AC_PASSWORD \
|
||||
--apple-id you@domain.com \
|
||||
--team-id <DeveloperTeamID> \
|
||||
--password <secret_app_specific_2FA_password>
|
||||
```
|
||||
. Once all of this is set up, run:
|
||||
|
||||
```bash
|
||||
tools/osx/builder
|
||||
```
|
||||
, this will take a while because it builds all of the dependencies.
|
||||
|
||||
Collect the following files from `~/vbam-build-mac-64bit/project`:
|
||||
|
||||
- `visualboyadvance-m-Mac-64bit.zip`
|
||||
- `visualboyadvance-m-Mac-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Mac-x86_64.zip`
|
||||
- `visualboyadvance-m-Mac-x86_64-debug.zip`
|
||||
.
|
||||
|
||||
#### Final steps
|
||||
|
||||
|
@ -381,27 +371,26 @@ Go to the github releases tab, and make a release for the tag you pushed
|
|||
earlier.
|
||||
|
||||
Put any notes to users and distro maintainers into the description as well as
|
||||
the entries from `CHANGELOG.md` generated earlier from git by the release
|
||||
commit script.
|
||||
the generated entries from `CHANGELOG.md` you edited earlier.
|
||||
|
||||
Upload all files collected during the earlier builds, the complete list is:
|
||||
|
||||
|
||||
- `translations.zip`
|
||||
- `translations.zip.asc`
|
||||
- `visualboyadvance-m-Mac-64bit.zip`
|
||||
- `visualboyadvance-m-Mac-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-32bit.zip`
|
||||
- `visualboyadvance-m-Win-32bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-64bit.zip`
|
||||
- `visualboyadvance-m-Win-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-x86_64.zip`
|
||||
- `visualboyadvance-m-Win-x86_64-debug.zip`
|
||||
- `visualboyadvance-m-Win-x86_32.zip`
|
||||
- `visualboyadvance-m-Win-x86_32-debug.zip`
|
||||
- `visualboyadvance-m-Win-arm64.zip`
|
||||
- 'visualboyadvance-m-Win-arm64-debug.zip'
|
||||
- `visualboyadvance-m-Mac-x86_64.zip`
|
||||
- `visualboyadvance-m-Mac-x86_64-debug.zip`
|
||||
|
||||
Update the winsparkle appcast.xml by running this cmake command:
|
||||
Update the winsparkle `appcast.xml` by running this cmake command:
|
||||
|
||||
```bash
|
||||
cmake .. -DUPDATE_APPCAST=TRUE
|
||||
```
|
||||
|
||||
follow the instructions to push the change to the web data repo.
|
||||
, follow the instructions to push the change to the web data repo.
|
||||
|
||||
Announce the release on reddit r/emulation and the forum.
|
||||
|
|
186
README.md
186
README.md
|
@ -3,11 +3,11 @@
|
|||
|
||||
|
||||
- [Visual Boy Advance - M](#visual-boy-advance---m)
|
||||
- [System Requirements](#system-requirements)
|
||||
- [Building](#building)
|
||||
- [Building a Libretro core](#building-a-libretro-core)
|
||||
- [Visual Studio Support](#visual-studio-support)
|
||||
- [Visual Studio Code Support](#visual-studio-code-support)
|
||||
- [Optional: clangd](#optional-clangd)
|
||||
- [Dependencies](#dependencies)
|
||||
- [Cross compiling for 32 bit on a 64 bit host](#cross-compiling-for-32-bit-on-a-64-bit-host)
|
||||
- [Cross Compiling for Win32](#cross-compiling-for-win32)
|
||||
|
@ -19,8 +19,6 @@
|
|||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
[](https://gitter.im/visualboyadvance-m/Lobby)
|
||||
|
||||
Our bridged Discord server is [Here](https://discord.gg/EpfxEuGMKH).
|
||||
|
||||
We are also on *`#vba-m`* on [Libera IRC](https://libera.chat/) which has a [Web
|
||||
|
@ -37,11 +35,11 @@ Chat](https://web.libera.chat/).
|
|||
|
||||
Game Boy and Game Boy Advance Emulator
|
||||
|
||||
The forums are [here](https://board.vba-m.com/).
|
||||
The forums are [here](https://board.visualboyadvance-m.org/).
|
||||
|
||||
Windows and Mac builds are in the [releases tab](https://github.com/visualboyadvance-m/visualboyadvance-m/releases).
|
||||
|
||||
Nightly builds for Windows and macOS are at [https://nightly.vba-m.com/](https://nightly.vba-m.com/).
|
||||
Nightly builds for Windows and macOS are at [https://nightly.visualboyadvance-m.org/](https://nightly.visualboyadvance-m.org/).
|
||||
|
||||
**PLEASE TEST THE NIGHTLY OR MASTER WITH A FACTORY RESET BEFORE REPORTING
|
||||
ISSUES**
|
||||
|
@ -57,26 +55,41 @@ the `translations.zip` to the same directory as the executable.
|
|||
If you are having issues, try resetting the config file first, go to `Help ->
|
||||
Factory Reset`.
|
||||
|
||||
## System Requirements
|
||||
|
||||
Windows XP, Vista, 7, 8.1 or 10/11, Linux distros or macOS.
|
||||
|
||||
2Ghz x86 (or x86-64) Intel Core 2 or AMD Athlon processor with SSE, Snapdragon 835
|
||||
or newer CPU compatible with Arm for Windows.
|
||||
|
||||
- Just a guideline, lower clock speeds and Celeron processors may be able to run at full
|
||||
speed on lower settings, and Linux based ARM Operating systems have wider CPU support.
|
||||
|
||||
DirectX June 2010 Redist
|
||||
[Full](https://www.microsoft.com/en-au/download/details.aspx?id=8109) /
|
||||
[Websetup](https://www.microsoft.com/en-au/download/details.aspx?id=35) for
|
||||
Xaudio (Remember to uncheck Bing on the websetup.)
|
||||
|
||||
## Building
|
||||
|
||||
The basic formula to build vba-m is:
|
||||
|
||||
```shell
|
||||
```bash
|
||||
cd ~ && mkdir src && cd src
|
||||
git clone https://github.com/visualboyadvance-m/visualboyadvance-m.git
|
||||
cd visualboyadvance-m
|
||||
./installdeps
|
||||
|
||||
# ./installdeps will give you build instructions, which will be similar to:
|
||||
./installdeps # On Linux or macOS
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||
ninja
|
||||
```
|
||||
|
||||
`./installdeps` is supported on MSys2, Linux (Debian/Ubuntu, Fedora, Arch,
|
||||
Solus, OpenSUSE, Gentoo and RHEL/CentOS) and Mac OS X (homebrew, macports or
|
||||
fink.)
|
||||
`./installdeps` is supported on MSYS2, Linux (Debian/Ubuntu, Fedora, Arch,
|
||||
Solus, OpenSUSE, Gentoo and RHEL/CentOS) and Mac OS X (homebrew, MacPorts or
|
||||
Fink.)
|
||||
|
||||
## Building a Libretro core
|
||||
|
||||
|
@ -87,7 +100,7 @@ cd src/libretro
|
|||
make -j`nproc`
|
||||
```
|
||||
|
||||
Copy vbam_libretro.so to your RetroArch cores directory.
|
||||
Copy `vbam_libretro.so` to your RetroArch cores directory.
|
||||
|
||||
## Visual Studio Support
|
||||
|
||||
|
@ -107,14 +120,16 @@ environment loaded.
|
|||
Using your own user-wide installation of vcpkg is supported, just make sure the
|
||||
environment variable `VCPKG_ROOT` is set.
|
||||
|
||||
To build in the visual studio command prompt, use something like this:
|
||||
To build in the Visual Studio `x64 Native Tools Command Prompt`, use something
|
||||
like this:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=Debug -G Ninja
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||
ninja
|
||||
```
|
||||
.
|
||||
|
||||
## Visual Studio Code Support
|
||||
|
||||
|
@ -149,10 +164,10 @@ And the following development libraries:
|
|||
- [zlib](https://zlib.net/) (required)
|
||||
- [mesa](https://mesa3d.org/) (if using X11 or any OpenGL otherwise)
|
||||
- [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording)
|
||||
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools (optional, with ENABLE_NLS)
|
||||
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools
|
||||
- [SDL2](https://www.libsdl.org/) (required)
|
||||
- [SFML](https://www.sfml-dev.org/) (optional, for link)
|
||||
- [OpenAL](https://www.openal.org/) or [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
|
||||
- [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
|
||||
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
|
||||
|
||||
On Linux and similar, you also need the version of GTK your wxWidgets is linked
|
||||
|
@ -172,66 +187,47 @@ This is supported on Fedora, Arch, Solus and MSYS2.
|
|||
may be `win32` which is an alias for `mingw-w64-i686` to target 32 bit Windows,
|
||||
or `mingw-w64-x86_64` for 64 bit Windows targets.
|
||||
|
||||
The target is implicit on MSys2 depending on which MINGW shell you started (the
|
||||
The target is implicit on MSYS2 depending on which MINGW shell you started (the
|
||||
value of `$MSYSTEM`.)
|
||||
|
||||
On Debian/Ubuntu this uses the MXE apt repository and works quite well.
|
||||
|
||||
On Fedora it can build using the Fedora MinGW packages, albeit with wx 2.8, no
|
||||
OpenGL support, and no Link support for lack of SFML.
|
||||
|
||||
On Arch it currently doesn't work at all because the AUR stuff is completely
|
||||
broken, I will at some point redo the arch stuff to use MXE as well.
|
||||
|
||||
## CMake Options
|
||||
|
||||
The CMake code tries to guess reasonable defaults for options, but you can
|
||||
override them, for example:
|
||||
|
||||
```shell
|
||||
cmake .. -DENABLE_LINK=NO -G Ninja
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LINK=NO -G Ninja
|
||||
```
|
||||
|
||||
Of particular interest is making **Release** or **Debug** builds, the default
|
||||
mode is **Release**, to make a **Debug** build use something like:
|
||||
|
||||
```shell
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja
|
||||
```
|
||||
|
||||
Here is the complete list:
|
||||
. Here is the complete list:
|
||||
|
||||
| **CMake Option** | **What it Does** | **Defaults** |
|
||||
|-----------------------|----------------------------------------------------------------------|-----------------------|
|
||||
| ENABLE_SDL | Build the SDL port | OFF |
|
||||
| ENABLE_WX | Build the wxWidgets port | ON |
|
||||
| ENABLE_DEBUGGER | Enable the debugger | ON |
|
||||
| ENABLE_NLS | Enable translations | ON |
|
||||
| ENABLE_ASM_CORE | Enable x86 ASM CPU cores (**BUGGY AND DANGEROUS**) | OFF |
|
||||
| ENABLE_ASM | Enable the following two ASM options | ON for 32 bit builds |
|
||||
| ENABLE_ASM_SCALERS | Enable x86 ASM graphic filters | ON for 32 bit builds |
|
||||
| ENABLE_MMX | Enable MMX | ON for 32 bit builds |
|
||||
| ENABLE_LINK | Enable GBA linking functionality (requires SFML) | AUTO |
|
||||
| ENABLE_LIRC | Enable LIRC support | OFF |
|
||||
| ENABLE_FFMPEG | Enable ffmpeg A/V recording | AUTO |
|
||||
| ENABLE_ONLINEUPDATES | Enable online update checks | ON |
|
||||
| ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | ON for release build |
|
||||
| ENABLE_GBA_LOGGING | Enable extended GBA logging | ON |
|
||||
| ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON |
|
||||
| ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
|
||||
| ENABLE_OPENAL | Enable OpenAL for the wxWidgets port | AUTO |
|
||||
| ENABLE_SSP | Enable gcc stack protector support (gcc only) | OFF |
|
||||
| ENABLE_ASAN | Enable libasan sanitizers (by default address, only in debug mode) | OFF |
|
||||
| UPSTREAM_RELEASE | Do some release tasks, like codesigning, making zip and gpg sigs. | OFF |
|
||||
| BUILD_TESTING | Build the tests and enable ctest support. | ON |
|
||||
| VBAM_STATIC | Try link all libs statically (the following are set to ON if ON) | OFF |
|
||||
| SDL2_STATIC | Try to link static SDL2 libraries | OFF |
|
||||
| SFML_STATIC_LIBRARIES | Try to link static SFML libraries | OFF |
|
||||
| FFMPEG_STATIC | Try to link static ffmpeg libraries | OFF |
|
||||
| SSP_STATIC | Try to link static gcc stack protector library (gcc only) | OFF except Win32 |
|
||||
| OPENAL_STATIC | Try to link static OpenAL libraries | OFF |
|
||||
| SSP_STATIC | Link gcc stack protecter libssp statically (gcc, with ENABLE_SSP) | OFF |
|
||||
| TRANSLATIONS_ONLY | Build only the translations.zip and nothing else | OFF |
|
||||
| `ENABLE_SDL` | Build the SDL port | OFF |
|
||||
| `ENABLE_WX` | Build the wxWidgets port | ON |
|
||||
| `ENABLE_DEBUGGER` | Enable the debugger | ON |
|
||||
| `ENABLE_ASM_CORE` | Enable x86 ASM CPU cores (**BUGGY AND DANGEROUS**) | OFF |
|
||||
| `ENABLE_ASM` | Enable the following two ASM options | ON for 32 bit builds |
|
||||
| `ENABLE_ASM_SCALERS` | Enable x86 ASM graphic filters | ON for 32 bit builds |
|
||||
| `ENABLE_MMX` | Enable MMX | ON for 32 bit builds |
|
||||
| `ENABLE_LINK` | Enable GBA linking functionality (requires SFML) | AUTO |
|
||||
| `ENABLE_LIRC` | Enable LIRC support | OFF |
|
||||
| `ENABLE_FFMPEG` | Enable ffmpeg A/V recording | AUTO |
|
||||
| `ENABLE_ONLINEUPDATES` | Enable online update checks | ON |
|
||||
| `ENABLE_LTO` | Compile with Link Time Optimization (gcc and clang only) | ON for release build |
|
||||
| `ENABLE_GBA_LOGGING` | Enable extended GBA logging | ON |
|
||||
| `ENABLE_XAUDIO2` | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
|
||||
| `ENABLE_FAUDIO` | Enable faudio sound output for wxWidgets, | ON, not 32 bit Win |
|
||||
| `ENABLE_ASAN` | Enable libasan sanitizers (by default address, only in debug mode) | OFF |
|
||||
| `UPSTREAM_RELEASE` | Do some release tasks, like codesigning, making zip and gpg sigs. | OFF |
|
||||
| `BUILD_TESTING` | Build the tests and enable ctest support. | ON |
|
||||
| `VBAM_STATIC` | Try link all libs statically (the following are set to ON if ON) | OFF |
|
||||
| `SDL2_STATIC` | Try to link static SDL2 libraries | OFF |
|
||||
| `SFML_STATIC_LIBRARIES` | Try to link static SFML libraries | OFF |
|
||||
| `FFMPEG_STATIC` | Try to link static ffmpeg libraries | OFF |
|
||||
| `OPENAL_STATIC` | Try to link static OpenAL libraries | OFF |
|
||||
| `TRANSLATIONS_ONLY` | Build only the translations.zip and nothing else | OFF |
|
||||
|
||||
Note for distro packagers, we use the CMake module
|
||||
[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs)
|
||||
|
@ -241,52 +237,6 @@ On Unix to use a different version of wxWidgets, set
|
|||
`wxWidgets_CONFIG_EXECUTABLE` to the path to the `wx-config` script you want to
|
||||
use.
|
||||
|
||||
## MSys2 Notes
|
||||
|
||||
To run the resulting binary, you can simply type:
|
||||
|
||||
```shell
|
||||
./visualboyadvance-m
|
||||
```
|
||||
|
||||
in the shell where you built it.
|
||||
|
||||
If you built with `-DCMAKE_BUILD_TYPE=Debug`, you will get a console app and
|
||||
will see debug messages, even in mintty.
|
||||
|
||||
If you want to start the binary from e.g. a shortcut or Explorer, you will need
|
||||
to put `c:\msys64\mingw32\bin` for 32 bit builds and `c:\msys64\mingw64\bin`
|
||||
for 64 bit builds in your PATH (to edit system PATH, go to Control Panel ->
|
||||
System -> Advanced system settings -> Environment Variables.)
|
||||
|
||||
If you want to package the binary, you will need to include the MinGW DLLs it
|
||||
depends on, they can install to the same directory as the binary.
|
||||
|
||||
Our own builds are static.
|
||||
|
||||
## Debug Messages
|
||||
|
||||
We have an override for `wxLogDebug()` to make it work even in non-debug builds
|
||||
of wx and on windows, even in mintty.
|
||||
|
||||
It works like `printf()`, e.g.:
|
||||
|
||||
```cpp
|
||||
int foo = 42;
|
||||
wxLogDebug(wxT("the value of foo = %d"), foo);
|
||||
```
|
||||
|
||||
From the core etc. the usual:
|
||||
|
||||
```cpp
|
||||
fprintf(stderr, "...", ...);
|
||||
```
|
||||
|
||||
will work fine.
|
||||
|
||||
You need a debug build for this to work or to even have a console on Windows.
|
||||
Pass `-DCMAKE_BUILD_TYPE=Debug` to cmake.
|
||||
|
||||
## Reporting Crash Bugs
|
||||
|
||||
If the emulator crashes and you wish to report the bug, a backtrace made with
|
||||
|
@ -305,27 +255,25 @@ do something such as:
|
|||
```shell
|
||||
ulimit -c unlimited
|
||||
```
|
||||
|
||||
in your shell to enable coredump files.
|
||||
, in your shell to enable core files.
|
||||
|
||||
[This
|
||||
post](https://ask.fedoraproject.org/en/question/98776/where-is-core-dump-located/?answer=98779#post-id-98779)
|
||||
explains how to retrieve core dump on Fedora Linux (and possibly other
|
||||
distributions.)
|
||||
explains how to retrieve core dump on some distributions, when they are managed
|
||||
by systemd.
|
||||
|
||||
Once you have the core dump file, open it with `gdb`, for example:
|
||||
Once you have the core file, open it with `gdb`, for example:
|
||||
|
||||
```shell
|
||||
gdb -c core ./visualboyadvance-m
|
||||
```
|
||||
|
||||
In the `gdb` shell, to print the backtrace, type:
|
||||
. In the `gdb` shell, to start the process and print the backtrace, type:
|
||||
|
||||
```
|
||||
run
|
||||
bt
|
||||
```
|
||||
|
||||
This may be a bit of a hassle, but it helps us out immensely.
|
||||
. This may be a bit of a hassle, but it helps us out immensely.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -21,3 +21,32 @@ linkage:
|
|||
short: Shared
|
||||
long: Create shared libraries/DLLs
|
||||
linkage: shared
|
||||
|
||||
useLink:
|
||||
default: withlink
|
||||
choices:
|
||||
withlink:
|
||||
short: WithLink
|
||||
long: Enable the Link feature
|
||||
settings:
|
||||
ENABLE_LINK: ON
|
||||
nolink:
|
||||
short: NoLink
|
||||
long: Disable the Link feature
|
||||
settings:
|
||||
ENABLE_LINK: OFF
|
||||
|
||||
useDebugger:
|
||||
default: withdebugger
|
||||
choices:
|
||||
withdebugger:
|
||||
short: WithDebugger
|
||||
long: Enable the Debugger feature
|
||||
settings:
|
||||
ENABLE_DEBUGGER: ON
|
||||
nodebugger:
|
||||
short: NoDebugger
|
||||
long: Disable the Debugger feature
|
||||
settings:
|
||||
ENABLE_DEBUGGER: OFF
|
||||
ENABLE_SDL: OFF
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYSTEM_PROCESSOR)
|
||||
if(NOT CMAKE_TOOLCHAIN_FILE AND CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
|
@ -52,9 +56,11 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
|
|||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
|
||||
set(ARM32 ON)
|
||||
set(ARCH_NAME arm32)
|
||||
set(WINARCH arm)
|
||||
elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(ARM64 ON)
|
||||
set(ARCH_NAME arm64)
|
||||
set(WINARCH arm64)
|
||||
endif()
|
||||
|
@ -63,3 +69,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
|
|||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# We do not support amd64 asm yet
|
||||
if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX))
|
||||
message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.")
|
||||
endif()
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# support for the nasm assembler
|
||||
|
||||
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm)
|
||||
|
||||
if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
|
||||
if(WIN32)
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
|
||||
else()
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_ASM_NASM_COMPILER} -v COMMAND awk "{print \$3}" OUTPUT_VARIABLE NASM_VERSION)
|
||||
IF(NASM_VERSION VERSION_LESS 2.0)
|
||||
IF(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
MESSAGE(FATAL_ERROR "Your nasm is too old to support AMD64, please install nasm from Homebrew or MacPorts.")
|
||||
ENDIF()
|
||||
SET(CMAKE_ASM_NAMS_OBJECT_FORMAT macho)
|
||||
ELSE()
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
|
||||
else()
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho32)
|
||||
endif()
|
||||
ENDIF()
|
||||
else()
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
|
||||
else()
|
||||
SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf32)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <DEFINES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
|
||||
|
||||
# Load the generic ASMInformation file:
|
||||
set(ASM_DIALECT "_NASM")
|
||||
include(CMakeASMInformation)
|
||||
set(ASM_DIALECT)
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
|
||||
|
||||
SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm)
|
||||
|
||||
IF(NOT CMAKE_ASM_NASM_COMPILER)
|
||||
FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm
|
||||
"$ENV{ProgramFiles}/NASM")
|
||||
ENDIF(NOT CMAKE_ASM_NASM_COMPILER)
|
||||
|
||||
# Load the generic DetermineASM compiler file with the DIALECT set properly:
|
||||
SET(ASM_DIALECT "_NASM")
|
||||
INCLUDE(CMakeDetermineASMCompiler)
|
||||
SET(ASM_DIALECT)
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that the selected ASM_NASM "compiler" works.
|
||||
# For assembler this can only check whether the compiler has been found,
|
||||
# because otherwise there would have to be a separate assembler source file
|
||||
# for each assembler on every architecture.
|
||||
|
||||
SET(ASM_DIALECT "_NASM")
|
||||
INCLUDE(CMakeTestASMCompiler)
|
||||
SET(ASM_DIALECT)
|
|
@ -0,0 +1,122 @@
|
|||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Look for some dependencies using CMake scripts
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||
set(OpenGL_GL_PREFERENCE LEGACY)
|
||||
endif()
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
# Add libsamplerate to SDL2 with vcpkg
|
||||
unset(SDL2_LIBRARY_TEMP)
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||
if(WIN32)
|
||||
unset(arch_suffix)
|
||||
unset(path_prefix)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES -static)
|
||||
set(arch_suffix -static)
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(path_prefix debug)
|
||||
endif()
|
||||
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix})
|
||||
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib)
|
||||
else()
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(VBAM_STATIC)
|
||||
set(VBAM_SDL2_LIBS SDL2::SDL2-static ${SDL2_LIBRARY_TEMP})
|
||||
else()
|
||||
set(VBAM_SDL2_LIBS SDL2::SDL2 ${SDL2_LIBRARY_TEMP})
|
||||
endif()
|
||||
|
||||
if(ENABLE_FFMPEG)
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
message(FATAL_ERROR "ENABLE_FFMPEG was specified, but required versions of ffmpeg libraries cannot be found!")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices")
|
||||
|
||||
if(UPSTREAM_RELEASE)
|
||||
list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid)
|
||||
list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS})
|
||||
|
||||
if(MSYS AND VBAM_STATIC)
|
||||
foreach(lib tiff jbig lzma)
|
||||
cygpath(lib "$ENV{MSYSTEM_PREFIX}/lib/lib${lib}.a")
|
||||
|
||||
list(APPEND FFMPEG_LIBRARIES "${lib}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LINK)
|
||||
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
|
||||
if(NOT WIN32)
|
||||
find_library(RT_LIB rt)
|
||||
if(RT_LIB)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB})
|
||||
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
||||
if(SEM_TIMEDWAIT)
|
||||
add_compile_definitions(HAVE_SEM_TIMEDWAIT)
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_LINK)
|
||||
endif()
|
||||
|
||||
# for now, only GBALink.cpp uses gettext() directly
|
||||
if(APPLE)
|
||||
# use Homebrew gettext if available
|
||||
if(EXISTS "/usr/local/opt/gettext")
|
||||
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/opt/gettext/include")
|
||||
set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/opt/gettext/lib")
|
||||
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_LINK OR ENABLE_WX)
|
||||
find_path(LIBINTL_INC libintl.h)
|
||||
find_library(LIBINTL_LIB NAMES libintl intl)
|
||||
find_library(LIBICONV_LIB NAMES libiconv iconv)
|
||||
find_library(LIBCHARSET_LIB NAMES libcharset charset)
|
||||
if(LIBINTL_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBINTL_LIB})
|
||||
endif()
|
||||
if(LIBICONV_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBICONV_LIB})
|
||||
endif()
|
||||
if(LIBCHARSET_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBCHARSET_LIB})
|
||||
endif()
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(gettext GETTEXT_FN)
|
||||
if(NOT (LIBINTL_INC OR GETTEXT_FN))
|
||||
message(FATAL_ERROR "NLS requires libintl/gettext")
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -1,231 +1,232 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindGettext
|
||||
# -----------
|
||||
#
|
||||
# Find GNU gettext tools
|
||||
#
|
||||
# This module looks for the GNU gettext tools. This module defines the
|
||||
# following values:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
|
||||
# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
|
||||
# GETTEXT_FOUND: True if gettext has been found.
|
||||
# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
|
||||
#
|
||||
#
|
||||
#
|
||||
# Additionally it provides the following macros:
|
||||
#
|
||||
# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# This will create a target "translations" which will convert the
|
||||
# given input po files into the binary output mo file. If the
|
||||
# ALL option is used, the translations will also be created when
|
||||
# building the default target.
|
||||
#
|
||||
# GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
|
||||
# LANGUAGES <lang1> <lang2> ... )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# Process the given pot file to mo files.
|
||||
# If INSTALL_DESTINATION is given then automatically install rules will
|
||||
# be created, the language subdirectory will be taken into account
|
||||
# (by default use share/locale/).
|
||||
# If ALL is specified, the pot file is processed when building the all traget.
|
||||
# It creates a custom target "potfile".
|
||||
#
|
||||
# GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
|
||||
# PO_FILES <po1> <po2> ... )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# Process the given po files to mo files for the given language.
|
||||
# If INSTALL_DESTINATION is given then automatically install rules will
|
||||
# be created, the language subdirectory will be taken into account
|
||||
# (by default use share/locale/).
|
||||
# If ALL is specified, the po files are processed when building the all traget.
|
||||
# It creates a custom target "pofiles".
|
||||
#
|
||||
# .. note::
|
||||
# If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
|
||||
#[=======================================================================[.rst:
|
||||
FindGettext
|
||||
-----------
|
||||
|
||||
Find GNU gettext tools
|
||||
|
||||
This module looks for the GNU gettext tools. This module defines the
|
||||
following values:
|
||||
|
||||
::
|
||||
|
||||
GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
|
||||
GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
|
||||
GETTEXT_FOUND: True if gettext has been found.
|
||||
GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
|
||||
|
||||
|
||||
|
||||
Additionally it provides the following macros:
|
||||
|
||||
GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
|
||||
|
||||
::
|
||||
|
||||
This will create a target "translations" which will convert the
|
||||
given input po files into the binary output mo file. If the
|
||||
ALL option is used, the translations will also be created when
|
||||
building the default target.
|
||||
|
||||
GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
|
||||
LANGUAGES <lang1> <lang2> ... )
|
||||
|
||||
::
|
||||
|
||||
Process the given pot file to mo files.
|
||||
If INSTALL_DESTINATION is given then automatically install rules will
|
||||
be created, the language subdirectory will be taken into account
|
||||
(by default use share/locale/).
|
||||
If ALL is specified, the pot file is processed when building the all target.
|
||||
It creates a custom target "potfile".
|
||||
|
||||
GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
|
||||
PO_FILES <po1> <po2> ... )
|
||||
|
||||
::
|
||||
|
||||
Process the given po files to mo files for the given language.
|
||||
If INSTALL_DESTINATION is given then automatically install rules will
|
||||
be created, the language subdirectory will be taken into account
|
||||
(by default use share/locale/).
|
||||
If ALL is specified, the po files are processed when building the all target.
|
||||
It creates a custom target "pofiles".
|
||||
|
||||
.. versionadded:: 3.2
|
||||
If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
|
||||
#]=======================================================================]
|
||||
|
||||
find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
|
||||
|
||||
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
|
||||
|
||||
if(GETTEXT_MSGMERGE_EXECUTABLE)
|
||||
execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
|
||||
execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE gettext_version
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
get_filename_component(msgmerge_name ${GETTEXT_MSGMERGE_EXECUTABLE} NAME)
|
||||
get_filename_component(msgmerge_namewe ${GETTEXT_MSGMERGE_EXECUTABLE} NAME_WE)
|
||||
if (gettext_version MATCHES "^(${msgmerge_name}|${msgmerge_namewe}) \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
|
||||
set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
unset(gettext_version)
|
||||
unset(msgmerge_name)
|
||||
unset(msgmerge_namewe)
|
||||
get_filename_component(msgmerge_name ${GETTEXT_MSGMERGE_EXECUTABLE} NAME)
|
||||
get_filename_component(msgmerge_namewe ${GETTEXT_MSGMERGE_EXECUTABLE} NAME_WE)
|
||||
if (gettext_version MATCHES "^(${msgmerge_name}|${msgmerge_namewe}) \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
|
||||
set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
unset(gettext_version)
|
||||
unset(msgmerge_name)
|
||||
unset(msgmerge_namewe)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
|
||||
REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
|
||||
VERSION_VAR GETTEXT_VERSION_STRING)
|
||||
|
||||
function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
|
||||
set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
|
||||
get_property(currentCounter GLOBAL PROPERTY "${propertyName}")
|
||||
if(NOT currentCounter)
|
||||
set(currentCounter 1)
|
||||
endif()
|
||||
set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
|
||||
math(EXPR currentCounter "${currentCounter} + 1")
|
||||
set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
|
||||
set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
|
||||
get_property(currentCounter GLOBAL PROPERTY "${propertyName}")
|
||||
if(NOT currentCounter)
|
||||
set(currentCounter 1)
|
||||
endif()
|
||||
set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
|
||||
math(EXPR currentCounter "${currentCounter} + 1")
|
||||
set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
|
||||
endfunction()
|
||||
|
||||
macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
|
||||
# make it a real variable, so we can modify it here
|
||||
set(_firstPoFile "${_firstPoFileArg}")
|
||||
# make it a real variable, so we can modify it here
|
||||
set(_firstPoFile "${_firstPoFileArg}")
|
||||
|
||||
set(_gmoFiles)
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
set(_gmoFiles)
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
|
||||
set(_addToAll)
|
||||
if(${_firstPoFile} STREQUAL "ALL")
|
||||
set(_addToAll "ALL")
|
||||
set(_firstPoFile)
|
||||
endif()
|
||||
set(_addToAll)
|
||||
if(${_firstPoFile} STREQUAL "ALL")
|
||||
set(_addToAll "ALL")
|
||||
set(_firstPoFile)
|
||||
endif()
|
||||
|
||||
foreach (_currentPoFile ${_firstPoFile} ${ARGN})
|
||||
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
|
||||
get_filename_component(_abs_PATH ${_absFile} PATH)
|
||||
string(REGEX REPLACE "^.*/([^/]+)(\\.[^.]+)$" "\\1" _lang ${_absFile})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
foreach (_currentPoFile ${_firstPoFile} ${ARGN})
|
||||
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
|
||||
get_filename_component(_abs_PATH ${_absFile} PATH)
|
||||
get_filename_component(_lang ${_absFile} NAME_WE)
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_gmoFile}
|
||||
#COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
||||
DEPENDS ${_absPotFile} ${_absFile}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${_gmoFile}
|
||||
# COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
||||
DEPENDS ${_absPotFile} ${_absFile}
|
||||
)
|
||||
|
||||
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
|
||||
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
|
||||
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
|
||||
if(NOT TARGET translations)
|
||||
add_custom_target(translations)
|
||||
endif()
|
||||
if(NOT TARGET translations)
|
||||
add_custom_target(translations)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
|
||||
|
||||
add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
|
||||
add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
|
||||
|
||||
add_dependencies(translations ${uniqueTargetName})
|
||||
|
||||
add_dependencies(translations ${uniqueTargetName})
|
||||
endmacro()
|
||||
|
||||
|
||||
function(GETTEXT_PROCESS_POT_FILE _potFile)
|
||||
set(_gmoFiles)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs LANGUAGES)
|
||||
set(_gmoFiles)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs LANGUAGES)
|
||||
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
|
||||
foreach (_lang ${_parsedArguments_LANGUAGES})
|
||||
set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po")
|
||||
set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo")
|
||||
foreach (_lang ${_parsedArguments_LANGUAGES})
|
||||
set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po")
|
||||
set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_poFile}"
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile}
|
||||
DEPENDS ${_absPotFile}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${_poFile}"
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile}
|
||||
DEPENDS ${_absPotFile}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_gmoFile}"
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
|
||||
DEPENDS ${_absPotFile} ${_poFile}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${_gmoFile}"
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
|
||||
DEPENDS ${_absPotFile} ${_poFile}
|
||||
)
|
||||
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach ()
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach ()
|
||||
|
||||
if(NOT TARGET potfiles)
|
||||
add_custom_target(potfiles)
|
||||
add_custom_target(potfiles)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName)
|
||||
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
|
||||
add_dependencies(potfiles ${uniqueTargetName})
|
||||
add_dependencies(potfiles ${uniqueTargetName})
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
function(GETTEXT_PROCESS_PO_FILES _lang)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs PO_FILES)
|
||||
set(_gmoFiles)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs PO_FILES)
|
||||
set(_gmoFiles)
|
||||
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
|
||||
get_filename_component(_name ${_current_PO_FILE} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
|
||||
add_custom_command(OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
|
||||
get_filename_component(_name ${_current_PO_FILE} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
|
||||
add_custom_command(OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach()
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach()
|
||||
|
||||
|
||||
if(NOT TARGET pofiles)
|
||||
add_custom_target(pofiles)
|
||||
add_custom_target(pofiles)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
|
||||
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
|
||||
add_dependencies(pofiles ${uniqueTargetName})
|
||||
add_dependencies(pofiles ${uniqueTargetName})
|
||||
|
||||
endfunction()
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
#.rst:
|
||||
# FindOpenAL
|
||||
# ----------
|
||||
#
|
||||
#
|
||||
#
|
||||
# Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
|
||||
# false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
|
||||
# the headers
|
||||
#
|
||||
# $OPENALDIR is an environment variable that would correspond to the
|
||||
# ./configure --prefix=$OPENALDIR used in building OpenAL.
|
||||
#
|
||||
# Created by Eric Wing. This was influenced by the FindSDL.cmake
|
||||
# module.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This makes the presumption that you are include al.h like
|
||||
# #include "al.h"
|
||||
# and not
|
||||
# #include <AL/al.h>
|
||||
# The reason for this is that the latter is not entirely portable.
|
||||
# Windows/Creative Labs does not by default put their headers in AL/ and
|
||||
# OS X uses the convention <OpenAL/al.h>.
|
||||
#
|
||||
# For Windows, Creative Labs seems to have added a registry key for their
|
||||
# OpenAL 1.1 installer. I have added that key to the list of search paths,
|
||||
# however, the key looks like it could be a little fragile depending on
|
||||
# if they decide to change the 1.00.0000 number for bug fix releases.
|
||||
# Also, they seem to have laid down groundwork for multiple library platforms
|
||||
# which puts the library in an extra subdirectory. Currently there is only
|
||||
# Win32 and I have hardcoded that here. This may need to be adjusted as
|
||||
# platforms are introduced.
|
||||
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
|
||||
# I do not know if the Nvidia OpenAL SDK has a registry key.
|
||||
#
|
||||
# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
|
||||
# To support the framework, I originally wrote special framework detection
|
||||
# code in this module which I have now removed with CMake's introduction
|
||||
# of native support for frameworks.
|
||||
# In addition, OpenAL is open source, and it is possible to compile on Panther.
|
||||
# Furthermore, due to bugs in the initial OpenAL release, and the
|
||||
# transition to OpenAL 1.1, it is common to need to override the built-in
|
||||
# framework.
|
||||
# Per my request, CMake should search for frameworks first in
|
||||
# the following order:
|
||||
# ~/Library/Frameworks/OpenAL.framework/Headers
|
||||
# /Library/Frameworks/OpenAL.framework/Headers
|
||||
# /System/Library/Frameworks/OpenAL.framework/Headers
|
||||
#
|
||||
# On OS X, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of
|
||||
# OPENAL_LIBRARY to override this selection or set the CMake environment
|
||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
|
||||
find_path(OPENAL_INCLUDE_DIR al.h
|
||||
HINTS
|
||||
ENV OPENALDIR
|
||||
PATH_SUFFIXES AL OpenAL
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_OpenAL_ARCH_DIR libs/Win64)
|
||||
else()
|
||||
set(_OpenAL_ARCH_DIR libs/Win32)
|
||||
endif()
|
||||
|
||||
find_library(OPENAL_LIBRARY
|
||||
NAMES OpenAL al openal OpenAL32
|
||||
HINTS
|
||||
ENV OPENALDIR
|
||||
PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
|
||||
)
|
||||
|
||||
unset(_OpenAL_ARCH_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
|
|
@ -1,263 +0,0 @@
|
|||
# This module defines
|
||||
# SDL2_LIBRARY, the name of the library to link against
|
||||
# SDL2_FOUND, if false, do not try to link to SDL2
|
||||
# SDL2_INCLUDE_DIR, where to find SDL.h
|
||||
#
|
||||
# If you have pkg-config, these extra variables are also defined:
|
||||
# SDL2_DEFINITIONS, extra CFLAGS
|
||||
# SDL2_EXTRA_LIBS, extra link libs
|
||||
# SDL2_LINKER_FLAGS, extra link flags
|
||||
#
|
||||
# The latter two are automatically added to SDL2_LIBRARY
|
||||
#
|
||||
# To use them, add code such as:
|
||||
#
|
||||
# # SET(SDL2_STATIC ON) # if you want to link SDL2 statically
|
||||
# FIND_PACKAGE(SDL2 REQUIRED)
|
||||
# ADD_DEFINITIONS(${SDL2_DEFINITIONS})
|
||||
# TARGET_LINK_LIBRARIES(your-executable-target ${SDL2_LIBRARY} ...)
|
||||
#
|
||||
# This module responds to the the flag:
|
||||
# SDL2_BUILDING_LIBRARY
|
||||
# If this is defined, then no SDL2main will be linked in because
|
||||
# only applications need main().
|
||||
# Otherwise, it is assumed you are building an application and this
|
||||
# module will attempt to locate and set the the proper link flags
|
||||
# as part of the returned SDL2_LIBRARY variable.
|
||||
#
|
||||
# If you want to link SDL2 statically, set SDL2_STATIC to ON.
|
||||
#
|
||||
# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||
# OS X framework based version. (Other versions link to -lSDL2main which
|
||||
# this module will try to find on your behalf.) Also for OS X, this
|
||||
# module will automatically add the -framework Cocoa on your behalf.
|
||||
#
|
||||
#
|
||||
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
|
||||
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
|
||||
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
|
||||
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
|
||||
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
|
||||
# as appropriate. These values are used to generate the final SDL2_LIBRARY
|
||||
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
|
||||
#
|
||||
#
|
||||
# $SDL2DIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$SDL2DIR
|
||||
# used in building SDL2.
|
||||
# l.e.galup 9-20-02
|
||||
#
|
||||
# Modified by Eric Wing.
|
||||
# Added code to assist with automated building by using environmental variables
|
||||
# and providing a more controlled/consistent search behavior.
|
||||
# Added new modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
# Also corrected the header search path to follow "proper" SDL guidelines.
|
||||
# Added a search for SDL2main which is needed by some platforms.
|
||||
# Added a search for threads which is needed by some platforms.
|
||||
# Added needed compile switches for MinGW.
|
||||
#
|
||||
# On OSX, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of
|
||||
# SDL2_LIBRARY to override this selection or set the CMake environment
|
||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
#
|
||||
# Note that the header path has changed from SDL3/SDL.h to just SDL.h
|
||||
# This needed to change because "proper" SDL convention
|
||||
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
|
||||
# reasons because not all systems place things in SDL2/ (see FreeBSD).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2003-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
SET(SDL2_SEARCH_PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local # Mac Homebrew and local installs
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # MacPorts
|
||||
/opt/csw # OpenCSW (Solaris)
|
||||
/opt
|
||||
${SDL2_PATH}/include
|
||||
${SDL2_PATH}/lib
|
||||
)
|
||||
|
||||
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
|
||||
HINTS $ENV{SDL2DIR}
|
||||
PATH_SUFFIXES SDL2
|
||||
PATHS ${SDL2_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
SET(CURRENT_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
if(SDL2_STATIC)
|
||||
if(MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(lib_suffixes)
|
||||
if(MSVC)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-static$")
|
||||
list(APPEND lib_suffixes -static)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
|
||||
list(APPEND lib_suffixes d)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Calculate combination of possible name+suffixes.
|
||||
unset(names)
|
||||
set(lib_name SDL2)
|
||||
set(current ${lib_name})
|
||||
foreach(suffix ${lib_suffixes})
|
||||
list(APPEND names "${current}${suffix}" "${lib_name}${suffix}")
|
||||
set(current "${current}${suffix}")
|
||||
endforeach()
|
||||
|
||||
# Fallback to name by itself.
|
||||
list(APPEND names ${lib_name})
|
||||
|
||||
FIND_LIBRARY(SDL2_LIBRARY_TEMP
|
||||
NAMES ${names}
|
||||
HINTS $ENV{SDL2DIR}
|
||||
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
|
||||
PATHS ${SDL2_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
if(NOT (SDL2_BUILDING_LIBRARY OR ${SDL2_INCLUDE_DIR} MATCHES ".framework"))
|
||||
# Non-OS X framework versions expect you to also dynamically link to
|
||||
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||
# seem to provide SDL2main for compatibility even though they don't
|
||||
# necessarily need it.
|
||||
find_library(SDL2MAIN_LIBRARY
|
||||
NAMES SDL2main${lib_suffix}
|
||||
HINTS $ENV{SDL2DIR}
|
||||
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
|
||||
PATHS ${SDL2_SEARCH_PATHS}
|
||||
)
|
||||
endif()
|
||||
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CURRENT_FIND_LIBRARY_SUFFIXES})
|
||||
UNSET(CURRENT_FIND_LIBRARY_SUFFIXES)
|
||||
|
||||
# SDL2 may require threads on your system.
|
||||
# The Apple build may not need an explicit flag because one of the
|
||||
# frameworks may already provide it.
|
||||
# But for non-OSX systems, I will use the CMake Threads package.
|
||||
IF(NOT APPLE)
|
||||
FIND_PACKAGE(Threads)
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# MinGW needs an additional link flag, -mwindows (to make a GUI app)
|
||||
# but we only add it when not making a Debug build.
|
||||
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
IF(MINGW)
|
||||
SET(MINGW32_LIBRARY -lmingw32 CACHE STRING "MinGW library")
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
|
||||
SET(MINGW32_LIBRARY ${MINGW32_LIBRARY} -mwindows)
|
||||
ENDIF()
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(SDL2_LIBRARY_TEMP)
|
||||
# For SDL2main
|
||||
if(SDL2MAIN_LIBRARY AND NOT WIN32)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
endif()
|
||||
|
||||
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
|
||||
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||
# though it actually is there if I modify a pre-used variable.
|
||||
# I think it has something to do with the CACHE STRING.
|
||||
# So I use a temporary variable until the end so I can set the
|
||||
# "real" variable in one-shot.
|
||||
IF(APPLE)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||
ENDIF(APPLE)
|
||||
|
||||
# For threads, as mentioned Apple doesn't need this.
|
||||
# In fact, there seems to be a problem if I used the Threads package
|
||||
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||
IF(NOT APPLE)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# For MinGW library
|
||||
IF(MINGW)
|
||||
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP} -lversion -limm32)
|
||||
ENDIF(MINGW)
|
||||
|
||||
# Add libsamplerate with vcpkg
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||
if(WIN32)
|
||||
unset(arch_suffix)
|
||||
unset(path_prefix)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES -static)
|
||||
set(arch_suffix -static)
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
|
||||
set(path_prefix debug)
|
||||
endif()
|
||||
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix})
|
||||
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib)
|
||||
else()
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add some stuff from pkg-config, if available
|
||||
IF(NOT PKG_CONFIG_EXECUTABLE)
|
||||
FIND_PACKAGE(PkgConfig QUIET)
|
||||
ENDIF(NOT PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
IF(PKG_CONFIG_EXECUTABLE)
|
||||
# get any definitions
|
||||
EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE} --cflags-only-other sdl2 OUTPUT_VARIABLE SDL2_DEFINITIONS ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
SET(SDL2_DEFINITIONS ${SDL2_DEFINITIONS} CACHE STRING "Extra CFLAGS for SDL2 from pkg-config")
|
||||
|
||||
# get any extra stuff needed for linking
|
||||
IF(NOT SDL2_STATIC)
|
||||
EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE} --libs-only-other sdl2 OUTPUT_VARIABLE SDL2_LINKER_FLAGS_RAW ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE} --libs-only-l sdl2 OUTPUT_VARIABLE SDL2_EXTRA_LIBS_RAW ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
ELSE(NOT SDL2_STATIC)
|
||||
EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE} --static --libs-only-other sdl2 OUTPUT_VARIABLE SDL2_LINKER_FLAGS_RAW ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE} --static --libs-only-l sdl2 OUTPUT_VARIABLE SDL2_EXTRA_LIBS_RAW ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
ENDIF(NOT SDL2_STATIC)
|
||||
|
||||
STRING(REGEX REPLACE "[^ ]+SDL2[^ ]*" "" SDL2_EXTRA_LIBS_RAW2 "${SDL2_EXTRA_LIBS_RAW}")
|
||||
STRING(REGEX REPLACE " +" ";" SDL2_EXTRA_LIBS "${SDL2_EXTRA_LIBS_RAW2}")
|
||||
STRING(REGEX REPLACE " +" ";" SDL2_LINKER_FLAGS "${SDL2_LINKER_FLAGS_RAW}")
|
||||
|
||||
SET(SDL2_LINKER_FLAGS ${SDL2_LINKER_FLAGS} CACHE STRING "Linker flags for linking SDL2")
|
||||
SET(SDL2_EXTRA_LIBS ${SDL2_EXTRA_LIBS} CACHE STRING "Extra libraries for linking SDL2")
|
||||
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${SDL2_EXTRA_LIBS} ${SDL2_LINKER_FLAGS})
|
||||
ENDIF(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
# Set the final string here so the GUI reflects the final state.
|
||||
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
|
||||
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
|
||||
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
|
||||
ENDIF(SDL2_LIBRARY_TEMP)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
# define the SFML_STATIC macro if static build was chosen
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
add_definitions(-DSFML_STATIC)
|
||||
add_compile_definitions(SFML_STATIC)
|
||||
endif()
|
||||
|
||||
# define the list of search paths for headers and libraries
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
# FindSSP.cmake
|
||||
#
|
||||
# Find libssp necessary when using gcc with e.g. -fstack-protector=strong
|
||||
#
|
||||
# See: http://wiki.osdev.org/Stack_Smashing_Protector
|
||||
#
|
||||
# To use:
|
||||
#
|
||||
# put a copy into your <project_root>/cmake/
|
||||
#
|
||||
# In your main CMakeLists.txt do something like this:
|
||||
#
|
||||
# if(WIN32)
|
||||
# set(SSP_STATIC ON)
|
||||
# endif()
|
||||
#
|
||||
# find_package(SSP)
|
||||
#
|
||||
# if(SSP_LIBRARY)
|
||||
# set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${SSP_LIBRARY}")
|
||||
# set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${SSP_LIBRARY}")
|
||||
# endif()
|
||||
|
||||
# only do this when compiling with gcc/g++
|
||||
if(NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
return()
|
||||
endif()
|
||||
|
||||
function(FindSSP)
|
||||
if(NOT CMAKE_CXX_COMPILER AND CMAKE_C_COMPILER)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
|
||||
endif()
|
||||
|
||||
foreach(arg ${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_COMPILER_ARG2} ${CMAKE_CXX_COMPILER_ARG3} ${CMAKE_CXX_COMPILER_ARG4} ${CMAKE_CXX_COMPILER_ARG5} ${CMAKE_CXX_COMPILER_ARG6} ${CMAKE_CXX_COMPILER_ARG7} ${CMAKE_CXX_COMPILER_ARG8} ${CMAKE_CXX_COMPILER_ARG9})
|
||||
string(STRIP ${arg} arg)
|
||||
set(gcc_args "${gcc_args};${arg}")
|
||||
endforeach()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${gcc_args} --print-prog-name=gcc OUTPUT_VARIABLE GCC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(WIN32 AND NOT MSYS)
|
||||
execute_process(COMMAND where.exe ${GCC_EXECUTABLE} OUTPUT_VARIABLE GCC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else()
|
||||
execute_process(COMMAND sh -c "command -v ${GCC_EXECUTABLE}" OUTPUT_VARIABLE GCC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
get_filename_component(GCC_DIRNAME "${GCC_EXECUTABLE}" DIRECTORY)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${gcc_args} --print-libgcc-file-name OUTPUT_VARIABLE LIBGCC_FILE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
get_filename_component(LIBGCC_DIRNAME "${LIBGCC_FILE}" DIRECTORY)
|
||||
|
||||
set(SSP_SEARCH_PATHS ${GCC_DIRNAME} ${LIBGCC_DIRNAME})
|
||||
|
||||
if(SSP_STATIC)
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_library(SSP_LIBRARY
|
||||
NAMES ssp libssp
|
||||
HINTS ${SSP_SEARCH_PATHS}
|
||||
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
|
||||
)
|
||||
|
||||
set(SSP_LIBRARY PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
FindSSP()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(SSP REQUIRED_VARS SSP_LIBRARY)
|
|
@ -7,23 +7,6 @@
|
|||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
|
@ -85,84 +68,3 @@ function(get_git_head_revision _refspecvar _hashvar)
|
|||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var} "CLEAN" PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var} "DIRTY" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
|
@ -3,7 +3,6 @@ function(git_version version revision version_release)
|
|||
set(${revision} "" CACHE STRING "Latest Git Tag Revision" FORCE)
|
||||
set(${version_release} 0 CACHE STRING "Is this a versioned release without revision" FORCE)
|
||||
|
||||
find_package(Git)
|
||||
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
# get latest version from tag history
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" tag "--format=%(align:width=20)%(refname:short)%(end)%(if)%(*objectname)%(then)%(*objectname)%(else)%(objectname)%(end)" --sort=-v:refname OUTPUT_VARIABLE tags OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
function(use_llvm_toolchain)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL Clang)
|
||||
set(compiler "${CMAKE_C_COMPILER}")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set(compiler "${CMAKE_CXX_COMPILER}")
|
||||
else()
|
||||
return()
|
||||
endif()
|
||||
|
||||
foreach(tool ar ranlib ld nm objdump as)
|
||||
execute_process(
|
||||
COMMAND "${compiler}" -print-prog-name=llvm-${tool}
|
||||
OUTPUT_VARIABLE prog_path
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# for FreeBSD
|
||||
if(NOT prog_path MATCHES "^/")
|
||||
get_filename_component(
|
||||
abs_path ${prog_path} ABSOLUTE
|
||||
BASE_DIR /usr/local/llvm-devel/bin
|
||||
)
|
||||
|
||||
if(EXISTS ${abs_path})
|
||||
set(prog_path ${abs_path})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(prog_path MATCHES "^/")
|
||||
if(tool STREQUAL ld)
|
||||
set(tool linker)
|
||||
elseif(tool STREQUAL as)
|
||||
set(tool asm_compiler)
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${tool} utool)
|
||||
|
||||
set(CMAKE_${utool} "${prog_path}" PARENT_SCOPE)
|
||||
set(CMAKE_${utool} "${prog_path}" CACHE FILEPATH "${tool}" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
use_llvm_toolchain()
|
|
@ -11,8 +11,8 @@
|
|||
# In addition, the following commands are called with the package manager's
|
||||
# paths:
|
||||
#
|
||||
# INCLUDE_DIRECTORIES()
|
||||
# LINK_DIRECTORIES()
|
||||
# include_directories()
|
||||
# link_directories()
|
||||
#
|
||||
# The paths of package managers not currently in $ENV{PATH} are added to
|
||||
# CMAKE_IGNORE_PATH .
|
||||
|
@ -41,68 +41,75 @@
|
|||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
IF(NOT APPLE)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
if(NOT APPLE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
IF(EXISTS /usr/local/bin/brew AND $ENV{PATH} MATCHES "(^|:)/usr/local/bin/?(:|$)")
|
||||
MESSAGE("-- Configuring for Mac Homebrew")
|
||||
if(NOT "$ENV{IN_NIX_SHELL}" STREQUAL "")
|
||||
message(STATUS "Configuring for Nix")
|
||||
|
||||
SET(MAC_HOMEBREW ON)
|
||||
set(NIX ON)
|
||||
|
||||
SET(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
SET(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
elseif(EXISTS /usr/local/bin/brew AND $ENV{PATH} MATCHES "(^|:)/usr/local/bin/?(:|$)")
|
||||
message(STATUS "Configuring for Mac Homebrew")
|
||||
|
||||
SET(CMAKE_FRAMEWORK_PATH /usr/local/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
set(MAC_HOMEBREW ON)
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH /usr/local/include ${CMAKE_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES("/usr/local/include")
|
||||
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
|
||||
SET(CMAKE_LIBRARY_PATH /usr/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
LINK_DIRECTORIES("/usr/local/lib")
|
||||
set(CMAKE_FRAMEWORK_PATH /usr/local/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
|
||||
SET(CMAKE_PROGRAM_PATH /usr/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
set(CMAKE_INCLUDE_PATH /usr/local/include ${CMAKE_INCLUDE_PATH})
|
||||
include_directories("/usr/local/include")
|
||||
|
||||
set(CMAKE_LIBRARY_PATH /usr/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
link_directories("/usr/local/lib")
|
||||
|
||||
set(CMAKE_PROGRAM_PATH /usr/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
|
||||
set(ZLIB_ROOT /usr/local/opt/zlib)
|
||||
ELSEIF(EXISTS /opt/local/bin/port AND $ENV{PATH} MATCHES "(^|:)/opt/local/bin/?(:|$)")
|
||||
MESSAGE("-- Configuring for MacPorts")
|
||||
elseif(EXISTS /opt/local/bin/port AND $ENV{PATH} MATCHES "(^|:)/opt/local/bin/?(:|$)")
|
||||
message(STATUS "Configuring for MacPorts")
|
||||
|
||||
SET(MACPORTS ON)
|
||||
set(MACPORTS ON)
|
||||
|
||||
SET(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
|
||||
SET(CMAKE_FRAMEWORK_PATH /opt/local/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
set(CMAKE_FRAMEWORK_PATH /opt/local/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES("/opt/local/include")
|
||||
set(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
|
||||
include_directories("/opt/local/include")
|
||||
|
||||
SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
LINK_DIRECTORIES("/opt/local/lib")
|
||||
set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
link_directories("/opt/local/lib")
|
||||
|
||||
SET(CMAKE_PROGRAM_PATH /opt/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
ELSEIF(EXISTS /sw/bin/fink AND $ENV{PATH} MATCHES "(^|:)/sw/bin/?(:|$)")
|
||||
MESSAGE("-- Configuring for Fink")
|
||||
set(CMAKE_PROGRAM_PATH /opt/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
elseif(EXISTS /sw/bin/fink AND $ENV{PATH} MATCHES "(^|:)/sw/bin/?(:|$)")
|
||||
message(STATUS "Configuring for Fink")
|
||||
|
||||
SET(FINK ON)
|
||||
set(FINK ON)
|
||||
|
||||
SET(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
|
||||
SET(CMAKE_FRAMEWORK_PATH /sw/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
set(CMAKE_FRAMEWORK_PATH /sw/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH /sw/include ${CMAKE_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES("/sw/include")
|
||||
set(CMAKE_INCLUDE_PATH /sw/include ${CMAKE_INCLUDE_PATH})
|
||||
include_directories("/sw/include")
|
||||
|
||||
SET(CMAKE_LIBRARY_PATH /sw/lib ${CMAKE_LIBRARY_PATH})
|
||||
LINK_DIRECTORIES("/sw/lib")
|
||||
set(CMAKE_LIBRARY_PATH /sw/lib ${CMAKE_LIBRARY_PATH})
|
||||
link_directories("/sw/lib")
|
||||
|
||||
SET(CMAKE_PROGRAM_PATH /sw/bin ${CMAKE_PROGRAM_PATH})
|
||||
ELSE()
|
||||
set(CMAKE_PROGRAM_PATH /sw/bin ${CMAKE_PROGRAM_PATH})
|
||||
else()
|
||||
# no package manager found or active, do nothing
|
||||
RETURN()
|
||||
ENDIF()
|
||||
return()
|
||||
endif()
|
||||
|
||||
# only ignore /usr/local if brew is installed and not in the PATH
|
||||
# in other cases, it is the user's personal installations
|
||||
IF(NOT MAC_HOMEBREW AND EXISTS /usr/local/bin/brew)
|
||||
SET(CMAKE_IGNORE_PATH /usr/local /usr/local/bin /usr/local/include /usr/local/Library/Frameworks /usr/local/lib ${CMAKE_IGNORE_PATH})
|
||||
ENDIF()
|
||||
if(NOT MAC_HOMEBREW AND EXISTS /usr/local/bin/brew)
|
||||
set(CMAKE_IGNORE_PATH /usr/local /usr/local/bin /usr/local/include /usr/local/Library/Frameworks /usr/local/lib /usr/local/opt/gettext/bin /usr/local/opt/gettext/lib ${CMAKE_IGNORE_PATH})
|
||||
endif()
|
||||
|
|
|
@ -10,12 +10,6 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
|||
message(FATAL_ERROR "releases can only be done from a git clone")
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
message(FATAL_ERROR "git is required to make a release")
|
||||
endif()
|
||||
|
||||
find_program(GPG_EXECUTABLE gpg)
|
||||
|
||||
if(NOT GPG_EXECUTABLE)
|
||||
|
@ -37,7 +31,7 @@ function(make_release_commit_and_tag)
|
|||
# First make sure we are on master.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short --abbrev-ref=strict HEAD
|
||||
COMMAND git rev-parse --short --abbrev-ref=strict HEAD
|
||||
OUTPUT_VARIABLE git_branch
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -48,7 +42,7 @@ function(make_release_commit_and_tag)
|
|||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} status --porcelain=2
|
||||
COMMAND git status --porcelain=2
|
||||
OUTPUT_VARIABLE git_status
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -61,7 +55,7 @@ function(make_release_commit_and_tag)
|
|||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag --sort=-v:refname
|
||||
COMMAND git tag --sort=-v:refname
|
||||
OUTPUT_VARIABLE git_tags
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -82,7 +76,7 @@ function(make_release_commit_and_tag)
|
|||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log ${git_last_tag}.. "--pretty=format:* %h - %s [%aL]"
|
||||
COMMAND git log ${git_last_tag}.. "--pretty=format:* %h - %s [%aL]"
|
||||
OUTPUT_VARIABLE release_log
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -92,17 +86,17 @@ function(make_release_commit_and_tag)
|
|||
|
||||
if(TAG_RELEASE STREQUAL UNDO)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag -d ${git_last_tag}
|
||||
COMMAND git tag -d ${git_last_tag}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} reset HEAD~1
|
||||
COMMAND git reset HEAD~1
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout HEAD CHANGELOG.md
|
||||
COMMAND git checkout HEAD CHANGELOG.md
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
|
@ -186,10 +180,12 @@ Ignore the following cmake error.
|
|||
endwhile()
|
||||
|
||||
# Convert to UNIX line endings on Windows, just copy the file otherwise.
|
||||
|
||||
if(CMAKE_HOST_SYSTEM MATCHES Windows OR ((NOT DEFINED CMAKE_HOST_SYSTEM) AND WIN32))
|
||||
if(NOT DEFINED POWERSHELL)
|
||||
message(FATAL_ERROR "Powershell is required to convert line endings on Windows.")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command [=[
|
||||
COMMAND ${POWERSHELL} -NoLogo -NoProfile -ExecutionPolicy Bypass -Command [=[
|
||||
$text = [IO.File]::ReadAllText("CHANGELOG.md.work") -replace "`r`n", "`n"
|
||||
[IO.File]::WriteAllText("CHANGELOG.md", $text)
|
||||
]=]
|
||||
|
@ -212,45 +208,37 @@ Ignore the following cmake error.
|
|||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} add CHANGELOG.md
|
||||
COMMAND git add CHANGELOG.md
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# Make the release commit.
|
||||
message(FATAL_ERROR "
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} commit -m "release ${new_tag}" --signoff -S
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
Release prepared.
|
||||
|
||||
# Make release tag.
|
||||
Edit CHANGELOG.md to remove any non-user-facing commits, and optionally add any
|
||||
release notes.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag -s -m${new_tag} ${new_tag}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
Run the following commands to commit the change:
|
||||
|
||||
message(FATAL_ERROR [=[
|
||||
|
||||
Release commit and tag generated.
|
||||
|
||||
**** IF YOU ARE SURE YOU WANT TO RELEASE ****
|
||||
|
||||
Run the following commands to push the release commit and tag:
|
||||
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
**** TO UNDO THE RELEASE ****
|
||||
git commit -m'release ${new_tag}' --signoff -S
|
||||
git tag -s -m'${new_tag}' ${new_tag}
|
||||
|
||||
To rollback these changes, run this command:
|
||||
|
||||
cmake .. -DTAG_RELEASE=UNDO
|
||||
|
||||
Ignore the "configuration incomplete" message following, this mode does not
|
||||
==== IF YOU ARE SURE YOU WANT TO RELEASE, THIS **CANNOT** BE REVERSED ====
|
||||
|
||||
Run the following to push the release commit and tag:
|
||||
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
Ignore the 'configuration incomplete' message following, this mode does not
|
||||
build anything.
|
||||
|
||||
]=])
|
||||
")
|
||||
endfunction()
|
||||
|
||||
make_release_commit_and_tag()
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
option(BUILD_TESTING "Build testing" ON)
|
||||
option(BUILD_SHARED_LIBS "Build dynamic libraries" OFF)
|
||||
|
||||
option(TRANSLATIONS_ONLY "Build only the translations.zip" OFF)
|
||||
if(TRANSLATIONS_ONLY)
|
||||
set(BUILD_DEFAULT OFF)
|
||||
else()
|
||||
set(BUILD_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
set(ENABLE_SDL_DEFAULT ${BUILD_DEFAULT})
|
||||
if(WIN32 OR APPLE)
|
||||
set(ENABLE_SDL_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SDL "Build the SDL port" ${ENABLE_SDL_DEFAULT})
|
||||
option(ENABLE_WX "Build the wxWidgets port" ${BUILD_DEFAULT})
|
||||
option(ENABLE_DEBUGGER "Enable the debugger" ON)
|
||||
option(ENABLE_ASAN "Enable -fsanitize=address by default. Requires debug build with GCC/Clang" OFF)
|
||||
|
||||
# Static linking
|
||||
set(VBAM_STATIC_DEFAULT OFF)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES -static OR CMAKE_TOOLCHAIN_FILE MATCHES "mxe|-static")
|
||||
set(VBAM_STATIC_DEFAULT ON)
|
||||
elseif(MINGW OR MSYS)
|
||||
# Default to static builds on MinGW and all MSYS2 envs.
|
||||
set(VBAM_STATIC_DEFAULT ON)
|
||||
endif()
|
||||
option(VBAM_STATIC "Try to link all libraries statically" ${VBAM_STATIC_DEFAULT})
|
||||
|
||||
if(VBAM_STATIC)
|
||||
set(SDL2_STATIC ON)
|
||||
set(SFML_STATIC_LIBRARIES ON)
|
||||
set(FFMPEG_STATIC ON)
|
||||
set(OPENAL_STATIC ON)
|
||||
set_property(GLOBAL PROPERTY LINK_SEARCH_START_STATIC ON)
|
||||
set_property(GLOBAL PROPERTY LINK_SEARCH_END_STATIC ON)
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
|
||||
else()
|
||||
list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .a)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(ENABLE_ASM "Enable x86 ASM related options" OFF)
|
||||
|
||||
# The ARM ASM core seems to be very buggy, see #98 and #54. Default to it being
|
||||
# OFF for the time being, until it is either fixed or replaced.
|
||||
option(ENABLE_ASM_CORE "Enable x86 ASM CPU cores (EXPERIMENTAL)" OFF)
|
||||
|
||||
set(ASM_SCALERS_DEFAULT ${ENABLE_ASM})
|
||||
set(MMX_DEFAULT ${ENABLE_ASM})
|
||||
|
||||
option(ENABLE_ASM_SCALERS "Enable x86 ASM graphic filters" ${ASM_SCALERS_DEFAULT})
|
||||
|
||||
include(CMakeDependentOption)
|
||||
cmake_dependent_option(ENABLE_MMX "Enable MMX" ${MMX_DEFAULT} "ENABLE_ASM_SCALERS" OFF)
|
||||
|
||||
option(ENABLE_LIRC "Enable LIRC support" OFF)
|
||||
|
||||
# Add support for Homebrew, MacPorts and Fink on macOS
|
||||
option(DISABLE_MACOS_PACKAGE_MANAGERS "Set to TRUE to disable support for macOS Homebrew, MacPorts and Fink." FALSE)
|
||||
if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS)
|
||||
include(MacPackageManagers)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
# Link / SFML
|
||||
if(TRANSLATIONS_ONLY)
|
||||
set(ENABLE_LINK_DEFAULT OFF)
|
||||
else()
|
||||
find_package(SFML 2.4 COMPONENTS network system)
|
||||
set(ENABLE_LINK_DEFAULT OFF)
|
||||
if(SFML_FOUND)
|
||||
set(ENABLE_LINK_DEFAULT ON)
|
||||
endif()
|
||||
endif()
|
||||
option(ENABLE_LINK "Enable GBA linking functionality (BROKEN)" ${ENABLE_LINK_DEFAULT})
|
||||
|
||||
if(ENABLE_LINK)
|
||||
# Always disable link for now as SFML 2 is broken and we don't have a replacement yet.
|
||||
set(ENABLE_LINK OFF CACHE BOOL "Enable GBA linking functionality (BROKEN)" FORCE)
|
||||
endif()
|
||||
|
||||
# FFMpeg
|
||||
set(FFMPEG_DEFAULT OFF)
|
||||
set(FFMPEG_COMPONENTS AVCODEC AVFORMAT SWSCALE AVUTIL SWRESAMPLE)
|
||||
set(FFMPEG_COMPONENT_VERSIONS AVCODEC>=58.18.100 AVFORMAT>=58.12.100 SWSCALE>=5.1.100 AVUTIL>=56.14.100 SWRESAMPLE>=3.1.100)
|
||||
|
||||
if(NOT TRANSLATIONS_ONLY AND (NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG) AND (NOT (X86 AND MINGW)))
|
||||
set(FFMPEG_DEFAULT ON)
|
||||
|
||||
find_package(FFmpeg COMPONENTS ${FFMPEG_COMPONENTS})
|
||||
# check versions, but only if pkgconfig is available
|
||||
if(FFMPEG_FOUND AND PKG_CONFIG_FOUND AND NOT CMAKE_TOOLCHAIN_FILE MATCHES vcpkg)
|
||||
foreach(component ${FFMPEG_COMPONENT_VERSIONS})
|
||||
string(REPLACE ">=" ";" parts ${component})
|
||||
list(GET parts 0 name)
|
||||
list(GET parts 1 version)
|
||||
|
||||
if((NOT DEFINED ${name}_VERSION) OR ${name}_VERSION VERSION_LESS ${version})
|
||||
set(FFMPEG_FOUND OFF)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NOT FFMPEG_FOUND)
|
||||
set(FFMPEG_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
option(ENABLE_FFMPEG "Enable ffmpeg A/V recording" ${FFMPEG_DEFAULT})
|
||||
|
||||
# Online Updates
|
||||
set(ONLINEUPDATES_DEFAULT OFF)
|
||||
if(DEFINED(UPSTREAM_RELEASE) AND UPSTREAM_RELEASE)
|
||||
set(ONLINEUPDATES_DEFAULT ON)
|
||||
endif()
|
||||
option(ENABLE_ONLINEUPDATES "Enable online update checks" ${ONLINEUPDATES_DEFAULT})
|
||||
option(HTTPS "Use https URL for winsparkle" ON)
|
||||
|
||||
# We generally don't want LTO when debugging because it makes linking slow
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(LTO_DEFAULT OFF)
|
||||
else()
|
||||
set(LTO_DEFAULT ON)
|
||||
endif()
|
||||
option(ENABLE_LTO "Compile with Link Time Optimization" ${LTO_DEFAULT})
|
||||
|
||||
option(ENABLE_GBA_LOGGING "Enable extended GBA logging" ON)
|
||||
|
||||
option(UPSTREAM_RELEASE "do some optimizations and release automation tasks" OFF)
|
||||
|
||||
if(WIN32)
|
||||
# not yet implemented
|
||||
option(ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" OFF)
|
||||
|
||||
set(XAUDIO2_DEFAULT ON)
|
||||
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
# TODO: We should update the XAudio headers to build with clang-cl. See
|
||||
# https://github.com/visualboyadvance-m/visualboyadvance-m/issues/1021
|
||||
set(XAUDIO2_DEFAULT OFF)
|
||||
endif()
|
||||
option(ENABLE_XAUDIO2 "Enable xaudio2 sound output for the wxWidgets port" ${XAUDIO2_DEFAULT})
|
||||
endif()
|
||||
|
||||
set(ENABLE_FAUDIO_DEFAULT OFF)
|
||||
|
||||
find_package(FAudio QUIET)
|
||||
|
||||
if(FAudio_FOUND AND NOT (MINGW AND X86))
|
||||
set(ENABLE_FAUDIO_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" ${ENABLE_FAUDIO_DEFAULT})
|
||||
|
||||
option(ZIP_SUFFIX [=[suffix for release zip files, e.g. "-somebranch".zip]=] OFF)
|
||||
|
||||
# The SDL port can't be built without debugging support
|
||||
if(NOT ENABLE_DEBUGGER AND ENABLE_SDL)
|
||||
message(FATAL_ERROR "The SDL port can't be built without debugging support")
|
||||
endif()
|
||||
|
||||
if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX))
|
||||
message(FATAL_ERROR "The SDL and wxWidgets ports can't be built when TRANSLATIONS_ONLY is enabled")
|
||||
endif()
|
||||
|
||||
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
|
|
@ -1,16 +0,0 @@
|
|||
function(make_path_run_wrapper cmd target)
|
||||
get_filename_component(name "${target}" NAME)
|
||||
get_filename_component(cmd_resolved "${cmd}" REALPATH)
|
||||
get_filename_component(base_name "${cmd_resolved}" NAME)
|
||||
get_filename_component(dir_name "${cmd_resolved}" DIRECTORY)
|
||||
|
||||
set(source "${target}.c")
|
||||
|
||||
configure_file(src/gcc-wrap.c.in "${source}")
|
||||
|
||||
include(HostCompile)
|
||||
host_compile("${source}" "${target}")
|
||||
|
||||
add_custom_target(generate_${name} DEPENDS "${CMAKE_BINARY_DIR}/${name}")
|
||||
add_dependencies(generate generate_${name})
|
||||
endfunction()
|
|
@ -1,9 +1,5 @@
|
|||
if(POLICY CMP0012)
|
||||
cmake_policy(SET CMP0012 NEW) # Saner if() behavior.
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0135)
|
||||
cmake_policy(SET CMP0135 NEW) # Use timestamps from archives.
|
||||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
||||
|
@ -14,19 +10,28 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
|||
# Check if we are in an MSVC environment.
|
||||
find_program(cl_exe_path NAME cl.exe HINTS ENV PATH)
|
||||
|
||||
if($ENV{CXX} MATCHES "cl.exe$" OR cl_exe_path)
|
||||
if(ENV{CXX} MATCHES "cl.exe$" OR cl_exe_path)
|
||||
# Infer the architecture from the LIB folders.
|
||||
foreach(LIB $ENV{LIB})
|
||||
if(${LIB} MATCHES "x64$")
|
||||
foreach(lib $ENV{LIB})
|
||||
if(lib MATCHES "x64$")
|
||||
set(VBAM_VCPKG_PLATFORM "x64-windows-static")
|
||||
break()
|
||||
endif()
|
||||
if(${LIB} MATCHES "x86$")
|
||||
if(lib MATCHES "x86$")
|
||||
set(VBAM_VCPKG_PLATFORM "x86-windows-static")
|
||||
break()
|
||||
endif()
|
||||
if(${LIB} MATCHES "ARM64$")
|
||||
if(lib MATCHES "ARM64$")
|
||||
set(VBAM_VCPKG_PLATFORM "arm64-windows-static")
|
||||
|
||||
foreach(path $ENV{PATH})
|
||||
if(path MATCHES "[Hh]ost[Xx]64")
|
||||
set(VCPKG_HOST_TRIPLET "x64-windows-static" CACHE STRING "Vcpkg host triplet" FORCE)
|
||||
set(VCPKG_USE_HOST_TOOLS ON CACHE BOOL "Use vcpkg host tools" FORCE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
@ -79,7 +84,7 @@ endfunction()
|
|||
|
||||
function(vcpkg_check_git_status git_status)
|
||||
# The VS vcpkg component cannot be written to without elevation.
|
||||
if(NOT git_status EQUAL 0 AND NOT VCPKG_ROOT MATCHES "^C:/Program Files/Microsoft Visual Studio/")
|
||||
if(NOT git_status EQUAL 0 AND NOT VCPKG_ROOT MATCHES "Visual Studio")
|
||||
message(FATAL_ERROR "Error updating vcpkg from git, please make sure git for windows is installed correctly, it can be installed from Visual Studio components")
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -146,7 +151,7 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
|
|||
string(REPLACE "-" "." pkg_ver ${pkg_ver})
|
||||
|
||||
if(NOT DEFINED VCPKG_INSTALLED_COUNT)
|
||||
if(VCPKG_ROOT MATCHES "^C:/Program Files/Microsoft Visual Studio/")
|
||||
if(VCPKG_ROOT MATCHES "Visual Studio")
|
||||
execute_process(
|
||||
COMMAND ${powershell}
|
||||
-executionpolicy bypass -noprofile
|
||||
|
@ -242,7 +247,7 @@ function(get_binary_packages vcpkg_exe)
|
|||
|
||||
foreach(triplet ${triplets})
|
||||
file(
|
||||
DOWNLOAD "https://nightly.vba-m.com/vcpkg/${triplet}/" "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html"
|
||||
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${triplet}/" "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html"
|
||||
STATUS pkg_list_status
|
||||
)
|
||||
list(GET pkg_list_status 1 pkg_list_error)
|
||||
|
@ -277,12 +282,6 @@ function(get_binary_packages vcpkg_exe)
|
|||
FetchContent_Populate(vcpkg_binpkg)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(powershell powershell)
|
||||
else()
|
||||
set(powershell pwsh)
|
||||
endif()
|
||||
|
||||
unset(to_install)
|
||||
foreach(pkg ${binary_packages})
|
||||
if(NOT pkg MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip")
|
||||
|
@ -292,7 +291,7 @@ function(get_binary_packages vcpkg_exe)
|
|||
set(pkg_version ${CMAKE_MATCH_2})
|
||||
set(pkg_triplet ${CMAKE_MATCH_3})
|
||||
|
||||
vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${powershell} pkg_installed)
|
||||
vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${POWERSHELL} pkg_installed)
|
||||
|
||||
if(NOT pkg_installed)
|
||||
list(APPEND to_install ${pkg})
|
||||
|
@ -306,10 +305,10 @@ function(get_binary_packages vcpkg_exe)
|
|||
foreach(pkg ${to_install})
|
||||
string(REGEX REPLACE "^[^_]+_[^_]+_([^.]+)[.]zip\$" "\\1" pkg_triplet ${pkg})
|
||||
|
||||
message(STATUS "Downloading https://nightly.vba-m.com/vcpkg/${pkg_triplet}/${pkg} ...")
|
||||
message(STATUS "Downloading https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg} ...")
|
||||
|
||||
file(
|
||||
DOWNLOAD "https://nightly.vba-m.com/vcpkg/${pkg_triplet}/${pkg}" "${bin_pkgs_dir}/${pkg}"
|
||||
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg}" "${bin_pkgs_dir}/${pkg}"
|
||||
STATUS pkg_download_status
|
||||
)
|
||||
list(GET pkg_download_status 1 pkg_download_error)
|
||||
|
@ -325,7 +324,7 @@ function(get_binary_packages vcpkg_exe)
|
|||
|
||||
# -command "import-module ($env:USERPROFILE + '/source/repos/vcpkg-binpkg-prototype/vcpkg-binpkg.psm1'); vcpkg-instpkg ."
|
||||
execute_process(
|
||||
COMMAND ${powershell}
|
||||
COMMAND ${POWERSHELL}
|
||||
-executionpolicy bypass -noprofile
|
||||
-command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-instpkg ."
|
||||
WORKING_DIRECTORY ${bin_pkgs_dir}
|
||||
|
@ -356,6 +355,9 @@ function(vcpkg_remove_optional_deps vcpkg_exe)
|
|||
endfunction()
|
||||
|
||||
function(vcpkg_set_toolchain)
|
||||
if(NOT DEFINED POWERSHELL)
|
||||
message(FATAL_ERROR "Powershell is required to use vcpkg binaries.")
|
||||
endif()
|
||||
if(NOT DEFINED ENV{VCPKG_ROOT})
|
||||
get_filename_component(preferred_root ${CMAKE_SOURCE_DIR}/../vcpkg ABSOLUTE)
|
||||
|
||||
|
@ -574,14 +576,4 @@ endfunction()
|
|||
|
||||
vcpkg_set_toolchain()
|
||||
|
||||
# Make vcpkg use debug libs for RelWithDebInfo
|
||||
set(orig_build_type ${CMAKE_BUILD_TYPE})
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
|
||||
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
|
||||
|
||||
set(CMAKE_BUILD_TYPE ${orig_build_type})
|
||||
unset(orig_build_type)
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
include(VbamFunctions)
|
||||
|
||||
function(add_compiler_flags)
|
||||
foreach(var RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
|
||||
set("CMAKE_CXX_FLAGS_${var}" "" CACHE STRING "MUST BE UNSET" FORCE)
|
||||
set("CMAKE_CXX_FLAGS_${var}" "" PARENT_SCOPE)
|
||||
set("CMAKE_C_FLAGS_${var}" "" CACHE STRING "MUST BE UNSET" FORCE)
|
||||
set("CMAKE_C_FLAGS_${var}" "" PARENT_SCOPE)
|
||||
endforeach()
|
||||
|
||||
# Set C and CXX flags if not already set.
|
||||
foreach(flag ${ARGV})
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
||||
# Remove any duplicates first.
|
||||
remove_dupes("${${var}}" "${var}")
|
||||
|
||||
string(FIND "${${var}}" "${flag}" found)
|
||||
|
||||
if(found EQUAL -1)
|
||||
set("${var}" "${${var}} ${flag}" CACHE STRING "Compiler Flags" FORCE)
|
||||
set("${var}" "${${var}} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(add_linker_flags)
|
||||
# Set linker flags if not already set.
|
||||
foreach(flag ${ARGV})
|
||||
foreach(var EXE SHARED)
|
||||
set(var "CMAKE_${var}_LINKER_FLAGS")
|
||||
|
||||
# Remove any duplicates first.
|
||||
remove_dupes("${${var}}" "${var}")
|
||||
|
||||
string(FIND "${${var}}" "${flag}" found)
|
||||
|
||||
if(found EQUAL -1)
|
||||
set("${var}" "${${var}} ${flag}" CACHE STRING "Linker Flags" FORCE)
|
||||
set("${var}" "${${var}} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
|
@ -0,0 +1,37 @@
|
|||
if(NOT ENABLE_ASAN)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
check_cxx_compiler_flag(/fsanitize=address MSVC_ASAN_SUPPORTED)
|
||||
if(MSVC_ASAN_SUPPORTED)
|
||||
add_compile_options(/fsanitize=address)
|
||||
add_compile_definitions(_DISABLE_VECTOR_ANNOTATION _DISABLE_STRING_ANNOTATION)
|
||||
else()
|
||||
message(WARNING "ASAN not available for the compiler, disabling.")
|
||||
set(ENABLE_ASAN OFF)
|
||||
return()
|
||||
endif()
|
||||
else()
|
||||
# ASAN does not work on non-debug builds for GCC and Clang.
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
message(WARNING "ASAN requires debug build, set -DCMAKE_BUILD_TYPE=Debug, disabling.")
|
||||
set(ENABLE_ASAN OFF)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# It is necessary to modify the linker flagas for the compiler check to work.
|
||||
set(BACKUP_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address")
|
||||
check_cxx_compiler_flag(-fsanitize=address ASAN_SUPPORTED)
|
||||
set(CMAKE_EXE_LINKER_FLAGS ${BACKUP_LINKER_FLAGS})
|
||||
|
||||
if(ASAN_SUPPORTED)
|
||||
add_compile_options(-fsanitize=address)
|
||||
add_link_options(-fsanitize=address)
|
||||
else()
|
||||
message(WARNING "ASAN not available for the compiler, disabling.")
|
||||
set(ENABLE_ASAN OFF)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
|
@ -0,0 +1,76 @@
|
|||
if(X86_32 OR X86_64)
|
||||
add_compile_options(-mfpmath=sse -msse2)
|
||||
endif()
|
||||
|
||||
if(UPSTREAM_RELEASE)
|
||||
if(X86_64)
|
||||
# Require and optimize for Core2 level support, tune for generic.
|
||||
add_compile_options(-march=core2 -mtune=generic)
|
||||
elseif(X86_32)
|
||||
# Optimize for pentiumi3 and tune for generic for Windows XP builds.
|
||||
set(WINXP TRUE)
|
||||
add_compile_options(-march=pentium3 -mtune=generic)
|
||||
add_compile_definitions(-DWINXP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Common flags.
|
||||
add_compile_options(
|
||||
-pipe
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
|
||||
-Wformat
|
||||
-Wformat-security
|
||||
-fdiagnostics-color=always
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-Wno-unused-command-line-argument)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-feliminate-unused-debug-types)
|
||||
endif()
|
||||
|
||||
# check if ssp flags are supported.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
check_cxx_compiler_flag(-fstack-protector-strong STACK_PROTECTOR_SUPPORTED)
|
||||
|
||||
if(STACK_PROTECTOR_SUPPORTED)
|
||||
add_compile_options(-fstack-protector-strong)
|
||||
|
||||
check_cxx_compiler_flag("--param ssp-buffer-size=4" SSP_BUFFER_SIZE_SUPPORTED)
|
||||
if(SSP_BUFFER_SIZE_SUPPORTED)
|
||||
add_compile_options(--param ssp-buffer-size=4)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC
|
||||
add_compile_options(-fPIC)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_options(-ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
|
||||
else()
|
||||
add_compile_options(-Ofast -fomit-frame-pointer)
|
||||
endif()
|
||||
|
||||
# for some reason this is necessary
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
include_directories(/usr/local/include)
|
||||
endif()
|
||||
|
||||
if(VBAM_STATIC)
|
||||
if(APPLE)
|
||||
add_link_options(-static-libstdc++)
|
||||
else()
|
||||
add_link_options(-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# To support LTO, this must always fail.
|
||||
add_compile_options(-Werror=odr -Werror=strict-aliasing)
|
||||
add_link_options( -Werror=odr -Werror=strict-aliasing)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Werror=lto-type-mismatch)
|
||||
add_link_options( -Werror=lto-type-mismatch)
|
||||
endif()
|
|
@ -0,0 +1,10 @@
|
|||
if (NOT MINGW)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# this has to run after the toolchain is initialized.
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/mingw-include")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
|
||||
|
||||
# Add Winsock as the last library linked because of broken link precedence.
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lws2_32")
|
|
@ -0,0 +1,83 @@
|
|||
# Set the runtime library properly.
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:DEBUG>:Debug>" CACHE INTERNAL "")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# MSVC-specific flags (not supported by clang-cl).
|
||||
add_compile_options(/nologo)
|
||||
if (NOT CMAKE_GENERATOR MATCHES "Ninja")
|
||||
# Multi-processor compilation does not work well with Ninja.
|
||||
add_compile_options(/MP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/msvc")
|
||||
|
||||
add_compile_definitions(
|
||||
_FORCENAMELESSUNION
|
||||
WIN32_LEAN_AND_MEAN
|
||||
WIN32
|
||||
_WINDOWS
|
||||
__STDC_LIMIT_MACROS
|
||||
__STDC_CONSTANT_MACROS
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_UNICODE
|
||||
UNICODE
|
||||
WINVER=0x0A00
|
||||
NTDDI_VERSION=0x0A000007
|
||||
NOMINMAX
|
||||
)
|
||||
add_compile_options(
|
||||
/W4
|
||||
/GR
|
||||
/EHsc
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_definitions(_DEBUG)
|
||||
add_compile_options(/Ob0 /Od /RTC1)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT ENABLE_ASAN)
|
||||
# Use Edit and Continue with MSVC.
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue" CACHE STRING "" FORCE)
|
||||
else()
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
else()
|
||||
add_compile_options(/MT /Oi /Gy)
|
||||
add_link_options(/OPT:REF /OPT:ICF)
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||
add_compile_options(/O1 /Ob1)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
add_compile_options(/O2 /Ob1)
|
||||
else()
|
||||
add_compile_options(/O2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.25")
|
||||
# Backwards-compatible way of setting the /Z option.
|
||||
if(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT STREQUAL "EditAndContinue")
|
||||
add_compile_options(/ZI)
|
||||
elseif(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT STREQUAL "ProgramDatabase")
|
||||
add_compile_options(/Zi)
|
||||
elseif(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT STREQUAL "Embedded")
|
||||
add_compile_options(/Z7)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown value for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: ${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE)
|
||||
|
||||
# We need to explicitly set all of these to override the CMake defaults.
|
||||
set(CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
|
|
@ -0,0 +1,126 @@
|
|||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Compiler stuff
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(num_cpus)
|
||||
|
||||
if(ENABLE_LTO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT LTO_SUPPORTED)
|
||||
|
||||
# MINGW64 does not support LTO
|
||||
if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(LTO_SUPPORTED FALSE)
|
||||
endif()
|
||||
|
||||
if(LTO_SUPPORTED)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(WARNING "LTO is not supported by the compiler, diasabling LTO")
|
||||
set(ENABLE_LTO OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Output all binaries at top level
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT HTTPS)
|
||||
add_compile_definitions(NO_HTTPS)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GBA_LOGGING)
|
||||
add_compile_definitions(GBA_LOGGING )
|
||||
endif()
|
||||
|
||||
if(ENABLE_MMX)
|
||||
add_compile_definitions(MMX)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT ENABLE_ONLINEUPDATES)
|
||||
add_compile_definitions(NO_ONLINEUPDATES)
|
||||
endif()
|
||||
|
||||
# The debugger is enabled by default
|
||||
if(ENABLE_DEBUGGER)
|
||||
add_compile_definitions(VBAM_ENABLE_DEBUGGER)
|
||||
endif()
|
||||
|
||||
# The ASM core is disabled by default because we don't know on which platform we are
|
||||
if(NOT ENABLE_ASM_CORE)
|
||||
add_compile_definitions(C_CORE)
|
||||
endif()
|
||||
|
||||
# Set up "src" and generated directory as a global include directory.
|
||||
set(VBAM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${VBAM_GENERATED_DIR}
|
||||
)
|
||||
|
||||
# C defines
|
||||
add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
||||
add_compile_definitions(__STDC_FORMAT_MACROS)
|
||||
add_compile_definitions(LOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
# Common compiler settings.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_definitions(DEBUG)
|
||||
else()
|
||||
add_compile_definitions(NDEBUG)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_compile_definitions(MACHO)
|
||||
elseif("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||
add_compile_definitions(ELF)
|
||||
endif()
|
||||
|
||||
if(X86_64)
|
||||
add_compile_definitions(__AMD64__ __X86_64__)
|
||||
endif()
|
||||
|
||||
# Enable ASAN if requested and supported.
|
||||
include(Toolchain-asan)
|
||||
|
||||
# MINGW/MSYS-specific settings.
|
||||
include(Toolchain-mingw)
|
||||
|
||||
# Toolchain-specific settings.
|
||||
if(MSVC)
|
||||
# This also includes clang-cl.
|
||||
include(Toolchain-msvc)
|
||||
else()
|
||||
include(Toolchain-gcc-clang)
|
||||
endif()
|
||||
|
||||
# Assembler flags.
|
||||
if(ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS)
|
||||
if(MSVC)
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/nuget.exe)
|
||||
file(DOWNLOAD "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" ${CMAKE_BINARY_DIR}/nuget.exe)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND nuget.exe install nasm2 -OutputDirectory ${CMAKE_BINARY_DIR}/nuget
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
file(GLOB pkg ${CMAKE_BINARY_DIR}/nuget/nasm2*)
|
||||
|
||||
list(APPEND CMAKE_PROGRAM_PATH ${pkg}/tools)
|
||||
endif()
|
||||
|
||||
enable_language(ASM_NASM)
|
||||
|
||||
set(ASM_ENABLED ON)
|
||||
endif()
|
||||
|
||||
if(ASM_ENABLED)
|
||||
string(REGEX REPLACE "<FLAGS>" "-I${CMAKE_SOURCE_DIR}/src/filters/hq/asm/ -O1 -w-orphan-labels" CMAKE_ASM_NASM_COMPILE_OBJECT ${CMAKE_ASM_NASM_COMPILE_OBJECT})
|
||||
endif()
|
|
@ -2,12 +2,6 @@
|
|||
# Update version in appcast.xml to latest tag.
|
||||
# Commit web-data.
|
||||
|
||||
find_package(Git)
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
message(FATAL_ERROR "git is required to update the appcast")
|
||||
endif()
|
||||
|
||||
function(update_appcast)
|
||||
if(UPDATE_APPCAST STREQUAL UNDO)
|
||||
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/web-data)
|
||||
|
@ -22,7 +16,7 @@ Ignore the following cmake error.
|
|||
# Get last tag.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag --sort=-v:refname
|
||||
COMMAND git tag --sort=-v:refname
|
||||
OUTPUT_VARIABLE git_tags
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -49,7 +43,7 @@ Ignore the following cmake error.
|
|||
# Clone repo.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} clone git@github.com:visualboyadvance-m/visualboyadvance-m.github.io web-data
|
||||
COMMAND git clone git@github.com:visualboyadvance-m/visualboyadvance-m.github.io web-data
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
@ -81,10 +75,12 @@ Ignore the following cmake error.
|
|||
endwhile()
|
||||
|
||||
# Convert to UNIX line endings on Windows, just copy the file otherwise.
|
||||
|
||||
if(CMAKE_HOST_SYSTEM MATCHES Windows OR ((NOT DEFINED CMAKE_HOST_SYSTEM) AND WIN32))
|
||||
if(NOT DEFINED POWERSHELL)
|
||||
message(FATAL_ERROR "Powershell is required to convert line endings on Windows.")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command [=[
|
||||
COMMAND ${POWERSHELL} -NoLogo -NoProfile -ExecutionPolicy Bypass -Command [=[
|
||||
$text = [IO.File]::ReadAllText("appcast.xml.work") -replace "`r`n", "`n"
|
||||
[IO.File]::WriteAllText("appcast.xml", $text)
|
||||
]=]
|
||||
|
@ -107,21 +103,21 @@ Ignore the following cmake error.
|
|||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} add appcast.xml
|
||||
COMMAND git add appcast.xml
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
|
||||
)
|
||||
|
||||
# Commit the change.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} commit -m "release ${new_tag}" --signoff -S
|
||||
COMMAND git commit -m "release ${new_tag}" --signoff -S
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
|
||||
)
|
||||
|
||||
# Make release tag.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag -s -m${new_tag} ${new_tag}
|
||||
COMMAND git tag -s -m${new_tag} ${new_tag}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
|
||||
)
|
||||
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
# UseGCCBinUtilsWrappers.cmake
|
||||
#
|
||||
# Use gcc binutils wrappers such as gcc-ar, this may be necessary for LTO.
|
||||
#
|
||||
# To use:
|
||||
#
|
||||
# put a copy into your <project_root>/CMakeScripts/
|
||||
#
|
||||
# In your main CMakeLists.txt add the command:
|
||||
#
|
||||
# INCLUDE(UseGCCBinUtilsWrappers)
|
||||
#
|
||||
# BSD 2-Clause License
|
||||
#
|
||||
# Copyright (c) 2016, Rafael Kitover
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# only do this when compiling with gcc/g++
|
||||
IF(NOT (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC))
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# first try appending -util to basename of compiler
|
||||
STRING(REGEX MATCH "\\.(exe|EXE)$" GCC_EXE_SUFFIX ${CMAKE_C_COMPILER})
|
||||
STRING(REGEX REPLACE "\\.(exe|EXE)$" "" GCC_BASENAME ${CMAKE_C_COMPILER})
|
||||
|
||||
SET(GCC_AR "${GCC_BASENAME}-ar${GCC_EXE_SUFFIX}")
|
||||
SET(GCC_NM "${GCC_BASENAME}-nm${GCC_EXE_SUFFIX}")
|
||||
SET(GCC_RANLIB "${GCC_BASENAME}-ranlib${GCC_EXE_SUFFIX}")
|
||||
|
||||
# if that does not work, try looking for gcc-util in the compiler directory,
|
||||
# and failing that in the PATH
|
||||
|
||||
GET_FILENAME_COMPONENT(GCC_DIRNAME ${CMAKE_C_COMPILER} DIRECTORY)
|
||||
|
||||
IF(NOT EXISTS ${GCC_AR})
|
||||
UNSET(GCC_AR)
|
||||
|
||||
FIND_PROGRAM(GCC_AR NAMES gcc-ar gcc-ar.exe GCC-AR.EXE HINTS ${GCC_DIRNAME})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS ${GCC_NM})
|
||||
UNSET(GCC_NM)
|
||||
|
||||
FIND_PROGRAM(GCC_NM NAMES gcc-nm gcc-nm.exe GCC-NM.EXE HINTS ${GCC_DIRNAME})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS ${GCC_RANLIB})
|
||||
UNSET(GCC_RANLIB)
|
||||
|
||||
FIND_PROGRAM(GCC_RANLIB NAMES gcc-ranlib gcc-ranlib.exe GCC-RANLIB.EXE HINTS ${GCC_DIRNAME})
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(PathRun)
|
||||
|
||||
IF(EXISTS ${GCC_AR})
|
||||
MESSAGE("-- Found gcc-ar: ${GCC_AR}")
|
||||
|
||||
SET(target "${CMAKE_BINARY_DIR}/gcc-ar-wrap")
|
||||
MAKE_PATH_RUN_WRAPPER("${GCC_AR}" "${target}")
|
||||
SET(CMAKE_AR "${target}")
|
||||
ENDIF()
|
||||
|
||||
IF(EXISTS ${GCC_NM})
|
||||
MESSAGE("-- Found gcc-nm: ${GCC_NM}")
|
||||
|
||||
SET(target "${CMAKE_BINARY_DIR}/gcc-nm-wrap")
|
||||
MAKE_PATH_RUN_WRAPPER("${GCC_NM}" "${target}")
|
||||
SET(CMAKE_NM "${target}")
|
||||
ENDIF()
|
||||
|
||||
IF(EXISTS ${GCC_RANLIB})
|
||||
MESSAGE("-- Found gcc-ranlib: ${GCC_RANLIB}")
|
||||
|
||||
SET(target "${CMAKE_BINARY_DIR}/gcc-ranlib-wrap")
|
||||
MAKE_PATH_RUN_WRAPPER("${GCC_RANLIB}" "${target}")
|
||||
SET(CMAKE_RANLIB "${target}")
|
||||
ENDIF()
|
||||
|
||||
FOREACH(VAR "GCC_AR" "GCC_NM" "GCC_RANLIB" "GCC_DIRNAME" "GCC_BASENAME" "GCC_EXE_SUFFIX" "target")
|
||||
UNSET(${VAR})
|
||||
ENDFOREACH()
|
|
@ -1,48 +1,3 @@
|
|||
# From: https://stackoverflow.com/a/41416298/262458
|
||||
function(REMOVE_DUPES ARG_STR OUTPUT)
|
||||
set(ARG_LIST ${ARG_STR})
|
||||
separate_arguments(ARG_LIST)
|
||||
list(REMOVE_DUPLICATES ARG_LIST)
|
||||
string (REGEX REPLACE "([^\\]|^);" "\\1 " _TMP_STR "${ARG_LIST}")
|
||||
string (REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
|
||||
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# From: https://stackoverflow.com/a/7216542
|
||||
function(JOIN VALUES GLUE OUTPUT)
|
||||
string (REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
|
||||
string (REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
|
||||
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# On MSYS2 transform wx lib paths to native paths for Ninja.
|
||||
function(normalize_wx_paths)
|
||||
if(MSYS)
|
||||
set(libs "")
|
||||
|
||||
foreach(lib ${wxWidgets_LIBRARIES})
|
||||
if(NOT lib MATCHES "^(-Wl,|-mwindows$|-pipe$)")
|
||||
if(lib MATCHES "^/")
|
||||
cygpath(lib "${lib}")
|
||||
endif()
|
||||
|
||||
if(VBAM_STATIC AND lib MATCHES "^-l(wx.*|jpeg|tiff|jbig|lzma|expat)$")
|
||||
cygpath(lib "$ENV{MSYSTEM_PREFIX}/lib/lib${CMAKE_MATCH_1}.a")
|
||||
endif()
|
||||
|
||||
list(APPEND libs "${lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(wxWidgets_LIBRARIES "${libs}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(cleanup_wx_vars)
|
||||
if(wxWidgets_CXX_FLAGS)
|
||||
list(REMOVE_ITEM wxWidgets_CXX_FLAGS -fpermissive)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(cygpath var path)
|
||||
execute_process(
|
||||
|
@ -157,5 +112,3 @@ function(find_wx_util var util)
|
|||
set(${var} ${util} PARENT_SCOPE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# vim:sw=4 sts et:
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
doctest
|
||||
-----
|
||||
|
||||
This module defines a function to help use the doctest test framework.
|
||||
|
||||
The :command:`doctest_discover_tests` discovers tests by asking the compiled test
|
||||
executable to enumerate its tests. This does not require CMake to be re-run
|
||||
when tests change. However, it may not work in a cross-compiling environment,
|
||||
and setting test properties is less convenient.
|
||||
|
||||
This command is intended to replace use of :command:`add_test` to register
|
||||
tests, and will create a separate CTest test for each doctest test case. Note
|
||||
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||
cannot be shared by multiple test cases executing in the same instance.
|
||||
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||
usually considered as more beneficial. By default, the CTest test name is the
|
||||
same as the doctest name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||
|
||||
.. command:: doctest_discover_tests
|
||||
|
||||
Automatically add tests with CTest by querying the compiled test executable
|
||||
for available tests::
|
||||
|
||||
doctest_discover_tests(target
|
||||
[TEST_SPEC arg1...]
|
||||
[EXTRA_ARGS arg1...]
|
||||
[WORKING_DIRECTORY dir]
|
||||
[TEST_PREFIX prefix]
|
||||
[TEST_SUFFIX suffix]
|
||||
[PROPERTIES name1 value1...]
|
||||
[TEST_LIST var]
|
||||
)
|
||||
|
||||
``doctest_discover_tests`` sets up a post-build command on the test executable
|
||||
that generates the list of tests by parsing the output from running the test
|
||||
with the ``--list-test-cases`` argument. This ensures that the full
|
||||
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||
not necessary to re-run CMake when the list of tests changes.
|
||||
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||
in order to function in a cross-compiling environment.
|
||||
|
||||
Additionally, setting properties on tests is somewhat less convenient, since
|
||||
the tests are not available at CMake time. Additional test properties may be
|
||||
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||
more fine-grained test control is needed, custom content may be provided
|
||||
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||
directory property. The set of discovered tests is made accessible to such a
|
||||
script via the ``<target>_TESTS`` variable.
|
||||
|
||||
The options are:
|
||||
|
||||
``target``
|
||||
Specifies the doctest executable, which must be a known CMake executable
|
||||
target. CMake will substitute the location of the built executable when
|
||||
running the test.
|
||||
|
||||
``TEST_SPEC arg1...``
|
||||
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||
pass to the doctest executable with the ``--list-test-cases`` argument.
|
||||
|
||||
``EXTRA_ARGS arg1...``
|
||||
Any extra arguments to pass on the command line to each test case.
|
||||
|
||||
``WORKING_DIRECTORY dir``
|
||||
Specifies the directory in which to run the discovered test cases. If this
|
||||
option is not provided, the current binary directory is used.
|
||||
|
||||
``TEST_PREFIX prefix``
|
||||
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||
case. This can be useful when the same test executable is being used in
|
||||
multiple calls to ``doctest_discover_tests()`` but with different
|
||||
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||
|
||||
``TEST_SUFFIX suffix``
|
||||
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||
be specified.
|
||||
|
||||
``PROPERTIES name1 value1...``
|
||||
Specifies additional properties to be set on all tests discovered by this
|
||||
invocation of ``doctest_discover_tests``.
|
||||
|
||||
``TEST_LIST var``
|
||||
Make the list of tests available in the variable ``var``, rather than the
|
||||
default ``<target>_TESTS``. This can be useful when the same test
|
||||
executable is being used in multiple calls to ``doctest_discover_tests()``.
|
||||
Note that this variable is only available in CTest.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
function(doctest_discover_tests TARGET)
|
||||
cmake_parse_arguments(
|
||||
""
|
||||
""
|
||||
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
|
||||
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(NOT _WORKING_DIRECTORY)
|
||||
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
if(NOT _TEST_LIST)
|
||||
set(_TEST_LIST ${TARGET}_TESTS)
|
||||
endif()
|
||||
|
||||
## Generate a unique name based on the extra arguments
|
||||
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||
|
||||
# Define rule to generate test list for aforementioned test executable
|
||||
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||
get_property(crosscompiling_emulator
|
||||
TARGET ${TARGET}
|
||||
PROPERTY CROSSCOMPILING_EMULATOR
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET} POST_BUILD
|
||||
BYPRODUCTS "${ctest_tests_file}"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "TEST_TARGET=${TARGET}"
|
||||
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||
-D "TEST_LIST=${_TEST_LIST}"
|
||||
-D "CTEST_FILE=${ctest_tests_file}"
|
||||
-P "${_DOCTEST_DISCOVER_TESTS_SCRIPT}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
file(WRITE "${ctest_include_file}"
|
||||
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||
" include(\"${ctest_tests_file}\")\n"
|
||||
"else()\n"
|
||||
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||
"endif()\n"
|
||||
)
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.10)
|
||||
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||
set_property(DIRECTORY
|
||||
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||
if(NOT ${test_include_file_set})
|
||||
set_property(DIRECTORY
|
||||
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
###############################################################################
|
||||
|
||||
set(_DOCTEST_DISCOVER_TESTS_SCRIPT
|
||||
${CMAKE_CURRENT_LIST_DIR}/doctestAddTests.cmake
|
||||
)
|
|
@ -1,81 +0,0 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
set(prefix "${TEST_PREFIX}")
|
||||
set(suffix "${TEST_SUFFIX}")
|
||||
set(spec ${TEST_SPEC})
|
||||
set(extra_args ${TEST_EXTRA_ARGS})
|
||||
set(properties ${TEST_PROPERTIES})
|
||||
set(script)
|
||||
set(suite)
|
||||
set(tests)
|
||||
|
||||
function(add_command NAME)
|
||||
set(_args "")
|
||||
foreach(_arg ${ARGN})
|
||||
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||
else()
|
||||
set(_args "${_args} ${_arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Run test executable to get list of available tests
|
||||
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||
message(FATAL_ERROR
|
||||
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||
)
|
||||
endif()
|
||||
|
||||
if("${spec}" MATCHES .)
|
||||
set(spec "--test-case=${spec}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-cases
|
||||
OUTPUT_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
if(NOT ${result} EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||
" Result: ${result}\n"
|
||||
" Output: ${output}\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" output "${output}")
|
||||
|
||||
# Parse output
|
||||
foreach(line ${output})
|
||||
if("${line}" STREQUAL "===============================================================================" OR "${line}" MATCHES [==[^\[doctest\] ]==])
|
||||
continue()
|
||||
endif()
|
||||
set(test ${line})
|
||||
# use escape commas to handle properly test cases with commas inside the name
|
||||
string(REPLACE "," "\\," test_name ${test})
|
||||
# ...and add to script
|
||||
add_command(add_test
|
||||
"${prefix}${test}${suffix}"
|
||||
${TEST_EXECUTOR}
|
||||
"${TEST_EXECUTABLE}"
|
||||
"--test-case=${test_name}"
|
||||
${extra_args}
|
||||
)
|
||||
add_command(set_tests_properties
|
||||
"${prefix}${test}${suffix}"
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
${properties}
|
||||
)
|
||||
list(APPEND tests "${prefix}${test}${suffix}")
|
||||
endforeach()
|
||||
|
||||
# Create a list of all discovered tests, which users may use to e.g. set
|
||||
# properties on the tests
|
||||
add_command(set ${TEST_LIST} ${tests})
|
||||
|
||||
# Write CTest script
|
||||
file(WRITE "${CTEST_FILE}" "${script}")
|
|
@ -2,7 +2,7 @@ with import <nixpkgs> {};
|
|||
stdenv.mkDerivation {
|
||||
name = "visualboyadvance-m";
|
||||
buildInputs = if stdenv.isDarwin then
|
||||
[ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL ]
|
||||
[ ninja cmake nasm faudio gettext libintl pkg-config zip zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.System darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL llvmPackages_latest.clang llvmPackages_latest.bintools ]
|
||||
else
|
||||
[ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 mesa glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon epoxy dbus at-spi2-core ];
|
||||
[ ninja cmake gcc clang llvm llvmPackages.libcxx nasm faudio gettext libintl pkg-config zip zlib openal ffmpeg wxGTK32 libGL libGLU glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon libepoxy dbus at-spi2-core ];
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit e8ce758a98161d47559aa294d3298425ec75e28e
|
|
@ -2,59 +2,27 @@
|
|||
Developer Information File
|
||||
==========================
|
||||
|
||||
|
||||
|
||||
Known preprocessor switches:
|
||||
- SDL: Defined for the SDL version
|
||||
- GBA_LOGGING: Enables logging for the GBA core
|
||||
- FINAL_VERSION: Defined for release versions, disables additional GBA logging and completely disables GB logging. Increases the amount of CPU cycles being emulated in one go.
|
||||
- BKPT_SUPPORT
|
||||
- VBAM_ENABLE_DEBUGGER: Enable remote debugging support
|
||||
- MMX: Enable MMX instruction set
|
||||
- NO_ASM: Use C++ version of hq3x/4x filters
|
||||
- RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version)
|
||||
- NO_OGL: Exclude OpenGL code
|
||||
- NO_D3D: Exclude Direct3D code
|
||||
- NO_OAL: Exclude OpenAL code
|
||||
- NO_XAUDIO2: Exclude XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
||||
- VBAM_ENABLE_XAUDIO2: Enable XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
||||
- VBAM_ENABLE_FAUDIO: Enable FAudio code (the FAudio interface is an open source multiplatform re-implementation of XAudio2)
|
||||
- NO_LINK: Exclude linking code (joybus, multilink, ...)
|
||||
- WIN64: This macro is only defined for 64 bit builds
|
||||
|
||||
|
||||
|
||||
Download locations:
|
||||
NASM: http://nasm.us/
|
||||
DirectX SDK: http://msdn.microsoft.com/en-us/xna/aa937788.aspx
|
||||
OpenAL SDK: http://connect.creativelabs.com/openal/default.aspx
|
||||
OpenGL files: http://www.opengl.org/registry/
|
||||
zlib: http://zlib.net/
|
||||
libpng: http://libpng.org/pub/png/libpng.html
|
||||
|
||||
You can find pre-built versions of zlib & libpng at:
|
||||
http://spacy51.sp.funpic.de/VBA-M/libs/
|
||||
Just extract them somewhere and point Visual C++ 2008 to the include & lib folders.
|
||||
They are built with the static C runtime (this is what the release builds use).
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# --- Build Systems --- #
|
||||
###########################
|
||||
|
||||
===Win32/MFC===
|
||||
This is the full-featured Windows build using the MFC GUI.
|
||||
The project files are located in /project/vc2008_mfc (VBA2008.sln) and /project/vs2010_mfc (VBA2010.sln).
|
||||
Anyone distributing builds should be using MSVC 2010 SP1, the unpatched release has a bug where it applies SSE2 updates to mov and other instructions resulting in illegal instruction errors on cpu's only supporting SSE.
|
||||
You also have to install Microsoft's DirectX SDK for Direct3D, DirectInput & XAudio2.
|
||||
If you want to enable OpenAL sound output, install the OpenAL SDK. If you do not want it, add NO_OAL to the VBA-M project's preprocessor definitions.
|
||||
SubWCRev.exe is used to append the svn versioning to the output executable, this as of TortoiseSVN 1.7, is only available by installing TortoiseSVN.
|
||||
All other dependencies for MSVC builds may be found in the ../dependencies directory (above /trunk).
|
||||
Normally, Windows users will want to checkout the root of the repository instead of just the trunk directory. Afterwards, simply opening the .sln of choice, setting preprocessor definitions, and hitting build is all that's required.
|
||||
|
||||
===*nix/GTK===
|
||||
===src/sdl===
|
||||
This is the standard build configuration on non-Windows.
|
||||
Running cmake will inform you of any packages you need to install.
|
||||
|
||||
===*/wxw===
|
||||
The wxWidgets interface is an in-development frontend meant to be more cross-platform friendly than MFC and GTK.
|
||||
===src/wx===
|
||||
The wxWidgets interface is an in-development frontend meant to be more cross-platform friendly than MFC and SDL.
|
||||
Running cmake will inform you of any packages you need to install.
|
||||
NOTE: In addition to what cmake currently checks for, you will also need the wxrc tool and libgdiplus.
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
VisualBoyAdvance-M
|
||||
Nintendo Game Boy & Game Boy Advance Emulator
|
||||
Project Homepage: http://vba-m.com
|
||||
Project Homepage: http://visualboyadvance-m.org
|
||||
|
||||
This program is distributed under the GNU General Public License
|
||||
http://www.gnu.org/licenses/gpl.html
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
#Do not use this file directly. Always use the top level CMakeLists.txt file
|
||||
#File extractors so the user doesn't have to extract the rom before playing it
|
||||
|
||||
# Source files definition
|
||||
SET(SRC_FEX
|
||||
7z_C/7zAlloc.c
|
||||
7z_C/7zBuf.c
|
||||
7z_C/7zCrc.c
|
||||
7z_C/7zCrcOpt.c
|
||||
7z_C/7zDec.c
|
||||
7z_C/7zIn.c
|
||||
7z_C/7zStream.c
|
||||
7z_C/Bcj2.c
|
||||
7z_C/Bra86.c
|
||||
7z_C/Bra.c
|
||||
7z_C/CpuArch.c
|
||||
7z_C/Lzma2Dec.c
|
||||
7z_C/LzmaDec.c
|
||||
7z_C/Ppmd7.c
|
||||
7z_C/Ppmd7Dec.c
|
||||
fex/Binary_Extractor.cpp
|
||||
fex/blargg_common.cpp
|
||||
fex/blargg_errors.cpp
|
||||
fex/Data_Reader.cpp
|
||||
fex/fex.cpp
|
||||
fex/File_Extractor.cpp
|
||||
fex/Gzip_Extractor.cpp
|
||||
fex/Gzip_Reader.cpp
|
||||
fex/Rar_Extractor.cpp
|
||||
fex/Zip7_Extractor.cpp
|
||||
fex/Zip_Extractor.cpp
|
||||
fex/Zlib_Inflater.cpp
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
.
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
ADD_LIBRARY(
|
||||
fex
|
||||
STATIC
|
||||
${SRC_FEX}
|
||||
)
|
||||
|
||||
add_dependencies(fex generate)
|
89
installdeps
89
installdeps
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
CMAKE=cmake
|
||||
ENABLE_OPENAL=1
|
||||
ENABLE_FFMPEG=1
|
||||
|
||||
main() {
|
||||
|
@ -25,10 +24,6 @@ check_command_line_args() {
|
|||
usage
|
||||
quit 0
|
||||
;;
|
||||
--no-openal)
|
||||
ENABLE_OPENAL=
|
||||
shift
|
||||
;;
|
||||
--no-ffmpeg)
|
||||
ENABLE_FFMPEG=
|
||||
shift
|
||||
|
@ -355,9 +350,8 @@ debian_installdeps() {
|
|||
;;
|
||||
esac
|
||||
|
||||
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl2-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev libsfml-dev $sfml_libs $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build"
|
||||
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl2-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev libsfml-dev $sfml_libs $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build libopenal-dev"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && pkgs="$pkgs libopenal-dev"
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev"
|
||||
|
||||
check sudo apt-get -qy install $pkgs
|
||||
|
@ -407,8 +401,7 @@ debian_installdeps() {
|
|||
fi
|
||||
fi
|
||||
|
||||
deps="gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets"
|
||||
[ -n "$ENABLE_OPENAL" ] && deps="$deps openal"
|
||||
deps="gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets openal"
|
||||
[ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg"
|
||||
|
||||
set --
|
||||
|
@ -510,9 +503,6 @@ fedora_installdeps() {
|
|||
*ffmpeg*)
|
||||
[ -z "$ENABLE_FFMPEG" ] && continue
|
||||
;;
|
||||
*openal*)
|
||||
[ -z "$ENABLE_OPENAL" ] && continue
|
||||
;;
|
||||
esac
|
||||
|
||||
pkg_arch=
|
||||
|
@ -601,15 +591,9 @@ fedora_installdeps() {
|
|||
;;
|
||||
esac
|
||||
# install static deps
|
||||
for pkg in zlib gettext SDL2 wxWidgets3; do
|
||||
for pkg in zlib gettext SDL2 wxWidgets3 openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}-static"
|
||||
done
|
||||
# install deps that are not available as static
|
||||
if [ -n "$ENABLE_OPENAL" ]; then
|
||||
for pkg in openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}"
|
||||
done
|
||||
fi
|
||||
|
||||
# get the necessary win32 headers
|
||||
git submodule update --init --remote --recursive
|
||||
|
@ -707,9 +691,6 @@ rhel_installdeps() {
|
|||
*ffmpeg*)
|
||||
[ -z "$ENABLE_FFMPEG" ] && continue
|
||||
;;
|
||||
*openal*)
|
||||
[ -z "$ENABLE_OPENAL" ] && continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$amd64" ]; then
|
||||
|
@ -790,15 +771,9 @@ rhel_installdeps() {
|
|||
;;
|
||||
esac
|
||||
# install static deps
|
||||
for pkg in zlib gettext SDL2 wxWidgets; do
|
||||
for pkg in zlib gettext SDL2 wxWidgets openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}-static"
|
||||
done
|
||||
# install deps that are not available as static
|
||||
if [ -n "$ENABLE_OPENAL" ]; then
|
||||
for pkg in openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}"
|
||||
done
|
||||
fi
|
||||
|
||||
# get the necessary win32 headers
|
||||
git submodule update --init --remote --recursive
|
||||
|
@ -824,13 +799,10 @@ suse_installdeps() {
|
|||
|
||||
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip sfml2-devel ninja"
|
||||
|
||||
libs="gcc gcc-c++ libSDL2-devel wxWidgets-3_0-devel" # ffmpeg-devel
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && libs="$libs openal-soft-devel"
|
||||
# ffmpeg requires packman repos
|
||||
libs="gcc gcc-c++ libSDL2-devel wxGTK3-3_2-devel openal-soft-devel ffmpeg-7-libavcodec-devel ffmpeg-7-libavdevice-devel ffmpeg-7-libavfilter-devel ffmpeg-7-libavformat-devel ffmpeg-7-libavutil-devel ffmpeg-7-libpostproc-devel ffmpeg-7-libswresample-devel ffmpeg-7-libswscale-devel"
|
||||
|
||||
if [ "$target" = m32 ]; then
|
||||
libs=$(echo "$libs" | sed -E 's/([^ ]) ([^ ])/\1-32bit \2/g; s/$/-32bit/;')
|
||||
error '32 bit cross builds are no longer supported on OpenSUSE'
|
||||
fi
|
||||
|
||||
check sudo zypper in -y $tools $libs
|
||||
|
@ -894,9 +866,8 @@ archlinux_installdeps() {
|
|||
|
||||
$pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic
|
||||
|
||||
libs="zlib mesa gettext sdl2 wxgtk3 $gtk sfml"
|
||||
libs="zlib mesa gettext sdl2 wxgtk3 $gtk sfml openal"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && libs="$libs openal"
|
||||
[ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg"
|
||||
|
||||
if [ -z "$target" -o "$target" = m32 ]; then
|
||||
|
@ -991,9 +962,7 @@ EOF
|
|||
fi
|
||||
done
|
||||
|
||||
deps="zlib gettext pkg-config sdl2 wxmsw"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && deps="$deps openal"
|
||||
deps="zlib gettext pkg-config sdl2 wxmsw openal"
|
||||
|
||||
# and the actual deps
|
||||
for p in $deps; do
|
||||
|
@ -1024,9 +993,7 @@ solus_installdeps() {
|
|||
check sudo eopkg -y install -c system.devel
|
||||
check sudo eopkg -y install git ccache ninja
|
||||
|
||||
set -- sdl2-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && set -- "$@" openal-soft-devel
|
||||
set -- sdl2-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel libglu-devel openal-soft-devel
|
||||
|
||||
if [ -n "$amd64" -a "$target" = m32 ]; then
|
||||
info_msg 'Calculating dependencies, this will take a while..'
|
||||
|
@ -1095,15 +1062,23 @@ gentoo_installdeps() {
|
|||
wx_slot=$(equery -qC list -p -F '$slot' x11-libs/wxGTK | grep gtk3 | sort -rV | head -1)
|
||||
|
||||
ebuilds="\
|
||||
sys-devel/gcc sys-devel/make dev-util/cmake dev-util/ccache sys-devel/binutils \
|
||||
media-libs/libsdl2 media-libs/libsfml x11-libs/wxGTK:$wx_slot sys-libs/zlib dev-util/pkgconf \
|
||||
dev-lang/nasm dev-util/ninja"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && ebuilds="$ebuilds media-libs/openal"
|
||||
sys-devel/gcc \
|
||||
dev-build/make \
|
||||
dev-build/cmake \
|
||||
dev-util/ccache \
|
||||
sys-devel/binutils \
|
||||
media-libs/libsdl2 \
|
||||
media-libs/libsfml \
|
||||
media-libs/openal \
|
||||
x11-libs/wxGTK:$wx_slot \
|
||||
sys-libs/zlib \
|
||||
dev-util/pkgconf \
|
||||
dev-lang/nasm \
|
||||
dev-build/ninja"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && ebuilds="$ebuilds media-video/ffmpeg"
|
||||
|
||||
check sudo emerge -vn $ebuilds
|
||||
check sudo emerge -vna $ebuilds
|
||||
|
||||
build_instructions
|
||||
}
|
||||
|
@ -1130,10 +1105,10 @@ windows_installdeps() {
|
|||
|
||||
case "$target" in
|
||||
*clang*)
|
||||
pkgs="lldb"
|
||||
pkgs="lldb clang"
|
||||
;;
|
||||
*)
|
||||
pkgs="$pkgs gcc gcc-libs gcc-libgfortran"
|
||||
pkgs="gcc gcc-libs gcc-libgfortran"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -1141,11 +1116,19 @@ windows_installdeps() {
|
|||
*i686*)
|
||||
pkgs="$pkgs nasm"
|
||||
;;
|
||||
*)
|
||||
pkgs="$pkgs FAudio"
|
||||
;;
|
||||
esac
|
||||
|
||||
pkgs="$pkgs SDL2 sfml wxWidgets3.2 zlib binutils cmake crt-git extra-cmake-modules headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache"
|
||||
pkgs="$pkgs SDL2 sfml wxWidgets3.2 zlib binutils cmake crt-git headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache openal"
|
||||
|
||||
case "$target" in
|
||||
*x86_64)
|
||||
pkgs="$pkgs extra-cmake-modules"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && pkgs="$pkgs openal"
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
||||
|
||||
set --
|
||||
|
@ -1210,7 +1193,7 @@ brew_installdeps() {
|
|||
|
||||
check brew -v update
|
||||
|
||||
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets ccache ninja"
|
||||
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets faudio ccache ninja zlib"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
IF(ENABLE_WX)
|
||||
add_subdirectory(wxvbam)
|
||||
ENDIF(ENABLE_WX)
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
if(NOT TRANSLATIONS_ONLY AND NOT ENABLE_WX)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(GLOB po_files "${CMAKE_CURRENT_SOURCE_DIR}/*.po")
|
||||
|
||||
gettext_create_translations(
|
||||
wxvbam.pot
|
||||
${po_files}
|
||||
)
|
||||
|
||||
add_dependencies(visualboyadvance-m translations)
|
||||
gettext_create_translations(wxvbam.pot ${po_files})
|
||||
|
|
3195
po/wxvbam/bg.po
3195
po/wxvbam/bg.po
File diff suppressed because it is too large
Load Diff
3177
po/wxvbam/br.po
3177
po/wxvbam/br.po
File diff suppressed because it is too large
Load Diff
3177
po/wxvbam/cs.po
3177
po/wxvbam/cs.po
File diff suppressed because it is too large
Load Diff
2470
po/wxvbam/de.po
2470
po/wxvbam/de.po
File diff suppressed because it is too large
Load Diff
3220
po/wxvbam/el.po
3220
po/wxvbam/el.po
File diff suppressed because it is too large
Load Diff
2283
po/wxvbam/es.po
2283
po/wxvbam/es.po
File diff suppressed because it is too large
Load Diff
2312
po/wxvbam/es_419.po
2312
po/wxvbam/es_419.po
File diff suppressed because it is too large
Load Diff
3558
po/wxvbam/fr_FR.po
3558
po/wxvbam/fr_FR.po
File diff suppressed because it is too large
Load Diff
3195
po/wxvbam/gl.po
3195
po/wxvbam/gl.po
File diff suppressed because it is too large
Load Diff
3197
po/wxvbam/he_IL.po
3197
po/wxvbam/he_IL.po
File diff suppressed because it is too large
Load Diff
3199
po/wxvbam/hu_HU.po
3199
po/wxvbam/hu_HU.po
File diff suppressed because it is too large
Load Diff
3306
po/wxvbam/id.po
3306
po/wxvbam/id.po
File diff suppressed because it is too large
Load Diff
3212
po/wxvbam/it_IT.po
3212
po/wxvbam/it_IT.po
File diff suppressed because it is too large
Load Diff
3220
po/wxvbam/ja.po
3220
po/wxvbam/ja.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3637
po/wxvbam/ko_KR.po
3637
po/wxvbam/ko_KR.po
File diff suppressed because it is too large
Load Diff
3177
po/wxvbam/ms_MY.po
3177
po/wxvbam/ms_MY.po
File diff suppressed because it is too large
Load Diff
3177
po/wxvbam/nb.po
3177
po/wxvbam/nb.po
File diff suppressed because it is too large
Load Diff
3177
po/wxvbam/nl.po
3177
po/wxvbam/nl.po
File diff suppressed because it is too large
Load Diff
3205
po/wxvbam/pl_PL.po
3205
po/wxvbam/pl_PL.po
File diff suppressed because it is too large
Load Diff
3210
po/wxvbam/pt_BR.po
3210
po/wxvbam/pt_BR.po
File diff suppressed because it is too large
Load Diff
3171
po/wxvbam/pt_PT.po
3171
po/wxvbam/pt_PT.po
File diff suppressed because it is too large
Load Diff
3195
po/wxvbam/ru_RU.po
3195
po/wxvbam/ru_RU.po
File diff suppressed because it is too large
Load Diff
2384
po/wxvbam/sv.po
2384
po/wxvbam/sv.po
File diff suppressed because it is too large
Load Diff
3204
po/wxvbam/tr.po
3204
po/wxvbam/tr.po
File diff suppressed because it is too large
Load Diff
3207
po/wxvbam/uk.po
3207
po/wxvbam/uk.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3179
po/wxvbam/wxvbam.pot
3179
po/wxvbam/wxvbam.pot
File diff suppressed because it is too large
Load Diff
3219
po/wxvbam/zh-Hans.po
3219
po/wxvbam/zh-Hans.po
File diff suppressed because it is too large
Load Diff
3261
po/wxvbam/zh_CN.po
3261
po/wxvbam/zh_CN.po
File diff suppressed because it is too large
Load Diff
|
@ -51,7 +51,6 @@ parts:
|
|||
- libopenal-dev
|
||||
- libwxgtk3.0-gtk3-dev
|
||||
cmake-parameters:
|
||||
- -DENABLE_OPENAL=ON
|
||||
- -DENABLE_SDL=OFF
|
||||
- -DCMAKE_INSTALL_PREFIX=/usr
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
// -*- C++ -*-
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef __AUTOBUILD_H__
|
||||
#define __AUTOBUILD_H__
|
||||
#include "version.h"
|
||||
// change the FALSE to TRUE for autoincrement of build number
|
||||
#define INCREMENT_VERSION FALSE
|
||||
#define FILEVER 2, 0, 0, 600
|
||||
#define PRODUCTVER 2, 0, 0, 600
|
||||
#define STRFILEVER "2, 0, 0, 600\0"
|
||||
#define STRPRODUCTVER "2, 0, 0, 600\0"
|
||||
#endif //__AUTOBUILD_H__
|
910
src/Util.cpp
910
src/Util.cpp
|
@ -1,910 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#else // _WIN32
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
extern "C" {
|
||||
#include "stb_image.h"
|
||||
}
|
||||
|
||||
#define STBI_MSC_SECURE_CRT
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
extern "C" {
|
||||
#include "stb_image_write.h"
|
||||
}
|
||||
|
||||
#include "NLS.h"
|
||||
#include "System.h"
|
||||
#include "Util.h"
|
||||
#include "common/Port.h"
|
||||
#include "gba/Flash.h"
|
||||
#include "gba/GBA.h"
|
||||
#include "gba/Globals.h"
|
||||
#include "gba/RTC.h"
|
||||
|
||||
#include "fex/fex.h"
|
||||
|
||||
extern "C" {
|
||||
#include "common/memgzio.h"
|
||||
}
|
||||
|
||||
#include "gb/gbGlobals.h"
|
||||
#include "gba/gbafilter.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define _stricmp strcasecmp
|
||||
#endif // ! _MSC_VER
|
||||
|
||||
extern int systemColorDepth;
|
||||
extern int systemRedShift;
|
||||
extern int systemGreenShift;
|
||||
extern int systemBlueShift;
|
||||
|
||||
extern uint16_t systemColorMap16[0x10000];
|
||||
extern uint32_t systemColorMap32[0x10000];
|
||||
|
||||
static int(ZEXPORT *utilGzWriteFunc)(gzFile, const voidp, unsigned int) = NULL;
|
||||
static int(ZEXPORT *utilGzReadFunc)(gzFile, voidp, unsigned int) = NULL;
|
||||
static int(ZEXPORT *utilGzCloseFunc)(gzFile) = NULL;
|
||||
static z_off_t(ZEXPORT *utilGzSeekFunc)(gzFile, z_off_t, int) = NULL;
|
||||
|
||||
#define MAX_CART_SIZE 0x8000000 // 128MB
|
||||
|
||||
bool FileExists(const char *filename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (_access(filename, 0) != -1);
|
||||
#else
|
||||
struct stat buffer;
|
||||
return (stat(filename, &buffer) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
wchar_t* utf8ToUtf16(const char *utf8)
|
||||
{
|
||||
wchar_t *utf16 = nullptr;
|
||||
size_t size = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL , 0);
|
||||
if (size == 0) return nullptr; // error
|
||||
utf16 = new wchar_t[size];
|
||||
size = MultiByteToWideChar(CP_UTF8, 0, utf8 , -1, utf16, size);
|
||||
if (size == 0) {
|
||||
delete[] utf16;
|
||||
return nullptr; // error
|
||||
}
|
||||
return utf16;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
FILE* utilOpenFile(const char *filename, const char *mode)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
#ifdef _WIN32
|
||||
wchar_t *wfilename = utf8ToUtf16(filename);
|
||||
if (!wfilename) return nullptr;
|
||||
wchar_t *wmode = utf8ToUtf16(mode);
|
||||
if (!wmode) {
|
||||
delete[] wfilename;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
f = _wfopen(wfilename, wmode);
|
||||
delete[] wfilename;
|
||||
delete[] wmode;
|
||||
#else
|
||||
f = fopen(filename, mode);
|
||||
#endif // _WIN32
|
||||
return f;
|
||||
}
|
||||
|
||||
// Get user-specific config dir manually.
|
||||
// apple: ~/Library/Application Support/
|
||||
// windows: %APPDATA%/
|
||||
// unix: ${XDG_CONFIG_HOME:-~/.config}/
|
||||
std::string get_xdg_user_config_home()
|
||||
{
|
||||
std::string path;
|
||||
#ifdef __APPLE__
|
||||
std::string home(getenv("HOME"));
|
||||
path = home + "/Library/Application Support";
|
||||
#elif _WIN32
|
||||
char *app_data_env = getenv("LOCALAPPDATA");
|
||||
if (!app_data_env) app_data_env = getenv("APPDATA");
|
||||
std::string app_data(app_data_env);
|
||||
path = app_data;
|
||||
#else // Unix
|
||||
char *xdg_var = getenv("XDG_CONFIG_HOME");
|
||||
if (!xdg_var || !*xdg_var)
|
||||
{
|
||||
std::string xdg_default(getenv("HOME"));
|
||||
path = xdg_default + "/.config";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = xdg_var;
|
||||
}
|
||||
#endif
|
||||
return path + FILE_SEP;
|
||||
}
|
||||
|
||||
// Get user-specific data dir manually.
|
||||
// apple: ~/Library/Application Support/
|
||||
// windows: %APPDATA%/
|
||||
// unix: ${XDG_DATA_HOME:-~/.local/share}/
|
||||
std::string get_xdg_user_data_home()
|
||||
{
|
||||
std::string path;
|
||||
#ifdef __APPLE__
|
||||
std::string home(getenv("HOME"));
|
||||
path = home + "/Library/Application Support";
|
||||
#elif _WIN32
|
||||
char *app_data_env = getenv("LOCALAPPDATA");
|
||||
if (!app_data_env) app_data_env = getenv("APPDATA");
|
||||
std::string app_data(app_data_env);
|
||||
path = app_data;
|
||||
#else // Unix
|
||||
char *xdg_var = getenv("XDG_DATA_HOME");
|
||||
if (!xdg_var || !*xdg_var)
|
||||
{
|
||||
std::string xdg_default(getenv("HOME"));
|
||||
path = xdg_default + "/.local/share";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = xdg_var;
|
||||
}
|
||||
#endif
|
||||
return path + FILE_SEP;
|
||||
}
|
||||
|
||||
void utilReadScreenPixels(uint8_t *dest, int w, int h)
|
||||
{
|
||||
uint8_t *b = dest;
|
||||
int sizeX = w;
|
||||
int sizeY = h;
|
||||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
uint16_t *p = (uint16_t *)(pix + (w + 2) * 2); // skip first black line
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint16_t v = *p++;
|
||||
|
||||
*b++ = ((v >> systemRedShift) & 0x001f) << 3; // R
|
||||
*b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G
|
||||
*b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B
|
||||
}
|
||||
p++; // skip black pixel for filters
|
||||
p++; // skip black pixel for filters
|
||||
}
|
||||
} break;
|
||||
case 24: {
|
||||
uint8_t *pixU8 = (uint8_t *)pix;
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
if (systemRedShift < systemBlueShift) {
|
||||
*b++ = *pixU8++; // R
|
||||
*b++ = *pixU8++; // G
|
||||
*b++ = *pixU8++; // B
|
||||
} else {
|
||||
int blue = *pixU8++;
|
||||
int green = *pixU8++;
|
||||
int red = *pixU8++;
|
||||
|
||||
*b++ = red;
|
||||
*b++ = green;
|
||||
*b++ = blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case 32: {
|
||||
uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1));
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint32_t v = *pixU32++;
|
||||
*b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B
|
||||
*b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G
|
||||
*b++ = ((v >> systemRedShift) & 0x001f) << 3; // R
|
||||
}
|
||||
pixU32++;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
#define CHANNEL_NUM 3 // RGB
|
||||
|
||||
bool utilWritePNGFile(const char *fileName, int w, int h, uint8_t *pix)
|
||||
{
|
||||
uint8_t *writeBuffer = new uint8_t[w * h * CHANNEL_NUM];
|
||||
|
||||
uint8_t *b = writeBuffer;
|
||||
|
||||
int sizeX = w;
|
||||
int sizeY = h;
|
||||
|
||||
switch (systemColorDepth)
|
||||
{
|
||||
case 16: {
|
||||
uint16_t *p = (uint16_t *)(pix + (w + 2) * 2); // skip first black line
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint16_t v = *p++;
|
||||
|
||||
*b++ = ((v >> systemRedShift) & 0x001f) << 3; // R
|
||||
*b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G
|
||||
*b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B
|
||||
}
|
||||
p++; // skip black pixel for filters
|
||||
p++; // skip black pixel for filters
|
||||
}
|
||||
} break;
|
||||
case 24: {
|
||||
uint8_t *pixU8 = (uint8_t *)pix;
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
if (systemRedShift < systemBlueShift) {
|
||||
*b++ = *pixU8++; // R
|
||||
*b++ = *pixU8++; // G
|
||||
*b++ = *pixU8++; // B
|
||||
} else {
|
||||
int blue = *pixU8++;
|
||||
int green = *pixU8++;
|
||||
int red = *pixU8++;
|
||||
|
||||
*b++ = red;
|
||||
*b++ = green;
|
||||
*b++ = blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case 32: {
|
||||
uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1));
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint32_t v = *pixU32++;
|
||||
|
||||
*b++ = ((v >> systemRedShift) & 0x001f) << 3; // R
|
||||
*b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G
|
||||
*b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B
|
||||
}
|
||||
pixU32++;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
bool ret = (0 != stbi_write_png(fileName, w, h, CHANNEL_NUM, writeBuffer, w * CHANNEL_NUM));
|
||||
delete[] writeBuffer;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void utilPutDword(uint8_t *p, uint32_t value)
|
||||
{
|
||||
*p++ = value & 255;
|
||||
*p++ = (value >> 8) & 255;
|
||||
*p++ = (value >> 16) & 255;
|
||||
*p = (value >> 24) & 255;
|
||||
}
|
||||
|
||||
void utilPutWord(uint8_t *p, uint16_t value)
|
||||
{
|
||||
*p++ = value & 255;
|
||||
*p = (value >> 8) & 255;
|
||||
}
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
|
||||
{
|
||||
uint8_t writeBuffer[512 * 3];
|
||||
|
||||
FILE *fp = fopen(fileName, "wb");
|
||||
|
||||
if (!fp) {
|
||||
systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct {
|
||||
uint8_t ident[2];
|
||||
uint8_t filesize[4];
|
||||
uint8_t reserved[4];
|
||||
uint8_t dataoffset[4];
|
||||
uint8_t headersize[4];
|
||||
uint8_t width[4];
|
||||
uint8_t height[4];
|
||||
uint8_t planes[2];
|
||||
uint8_t bitsperpixel[2];
|
||||
uint8_t compression[4];
|
||||
uint8_t datasize[4];
|
||||
uint8_t hres[4];
|
||||
uint8_t vres[4];
|
||||
uint8_t colors[4];
|
||||
uint8_t importantcolors[4];
|
||||
// uint8_t pad[2];
|
||||
} bmpheader;
|
||||
memset(&bmpheader, 0, sizeof(bmpheader));
|
||||
|
||||
bmpheader.ident[0] = 'B';
|
||||
bmpheader.ident[1] = 'M';
|
||||
|
||||
uint32_t fsz = sizeof(bmpheader) + w * h * 3;
|
||||
utilPutDword(bmpheader.filesize, fsz);
|
||||
utilPutDword(bmpheader.dataoffset, 0x36);
|
||||
utilPutDword(bmpheader.headersize, 0x28);
|
||||
utilPutDword(bmpheader.width, w);
|
||||
utilPutDword(bmpheader.height, h);
|
||||
utilPutDword(bmpheader.planes, 1);
|
||||
utilPutDword(bmpheader.bitsperpixel, 24);
|
||||
utilPutDword(bmpheader.datasize, 3 * w * h);
|
||||
|
||||
fwrite(&bmpheader, 1, sizeof(bmpheader), fp);
|
||||
|
||||
uint8_t *b = writeBuffer;
|
||||
|
||||
int sizeX = w;
|
||||
int sizeY = h;
|
||||
|
||||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
uint16_t *p = (uint16_t *)(pix + (w + 2) * (h)*2); // skip first black line
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint16_t v = *p++;
|
||||
|
||||
*b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B
|
||||
*b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G
|
||||
*b++ = ((v >> systemRedShift) & 0x001f) << 3; // R
|
||||
}
|
||||
p++; // skip black pixel for filters
|
||||
p++; // skip black pixel for filters
|
||||
p -= 2 * (w + 2);
|
||||
fwrite(writeBuffer, 1, 3 * w, fp);
|
||||
|
||||
b = writeBuffer;
|
||||
}
|
||||
} break;
|
||||
case 24: {
|
||||
uint8_t *pixU8 = (uint8_t *)pix + 3 * w * (h - 1);
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
if (systemRedShift > systemBlueShift) {
|
||||
*b++ = *pixU8++; // B
|
||||
*b++ = *pixU8++; // G
|
||||
*b++ = *pixU8++; // R
|
||||
} else {
|
||||
int red = *pixU8++;
|
||||
int green = *pixU8++;
|
||||
int blue = *pixU8++;
|
||||
|
||||
*b++ = blue;
|
||||
*b++ = green;
|
||||
*b++ = red;
|
||||
}
|
||||
}
|
||||
pixU8 -= 2 * 3 * w;
|
||||
fwrite(writeBuffer, 1, 3 * w, fp);
|
||||
|
||||
b = writeBuffer;
|
||||
}
|
||||
} break;
|
||||
case 32: {
|
||||
uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1) * (h));
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint32_t v = *pixU32++;
|
||||
|
||||
*b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B
|
||||
*b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G
|
||||
*b++ = ((v >> systemRedShift) & 0x001f) << 3; // R
|
||||
}
|
||||
pixU32++;
|
||||
pixU32 -= 2 * (w + 1);
|
||||
|
||||
fwrite(writeBuffer, 1, 3 * w, fp);
|
||||
|
||||
b = writeBuffer;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif /* !__LIBRETRO__ */
|
||||
|
||||
bool utilIsGBAImage(const char *file)
|
||||
{
|
||||
coreOptions.cpuIsMultiBoot = false;
|
||||
if (strlen(file) > 4) {
|
||||
const char *p = strrchr(file, '.');
|
||||
|
||||
if (p != NULL) {
|
||||
if ((_stricmp(p, ".agb") == 0) || (_stricmp(p, ".gba") == 0) ||
|
||||
(_stricmp(p, ".bin") == 0) || (_stricmp(p, ".elf") == 0))
|
||||
return true;
|
||||
if (_stricmp(p, ".mb") == 0) {
|
||||
coreOptions.cpuIsMultiBoot = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool utilIsGBImage(const char *file)
|
||||
{
|
||||
if (strlen(file) > 4) {
|
||||
const char *p = strrchr(file, '.');
|
||||
|
||||
if (p != NULL) {
|
||||
if ((_stricmp(p, ".dmg") == 0) || (_stricmp(p, ".gb") == 0) ||
|
||||
(_stricmp(p, ".gbc") == 0) || (_stricmp(p, ".cgb") == 0) ||
|
||||
(_stricmp(p, ".sgb") == 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool utilIsGzipFile(const char *file)
|
||||
{
|
||||
if (strlen(file) > 3) {
|
||||
const char *p = strrchr(file, '.');
|
||||
|
||||
if (p != NULL) {
|
||||
if (_stricmp(p, ".gz") == 0)
|
||||
return true;
|
||||
if (_stricmp(p, ".z") == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// strip .gz or .z off end
|
||||
void utilStripDoubleExtension(const char *file, char *buffer)
|
||||
{
|
||||
if (buffer != file) // allows conversion in place
|
||||
strcpy(buffer, file);
|
||||
|
||||
if (utilIsGzipFile(file)) {
|
||||
char *p = strrchr(buffer, '.');
|
||||
|
||||
if (p)
|
||||
*p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Opens and scans archive using accept(). Returns fex_t if found.
|
||||
// If error or not found, displays message and returns NULL.
|
||||
static fex_t *scan_arc(const char *file, bool (*accept)(const char *), char (&buffer)[2048])
|
||||
{
|
||||
fex_t *fe;
|
||||
fex_err_t err = fex_open(&fe, file);
|
||||
if (!fe) {
|
||||
systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s: %s"), file, err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Scan filenames
|
||||
bool found = false;
|
||||
while (!fex_done(fe)) {
|
||||
strncpy(buffer, fex_name(fe), sizeof buffer);
|
||||
buffer[sizeof buffer - 1] = '\0';
|
||||
|
||||
utilStripDoubleExtension(buffer, buffer);
|
||||
|
||||
if (accept(buffer)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
fex_err_t err = fex_next(fe);
|
||||
if (err) {
|
||||
systemMessage(MSG_BAD_ZIP_FILE,
|
||||
N_("Cannot read archive %s: %s"),
|
||||
file,
|
||||
err);
|
||||
fex_close(fe);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
systemMessage(MSG_NO_IMAGE_ON_ZIP, N_("No image found in file %s"), file);
|
||||
fex_close(fe);
|
||||
return NULL;
|
||||
}
|
||||
return fe;
|
||||
}
|
||||
|
||||
static bool utilIsImage(const char *file)
|
||||
{
|
||||
return utilIsGBAImage(file) || utilIsGBImage(file);
|
||||
}
|
||||
|
||||
IMAGE_TYPE utilFindType(const char *file, char (&buffer)[2048]);
|
||||
|
||||
IMAGE_TYPE utilFindType(const char *file)
|
||||
{
|
||||
char buffer[2048];
|
||||
return utilFindType(file, buffer);
|
||||
}
|
||||
|
||||
IMAGE_TYPE utilFindType(const char *file, char (&buffer)[2048])
|
||||
{
|
||||
#ifdef WIN32
|
||||
DWORD dwNum = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
|
||||
wchar_t *pwText;
|
||||
pwText = new wchar_t[dwNum];
|
||||
if (!pwText) {
|
||||
return IMAGE_UNKNOWN;
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, file, -1, pwText, dwNum);
|
||||
//char *file_conv = fex_wide_to_path(file);
|
||||
char *file_conv = (char *)file;
|
||||
// if ( !utilIsImage( file_conv ) ) // TODO: utilIsArchive() instead?
|
||||
// {
|
||||
fex_t *fe = scan_arc(file_conv, utilIsImage, buffer);
|
||||
if (!fe)
|
||||
return IMAGE_UNKNOWN;
|
||||
fex_close(fe);
|
||||
file = buffer;
|
||||
// }
|
||||
//free(file_conv);
|
||||
#else
|
||||
// if ( !utilIsImage( file ) ) // TODO: utilIsArchive() instead?
|
||||
// {
|
||||
fex_t *fe = scan_arc(file, utilIsImage, buffer);
|
||||
if (!fe)
|
||||
return IMAGE_UNKNOWN;
|
||||
fex_close(fe);
|
||||
file = buffer;
|
||||
// }
|
||||
#endif
|
||||
return utilIsGBAImage(file) ? IMAGE_GBA : IMAGE_GB;
|
||||
}
|
||||
|
||||
static int utilGetSize(int size)
|
||||
{
|
||||
int res = 1;
|
||||
while (res < size)
|
||||
res <<= 1;
|
||||
return res;
|
||||
}
|
||||
|
||||
uint8_t *utilLoad(const char *file, bool (*accept)(const char *), uint8_t *data, int &size)
|
||||
{
|
||||
// find image file
|
||||
char buffer[2048];
|
||||
#ifdef WIN32
|
||||
DWORD dwNum = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
|
||||
wchar_t *pwText;
|
||||
pwText = new wchar_t[dwNum];
|
||||
if (!pwText) {
|
||||
return NULL;
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, file, -1, pwText, dwNum);
|
||||
//char *file_conv = fex_wide_to_path(file);
|
||||
char *file_conv = (char *)file;
|
||||
delete[] pwText;
|
||||
fex_t *fe = scan_arc(file_conv, accept, buffer);
|
||||
if (!fe)
|
||||
return NULL;
|
||||
//free(file_conv);
|
||||
#else
|
||||
fex_t *fe = scan_arc(file, accept, buffer);
|
||||
if (!fe)
|
||||
return NULL;
|
||||
#endif
|
||||
// Allocate space for image
|
||||
fex_err_t err = fex_stat(fe);
|
||||
int fileSize = fex_size(fe);
|
||||
if (size == 0)
|
||||
size = fileSize;
|
||||
|
||||
if (size > MAX_CART_SIZE)
|
||||
return NULL;
|
||||
|
||||
uint8_t *image = data;
|
||||
|
||||
if (image == NULL) {
|
||||
// allocate buffer memory if none was passed to the function
|
||||
image = (uint8_t *)malloc(utilGetSize(size));
|
||||
if (image == NULL) {
|
||||
fex_close(fe);
|
||||
systemMessage(MSG_OUT_OF_MEMORY,
|
||||
N_("Failed to allocate memory for %s"),
|
||||
"data");
|
||||
return NULL;
|
||||
}
|
||||
size = fileSize;
|
||||
}
|
||||
|
||||
// Read image
|
||||
int read = fileSize <= size ? fileSize : size; // do not read beyond file
|
||||
err = fex_read(fe, image, read);
|
||||
fex_close(fe);
|
||||
if (err) {
|
||||
systemMessage(MSG_ERROR_READING_IMAGE,
|
||||
N_("Error reading image from %s: %s"),
|
||||
buffer,
|
||||
err);
|
||||
if (data == NULL)
|
||||
free(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = fileSize;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
void replaceAll(std::string &str, const std::string &from, const std::string &to)
|
||||
{
|
||||
if (from.empty())
|
||||
return;
|
||||
size_t start_pos = 0;
|
||||
while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
|
||||
str.replace(start_pos, from.length(), to);
|
||||
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with
|
||||
// 'yx'
|
||||
}
|
||||
}
|
||||
|
||||
void utilExtract(const char *filepath, const char *filename)
|
||||
{
|
||||
fex_t *fex;
|
||||
std::string archive_name(filepath);
|
||||
archive_name.append(filename);
|
||||
|
||||
fex_open(&fex, archive_name.c_str());
|
||||
while (!fex_done(fex)) {
|
||||
std::string extracted_filename(filepath);
|
||||
extracted_filename.append(fex_name(fex));
|
||||
#ifdef WIN32
|
||||
replaceAll(extracted_filename, "/", "\\");
|
||||
#endif
|
||||
|
||||
std::string new_dir(filepath);
|
||||
new_dir.append(fex_name(fex));
|
||||
#ifdef WIN32
|
||||
replaceAll(new_dir, "/", "\\");
|
||||
#endif
|
||||
new_dir = new_dir.substr(0, new_dir.find_last_of("\\"));
|
||||
if (!FileExists(new_dir.c_str()))
|
||||
mkdir(new_dir.c_str()
|
||||
#ifndef WIN32
|
||||
,
|
||||
0777
|
||||
#endif
|
||||
);
|
||||
|
||||
if (FileExists(extracted_filename.c_str())) {
|
||||
std::string new_name(filepath);
|
||||
new_name.append("old-");
|
||||
new_name.append(fex_name(fex));
|
||||
#ifdef WIN32
|
||||
replaceAll(new_name, "/", "\\");
|
||||
#endif
|
||||
remove(new_name.c_str());
|
||||
rename(extracted_filename.c_str(), new_name.c_str());
|
||||
}
|
||||
|
||||
FILE *extracted_file = fopen(extracted_filename.c_str(), "wb");
|
||||
const void *p;
|
||||
fex_data(fex, &p);
|
||||
fwrite(p, fex_size(fex), 1, extracted_file);
|
||||
fclose(extracted_file);
|
||||
fex_next(fex);
|
||||
}
|
||||
fex_close(fex);
|
||||
}
|
||||
|
||||
void utilWriteInt(gzFile gzFile, int i)
|
||||
{
|
||||
utilGzWrite(gzFile, &i, sizeof(int));
|
||||
}
|
||||
|
||||
int utilReadInt(gzFile gzFile)
|
||||
{
|
||||
int i = 0;
|
||||
utilGzRead(gzFile, &i, sizeof(int));
|
||||
return i;
|
||||
}
|
||||
|
||||
void utilReadData(gzFile gzFile, variable_desc *data)
|
||||
{
|
||||
while (data->address) {
|
||||
utilGzRead(gzFile, data->address, data->size);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
void utilReadDataSkip(gzFile gzFile, variable_desc *data)
|
||||
{
|
||||
while (data->address) {
|
||||
utilGzSeek(gzFile, data->size, SEEK_CUR);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
void utilWriteData(gzFile gzFile, variable_desc *data)
|
||||
{
|
||||
while (data->address) {
|
||||
utilGzWrite(gzFile, data->address, data->size);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
gzFile utilAutoGzOpen(const char *file, const char *mode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wchar_t *wfile = utf8ToUtf16(file);
|
||||
if (!wfile) return nullptr;
|
||||
gzFile handler = gzopen_w(wfile, mode);
|
||||
delete[] wfile;
|
||||
return handler;
|
||||
#else
|
||||
return gzopen(file, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
gzFile utilGzOpen(const char *file, const char *mode)
|
||||
{
|
||||
utilGzWriteFunc = (int(ZEXPORT *)(gzFile, void *const, unsigned int))gzwrite;
|
||||
utilGzReadFunc = gzread;
|
||||
utilGzCloseFunc = gzclose;
|
||||
utilGzSeekFunc = gzseek;
|
||||
|
||||
return utilAutoGzOpen(file, mode);
|
||||
}
|
||||
|
||||
gzFile utilMemGzOpen(char *memory, int available, const char *mode)
|
||||
{
|
||||
utilGzWriteFunc = memgzwrite;
|
||||
utilGzReadFunc = memgzread;
|
||||
utilGzCloseFunc = memgzclose;
|
||||
utilGzSeekFunc = memgzseek;
|
||||
|
||||
return memgzopen(memory, available, mode);
|
||||
}
|
||||
|
||||
int utilGzWrite(gzFile file, const voidp buffer, unsigned int len)
|
||||
{
|
||||
return utilGzWriteFunc(file, buffer, len);
|
||||
}
|
||||
|
||||
int utilGzRead(gzFile file, voidp buffer, unsigned int len)
|
||||
{
|
||||
return utilGzReadFunc(file, buffer, len);
|
||||
}
|
||||
|
||||
int utilGzClose(gzFile file)
|
||||
{
|
||||
return utilGzCloseFunc(file);
|
||||
}
|
||||
|
||||
z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence)
|
||||
{
|
||||
return utilGzSeekFunc(file, offset, whence);
|
||||
}
|
||||
|
||||
long utilGzMemTell(gzFile file)
|
||||
{
|
||||
return memtell(file);
|
||||
}
|
||||
|
||||
void utilGBAFindSave(const int size)
|
||||
{
|
||||
uint32_t *p = (uint32_t *)&rom[0];
|
||||
uint32_t *end = (uint32_t *)(&rom[0] + size);
|
||||
int detectedSaveType = 0;
|
||||
int flashSize = 0x10000;
|
||||
bool rtcFound = false;
|
||||
|
||||
while (p < end) {
|
||||
uint32_t d = READ32LE(p);
|
||||
|
||||
if (d == 0x52504545) {
|
||||
if (memcmp(p, "EEPROM_", 7) == 0) {
|
||||
if (detectedSaveType == 0 || detectedSaveType == 4)
|
||||
detectedSaveType = 1;
|
||||
}
|
||||
} else if (d == 0x4D415253) {
|
||||
if (memcmp(p, "SRAM_", 5) == 0) {
|
||||
if (detectedSaveType == 0 || detectedSaveType == 1 ||
|
||||
detectedSaveType == 4)
|
||||
detectedSaveType = 2;
|
||||
}
|
||||
} else if (d == 0x53414C46) {
|
||||
if (memcmp(p, "FLASH1M_", 8) == 0) {
|
||||
if (detectedSaveType == 0) {
|
||||
detectedSaveType = 3;
|
||||
flashSize = 0x20000;
|
||||
}
|
||||
} else if (memcmp(p, "FLASH512_", 9) == 0) {
|
||||
if (detectedSaveType == 0) {
|
||||
detectedSaveType = 3;
|
||||
flashSize = 0x10000;
|
||||
}
|
||||
} else if (memcmp(p, "FLASH", 5) == 0) {
|
||||
if (detectedSaveType == 0) {
|
||||
detectedSaveType = 4;
|
||||
flashSize = 0x10000;
|
||||
}
|
||||
}
|
||||
} else if (d == 0x52494953) {
|
||||
if (memcmp(p, "SIIRTC_V", 8) == 0)
|
||||
rtcFound = true;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
// if no matches found, then set it to NONE
|
||||
if (detectedSaveType == 0) {
|
||||
detectedSaveType = 5;
|
||||
}
|
||||
if (detectedSaveType == 4) {
|
||||
detectedSaveType = 3;
|
||||
}
|
||||
rtcEnable(rtcFound);
|
||||
rtcEnableRumble(!rtcFound);
|
||||
coreOptions.saveType = detectedSaveType;
|
||||
flashSetSize(flashSize);
|
||||
}
|
||||
|
||||
void utilUpdateSystemColorMaps(bool lcd)
|
||||
{
|
||||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal(systemColorMap16, 0x10000);
|
||||
} break;
|
||||
case 24:
|
||||
case 32: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for existence of file.
|
||||
bool utilFileExists(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (f == NULL) {
|
||||
return false;
|
||||
} else {
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef VBAM_BSD_H
|
||||
#define VBAM_BSD_H
|
||||
|
||||
#define fopen64 fopen
|
||||
#define fseeko64 fseeko
|
||||
#define fseek64 fseek
|
||||
#define ftell64 ftell
|
||||
#define ftello64 ftello
|
||||
|
||||
#endif // VBAM_BSD_H
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef PATCH_H
|
||||
#define PATCH_H
|
||||
|
||||
#include "../Util.h"
|
||||
#include "Types.h"
|
||||
|
||||
bool applyPatch(const char *patchname, uint8_t **rom, int *size);
|
||||
|
||||
#endif // PATCH_H
|
|
@ -1,64 +0,0 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 2015 VBA-M development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef __VBA_SOUND_DRIVER_H__
|
||||
#define __VBA_SOUND_DRIVER_H__
|
||||
|
||||
#include <stdint.h> // for uint16_t
|
||||
|
||||
/**
|
||||
* Sound driver abstract interface for the core to use to output sound.
|
||||
* Subclass this to implement a new sound driver.
|
||||
*/
|
||||
class SoundDriver
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destructor. Free the resources allocated by the sound driver.
|
||||
*/
|
||||
virtual ~SoundDriver(){};
|
||||
|
||||
/**
|
||||
* Initialize the sound driver.
|
||||
* @param sampleRate In Hertz
|
||||
*/
|
||||
virtual bool init(long sampleRate) = 0;
|
||||
|
||||
/**
|
||||
* Tell the driver that the sound stream has paused
|
||||
*/
|
||||
virtual void pause() = 0;
|
||||
|
||||
/**
|
||||
* Reset the sound driver
|
||||
*/
|
||||
virtual void reset() = 0;
|
||||
|
||||
/**
|
||||
* Tell the driver that the sound stream has resumed
|
||||
*/
|
||||
virtual void resume() = 0;
|
||||
|
||||
/**
|
||||
* Write length bytes of data from the finalWave buffer to the driver output buffer.
|
||||
*/
|
||||
virtual void write(uint16_t *finalWave, int length) = 0;
|
||||
|
||||
virtual void setThrottle(unsigned short throttle) = 0;
|
||||
};
|
||||
|
||||
#endif // __VBA_SOUND_DRIVER_H__
|
|
@ -1,28 +0,0 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 2008 VBA-M development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef __VBA_TYPES_H__
|
||||
#define __VBA_TYPES_H__
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#include "cstdint.h"
|
||||
#endif
|
||||
|
||||
#endif // __VBA_TYPES_H__
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef CONTAINS_HPP_
|
||||
#define CONTAINS_HPP_
|
||||
|
||||
template <class C, class V>
|
||||
bool contains(const C& container, const V& val)
|
||||
{
|
||||
return (container.find(val) != container.end());
|
||||
}
|
||||
|
||||
#endif /* CONTAINS_HPP_ */
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef CSTDINT_H
|
||||
#define CSTDINT_H
|
||||
|
||||
#if defined(__has_include)
|
||||
# if __has_include(<cstdint>)
|
||||
# include <cstdint>
|
||||
// necessary on Mac OS X Lion 10.7 or any clang <= 3.0
|
||||
# elif __has_include(<tr1/cstdint>)
|
||||
# include <tr1/cstdint>
|
||||
# else
|
||||
// throw error
|
||||
# include <cstdint>
|
||||
# endif
|
||||
#else
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
#endif // CSTDINT_H
|
|
@ -1,669 +0,0 @@
|
|||
/*
|
||||
Range
|
||||
=====
|
||||
|
||||
Copyright (c) 2009-2011 Khaled Alshaya
|
||||
|
||||
Distributed under the Boost Software License, version 1.0
|
||||
(See the license at: http://www.boost.org/license_1_0.txt).
|
||||
*/
|
||||
|
||||
/*
|
||||
Rationale
|
||||
=========
|
||||
|
||||
In Python, there is a beautiful function called "range".
|
||||
"range" allows the programmer to iterate over a range elegantly.
|
||||
This concept is not as general as "for-loops" in C++,
|
||||
but non the less, it expresses the intent of the programmer
|
||||
clearer than the general "for-loops" in many cases.
|
||||
|
||||
|
||||
Design
|
||||
======
|
||||
|
||||
Range is made to be STL-like library. In fact, it is
|
||||
built on top of the concepts of STL. The library is designed to
|
||||
work with STL algorithms as well. Range is more flexible
|
||||
than the Python "range", because:
|
||||
|
||||
Range is an "immutable ordered random access container"
|
||||
|
||||
|
||||
Specifications
|
||||
==============
|
||||
|
||||
Range satisfies the following requirements:
|
||||
|
||||
* Immutable.
|
||||
* Random Access Container.
|
||||
* Random Access Iterator Interface.
|
||||
* Constant Time Complexity Operations.
|
||||
|
||||
|
||||
Range models an ordered sequence of elements,
|
||||
where a range is defined by:
|
||||
|
||||
[begin, end)
|
||||
|
||||
* begin: the first element in the range. (Inclusive)
|
||||
* end : the last element in the range. (Exclusive)
|
||||
* step : the distance between two consecutive elements in a range.
|
||||
|
||||
where each element in the range is defined by:
|
||||
|
||||
element = begin + step * i
|
||||
|
||||
* i: is the index of the element in range.
|
||||
|
||||
The following precondition must be met for the sequence
|
||||
to be a valid range:
|
||||
|
||||
step != 0
|
||||
&&
|
||||
(
|
||||
begin <= end && step > 0
|
||||
||
|
||||
begin >= end && step < 0
|
||||
)
|
||||
|
||||
|
||||
Portability
|
||||
===========
|
||||
|
||||
Range Generator is written in standard C++ (C++98). It depends
|
||||
-only- on the standard C++ library.
|
||||
*/
|
||||
|
||||
#ifndef range_h__
|
||||
#define range_h__
|
||||
|
||||
// using std::range
|
||||
// using std::size_t from <cstddef>
|
||||
// using std::ceil from <cmath>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <cstddef>
|
||||
#include <cmath>
|
||||
|
||||
namespace Range
|
||||
{
|
||||
template <class IntegerType>
|
||||
struct basic_range
|
||||
{
|
||||
struct const_iterator_impl
|
||||
{
|
||||
typedef IntegerType value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef IntegerType difference_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef
|
||||
std::random_access_iterator_tag
|
||||
iterator_category;
|
||||
|
||||
const_iterator_impl(): r(0), index(0)
|
||||
{ }
|
||||
|
||||
const_iterator_impl(const const_iterator_impl& rhs)
|
||||
: r(rhs.r), index(rhs.index)
|
||||
{ }
|
||||
|
||||
const_iterator_impl(basic_range<IntegerType> const * p_range, size_type p_index)
|
||||
:r(p_range), index(p_index)
|
||||
{ }
|
||||
|
||||
const_iterator_impl& operator=(const const_iterator_impl& rhs)
|
||||
{
|
||||
r = rhs.r;
|
||||
index = rhs.index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return *r == *(rhs.r) && index == rhs.index;
|
||||
}
|
||||
|
||||
bool operator!=(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator<(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return index < rhs.index;
|
||||
}
|
||||
|
||||
bool operator>(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return index > rhs.index;
|
||||
}
|
||||
|
||||
bool operator<=(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return index <= rhs.index;
|
||||
}
|
||||
|
||||
bool operator>=(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return index >= rhs.index;
|
||||
}
|
||||
|
||||
value_type operator*() const
|
||||
{
|
||||
return r->m_first_element + r->m_step*index;
|
||||
}
|
||||
|
||||
// operator->
|
||||
// is not implemented because the value_type is an integer type
|
||||
// and primitive types in C++ don't define member functions.
|
||||
|
||||
const_iterator_impl& operator++()
|
||||
{
|
||||
++index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator_impl operator++(int)
|
||||
{
|
||||
const_iterator_impl temp = *this;
|
||||
++index;
|
||||
return temp;
|
||||
}
|
||||
|
||||
const_iterator_impl& operator--()
|
||||
{
|
||||
--index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator_impl operator--(int)
|
||||
{
|
||||
const_iterator_impl temp = *this;
|
||||
--index;
|
||||
return temp;
|
||||
}
|
||||
|
||||
const_iterator_impl& operator+=(difference_type increment)
|
||||
{
|
||||
index += increment;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// operator+
|
||||
// is friend operator but operator-
|
||||
// is not, because we want to allow the following for "+":
|
||||
// iterator+5
|
||||
// 5+iterator
|
||||
// For the "-" it is not correct to do so, because
|
||||
// iterator-5 != 5-iterator
|
||||
friend const_iterator_impl operator+
|
||||
(const const_iterator_impl& lhs, difference_type increment)
|
||||
{
|
||||
const_iterator_impl sum;
|
||||
sum.r = lhs.r;
|
||||
sum.index = lhs.index + increment;
|
||||
return sum;
|
||||
}
|
||||
|
||||
const_iterator_impl& operator-=(difference_type decrement)
|
||||
{
|
||||
index -= decrement;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator_impl operator-(difference_type decrement) const
|
||||
{
|
||||
const_iterator_impl shifted_iterator;
|
||||
shifted_iterator.r = r;
|
||||
shifted_iterator.index = index - decrement;
|
||||
return shifted_iterator;
|
||||
}
|
||||
|
||||
difference_type operator-(const const_iterator_impl& rhs) const
|
||||
{
|
||||
return index - rhs.index;
|
||||
}
|
||||
|
||||
value_type operator[](difference_type offset) const
|
||||
{
|
||||
size_type new_index = index + offset;
|
||||
return r->m_first_element + r->m_step*new_index;
|
||||
}
|
||||
|
||||
private:
|
||||
basic_range<IntegerType> const * r;
|
||||
size_type index;
|
||||
};
|
||||
|
||||
|
||||
struct const_reverse_iterator_impl
|
||||
{
|
||||
typedef IntegerType value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef IntegerType difference_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef
|
||||
std::random_access_iterator_tag
|
||||
iterator_category;
|
||||
|
||||
|
||||
const_reverse_iterator_impl(): r(0), index(0)
|
||||
{ }
|
||||
|
||||
const_reverse_iterator_impl(const const_reverse_iterator_impl& rhs)
|
||||
: r(rhs.r), index(rhs.index)
|
||||
{ }
|
||||
|
||||
const_reverse_iterator_impl(basic_range<IntegerType> const * p_range, size_type p_index)
|
||||
:r(p_range), index(p_index)
|
||||
{ }
|
||||
|
||||
const_reverse_iterator_impl& operator=(const const_reverse_iterator_impl& rhs)
|
||||
{
|
||||
r = rhs.r;
|
||||
index = rhs.index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return *r == *(rhs.r) && index == rhs.index;
|
||||
}
|
||||
|
||||
bool operator!=(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator<(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return index < rhs.index;
|
||||
}
|
||||
|
||||
bool operator>(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return index > rhs.index;
|
||||
}
|
||||
|
||||
bool operator<=(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return index <= rhs.index;
|
||||
}
|
||||
|
||||
bool operator>=(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return index >= rhs.index;
|
||||
}
|
||||
|
||||
value_type operator*() const
|
||||
{
|
||||
size_type reverse_index
|
||||
= (r->m_element_count - 1) - index;
|
||||
return r->m_first_element + r->m_step*reverse_index;
|
||||
}
|
||||
|
||||
// operator->
|
||||
// is not implemented because the value_type is integer type
|
||||
// and primitive types in C++ don't define member functions.
|
||||
|
||||
const_reverse_iterator_impl& operator++()
|
||||
{
|
||||
++index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_reverse_iterator_impl operator++(int)
|
||||
{
|
||||
const_reverse_iterator_impl temp = *this;
|
||||
++index;
|
||||
return temp;
|
||||
}
|
||||
|
||||
const_reverse_iterator_impl& operator--()
|
||||
{
|
||||
--index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_reverse_iterator_impl operator--(int)
|
||||
{
|
||||
const_reverse_iterator_impl temp = *this;
|
||||
--index;
|
||||
return temp;
|
||||
}
|
||||
|
||||
const_reverse_iterator_impl& operator+=(difference_type increment)
|
||||
{
|
||||
index += increment;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// operator+
|
||||
// is friend operator but operator-
|
||||
// is not, because we want to allow the following for "+":
|
||||
// iterator+5
|
||||
// 5+iterator
|
||||
// For the "-" it is not correct to do so, because
|
||||
// iterator-5 != 5-iterator
|
||||
friend const_reverse_iterator_impl operator+
|
||||
(const const_reverse_iterator_impl& lhs, difference_type increment)
|
||||
{
|
||||
const_reverse_iterator_impl sum;
|
||||
sum.r = lhs.r;
|
||||
sum.index = lhs.index + increment;
|
||||
return sum;
|
||||
}
|
||||
|
||||
const_reverse_iterator_impl& operator-=(difference_type decrement)
|
||||
{
|
||||
index -= decrement;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_reverse_iterator_impl operator-(difference_type decrement) const
|
||||
{
|
||||
const_reverse_iterator_impl shifted_iterator;
|
||||
shifted_iterator.r = r;
|
||||
shifted_iterator.index = index - decrement;
|
||||
return shifted_iterator;
|
||||
}
|
||||
|
||||
difference_type operator-(const const_reverse_iterator_impl& rhs) const
|
||||
{
|
||||
return index - rhs.index;
|
||||
}
|
||||
|
||||
value_type operator[](difference_type offset) const
|
||||
{
|
||||
size_type new_reverse_index
|
||||
= (r->m_element_count - 1) - (index + offset);
|
||||
return r->m_first_element + r->m_step*new_reverse_index;
|
||||
}
|
||||
|
||||
private:
|
||||
basic_range<IntegerType> const * r;
|
||||
size_type index;
|
||||
};
|
||||
|
||||
typedef IntegerType value_type;
|
||||
typedef const_iterator_impl iterator;
|
||||
typedef const_iterator_impl const_iterator;
|
||||
typedef const_reverse_iterator_impl reverse_iterator;
|
||||
typedef const_reverse_iterator_impl const_reverse_iterator;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* pointer;
|
||||
typedef IntegerType difference_type;
|
||||
typedef std::size_t size_type;
|
||||
|
||||
// In the case of default construction,
|
||||
// the range is considered as an empty range with no elements.
|
||||
// step can be anything other than 0. 1 is
|
||||
// an implementation convention, and it doesn't have
|
||||
// a significance in this case because the range is empty.
|
||||
basic_range(): m_first_element(0), m_element_count(0), m_step(1)
|
||||
{ }
|
||||
|
||||
// first_element: is begin in specifications.
|
||||
// last_element: is end in specifications.
|
||||
basic_range(value_type first_element, value_type last_element, value_type step)
|
||||
: m_first_element(first_element),
|
||||
m_step(step)
|
||||
{
|
||||
// We need to count the number of elements.
|
||||
// The only case where a range is invalid,
|
||||
// when the step=0. It means that the range
|
||||
// is infinite, because the number of elements
|
||||
// in a range, is the length of that range
|
||||
// divided by the difference between
|
||||
// every two successive elements.
|
||||
|
||||
if(step == 0)
|
||||
throw std::out_of_range("Invalid Range: step can't be equal to zero!");
|
||||
if(first_element < last_element && step < 0)
|
||||
throw std::out_of_range("Invalid Range: step can't be backward, while the range is forward!");
|
||||
if(first_element > last_element && step > 0)
|
||||
throw std::out_of_range("Invalid Range: step can't be forward, while the range is backward!");
|
||||
|
||||
m_element_count = (last_element-first_element)/step;
|
||||
if( (last_element-first_element)%step != 0 )
|
||||
++m_element_count;
|
||||
}
|
||||
|
||||
// The following constructor, determines the step
|
||||
// automatically. If the range is forward, then
|
||||
// step will be one. If the range is backward,
|
||||
// step will be minus one. If the begin is equal
|
||||
// to end, then the step must not equal to zero
|
||||
// and it is set to one as a convention.
|
||||
basic_range(value_type first_element, value_type last_element)
|
||||
: m_first_element(first_element)
|
||||
{
|
||||
if(last_element >= first_element) *this = basic_range<IntegerType>(first_element, last_element, 1);
|
||||
else *this = basic_range<IntegerType>(first_element, last_element, -1);
|
||||
|
||||
}
|
||||
|
||||
// The following constructor is a shortcut
|
||||
// if you want the first element as zero.
|
||||
// the step is determined automatically, based
|
||||
// on the last element. If the last element is
|
||||
// positive, then step is one, but if it is negative
|
||||
// then step is minus one.
|
||||
basic_range<IntegerType>(value_type last_element)
|
||||
: m_first_element(0)
|
||||
{
|
||||
if(last_element >= m_first_element) *this = basic_range<IntegerType>(m_first_element, last_element, 1);
|
||||
else *this = basic_range<IntegerType>(m_first_element, last_element, -1);
|
||||
}
|
||||
|
||||
basic_range<IntegerType>(const basic_range<IntegerType>& r)
|
||||
: m_first_element(r.m_first_element),
|
||||
m_element_count(r.m_element_count),
|
||||
m_step(r.m_step)
|
||||
{ }
|
||||
|
||||
basic_range<IntegerType>& operator=(const basic_range<IntegerType>& r)
|
||||
{
|
||||
m_first_element = r.m_first_element;
|
||||
m_element_count = r.m_element_count;
|
||||
m_step = r.m_step;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const basic_range<IntegerType>& r) const
|
||||
{
|
||||
return m_first_element == r.m_first_element
|
||||
&&
|
||||
m_element_count == r.m_element_count
|
||||
&&
|
||||
m_step == r.m_step;
|
||||
}
|
||||
|
||||
bool operator!=(const basic_range<IntegerType>& r) const
|
||||
{
|
||||
return !(*this == r);
|
||||
}
|
||||
|
||||
// The following four functions enable the user to compare
|
||||
// ranges using ( <, >, <=, >=).
|
||||
// The comparison between two ranges is a simple lexicographical
|
||||
// comparison(element by element). By convention, if two ranges
|
||||
// R1, R2 where R1 has a smaller number of elements. Then if
|
||||
// R1 contains more elements but all R1 elements are found in R2
|
||||
// R1 is considered less than R2.
|
||||
bool operator<(const basic_range<IntegerType>& r) const
|
||||
{
|
||||
// ********** This function needs refactoring.
|
||||
|
||||
if(m_element_count == 0 && r.m_element_count == 0)
|
||||
return false;
|
||||
if(m_element_count == 0 && r.m_element_count > 0)
|
||||
return true;
|
||||
if(m_element_count > 0 && r.m_element_count == 0)
|
||||
return false;
|
||||
|
||||
// At this point, both has at least one element.
|
||||
if(m_first_element < r.m_first_element)
|
||||
return true;
|
||||
if(m_first_element > r.m_first_element)
|
||||
return false;
|
||||
|
||||
// At this point, the first element of both are equal.
|
||||
if(m_element_count == 1 && r.m_element_count == 1)
|
||||
return false;
|
||||
if(m_element_count == 1 && r.m_element_count > 1)
|
||||
return true;
|
||||
if(m_element_count > 1 && r.m_element_count == 1)
|
||||
return false;
|
||||
|
||||
// At this point, both have at least two elements with
|
||||
// a similar first element. Note than the final answer
|
||||
// in this case depends on the second element only, because
|
||||
// we don't need to compare the elements further.
|
||||
// Note that the second element is at (index == 1), because
|
||||
// the first element is at (index == 0).
|
||||
if(m_first_element+m_step*1 < r.m_first_element+r.m_step*1)
|
||||
return true;
|
||||
if(m_first_element+m_step*1 > r.m_first_element+r.m_step*1)
|
||||
return false;
|
||||
|
||||
// if the first two elements of both ranges are equal, then
|
||||
// they are co-linear ranges(because the step is constant).
|
||||
// In that case, they comparison depends only on
|
||||
// the size of the ranges by convention.
|
||||
return m_element_count < r.m_element_count;
|
||||
}
|
||||
|
||||
bool operator>(const basic_range<IntegerType>& r) const
|
||||
{
|
||||
// ********** This function needs refactoring.
|
||||
|
||||
if(m_element_count == 0 && r.m_element_count == 0)
|
||||
return false;
|
||||
if(m_element_count == 0 && r.m_element_count > 0)
|
||||
return false;
|
||||
if(m_element_count > 0 && r.m_element_count == 0)
|
||||
return true;
|
||||
|
||||
// At this point, both has at least one element.
|
||||
if(m_first_element < r.m_first_element)
|
||||
return false;
|
||||
if(m_first_element > r.m_first_element)
|
||||
return true;
|
||||
|
||||
// At this point, the first element of both are equal.
|
||||
if(m_element_count == 1 && r.m_element_count == 1)
|
||||
return false;
|
||||
if(m_element_count == 1 && r.m_element_count > 1)
|
||||
return false;
|
||||
if(m_element_count > 1 && r.m_element_count == 1)
|
||||
return true;
|
||||
|
||||
// At this point, both have at least two elements with
|
||||
// a similar first element. Note than the final answer
|
||||
// in this case depends on the second element only, because
|
||||
// we don't need to compare the elements further.
|
||||
// Note that the second element is at (index == 1), because
|
||||
// the first element is at (index == 0).
|
||||
if(m_first_element+m_step*1 < r.m_first_element+r.m_step*1)
|
||||
return false;
|
||||
if(m_first_element+m_step*1 > r.m_first_element+r.m_step*1)
|
||||
return true;
|
||||
|
||||
// if the first two elements of both ranges are equal, then
|
||||
// they are co-linear ranges(because the step is constant).
|
||||
// In that case, they comparison depends only on
|
||||
// the size of the ranges by convention.
|
||||
return m_element_count > r.m_element_count;
|
||||
}
|
||||
|
||||
bool operator <=(const basic_range<IntegerType>& r) const
|
||||
{
|
||||
return !(*this > r);
|
||||
}
|
||||
|
||||
bool operator >=(const basic_range<IntegerType>& r) const
|
||||
{
|
||||
return !(*this < r);
|
||||
}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return const_iterator(this, 0);
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return const_iterator(this, m_element_count);
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(this, 0);
|
||||
}
|
||||
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(this, m_element_count);
|
||||
}
|
||||
|
||||
size_type size() const
|
||||
{
|
||||
return m_element_count;
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{
|
||||
// Because this is an immutable container,
|
||||
// max_size() == size()
|
||||
return m_element_count;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return m_element_count == 0;
|
||||
}
|
||||
|
||||
// exist() and find() are similar except that
|
||||
// find() returns the index of the element.
|
||||
iterator find(value_type element) const
|
||||
{
|
||||
value_type element_index = (element - m_first_element) / m_step;
|
||||
bool in_range = element_index >= 0 && element_index < m_element_count &&
|
||||
(element - m_first_element) % m_step == 0;
|
||||
if(in_range)
|
||||
return begin() + element_index;
|
||||
return end();
|
||||
}
|
||||
|
||||
bool exist(value_type element) const
|
||||
{
|
||||
return find(element) != end();
|
||||
}
|
||||
|
||||
// In the standard, the operator[]
|
||||
// should return a const reference.
|
||||
// Because Range Generator doesn't store its elements
|
||||
// internally, we return a copy of the value.
|
||||
// In any case, this doesn't affect the semantics of the operator.
|
||||
value_type operator[](size_type index) const
|
||||
{
|
||||
return m_first_element + m_step*index;
|
||||
}
|
||||
|
||||
private:
|
||||
// m_first_element: begin (see specifications).
|
||||
// m_element_count: (end - begin) / step
|
||||
value_type m_first_element, m_element_count, m_step;
|
||||
};
|
||||
|
||||
// This is the default type of range!
|
||||
typedef basic_range<int> range;
|
||||
}
|
||||
|
||||
#endif // range_h__
|
|
@ -1,6 +0,0 @@
|
|||
#include "version_cpp.h"
|
||||
#include "version.h"
|
||||
|
||||
const char* const vba_name_and_subversion = VBA_NAME_AND_SUBVERSION;
|
||||
|
||||
const char* const vbam_version = VBAM_VERSION;
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef VBAM_VERSION_CPP_H
|
||||
#define VBAM_VERSION_CPP_H
|
||||
|
||||
extern const char* const vba_name_and_subversion;
|
||||
|
||||
extern const char* const vbam_version;
|
||||
|
||||
#endif /* VBAM_VERSION_CPP_H */
|
|
@ -0,0 +1,6 @@
|
|||
add_subdirectory(av_recording)
|
||||
add_subdirectory(draw_text)
|
||||
add_subdirectory(filters)
|
||||
add_subdirectory(filters_agb)
|
||||
add_subdirectory(filters_interframe)
|
||||
add_subdirectory(user_config)
|
|
@ -0,0 +1,18 @@
|
|||
if(NOT ENABLE_FFMPEG)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(vbam-components-av-recording OBJECT)
|
||||
|
||||
target_sources(vbam-components-av-recording
|
||||
PRIVATE av_recording.cpp
|
||||
PUBLIC av_recording.h
|
||||
)
|
||||
|
||||
target_include_directories(vbam-components-av-recording
|
||||
PUBLIC ${FFMPEG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(vbam-components-av-recording
|
||||
PUBLIC ${FFMPEG_LIBRARIES}
|
||||
)
|
|
@ -1,9 +1,28 @@
|
|||
#include "ffmpeg.h"
|
||||
#include "components/av_recording/av_recording.h"
|
||||
|
||||
#define STREAM_FRAME_RATE 60
|
||||
#define STREAM_PIXEL_FORMAT AV_PIX_FMT_YUV420P
|
||||
#define IN_SOUND_FORMAT AV_SAMPLE_FMT_S16
|
||||
|
||||
namespace {
|
||||
|
||||
// Wrapper around an AVPacket that frees the underlying packet on destruction.
|
||||
class ScopedAVPacket {
|
||||
public:
|
||||
ScopedAVPacket() : av_packet_(av_packet_alloc()) {}
|
||||
~ScopedAVPacket() {
|
||||
av_packet_free(&av_packet_);
|
||||
}
|
||||
|
||||
AVPacket* operator->() { return av_packet_; }
|
||||
AVPacket* get() { return av_packet_; }
|
||||
|
||||
private:
|
||||
AVPacket* av_packet_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
struct supportedCodecs {
|
||||
AVCodecID codecId;
|
||||
char const *longName;
|
||||
|
@ -118,18 +137,12 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
|||
}
|
||||
}
|
||||
if (!isSupported && acodec->supported_samplerates) return MRET_ERR_NOCODEC;
|
||||
aenc->channels = av_get_channel_layout_nb_channels(aenc->channel_layout);
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
av_channel_layout_from_mask(&(aenc->ch_layout), AV_CH_LAYOUT_STEREO);
|
||||
#else
|
||||
aenc->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
if (acodec->channel_layouts)
|
||||
{
|
||||
aenc->channel_layout = acodec->channel_layouts[0];
|
||||
for (int i = 0; acodec->channel_layouts[i]; ++i)
|
||||
{
|
||||
if (acodec->channel_layouts[i] == AV_CH_LAYOUT_STEREO)
|
||||
aenc->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
}
|
||||
aenc->channels = av_get_channel_layout_nb_channels(aenc->channel_layout);
|
||||
aenc->channels = 2;
|
||||
#endif
|
||||
aenc->time_base = { 1, aenc->sample_rate };
|
||||
ast->time_base = { 1, STREAM_FRAME_RATE };
|
||||
// open and use codec on stream
|
||||
|
@ -150,7 +163,11 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
|||
audioframeTmp = av_frame_alloc();
|
||||
if (!audioframeTmp) return MRET_ERR_BUFSIZE;
|
||||
audioframeTmp->format = IN_SOUND_FORMAT;
|
||||
audioframeTmp->channel_layout = aenc->channel_layout;
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
audioframeTmp->ch_layout = aenc->ch_layout;
|
||||
#else
|
||||
audioframeTmp->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
#endif
|
||||
audioframeTmp->sample_rate = aenc->sample_rate;
|
||||
audioframeTmp->nb_samples = nb_samples;
|
||||
if (nb_samples)
|
||||
|
@ -162,7 +179,11 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
|||
audioframe = av_frame_alloc();
|
||||
if (!audioframe) return MRET_ERR_BUFSIZE;
|
||||
audioframe->format = aenc->sample_fmt;
|
||||
audioframe->channel_layout = aenc->channel_layout;
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
audioframe->ch_layout = aenc->ch_layout;
|
||||
#else
|
||||
audioframe->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
#endif
|
||||
audioframe->sample_rate = aenc->sample_rate;
|
||||
audioframe->nb_samples = nb_samples;
|
||||
if (nb_samples)
|
||||
|
@ -176,10 +197,15 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
|||
{
|
||||
return MRET_ERR_BUFSIZE;
|
||||
}
|
||||
av_opt_set_int (swr, "in_channel_count", aenc->channels, 0);
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
av_opt_set_chlayout (swr, "in_chlayout", &(aenc->ch_layout),0);
|
||||
av_opt_set_chlayout (swr, "out_chlayout", &(aenc->ch_layout),0);
|
||||
#else
|
||||
av_opt_set_int (swr, "in_channel_count", 2, 0);
|
||||
av_opt_set_int (swr, "out_channel_count", 2, 0);
|
||||
#endif
|
||||
av_opt_set_int (swr, "in_sample_rate", aenc->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(swr, "in_sample_fmt", IN_SOUND_FORMAT, 0);
|
||||
av_opt_set_int (swr, "out_channel_count", aenc->channels, 0);
|
||||
av_opt_set_int (swr, "out_sample_rate", aenc->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(swr, "out_sample_fmt", aenc->sample_fmt, 0);
|
||||
if (swr_init(swr) < 0)
|
||||
|
@ -188,8 +214,8 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
|||
return MRET_ERR_BUFSIZE;
|
||||
}
|
||||
// auxiliary buffer for setting up frames for encode
|
||||
audioBufferSize = nb_samples * aenc->channels * sizeof(uint16_t);
|
||||
audioBuffer = (uint16_t *) calloc(nb_samples * aenc->channels, sizeof(uint16_t));
|
||||
audioBufferSize = nb_samples * 2 * sizeof(uint16_t);
|
||||
audioBuffer = (uint16_t *) calloc(nb_samples * 2, sizeof(uint16_t));
|
||||
if (!audioBuffer) return MRET_ERR_BUFSIZE;
|
||||
samplesInAudioBuffer = 0;
|
||||
posInAudioBuffer = 0;
|
||||
|
@ -377,10 +403,9 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint8_t *vid)
|
|||
if (!isRecording) return MRET_OK;
|
||||
// fill and encode frame variables
|
||||
int got_packet = 0, ret = 0;
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
pkt.data = NULL;
|
||||
pkt.size = 0;
|
||||
ScopedAVPacket pkt;
|
||||
pkt->data = NULL;
|
||||
pkt->size = 0;
|
||||
// fill frame with current pic
|
||||
ret = av_image_fill_arrays(frameIn->data, frameIn->linesize,
|
||||
(uint8_t *)vid + tbord * (linesize + pixsize * rbord),
|
||||
|
@ -393,17 +418,17 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint8_t *vid)
|
|||
// set valid pts for frame
|
||||
frameOut->pts = npts++;
|
||||
// finally, encode frame
|
||||
got_packet = avcodec_receive_packet(enc, &pkt);
|
||||
got_packet = avcodec_receive_packet(enc, pkt.get());
|
||||
ret = avcodec_send_frame(enc, frameOut);
|
||||
if (ret < 0) return MRET_ERR_RECORDING;
|
||||
if (!got_packet)
|
||||
{
|
||||
// rescale output packet timestamp values from codec
|
||||
// to stream timebase
|
||||
av_packet_rescale_ts(&pkt, enc->time_base, st->time_base);
|
||||
pkt.stream_index = st->index;
|
||||
//log_packet(oc, &pkt);
|
||||
ret = av_interleaved_write_frame(oc, &pkt);
|
||||
av_packet_rescale_ts(pkt.get(), enc->time_base, st->time_base);
|
||||
pkt->stream_index = st->index;
|
||||
//log_packet(oc, pkt.get());
|
||||
ret = av_interleaved_write_frame(oc, pkt.get());
|
||||
if (ret < 0) return MRET_ERR_RECORDING;
|
||||
}
|
||||
return MRET_OK;
|
||||
|
@ -547,7 +572,7 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
|||
{
|
||||
if (!isRecording) return MRET_OK;
|
||||
AVCodecContext *c = aenc;
|
||||
int samples_size = av_samples_get_buffer_size(NULL, c->channels, audioframeTmp->nb_samples, IN_SOUND_FORMAT, 1);
|
||||
int samples_size = av_samples_get_buffer_size(NULL, 2, audioframeTmp->nb_samples, IN_SOUND_FORMAT, 1);
|
||||
|
||||
int realLength = length / sizeof *aud;
|
||||
bool isMissing = false;
|
||||
|
@ -584,12 +609,11 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
|||
}
|
||||
|
||||
int got_packet;
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
pkt.data = NULL;
|
||||
pkt.size = 0;
|
||||
ScopedAVPacket pkt;
|
||||
pkt->data = NULL;
|
||||
pkt->size = 0;
|
||||
|
||||
if (avcodec_fill_audio_frame(audioframeTmp, c->channels, IN_SOUND_FORMAT, (const uint8_t *)audioBuffer, samples_size, 1) < 0)
|
||||
if (avcodec_fill_audio_frame(audioframeTmp, 2, IN_SOUND_FORMAT, (const uint8_t *)audioBuffer, samples_size, 1) < 0)
|
||||
{
|
||||
return MRET_ERR_RECORDING;
|
||||
}
|
||||
|
@ -604,17 +628,17 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
|||
audioframe->pts = av_rescale_q(samplesCount, {1, c->sample_rate}, c->time_base);
|
||||
samplesCount += dst_nb_samples;
|
||||
|
||||
got_packet = avcodec_receive_packet(c, &pkt);
|
||||
got_packet = avcodec_receive_packet(c, pkt.get());
|
||||
if (avcodec_send_frame(c, audioframe) < 0)
|
||||
{
|
||||
return MRET_ERR_RECORDING;
|
||||
}
|
||||
if (!got_packet)
|
||||
{
|
||||
av_packet_rescale_ts(&pkt, { 1, c->sample_rate }, ast->time_base);
|
||||
pkt.stream_index = ast->index;
|
||||
//log_packet(oc, &pkt);
|
||||
if (av_interleaved_write_frame(oc, &pkt) < 0)
|
||||
av_packet_rescale_ts(pkt.get(), { 1, c->sample_rate }, ast->time_base);
|
||||
pkt->stream_index = ast->index;
|
||||
//log_packet(oc, pkt.get());
|
||||
if (av_interleaved_write_frame(oc, pkt.get()) < 0)
|
||||
{
|
||||
return MRET_ERR_RECORDING;
|
||||
}
|
||||
|
@ -637,11 +661,10 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
|||
// "X frames left in the queue on closing"
|
||||
void recording::MediaRecorder::flush_frames()
|
||||
{
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
pkt.data = NULL;
|
||||
pkt.size = 0;
|
||||
ScopedAVPacket pkt;
|
||||
pkt->data = NULL;
|
||||
pkt->size = 0;
|
||||
// flush last audio frames
|
||||
while (avcodec_receive_packet(aenc, &pkt) >= 0)
|
||||
while (avcodec_receive_packet(aenc, pkt.get()) >= 0)
|
||||
avcodec_send_frame(aenc, NULL);
|
||||
}
|
|
@ -1,16 +1,12 @@
|
|||
#ifndef WX_FFMPEG_H
|
||||
#define WX_FFMPEG_H
|
||||
#ifndef VBAM_COMPONENTS_AV_RECORDING_AV_RECORDING_H_
|
||||
#define VBAM_COMPONENTS_AV_RECORDING_AV_RECORDING_H_
|
||||
|
||||
// simplified interface for recording audio and/or video from emulator
|
||||
|
||||
// required for ffmpeg
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
|
||||
extern "C" {
|
||||
/* From: http://redino.net/blog/2013/12/uint64_c-defined-including-libavformatavformat-h-vs-2008/ */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef INT64_C
|
||||
#define INT64_C(c) (c ## LL)
|
||||
|
@ -33,7 +29,6 @@ extern "C" {
|
|||
}
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace recording {
|
||||
|
||||
|
@ -131,4 +126,4 @@ class MediaRecorder
|
|||
|
||||
}
|
||||
|
||||
#endif /* WX_FFMPEG_H */
|
||||
#endif // VBAM_COMPONENTS_AV_RECORDING_AV_RECORDING_H_
|
|
@ -0,0 +1,10 @@
|
|||
add_library(vbam-components-draw-text OBJECT)
|
||||
|
||||
target_sources(vbam-components-draw-text
|
||||
PRIVATE draw_text.cpp
|
||||
PUBLIC draw_text.h
|
||||
)
|
||||
|
||||
target_link_libraries(vbam-components-draw-text
|
||||
PRIVATE vbam-core-base
|
||||
)
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
/* Code originally from fceu/drawing.h file, adapted by Forgotten
|
||||
*/
|
||||
#include "../System.h"
|
||||
#include "components/draw_text/draw_text.h"
|
||||
|
||||
#include "core/base/system.h"
|
||||
|
||||
extern int RGB_LOW_BITS_MASK;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue