-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup crossplatform/compiler builds using CMakePresets.json
- Loading branch information
1 parent
af0e0b3
commit cfb081a
Showing
13 changed files
with
121 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ imgui.ini | |
logs.txt | ||
dab_radio_windows_x64/ | ||
dab_radio_windows_x64.zip | ||
.cache/ | ||
.cache/ | ||
CMakeUserPresets.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"version": 3, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 20, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "windows-msvc", | ||
"generator": "Ninja", | ||
"cacheVariables": { | ||
"CMAKE_CXX_FLAGS_INIT": "/MP /fp:fast /arch:AVX2 /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING", | ||
"CMAKE_C_FLAGS_INIT": "/MP /fp:fast /arch:AVX2 /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING" | ||
} | ||
}, | ||
{ | ||
"name": "windows-msvc-sanitize", | ||
"generator": "Ninja", | ||
"cacheVariables": { | ||
"CMAKE_CXX_FLAGS_INIT": "/MP /fp:fast /arch:AVX2 /fsanitize=address /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING /D_DISABLE_VECTOR_ANNOTATION /D_DISABLE_STRING_ANNOTATION", | ||
"CMAKE_C_FLAGS_INIT": "/MP /fp:fast /arch:AVX2 /fsanitize=address /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING /D_DISABLE_VECTOR_ANNOTATION /D_DISABLE_STRING_ANNOTATION" | ||
} | ||
}, | ||
{ | ||
"name": "gcc", | ||
"generator": "Ninja", | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "gcc", | ||
"CMAKE_CXX_COMPILER": "g++", | ||
"CMAKE_CXX_FLAGS_INIT": "-ffast-math -march=native", | ||
"CMAKE_C_FLAGS_INIT": "-ffast-math -march=native" | ||
} | ||
}, | ||
{ | ||
"name": "clang", | ||
"generator": "Ninja", | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "clang", | ||
"CMAKE_CXX_COMPILER": "clang++", | ||
"CMAKE_CXX_FLAGS_INIT": "-ffast-math -march=native", | ||
"CMAKE_C_FLAGS_INIT": "-ffast-math -march=native" | ||
} | ||
}, | ||
{ | ||
"name": "clang-arm", | ||
"generator": "Ninja", | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "clang", | ||
"CMAKE_CXX_COMPILER": "clang++", | ||
"CMAKE_CXX_FLAGS_INIT": "-ffast-math", | ||
"CMAKE_C_FLAGS_INIT": "-ffast-math" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Instructions | ||
1. brew update | ||
2. brew bundle install --file=./toolchains/macos/Brewfile | ||
3. cmake . -B build-macos -DCMAKE_BUILD_TYPE=Release -G Ninja | ||
4. cmake --build build-macos --config Release | ||
5. ./build-macos/examples/radio_app | ||
1. Update brew: ```brew update``` | ||
2. Install dependencies: ```brew bundle install --file=./toolchains/macos/Brewfile``` | ||
3. Configure cmake: ```cmake . -B build --preset clang -DCMAKE_BUILD_TYPE=Release``` | ||
4. Build: ```cmake --build build --config Release``` | ||
5. Run: ```./build/examples/radio_app``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## Instructions | ||
1. <code>./toolchains/ubuntu/install_packages.sh</code> | ||
2. <code>./toolchains/ubuntu/cmake_configure.sh</code> | ||
3. <code>ninja -C build-ubuntu</code> | ||
4. <code>./build-ubuntu/\<program\></code> | ||
# Instructions | ||
1. Install dependencies: ```./toolchains/ubuntu/install_packages.sh``` | ||
2. Configure cmake: ```cmake . -B build --preset gcc -DCMAKE_BUILD_TYPE=Release``` | ||
3. Build: ```cmake --build build --config Release``` | ||
4. Run: ```./build/examples/radio_app``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
## Instructions | ||
1. ```./toolchains/windows/cmake_configure.sh``` | ||
2. ```ninja -C build-windows``` | ||
3. ```./build-windows/\<program\>``` | ||
1. Install vcpkg and integrate install. Refer to instructions [here](https://github.com/microsoft/vcpkg#quick-start-windows) | ||
2. Setup x64 developer environment for C++ for MSVC. | ||
2. Configure cmake: ```cmake . -B build --preset windows-msvc -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake``` | ||
- Change ```-DCMAKE_TOOLCHAIN_FILE``` to point to your vcpkg installation directory. | ||
3. Build: ```cmake --build build --config Release``` | ||
4. Run: ```.\build\examples\*.exe``` | ||
|
||
## Compiling with clang-cl | ||
Compiling with clang gives better performing binaries compared to MSVC cl. | ||
|
||
1. Setup x64 developer environment for C++ for MSVC. | ||
2. Make sure clang for C++ is installed through Visual Studio. | ||
3. Enter a bash shell. | ||
4. ```CC=clang CXX=clang++ ./toolchains/windows/cmake_configure.sh``` | ||
Compiling with clang gives better performing binaries compared to MSVC. | ||
1. Make sure clang for C++ is installed through Visual Studio. | ||
2. Configure cmake: ```cmake . -B build --preset clang -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake``` | ||
|
||
## Compiling with different SIMD flags | ||
The default windows build compiles with AVX2 instructions. If your CPU doesn't support these then you will have to modify the scripts. | ||
The default windows build compiles with AVX2 instructions. If your CPU doesn't support these then you will have to modify the scripts. | ||
|
||
```vcpkg.json``` contains ```fftw3f``` which uses the ```avx2``` feature. Change this to ```[avx, sse2, sse]```. | ||
Modify ```CMakePresets.json``` so that configurePresets ```windows-msvc``` uses correct flags. [Link to docs](https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170) | ||
- ```/arch:AVX2``` | ||
- ```/arch:AVX``` | ||
- Remove the ```/arch:XXX``` flag entirely for SSE2 builds | ||
|
||
```CMakeLists.txt``` contains ```/arch:AVX2```. Change this to ```/arch:AVX``` or remove this compiler option. | ||
*(Optional)* FFTW3 is built by default with AVX2 instructions. Modify ```vcpkg.json``` so fftw3 uses the correct "features" for your CPU. This might not be necessary since it uses ```cpu_features``` to determine and dispatch calls at runtime. | ||
- ```"features": ["avx"]``` | ||
- ```"features": ["sse2"]``` | ||
- ```"features": ["sse"]``` |
This file was deleted.
Oops, something went wrong.