Skip to content

Commit b564033

Browse files
authored
Move to C++20 and other improvements (#79)
* Move to C++20 by default * Get rid of Optional * Improve python packaging * Bump pybind11 to latest * Bump minimum cmake to 3.31 * Bump minimum emsdk to 4.0.21 * Removed cache of emsdk in github actions * Add stackTrace to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE
1 parent de12491 commit b564033

File tree

110 files changed

+28416
-9190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+28416
-9190
lines changed

.github/workflows/build_wasm.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ env:
3030
libasound2-dev libjack-jackd2-dev ladspa-sdk libcurl4-openssl-dev libfreetype6-dev
3131
libx11-dev libxcomposite-dev libxcursor-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev
3232
libxrandr-dev libxrender-dev libglu1-mesa-dev mesa-common-dev
33-
EM_VERSION: 3.1.45
34-
EM_CACHE_FOLDER: "emsdk-cache"
33+
EM_VERSION: 4.0.21
3534

3635
jobs:
3736
build_tests:
@@ -46,7 +45,6 @@ jobs:
4645
uses: mymindstorm/setup-emsdk@v14
4746
with:
4847
version: ${{ env.EM_VERSION }}
49-
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
5048
- name: Configure
5149
run: emcmake cmake ${{ github.workspace }} -G "Ninja Multi-Config" -B ${{ runner.workspace }}/build -DYUP_ENABLE_TESTS=ON -DYUP_ENABLE_EXAMPLES=ON
5250
- run: cmake --build ${{ runner.workspace }}/build --config Debug --parallel 4 --target yup_tests
@@ -68,7 +66,6 @@ jobs:
6866
uses: mymindstorm/setup-emsdk@v14
6967
with:
7068
version: ${{ env.EM_VERSION }}
71-
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
7269
- name: Configure
7370
run: emcmake cmake ${{ github.workspace }} -G "Ninja Multi-Config" -B ${{ runner.workspace }}/build -DYUP_ENABLE_TESTS=ON -DYUP_ENABLE_EXAMPLES=ON
7471
- run: cmake --build ${{ runner.workspace }}/build --config Debug --parallel 4 --target example_console
@@ -86,7 +83,6 @@ jobs:
8683
uses: mymindstorm/setup-emsdk@v14
8784
with:
8885
version: ${{ env.EM_VERSION }}
89-
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
9086
- name: Configure
9187
run: emcmake cmake ${{ github.workspace }} -G "Ninja Multi-Config" -B ${{ runner.workspace }}/build -DYUP_ENABLE_TESTS=ON -DYUP_ENABLE_EXAMPLES=ON
9288
- run: cmake --build ${{ runner.workspace }}/build --config Debug --parallel 4 --target example_app
@@ -104,7 +100,6 @@ jobs:
104100
uses: mymindstorm/setup-emsdk@v14
105101
with:
106102
version: ${{ env.EM_VERSION }}
107-
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
108103
- name: Configure
109104
run: emcmake cmake ${{ github.workspace }} -G "Ninja Multi-Config" -B ${{ runner.workspace }}/build -DYUP_ENABLE_TESTS=ON -DYUP_ENABLE_EXAMPLES=ON
110105
- run: cmake --build ${{ runner.workspace }}/build --config Debug --parallel 4 --target example_graphics

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
#
1818
# ==============================================================================
1919

20-
cmake_minimum_required (VERSION 3.28)
20+
cmake_minimum_required (VERSION 3.31)
2121

2222
include (cmake/yup.cmake)
2323
_yup_get_project_version_string (${CMAKE_CURRENT_LIST_DIR}/modules yup_version)
2424
_yup_message (STATUS "Building project version ${yup_version}")
2525

26+
set (CMAKE_CXX_SCAN_FOR_MODULES 0)
27+
2628
if (YUP_PLATFORM_MAC)
2729
set (CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
2830
set (CMAKE_XCODE_GENERATE_SCHEME OFF)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ YUP brings a suite of powerful features, including:
102102

103103
## Prerequisites
104104
Before building, ensure you have a:
105-
- C++17-compliant compiler
105+
- C++20-compliant compiler
106106
- CMake 3.28 or later
107107

108108

@@ -293,7 +293,7 @@ START_YUP_APPLICATION (MyApplication)
293293
And add this as `CMakeLists.txt`:
294294
295295
```cmake
296-
cmake_minimum_required (VERSION 3.28)
296+
cmake_minimum_required (VERSION 3.31)
297297
298298
set (target_name my_app)
299299
set (target_version "0.0.1")

cmake/toolchains/ios.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
# command.
155155
#
156156

157-
cmake_minimum_required(VERSION 3.16.0)
157+
cmake_minimum_required(VERSION 3.31)
158158

159159
# CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds.
160160
if(DEFINED ENV{_IOS_TOOLCHAIN_HAS_RUN})

cmake/yup_audio_plugin.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function (yup_audio_plugin)
3636

3737
cmake_parse_arguments (YUP_ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
3838

39-
_yup_set_default (YUP_ARG_TARGET_CXX_STANDARD 17)
39+
_yup_set_default (YUP_ARG_TARGET_CXX_STANDARD 20)
4040

4141
set (target_name "${YUP_ARG_TARGET_NAME}")
4242
set (target_version "${YUP_ARG_TARGET_VERSION}")

cmake/yup_dependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function (_yup_fetch_perfetto)
8989
FetchContent_MakeAvailable (Perfetto)
9090

9191
add_library (perfetto STATIC)
92-
target_compile_features (perfetto PUBLIC cxx_std_17)
92+
target_compile_features (perfetto PUBLIC cxx_std_20)
9393

9494
target_sources (perfetto
9595
PRIVATE "$<BUILD_INTERFACE:${perfetto_SOURCE_DIR}/sdk/perfetto.cc>"

cmake/yup_modules.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function (_yup_module_setup_target module_name
183183
if (module_cpp_standard)
184184
target_compile_features (${module_name} INTERFACE cxx_std_${module_cpp_standard})
185185
else()
186-
target_compile_features (${module_name} INTERFACE cxx_std_17)
186+
target_compile_features (${module_name} INTERFACE cxx_std_20)
187187
endif()
188188

189189
set_target_properties (${module_name} PROPERTIES
@@ -366,7 +366,7 @@ function (yup_add_module module_path modules_definitions module_group)
366366
endif()
367367
endforeach()
368368

369-
_yup_set_default (module_cpp_standard "17")
369+
_yup_set_default (module_cpp_standard "20")
370370
_yup_set_default (module_arc_enabled OFF)
371371
_yup_set_default (module_needs_python OFF)
372372
_yup_resolve_variable_paths ("${module_searchpaths}" module_searchpaths)

cmake/yup_platforms.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function (_yup_prepare_gradle_android)
3737
_yup_set_default (YUP_ANDROID_TOOLCHAIN "clang")
3838
_yup_set_default (YUP_ANDROID_PLATFORM "android-${YUP_ANDROID_MIN_SDK_VERSION}")
3939
_yup_set_default (YUP_ANDROID_STL "c++_shared")
40-
_yup_set_default (YUP_ANDROID_CPP_VERSION "17")
40+
_yup_set_default (YUP_ANDROID_CPP_VERSION "20")
4141
_yup_set_default (YUP_ANDROID_APPLICATION_NAMESPACE "org.yup")
4242
_yup_set_default (YUP_ANDROID_APPLICATION_ID "org.yup.default_app")
4343
_yup_set_default (YUP_ANDROID_APPLICATION_VERSION "1.0")

cmake/yup_python.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function (yup_prepare_python_stdlib target_name python_tools_path output_variabl
2626

2727
cmake_parse_arguments (YUP_ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
2828

29-
set (default_ignored_library_patterns "lib2to3" "pydoc_data" "_xxtestfuzz*")
29+
set (default_ignored_library_patterns "lib2to3")
3030

3131
set (ignored_library_patterns ${default_ignored_library_patterns})
3232
list (APPEND ignored_library_patterns ${YUP_ARG_IGNORED_LIBRARY_PATTERNS})
@@ -45,7 +45,7 @@ function (yup_prepare_python_stdlib target_name python_tools_path output_variabl
4545

4646
get_filename_component (python_root_path "${python_embed_env_SOURCE_DIR}" REALPATH)
4747
else()
48-
get_filename_component (python_root_path "${Python_LIBRARY_DIRS}" REALPATH)
48+
get_filename_component (python_root_path "${Python_LIBRARY_DIRS}/.." REALPATH)
4949
endif()
5050

5151
_yup_message (STATUS "Executing python stdlib archive generator tool")

cmake/yup_standalone.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function (yup_standalone_app)
3535

3636
cmake_parse_arguments (YUP_ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
3737

38-
_yup_set_default (YUP_ARG_TARGET_CXX_STANDARD 17)
38+
_yup_set_default (YUP_ARG_TARGET_CXX_STANDARD 20)
3939
_yup_set_default (YUP_ARG_TARGET_ICON "${CMAKE_SOURCE_DIR}/cmake/resources/app-icon.png")
4040

4141
set (target_name "${YUP_ARG_TARGET_NAME}")
@@ -177,15 +177,14 @@ function (yup_standalone_app)
177177
-sASSERTIONS=1
178178
-sDISABLE_EXCEPTION_CATCHING=0
179179
-sERROR_ON_UNDEFINED_SYMBOLS=1
180-
-sDEMANGLE_SUPPORT=1
181180
-sSTACK_OVERFLOW_CHECK=2
182181
-sFORCE_FILESYSTEM=1
183182
-sNODERAWFS=0
184183
-sWASMFS=1
185184
-sFETCH=1
186185
#-sASYNCIFY=1
187186
-sEXPORTED_RUNTIME_METHODS=ccall,cwrap
188-
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$dynCall'
187+
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$dynCall','$stackTrace'
189188
--shell-file "${YUP_ARG_CUSTOM_SHELL}")
190189

191190
foreach (preload_file ${YUP_ARG_PRELOAD_FILES})

0 commit comments

Comments
 (0)