diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 40e29b87a0..536d5b50b9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -4,8 +4,6 @@ on: push env: BUILD_TYPE: Release - EM_VERSION: 2.0.34 - EM_CACHE_FOLDER: 'emsdk-cache' jobs: build: @@ -13,90 +11,126 @@ jobs: fail-fast: false matrix: platform: - - { name: Ubuntu GCC, os: ubuntu-latest, compiler: g++, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_CXX_COMPILER=g++"} - - { name: Ubuntu Clang, os: ubuntu-latest, compiler: clang++, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_CXX_COMPILER=clang++"} - - { name: Windows 32, os: windows-latest, compiler: vs2019, arch: "32", cmakepp: "", suffix: "", flags: "-DCMAKE_PREFIX_PATH=`pwd`/../dependencies -A Win32"} - - { name: Windows 64, os: windows-latest, compiler: vs2019, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_PREFIX_PATH=`pwd`/../dependencies -A x64"} - - { name: MacOS, os: macos-latest, compiler: clang++, arch: "64", cmakepp: "", suffix: "", flags: ""} - - { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", suffix: "-emscripten", flags: "-DCMAKE_PREFIX_PATH=`pwd`/../dependencies -DCMAKE_FIND_ROOT_PATH=/ -DLXGUI_TEST_IMPLEMENTATION=OPENGL_SDL"} + - name: Ubuntu GCC + os: ubuntu-latest + compiler: g++ + arch: "64" + suffix: "" + cmake-flags: "" + - name: Ubuntu Clang + os: ubuntu-latest + compiler: clang++ + arch: "64" + suffix: "" + cmake-flags: "" + - name: Windows + os: windows-latest + compiler: msvc + arch: "64" + suffix: "" + cmake-flags: "" + - name: MacOS + os: macos-latest + compiler: clang++ + arch: "64" + suffix: "" + cmake-flags: "" + - name: WebAssembly + os: ubuntu-latest + compiler: em++ + arch: "32" + suffix: "-emscripten" + cmake-flags: "-DLXGUI_BUILD_GUI_SFML_IMPL=OFF -DLXGUI_BUILD_INPUT_SFML_IMPL=OFF -DLXGUI_TEST_IMPLEMENTATION=OPENGL_SDL" name: ${{matrix.platform.name}} runs-on: ${{matrix.platform.os}} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: 'recursive' - name: Setup Clang if: matrix.platform.compiler == 'clang++' && matrix.platform.os == 'ubuntu-latest' - run: sudo apt install clang + run: | + sudo apt install clang + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV - - name: Setup Emscripten cache - if: matrix.platform.compiler == 'em++' - id: cache-system-libraries - uses: actions/cache@v2.1.7 - with: - path: ${{env.EM_CACHE_FOLDER}} - key: ${{env.EM_VERSION}}-${{ runner.os }} + - name: Setup Conan + shell: bash + working-directory: ${{github.workspace}} + run: | + pip install conan + echo "CONAN_HOME=`pwd`/conan-cache" >> $GITHUB_ENV - - name: Setup Emscripten - if: matrix.platform.compiler == 'em++' - uses: mymindstorm/setup-emsdk@v11 + - name: Setup Conan cache + id: cache-conan-packages + uses: actions/cache@v4 with: - version: ${{env.EM_VERSION}} - actions-cache-folder: ${{env.EM_CACHE_FOLDER}} - - - name: Create Build Environment - run: cmake -E make_directory ${{github.workspace}}/build - - - name: Get Linux dependencies - if: runner.os == 'Linux' && matrix.platform.compiler != 'em++' - run: | - sudo apt-get update - sudo apt-get install libz-dev libpng-dev libfreetype6-dev libglew-dev libglu1-mesa-dev libsfml-dev liblua5.2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-dev + path: ${{env.CONAN_HOME}} + key: ${{matrix.platform.name}}-${{matrix.platform.compiler}} - - name: Get Emscripten dependencies - if: matrix.platform.compiler == 'em++' + - name: Get Conan dependencies shell: bash - working-directory: ${{github.workspace}}/dependencies - run: unzip wasm.zip - - - name: Get Windows dependencies - if: runner.os == 'Windows' - # Ideally (but too slow): - #run: vcpkg install sfml lua zlib libpng freetype glew sdl2 sdl2-ttf sdl2-image - # Pre-compiled dependencies: - shell: bash - working-directory: ${{github.workspace}}/dependencies - run: unzip windows-dependencies-${{matrix.platform.compiler}}-${{matrix.platform.arch}}.zip + working-directory: ${{github.workspace}} + run: | + conan profile detect --force + conan create conan/observable_unique_ptr \ + -pr default \ + -pr ./conan/profiles/${{matrix.platform.os}}-${{matrix.platform.arch}}-${{matrix.platform.compiler}} + conan install . \ + --build=missing \ + -c tools.system.package_manager:mode=install \ + -c tools.system.package_manager:sudo=true \ + --output-folder dependencies \ + -pr:b default \ + -pr:h default \ + -pr:h ./conan/profiles/${{matrix.platform.os}}-${{matrix.platform.arch}}-${{matrix.platform.compiler}} - - name: Get MacOS dependencies - if: runner.os == 'macOS' - run: brew install sfml lua zlib libpng freetype glew sdl2 sdl2_ttf sdl2_image + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build - run: ${{matrix.platform.cmakepp}} cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLXGUI_BUILD_EXAMPLES=0 -DCMAKE_INSTALL_PREFIX=`pwd`/../dependencies ${{matrix.platform.flags}} + run: | + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake .. \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \ + -DLXGUI_BUILD_EXAMPLES=OFF \ + -DLXGUI_DEV=ON \ + -DCMAKE_INSTALL_PREFIX=`pwd`/../install \ + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW \ + ${{matrix.platform.cmake-flags}} - name: Build shell: bash working-directory: ${{github.workspace}}/build - run: cmake --build . --config ${BUILD_TYPE} --parallel 2 + run: | + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake --build . --config ${BUILD_TYPE} --parallel 2 - name: Install shell: bash working-directory: ${{github.workspace}}/build - run: cmake --install . --config ${BUILD_TYPE} + run: | + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake --install . --config ${BUILD_TYPE} - name: Build example SDL shell: bash working-directory: ${{github.workspace}}/build run: | rm -rf * - ${{matrix.platform.cmakepp}} cmake ../examples/sdl${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake ../examples/sdl${{matrix.platform.suffix}} \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \ + -DCMAKE_PREFIX_PATH=`pwd`/../install \ + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW cmake --build . --config ${BUILD_TYPE} --parallel 2 - name: Build example OpenGL-SDL @@ -104,7 +138,12 @@ jobs: working-directory: ${{github.workspace}}/build run: | rm -rf * - ${{matrix.platform.cmakepp}} cmake ../examples/opengl-sdl${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake ../examples/opengl-sdl${{matrix.platform.suffix}} \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \ + -DCMAKE_PREFIX_PATH=`pwd`/../install \ + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW cmake --build . --config ${BUILD_TYPE} --parallel 2 - name: Build example SFML @@ -113,7 +152,12 @@ jobs: working-directory: ${{github.workspace}}/build run: | rm -rf * - ${{matrix.platform.cmakepp}} cmake ../examples/sfml${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake ../examples/sfml${{matrix.platform.suffix}} \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \ + -DCMAKE_PREFIX_PATH=`pwd`/../install \ + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW cmake --build . --config ${BUILD_TYPE} --parallel 2 - name: Build example OpenGL-SFML @@ -122,7 +166,12 @@ jobs: working-directory: ${{github.workspace}}/build run: | rm -rf * - ${{matrix.platform.cmakepp}} cmake ../examples/opengl-sfml${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}} + test -f ../dependencies/conanbuild.sh && source ../dependencies/conanbuild.sh + cmake ../examples/opengl-sfml${{matrix.platform.suffix}} \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \ + -DCMAKE_PREFIX_PATH=`pwd`/../install \ + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW cmake --build . --config ${BUILD_TYPE} --parallel 2 - name: Prepare publish package @@ -135,7 +184,7 @@ jobs: - name: Publish if: matrix.platform.compiler == 'em++' && github.ref == 'refs/heads/main' - uses: JamesIves/github-pages-deploy-action@4.1.0 + uses: JamesIves/github-pages-deploy-action@v4.7.3 with: branch: gh-pages folder: ${{github.workspace}}/bin/demo diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 369cc3e0c4..0000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,79 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '17 6 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - permissions: - security-events: write - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Get Linux dependencies - run: | - sudo apt-get update - sudo apt-get install libz-dev libpng-dev libfreetype6-dev libglew-dev libglu1-mesa-dev libsfml-dev liblua5.2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-dev - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/custom.ruleset b/.github/workflows/custom.ruleset deleted file mode 100644 index 6a6a9e3572..0000000000 --- a/.github/workflows/custom.ruleset +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.github/workflows/msvc-analysis.yml b/.github/workflows/msvc-analysis.yml deleted file mode 100644 index de19f27efe..0000000000 --- a/.github/workflows/msvc-analysis.yml +++ /dev/null @@ -1,74 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# -# Find more information at: -# https://github.com/microsoft/msvc-code-analysis-action - -name: Microsoft C++ Code Analysis - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - schedule: - - cron: '28 3 * * 6' - -env: - # Path to the CMake build directory. - build: '${{ github.workspace }}/build' - compiler: 'vs2019' - arch: '64' - -jobs: - analyze: - name: Analyze - runs-on: windows-latest - - permissions: - security-events: write - actions: read - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Get Windows dependencies - shell: bash - working-directory: ${{github.workspace}}/dependencies - run: unzip windows-dependencies-${{env.compiler}}-${{env.arch}}.zip - - - name: Configure CMake - run: cmake -B ${{ env.build }} -DLXGUI_BUILD_EXAMPLES=0 -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dependencies -DCMAKE_PREFIX_PATH=${{github.workspace}}/dependencies -A x64 - - # Build is required as generated source files are used - #- name: Build CMake - # run: cmake --build ${{ env.build }} - - - name: Initialize MSVC Code Analysis - uses: microsoft/msvc-code-analysis-action@main - # Provide a unique ID to access the sarif output path - id: run-analysis - with: - cmakeBuildDirectory: ${{ env.build }} - buildConfiguration: Release - # Ruleset file that will determine what checks will be run - ruleset: ${{github.workspace}}/.github/workflows/custom.ruleset - - # Upload SARIF file to GitHub Code Scanning Alerts - - name: Upload SARIF to GitHub - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: ${{ steps.run-analysis.outputs.sarif }} - - # Upload SARIF file as an Artifact to download and view - - name: Upload SARIF as an Artifact - uses: actions/upload-artifact@v2 - with: - name: sarif-file - path: ${{ steps.run-analysis.outputs.sarif }} diff --git a/.gitignore b/.gitignore index ffbb85d96a..12d4347a6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,18 @@ build -build_wasm -build_clang -build_examples +build-* +dependencies +dependencies-* + +.cache + bin/lxgui-test* bin/cout.txt bin/gui.txt + doc/html doc/lua doc/*.log + *.sublime-workspace compile_commands.json -dependencies/lib -dependencies/include -include/lxgui/lxgui.hpp +CMakeUserPresets.json diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 66ac13f0f1..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,21 +0,0 @@ -[submodule "sol2"] - path = extern/sol2 - url = https://github.com/cschreib/sol2.git -[submodule "utfcpp"] - path = extern/utfcpp - url = https://github.com/nemtrif/utfcpp.git -[submodule "fmt"] - path = extern/fmt - url = https://github.com/fmtlib/fmt.git -[submodule "extern/observable_unique_ptr"] - path = extern/observable_unique_ptr - url = https://github.com/cschreib/observable_unique_ptr.git -[submodule "extern/pugixml"] - path = extern/pugixml - url = https://github.com/zeux/pugixml.git -[submodule "extern/rapidyaml"] - path = extern/rapidyaml - url = https://github.com/biojppm/rapidyaml.git -[submodule "extern/magic_enum"] - path = extern/magic_enum - url = https://github.com/Neargye/magic_enum.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c302fa522..2a424873eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,13 @@ ############################################################################## # Base setup ############################################################################## -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.14..3.31) cmake_policy(SET CMP0048 "NEW") cmake_policy(SET CMP0072 "NEW") cmake_policy(SET CMP0077 "NEW") cmake_policy(SET CMP0083 "NEW") set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0177 NEW) # define a macro that helps defining an option macro(lxgui_set_option var default type docstring) @@ -35,6 +36,7 @@ lxgui_set_option(LXGUI_BUILD_RAPIDYAML TRUE BOOL "Build the rapidyaml dependency lxgui_set_option(LXGUI_ENABLE_XML_PARSER TRUE BOOL "Enable the XML layout parser (if false, XML layout files cannot be read)") lxgui_set_option(LXGUI_ENABLE_YAML_PARSER TRUE BOOL "Enable the YAML layout parser (if false, YAML layout files cannot be read)") lxgui_set_option(LXGUI_TEST_IMPLEMENTATION "SFML" STRING "Which implementation to test (SFML/SDL/OPENGL_SFML/OPENGL_SDL)") +lxgui_set_option(LXGUI_DEV FALSE BOOL "Enable compiler options for development (warnings etc), not recommended for release") # project name project(lxgui LANGUAGES CXX VERSION 2.0) @@ -47,36 +49,10 @@ project(lxgui LANGUAGES CXX VERSION 2.0) if(CMAKE_SYSTEM_NAME MATCHES "Emscripten") set(LXGUI_COMPILER_EMSCRIPTEN TRUE) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion -dumpversion - OUTPUT_VARIABLE GCC_VERSION) - - string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION}) - list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) - list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) - set(GCC_VERSION ${GCC_MAJOR}.${GCC_MINOR}) - - if(GCC_VERSION VERSION_LESS 8.0) - message(ERROR ": lxgui requires advanced features from the C++17 norm that are only available with gcc 8 or higher (your version: ${GCC_VERSION}). Please upgrade your compiler.") - endif() - set(LXGUI_COMPILER_GCC TRUE) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - if(MSVC_VERSION VERSION_LESS 1910) - message(ERROR ": lxgui requires advanced features from the C++17 norm that are only available with MSVC 2017 or higher (version 1910, your version: ${MSVC_VERSION}). Please upgrade your compiler.") - endif() - set(LXGUI_COMPILER_MSVC TRUE) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11) - message(ERROR ": lxgui requires advanced features from the C++17 norm that are only available with Xcode 11 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.") - endif() - else() - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7) - message(ERROR ": lxgui requires advanced features from the C++17 norm that are only available with clang 7 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.") - endif() - endif() - set(LXGUI_COMPILER_CLANG TRUE) else() message(WARNING "Warning: your compiler has not been setup by the CMake script, do not expect it to work") @@ -135,6 +111,7 @@ macro(lxgui_set_warning_level target) target_compile_options(${target} PRIVATE -Wno-missing-noreturn) target_compile_options(${target} PRIVATE -Wno-shadow-uncaptured-local) target_compile_options(${target} PRIVATE -Wno-undefined-func-template) + target_compile_options(${target} PRIVATE -Wno-unsafe-buffer-usage) target_compile_options(${target} PRIVATE -fno-limit-debug-info) if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") @@ -163,16 +140,23 @@ endif() # Dependencies ############################################################################## -# configure dependencies -set(SDL2_BUILDING_LIBRARY TRUE) - # find dependencies -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH}) - find_package(Lua REQUIRED) -find_package(Freetype) +find_package(sol2 REQUIRED) +find_package(utf8cpp REQUIRED) +find_package(oup REQUIRED) +find_package(fmt REQUIRED) +find_package(magic_enum REQUIRED) + +if(LXGUI_ENABLE_XML_PARSER) + find_package(pugixml REQUIRED) +endif() +if(LXGUI_ENABLE_YAML_PARSER) + find_package(ryml REQUIRED) +endif() if(NOT LXGUI_COMPILER_EMSCRIPTEN) + find_package(Freetype) find_package(PNG) find_package(ZLIB) find_package(SFML 2 COMPONENTS system window graphics) @@ -183,57 +167,13 @@ if(NOT LXGUI_COMPILER_EMSCRIPTEN) find_package(SDL2_ttf) endif() +# configure if (LUA_VERSION_STRING VERSION_GREATER_EQUAL 5.1 AND LUA_VERSION_STRING VERSION_LESS 5.2) set(LXGUI_LUA51 TRUE) endif() -# add the subdirectories for dependencies -set(UTF8_INSTALL 1) -set(MAGIC_ENUM_OPT_INSTALL 1) -add_subdirectory(extern/utfcpp) -add_subdirectory(extern/observable_unique_ptr) -add_subdirectory(extern/magic_enum) - -if(LXGUI_BUILD_FMT) - set(FMT_INSTALL TRUE) - add_subdirectory(extern/fmt) -else() - find_package(fmt REQUIRED) -endif() - -if(LXGUI_ENABLE_XML_PARSER) - if(LXGUI_BUILD_PUGIXML) - add_subdirectory(extern/pugixml) - else() - find_package(pugixml) - if(NOT TARGET pugixml::pugixml) - message(ERROR ": the XML parser requires pugixml, which is missing. XML parsing will be disabled.") - set(LXGUI_ENABLE_XML_PARSER FALSE) - endif() - endif() -endif() - -if(LXGUI_ENABLE_YAML_PARSER) - if(LXGUI_BUILD_RAPIDYAML) - add_subdirectory(extern/rapidyaml) - else() - find_package(ryml) - if(NOT TARGET ryml::ryml) - message(ERROR ": the YAML parser requires rapidyaml, which is missing. YAML parsing will be disabled.") - set(LXGUI_ENABLE_YAML_PARSER FALSE) - endif() - endif() -endif() - set(SOL_ALL_SAFETIES_ON TRUE) set(SOL_PRINT_ERRORS FALSE) -if(LXGUI_BUILD_SOL2) - set(SOL2_BUILD_LUA FALSE) - set(SOL2_ENABLE_INSTALL TRUE) - add_subdirectory(extern/sol2) -else() - find_package(sol2 REQUIRED) -endif() ############################################################################## # Main library @@ -321,19 +261,20 @@ add_library(lxgui::lxgui ALIAS lxgui) target_compile_features(lxgui PUBLIC cxx_std_17) # compilation options -lxgui_set_warning_level(lxgui) +if(LXGUI_DEV) + lxgui_set_warning_level(lxgui) +endif() target_include_directories(lxgui PUBLIC $ $) # needed dependencies -target_link_libraries(lxgui PUBLIC Lua::Lua) target_link_libraries(lxgui PUBLIC sol2::sol2) target_link_libraries(lxgui PUBLIC fmt::fmt) target_link_libraries(lxgui PUBLIC oup::oup) target_link_libraries(lxgui PUBLIC magic_enum::magic_enum) target_compile_definitions(lxgui PRIVATE -DUTF_CPP_CPLUSPLUS=201703L) -target_link_libraries(lxgui PRIVATE utf8::cpp) +target_link_libraries(lxgui PRIVATE utf8cpp) if(LXGUI_ENABLE_XML_PARSER) target_link_libraries(lxgui PRIVATE pugixml::pugixml) endif() @@ -345,12 +286,18 @@ if(LXGUI_PLATFORM_LINUX) endif() if(CMAKE_SYSTEM_NAME MATCHES "Emscripten") - # Debugging options that can be added to LXGUI_EMSCRIPTEN_FLAGS: - # -g -s SAFE_HEAP=1 -s WARN_UNALIGNED=1 -s ASSERTIONS=2 - # -g -fsanitize=address -s INITIAL_MEMORY=200MB target_compile_options(lxgui PUBLIC "SHELL:-s DISABLE_EXCEPTION_CATCHING=0") + # Debugging options that can be added: + # target_compile_options(lxgui PUBLIC "SHELL:-s STRICT=1") + # target_compile_options(lxgui PUBLIC "-g") + # target_compile_options(lxgui PUBLIC "-fsanitize=address") + # target_compile_options(lxgui PUBLIC "SHELL:-s INITIAL_MEMORY=200MB") + target_link_options(lxgui PUBLIC "SHELL:-s DISABLE_EXCEPTION_CATCHING=0") - target_link_options(lxgui PUBLIC "SHELL:-s MAX_WEBGL_VERSION=3") + # Debugging options that can be added: + # target_link_options(lxgui PUBLIC "SHELL:-s ASSERTIONS=2") + # target_link_options(lxgui PUBLIC "SHELL:-s SAFE_HEAP=1") + # target_link_options(lxgui PUBLIC "SHELL:-s GL_ASSERTIONS=1") endif() configure_file("${PROJECT_SOURCE_DIR}/include/lxgui/lxgui.hpp.config" @@ -372,46 +319,39 @@ if(LXGUI_BUILD_GUI_GL_IMPL) if((OPENGL_FOUND AND GLEW_FOUND AND FREETYPE_FOUND AND PNG_FOUND AND ZLIB_FOUND) OR LXGUI_COMPILER_EMSCRIPTEN) add_subdirectory(impl/gui/gl) else() - message(ERROR ": the OpenGL implementation of the GUI requires OpenGL, GLEW, freetype, libpng and zlib") - set(LXGUI_BUILD_GUI_GL_IMPL FALSE) + message(SEND_ERROR ": the OpenGL implementation of the GUI requires OpenGL, GLEW, freetype, libpng and zlib") endif() endif() if(LXGUI_BUILD_GUI_SFML_IMPL) if(LXGUI_COMPILER_EMSCRIPTEN) - message(ERROR ": the SFML implementation of the GUI is not supported with Emscripten") - set(LXGUI_BUILD_GUI_SFML_IMPL FALSE) + message(SEND_ERROR ": the SFML implementation of the GUI is not supported with Emscripten") elseif(SFML_FOUND) add_subdirectory(impl/gui/sfml) else() - message(ERROR ": the SFML implementation of the GUI requires the SFML library") - set(LXGUI_BUILD_GUI_SFML_IMPL FALSE) + message(SEND_ERROR ": the SFML implementation of the GUI requires the SFML library") endif() endif() if(LXGUI_BUILD_INPUT_SFML_IMPL) if(LXGUI_COMPILER_EMSCRIPTEN) - message(ERROR ": the SFML implementation of the input is not supported with Emscripten") - set(LXGUI_BUILD_INPUT_SFML_IMPL FALSE) + message(SEND_ERROR ": the SFML implementation of the input is not supported with Emscripten") elseif(SFML_FOUND) add_subdirectory(impl/input/sfml) else() - message(ERROR ": the SFML implementation of the input requires the SFML library") - set(LXGUI_BUILD_INPUT_SFML_IMPL FALSE) + message(SEND_ERROR ": the SFML implementation of the input requires the SFML library") endif() endif() if(LXGUI_BUILD_GUI_SDL_IMPL) - if((SDL2_FOUND AND SDL2_TTF_FOUND AND SDL2_IMAGE_FOUND) OR LXGUI_COMPILER_EMSCRIPTEN) + if((SDL2_FOUND AND SDL2_ttf_FOUND AND SDL2_image_FOUND) OR LXGUI_COMPILER_EMSCRIPTEN) add_subdirectory(impl/gui/sdl) else() - message(ERROR ": the SDL implementation of the GUI requires the SDL2, SDL2_ttf, and SDL2_image libraries") - set(LXGUI_BUILD_GUI_SDL_IMPL FALSE) + message(SEND_ERROR ": the SDL implementation of the GUI requires the SDL2, SDL2_ttf, and SDL2_image libraries") endif() endif() if(LXGUI_BUILD_INPUT_SDL_IMPL) if(SDL2_FOUND OR LXGUI_COMPILER_EMSCRIPTEN) add_subdirectory(impl/input/sdl) else() - message(ERROR ": the SDL implementation of the input requires the SDL library") - set(LXGUI_BUILD_INPUT_SDL_IMPL FALSE) + message(SEND_ERROR ": the SDL implementation of the input requires the SDL library") endif() endif() @@ -475,9 +415,6 @@ write_basic_package_version_file( install(FILES "${PROJECT_BINARY_DIR}/lxgui-config.cmake" "${PROJECT_BINARY_DIR}/lxgui-config-version.cmake" - "${PROJECT_SOURCE_DIR}/cmake/FindLua.cmake" - "${PROJECT_SOURCE_DIR}/cmake/FindSDL2_image.cmake" - "${PROJECT_SOURCE_DIR}/cmake/FindSDL2_ttf.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lxgui COMPONENT Development) ############################################################################## @@ -486,34 +423,35 @@ install(FILES if(LXGUI_BUILD_TEST) if(LXGUI_COMPILER_EMSCRIPTEN AND NOT (LXGUI_TEST_IMPLEMENTATION STREQUAL "SDL" OR LXGUI_TEST_IMPLEMENTATION STREQUAL "OPENGL_SDL")) - message(WARNING "Warning: the test program only supports SDL or OPENGL_SDL when compiled with Emscripten") + message(WARNING ": the test program only supports SDL or OPENGL_SDL when compiled with Emscripten") set(LXGUI_TEST_IMPLEMENTATION "SDL") endif() + if(LXGUI_TEST_IMPLEMENTATION STREQUAL "OPENGL_SFML") if(OPENGL_FOUND AND GLEW_FOUND AND FREETYPE_FOUND AND PNG_FOUND AND ZLIB_FOUND AND SFML_FOUND) add_subdirectory(test) else() - message(ERROR ": the test program requires OpenGL, GLEW, freetype, libpng, zlib and SFML.") + message(SEND_ERROR ": the test program requires OpenGL, GLEW, freetype, libpng, zlib and SFML.") endif() elseif(LXGUI_TEST_IMPLEMENTATION STREQUAL "OPENGL_SDL") if((OPENGL_FOUND AND GLEW_FOUND AND FREETYPE_FOUND AND PNG_FOUND AND ZLIB_FOUND AND SDL2_FOUND) OR LXGUI_COMPILER_EMSCRIPTEN) add_subdirectory(test) else() - message(ERROR ": the test program requires OpenGL, GLEW, freetype, libpng, zlib and SDL.") + message(SEND_ERROR ": the test program requires OpenGL, GLEW, freetype, libpng, zlib and SDL.") endif() elseif(LXGUI_TEST_IMPLEMENTATION STREQUAL "SDL") if((SDL2_FOUND AND SDL2_TTF_FOUND AND SDL2_IMAGE_FOUND) OR LXGUI_COMPILER_EMSCRIPTEN) add_subdirectory(test) else() - message(ERROR ": the test program requires SDL2, SDL2_ttf, and SDL2_image.") + message(SEND_ERROR ": the test program requires SDL2, SDL2_ttf, and SDL2_image.") endif() elseif(LXGUI_TEST_IMPLEMENTATION STREQUAL "SFML") if(SFML_FOUND) add_subdirectory(test) else() - message(ERROR ": the test program requires SFML.") + message(SEND_ERROR ": the test program requires SFML.") endif() else() - message(ERROR ": unknown implementation ${LXGUI_TEST_IMPLEMENTATION}") + message(SEND_ERROR ": unknown implementation ${LXGUI_TEST_IMPLEMENTATION}") endif() endif() diff --git a/README.md b/README.md index 08d61a70ef..b12618c3b5 100644 --- a/README.md +++ b/README.md @@ -82,13 +82,13 @@ This screenshot was generated on a Release (optimised) build of lxgui with the O Using CMake (3.14 or later), you can compile using the command line, or create projects files for your favorite IDE. The front-end GUI library itself depends on: - [Lua](http://www.lua.org/) (>5.1), - - [sol2](https://github.com/ThePhD/sol2) (included as a submodule), - - [utfcpp](https://github.com/nemtrif/utfcpp) (included as a submodule), - - [magic_enum](https://github.com/Neargye/magic_enum) (included as a submodule), - - [oup](https://github.com/cschreib/observable_unique_ptr) (included as submodule), - - [fmtlib](https://github.com/fmtlib/fmt) (included as submodule). + - [sol2](https://github.com/ThePhD/sol2), + - [utfcpp](https://github.com/nemtrif/utfcpp), + - [magic_enum](https://github.com/Neargye/magic_enum), + - [oup](https://github.com/cschreib/observable_unique_ptr), + - [fmtlib](https://github.com/fmtlib/fmt). -To parse layout files, the library depends on [pugixml](https://github.com/zeux/pugixml) (included as submodule), and [rapidyaml](https://github.com/biojppm/rapidyaml) (included as submodule). These are optional dependencies; you can use both if you want to support both XML and YAML layout files, or just one if you need only XML or YAML, or even neither if you want to write your UI in pure C++. +To parse layout files, the library depends on [pugixml](https://github.com/zeux/pugixml), and [rapidyaml](https://github.com/biojppm/rapidyaml). These are optional dependencies; you can use both if you want to support both XML and YAML layout files, or just one if you need only XML or YAML, or even neither if you want to write your UI in pure C++. Available rendering back-ends: @@ -96,7 +96,7 @@ Available rendering back-ends: - SFML2. This back-end uses [SFML2](https://www.sfml-dev.org/) for everything, and thus only depends on SFML. It runs a little bit slower than the OpenGL back-end, as the extra layer from SFML adds a bit of overhead. At present, some limitations in the SFML API also prevents using VBOs. - - SDL2. This back-end uses [SDL2](https://www.libsdl.org/) for rendering, [SDL2_tff](https://www.libsdl.org/projects/SDL_ttf/) for font loading and rendering, and [SDL2_image](https://www.libsdl.org/projects/SDL_image/) for texture loading. It is the slowest available back-end, but also the one that supports the largest number of platforms (including platforms lacking a GPU). VBOs are not supported, and neither is per-vertex color. Text rendering is limited to Unicode code points which fit in a 16bit integer. + - SDL2. This back-end uses [SDL2](https://www.libsdl.org/) for rendering, [SDL2_tff](https://www.libsdl.org/projects/SDL_ttf/) for font loading and rendering, and [SDL2_image](https://www.libsdl.org/projects/SDL_image/) for texture loading. It is the slowest available back-end, but also the one that supports the largest number of platforms (including platforms lacking a GPU). VBOs are not supported, and neither is per-vertex color. Text rendering is limited to Unicode code points that fit in a 16bit integer. Available input back-ends: @@ -263,9 +263,9 @@ vcpkg install sdl2 sdl2-image zlib libpng freetype glew ## Build for WebAssembly / Emscripten -The WebAssembly build only supports the SDL2 back-end for input, and either the SDL2 or OpenGL back-ends for rendering (programmable pipeline only; the legacy fixed pipeline is not supported in WebGL). SDL2, OpenGL, and libpng are all already provided by default in Emscripten, so the only required dependency to setup is Lua and Freetype (at the time of writing this guide, the Freetype version in Emscripten was too old). Pre-compiled libraries are provided in `dependencies/wasm.zip`, but you can also build them from source yourself easily. +The WebAssembly build only supports the SDL2 back-end for input, and either the SDL2 or OpenGL back-ends for rendering (programmable pipeline only; the legacy fixed pipeline is not supported in WebGL). SDL2, OpenGL, Freetype, and libpng can be enabled from Emscripten ports; the rest of the dependencies needs to be built. -The SDL2 rendering back-end will support all platforms supported by SDL2, which should cover pretty much everything, but it may run slower on some platforms. The OpenGL back-end uses OpenGL ES 3, hence will only run on platforms supporting WebGL2, but it should provide the best performance. In practice, performance is highly dependent on the the host platform and browser. For example: earlier in the development of lxgui, and on my desktop machine, the SDL2 back-end was slower (30 FPS) than the OpenGL back-end (40 FPS) in Firefox, but in Chrome they both ran at the maximum 60 FPS. This is likely to change in the future, with browser updates and changes in the lxgui implementation. +The SDL2 rendering back-end will support all platforms supported by SDL2, which should cover pretty much everything, but it may run slower on some platforms. The OpenGL back-end uses OpenGL ES 3, hence will only run on platforms supporting WebGL2, but it should provide the best performance. In practice, performance is highly dependent on the the host platform and browser. With Emscripten [installed and sourced](https://emscripten.org/docs/getting_started/downloads.html) in your current terminal, run @@ -273,8 +273,8 @@ With Emscripten [installed and sourced](https://emscripten.org/docs/getting_star mkdir build cd build emcmake cmake ../ -emmake make -emmake make install +make +make install ``` diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake deleted file mode 100644 index 14dd3b9965..0000000000 --- a/cmake/FindLua.cmake +++ /dev/null @@ -1,223 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindLua -# ------- -# -# -# -# Locate Lua library This module defines -# -# :: -# -# LUA_FOUND - if false, do not try to link to Lua -# LUA_LIBRARIES - both lua and lualib -# LUA_INCLUDE_DIR - where to find lua.h -# LUA_VERSION_STRING - the version of Lua found -# LUA_VERSION_MAJOR - the major version of Lua -# LUA_VERSION_MINOR - the minor version of Lua -# LUA_VERSION_PATCH - the patch version of Lua -# -# -# -# Note that the expected include convention is -# -# :: -# -# #include "lua.h" -# -# and not -# -# :: -# -# #include -# -# This is because, the lua location is not standardized and may exist in -# locations other than lua/ - -unset(_lua_include_subdirs) -unset(_lua_library_names) -unset(_lua_append_versions) - -# this is a function only to have all the variables inside go away automatically -function(_lua_set_version_vars) - set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0) - - if (Lua_FIND_VERSION_EXACT) - if (Lua_FIND_VERSION_COUNT GREATER 1) - set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) - endif () - elseif (Lua_FIND_VERSION) - # once there is a different major version supported this should become a loop - if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) - if (Lua_FIND_VERSION_COUNT EQUAL 1) - set(_lua_append_versions ${LUA_VERSIONS5}) - else () - foreach (subver IN LISTS LUA_VERSIONS5) - if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) - list(APPEND _lua_append_versions ${subver}) - endif () - endforeach () - endif () - endif () - else () - # once there is a different major version supported this should become a loop - set(_lua_append_versions ${LUA_VERSIONS5}) - endif () - - list(APPEND _lua_include_subdirs "include/lua" "include") - - foreach (ver IN LISTS _lua_append_versions) - string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") - list(APPEND _lua_include_subdirs - include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} - include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - ) - endforeach () - - set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) - set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) -endfunction(_lua_set_version_vars) - -function(_lua_check_header_version _hdr_file) - # At least 5.[012] have different ways to express the version - # so all of them need to be tested. Lua 5.2 defines LUA_VERSION - # and LUA_RELEASE as joined by the C preprocessor, so avoid those. - file(STRINGS "${_hdr_file}" lua_version_strings - REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") - - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") - if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") - set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") - else () - string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - endif () - string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") - endif () - foreach (ver IN LISTS _lua_append_versions) - if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") - set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) - set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) - set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) - set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) - return() - endif () - endforeach () -endfunction(_lua_check_header_version) - -_lua_set_version_vars() - -if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h") -endif () - -if (NOT LUA_VERSION_STRING) - foreach (subdir IN LISTS _lua_include_subdirs) - unset(LUA_INCLUDE_PREFIX CACHE) - find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h - HINTS - ${LUA_ROOT} - $ENV{LUA_ROOT} - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - ) - if (LUA_INCLUDE_PREFIX) - _lua_check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h") - if (LUA_VERSION_STRING) - set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}") - break() - endif () - endif () - endforeach () -endif () -unset(_lua_include_subdirs) -unset(_lua_append_versions) - -if (LUA_VERSION_STRING) - set(_lua_library_names - lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR} - lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - ) -endif () - -find_library(LUA_LIBRARY - NAMES ${_lua_library_names} - HINTS - ${LUA_ROOT} - $ENV{LUA_ROOT} - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt -) -unset(_lua_library_names) - -if (NOT LUA_LIBRARY) - find_library(LUA_LIBRARY - NAMES lua - HINTS - ${LUA_ROOT} - $ENV{LUA_ROOT} - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt - ) -endif() - -if (LUA_LIBRARY) - # include the math library for Unix - if (UNIX AND NOT APPLE AND NOT BEOS AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") - find_library(LUA_MATH_LIBRARY m) - set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") - - # include dl library for statically-linked Lua library - get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} LAST_EXT) - if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX) - list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS}) - endif() - - # For Windows and Mac, don't need to explicitly include the math library - else () - set(LUA_LIBRARIES "${LUA_LIBRARY}") - endif () - - if(NOT TARGET Lua::Lua) - add_library(Lua::Lua UNKNOWN IMPORTED) - set_target_properties(Lua::Lua PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LUA_INCLUDE_DIR}") - set_target_properties(Lua::Lua PROPERTIES INTERFACE_LINK_LIBRARIES "${LUA_LIBRARIES}") - set_target_properties(Lua::Lua PROPERTIES IMPORTED_LOCATION "${LUA_LIBRARY}") - endif() -endif () - -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua - REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR - VERSION_VAR LUA_VERSION_STRING) - -mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/cmake/FindPkgMacros.cmake b/cmake/FindPkgMacros.cmake deleted file mode 100644 index fa2d062cbd..0000000000 --- a/cmake/FindPkgMacros.cmake +++ /dev/null @@ -1,160 +0,0 @@ -#------------------------------------------------------------------- -# This file is part of the CMake build system for OGRE -# (Object-oriented Graphics Rendering Engine) -# For the latest info, see http://www.ogre3d.org/ -# -# The contents of this file are placed in the public domain. Feel -# free to make use of it in any way you like. -#------------------------------------------------------------------- - -################################################################## -# Provides some common functionality for the FindPackage modules -################################################################## - -# Begin processing of package -macro(findpkg_begin PREFIX) - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS "Looking for ${PREFIX}...") - endif () -endmacro(findpkg_begin) - -# Display a status message unless FIND_QUIETLY is set -macro(pkg_message PREFIX) - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS ${ARGN}) - endif () -endmacro(pkg_message) - -# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes -macro(getenv_path VAR) - set(ENV_${VAR} $ENV{${VAR}}) - # replace won't work if var is blank - if (ENV_${VAR}) - string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) - endif () -endmacro(getenv_path) - -# Construct search paths for includes and libraries from a PREFIX_PATH -macro(create_search_paths PREFIX) - foreach(dir ${${PREFIX}_PREFIX_PATH}) - set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH} - ${dir}/include ${dir}/Include ${dir}/include/${PREFIX} ${dir}/Headers) - set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} - ${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs) - set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH} - ${dir}/bin) - endforeach(dir) - set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH}) -endmacro(create_search_paths) - -# clear cache variables if a certain variable changed -macro(clear_if_changed TESTVAR) - # test against internal check variable - # HACK: Apparently, adding a variable to the cache cleans up the list - # a bit. We need to also remove any empty strings from the list, but - # at the same time ensure that we are actually dealing with a list. - list(APPEND ${TESTVAR} "") - list(REMOVE_ITEM ${TESTVAR} "") - if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}") - message(STATUS "${TESTVAR} changed.") - foreach(var ${ARGN}) - set(${var} "NOTFOUND" CACHE STRING "x" FORCE) - endforeach(var) - endif () - set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE) -endmacro(clear_if_changed) - -# Try to get some hints from pkg-config, if available -macro(use_pkgconfig PREFIX PKGNAME) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(${PREFIX} ${PKGNAME}) - endif () -endmacro (use_pkgconfig) - -# Couple a set of release AND debug libraries (or frameworks) -macro(make_library_set PREFIX) - if (${PREFIX}_FWK) - set(${PREFIX} ${${PREFIX}_FWK}) - elseif (${PREFIX}_REL AND ${PREFIX}_DBG) - set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG}) - elseif (${PREFIX}_REL) - set(${PREFIX} ${${PREFIX}_REL}) - elseif (${PREFIX}_DBG) - set(${PREFIX} ${${PREFIX}_DBG}) - endif () -endmacro(make_library_set) - -# Generate debug names from given release names -macro(get_debug_names PREFIX) - foreach(i ${${PREFIX}}) - set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) - endforeach(i) -endmacro(get_debug_names) - -# Add the parent dir from DIR to VAR -macro(add_parent_dir VAR DIR) - get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE) - set(${VAR} ${${VAR}} ${${DIR}_TEMP}) -endmacro(add_parent_dir) - -# Do the final processing for the package find. -macro(findpkg_finish PREFIX) - # skip if already processed during this run - if (NOT ${PREFIX}_FOUND) - if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) - set(${PREFIX}_FOUND TRUE) - set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) - set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}") - endif () - else () - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS "Could not locate ${PREFIX}") - endif () - if (${PREFIX}_FIND_REQUIRED) - message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.") - endif () - endif () - - mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK) - endif () -endmacro(findpkg_finish) - - -# Slightly customised framework finder -macro(findpkg_framework fwk) - if(APPLE) - set(${fwk}_FRAMEWORK_PATH - ${${fwk}_FRAMEWORK_SEARCH_PATH} - ${CMAKE_FRAMEWORK_PATH} - ~/Library/Frameworks - /Library/Frameworks - /System/Library/Frameworks - /Network/Library/Frameworks - ${CMAKE_CURRENT_SOURCE_DIR}/lib/Release - ${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug - ) - # These could be arrays of paths, add each individually to the search paths - foreach(i ${OGRE_PREFIX_PATH}) - set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/Release ${i}/lib/Debug) - endforeach(i) - - foreach(i ${OGRE_PREFIX_BUILD}) - set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/Release ${i}/lib/Debug) - endforeach(i) - - foreach(dir ${${fwk}_FRAMEWORK_PATH}) - set(fwkpath ${dir}/${fwk}.framework) - if(EXISTS ${fwkpath}) - set(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES} - ${fwkpath}/Headers ${fwkpath}/PrivateHeaders) - set(${fwk}_FRAMEWORK_PATH ${dir}) - if (NOT ${fwk}_LIBRARY_FWK) - set(${fwk}_LIBRARY_FWK "-framework ${fwk}") - endif () - endif(EXISTS ${fwkpath}) - endforeach(dir) - endif(APPLE) -endmacro(findpkg_framework) diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake deleted file mode 100644 index d22e92f98c..0000000000 --- a/cmake/FindSDL2.cmake +++ /dev/null @@ -1,201 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindSDL2 -------- - -Locate SDL2 library - -This module defines - -:: - - SDL2_LIBRARIES, the name of the library to link against - SDL2_FOUND, if false, do not try to link to SDL - SDL2_INCLUDE_DIRS, where to find SDL.h - SDL2_VERSION_STRING, human-readable string containing the version of SDL - - - -This module responds to the flag: - -:: - - SDL2_BUILDING_LIBRARY - If this is defined, then no SDL2_main 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 proper link flags - as part of the returned SDL2_LIBRARIES variable. - - - -Don't forget to include SDLmain.h and SDLmain.m your project for the -OS X framework based version. (Other versions link to -lSDLmain 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_LIBRARIES_TEMP in your -configuration and no SDL2_LIBRARIES, it means CMake did not find your SDL -library (SDL.dll, libsdl.so, SDL.framework, etc). Set -SDL2_LIBRARIES_TEMP to point to your SDL 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_LIBRARIES variable, but when these values are unset, SDL2_LIBRARIES -does not get created. - - - -$SDL2DIR is an environment variable that would correspond to the -./configure --prefix=$SDL2DIR used in building SDL. 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 SDLmain 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_LIBRARIES 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 SDL/SDL.h to just SDL.h -This needed to change because "proper" SDL convention is #include -"SDL.h", not . This is done for portability reasons -because not all systems place things in SDL/ (see FreeBSD). -#]=======================================================================] - -find_path(SDL2_INCLUDE_DIRS SDL.h - HINTS - ENV SDL2DIR - PATH_SUFFIXES SDL2 - # path suffixes to search inside ENV{SDL2DIR} - include/SDL2 include -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(VC_LIB_PATH_SUFFIX lib/x64) -else() - set(VC_LIB_PATH_SUFFIX lib/x86) -endif() - -find_library(SDL2_LIBRARY - NAMES SDL2 - HINTS - ENV SDL2DIR - PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} -) - -# Hide this cache variable from the user, it's an internal implementation -# detail. The documented library variable for the user is SDL2_LIBRARIES -# which is derived from SDL2_LIBRARY further below. -set_property(CACHE SDL2_LIBRARY PROPERTY TYPE INTERNAL) - -if(NOT SDL2_BUILDING_LIBRARY) - if(NOT SDL2_INCLUDE_DIRS MATCHES ".framework") - # Non-OS X framework versions expect you to also dynamically link to - # SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms - # seem to provide SDLmain for compatibility even though they don't - # necessarily need it. - find_library(SDL2MAIN_LIBRARY - NAMES SDL2main - HINTS - ENV SDL2DIR - PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} - PATHS - /opt - ) - endif() -endif() - -# SDL 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() - -# MinGW needs an additional link flag, -mwindows -# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows -if(MINGW) - set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW") -endif() - -if(SDL2_LIBRARY) - set(SDL2_LIBRARIES_TEMP ${SDL2_LIBRARY}) - # For SDLmain - if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY) - list(FIND SDL2_LIBRARY "${SDL2MAIN_LIBRARY}" _SDL2_MAIN_INDEX) - if(_SDL2_MAIN_INDEX EQUAL -1) - set(SDL2_LIBRARIES_TEMP "${SDL2MAIN_LIBRARY}" ${SDL2_LIBRARIES_TEMP}) - endif() - unset(_SDL2_MAIN_INDEX) - endif() - - # For OS X, SDL 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_LIBRARIES_TEMP ${SDL2_LIBRARIES_TEMP} "-framework Cocoa") - endif() - - # 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_LIBRARIES_TEMP ${SDL2_LIBRARIES_TEMP} ${CMAKE_THREAD_LIBS_INIT}) - endif() - - # For MinGW library - if(MINGW) - set(SDL2_LIBRARIES_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARIES_TEMP}) - endif() - - # Set the final string here so the GUI reflects the final state. - set(SDL2_LIBRARIES ${SDL2_LIBRARIES_TEMP} CACHE STRING "Where the SDL Library can be found") -endif() - -if(SDL2_INCLUDE_DIRS AND EXISTS "${SDL2_INCLUDE_DIRS}/SDL_version.h") - file(STRINGS "${SDL2_INCLUDE_DIRS}/SDL_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_INCLUDE_DIRS}/SDL_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_INCLUDE_DIRS}/SDL_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") - string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}") - set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH}) - unset(SDL2_VERSION_MAJOR_LINE) - unset(SDL2_VERSION_MINOR_LINE) - unset(SDL2_VERSION_PATCH_LINE) - unset(SDL2_VERSION_MAJOR) - unset(SDL2_VERSION_MINOR) - unset(SDL2_VERSION_PATCH) -endif() - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 - REQUIRED_VARS SDL2_LIBRARIES SDL2_INCLUDE_DIRS - VERSION_VAR SDL2_VERSION_STRING) - -if (SDL2_FOUND) - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 UNKNOWN IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}") - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_LIBRARIES}") - set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LOCATION "${SDL2_LIBRARY}") - if(NOT APPLE) - target_link_libraries(SDL2::SDL2 INTERFACE Threads::Threads) - endif() - endif() -endif() diff --git a/cmake/FindSDL2_image.cmake b/cmake/FindSDL2_image.cmake deleted file mode 100644 index f4837c4be4..0000000000 --- a/cmake/FindSDL2_image.cmake +++ /dev/null @@ -1,109 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindSDL2_image -# ------------- -# -# Locate SDL2_image library -# -# This module defines: -# -# :: -# -# SDL2_IMAGE_LIBRARIES, the name of the library to link against -# SDL2_IMAGE_INCLUDE_DIRS, where to find the headers -# SDL2_IMAGE_FOUND, if false, do not try to link against -# SDL2_IMAGE_VERSION_STRING - human-readable string containing the -# version of SDL2_image -# -# -# -# For backward compatibility the following variables are also set: -# -# :: -# -# SDL2IMAGE_LIBRARY (same value as SDL2_IMAGE_LIBRARIES) -# SDL2IMAGE_INCLUDE_DIR (same value as SDL2_IMAGE_INCLUDE_DIRS) -# SDL2IMAGE_FOUND (same value as SDL2_IMAGE_FOUND) -# -# -# -# $SDLDIR is an environment variable that would correspond to the -# ./configure --prefix=$SDLDIR used in building SDL. -# -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). - -if(NOT SDL2_IMAGE_INCLUDE_DIR AND SDL2IMAGE_INCLUDE_DIR) - set(SDL2_IMAGE_INCLUDE_DIR ${SDL2IMAGE_INCLUDE_DIR} CACHE PATH "directory cache entry initialized from old variable name") -endif() -find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h - HINTS - ENV SDL2IMAGEDIR - ENV SDL2DIR - ${SDL2_DIR} - PATH_SUFFIXES SDL2 - # path suffixes to search inside ENV{SDL2DIR} - include/SDL2 include -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(VC_LIB_PATH_SUFFIX lib/x64) -else() - set(VC_LIB_PATH_SUFFIX lib/x86) -endif() - -if(NOT SDL2_IMAGE_LIBRARY AND SDL2IMAGE_LIBRARY) - set(SDL2_IMAGE_LIBRARY ${SDL2IMAGE_LIBRARY} CACHE FILEPATH "file cache entry initialized from old variable name") -endif() -find_library(SDL2_IMAGE_LIBRARY - NAMES SDL2_image - HINTS - ENV SDL2IMAGEDIR - ENV SDL2DIR - ${SDL2_DIR} - PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} -) - -if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h") - file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") - string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}") - set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) - unset(SDL2_IMAGE_VERSION_MAJOR_LINE) - unset(SDL2_IMAGE_VERSION_MINOR_LINE) - unset(SDL2_IMAGE_VERSION_PATCH_LINE) - unset(SDL2_IMAGE_VERSION_MAJOR) - unset(SDL2_IMAGE_VERSION_MINOR) - unset(SDL2_IMAGE_VERSION_PATCH) -endif() - -set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) -set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image - REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS - VERSION_VAR SDL2_IMAGE_VERSION_STRING) - -# for backward compatibility -set(SDL2IMAGE_LIBRARY ${SDL2_IMAGE_LIBRARIES}) -set(SDL2IMAGE_INCLUDE_DIR ${SDL2_IMAGE_INCLUDE_DIRS}) -set(SDL2IMAGE_FOUND ${SDL2_IMAGE_FOUND}) - -mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR) - -if (SDL2_IMAGE_FOUND) - if(NOT TARGET SDL2::image) - add_library(SDL2::image UNKNOWN IMPORTED) - set_target_properties(SDL2::image PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SDL2_IMAGE_INCLUDE_DIRS}") - set_target_properties(SDL2::image PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_IMAGE_LIBRARIES}") - set_target_properties(SDL2::image PROPERTIES IMPORTED_LOCATION "${SDL2_IMAGE_LIBRARY}") - endif() -endif() diff --git a/cmake/FindSDL2_ttf.cmake b/cmake/FindSDL2_ttf.cmake deleted file mode 100644 index 7c11aa4da8..0000000000 --- a/cmake/FindSDL2_ttf.cmake +++ /dev/null @@ -1,109 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindSDL2_ttf -# ------------- -# -# Locate SDL2_ttf library -# -# This module defines: -# -# :: -# -# SDL2_TTF_LIBRARIES, the name of the library to link against -# SDL2_TTF_INCLUDE_DIRS, where to find the headers -# SDL2_TTF_FOUND, if false, do not try to link against -# SDL2_TTF_VERSION_STRING - human-readable string containing the -# version of SDL2_ttf -# -# -# -# For backward compatibility the following variables are also set: -# -# :: -# -# SDL2TTF_LIBRARY (same value as SDL2_TTF_LIBRARIES) -# SDL2TTF_INCLUDE_DIR (same value as SDL2_TTF_INCLUDE_DIRS) -# SDL2TTF_FOUND (same value as SDL2_TTF_FOUND) -# -# -# -# $SDLDIR is an environment variable that would correspond to the -# ./configure --prefix=$SDLDIR used in building SDL. -# -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). - -if(NOT SDL2_TTF_INCLUDE_DIR AND SDL2TTF_INCLUDE_DIR) - set(SDL2_TTF_INCLUDE_DIR ${SDL2TTF_INCLUDE_DIR} CACHE PATH "directory cache entry initialized from old variable name") -endif() -find_path(SDL2_TTF_INCLUDE_DIR SDL_ttf.h - HINTS - ENV SDL2TTFDIR - ENV SDL2DIR - ${SDL2_DIR} - PATH_SUFFIXES SDL2 - # path suffixes to search inside ENV{SDL2DIR} - include/SDL2 include -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(VC_LIB_PATH_SUFFIX lib/x64) -else() - set(VC_LIB_PATH_SUFFIX lib/x86) -endif() - -if(NOT SDL2_TTF_LIBRARY AND SDL2TTF_LIBRARY) - set(SDL2_TTF_LIBRARY ${SDL2TTF_LIBRARY} CACHE FILEPATH "file cache entry initialized from old variable name") -endif() -find_library(SDL2_TTF_LIBRARY - NAMES SDL2_ttf - HINTS - ENV SDL2TTFDIR - ENV SDL2DIR - ${SDL2_DIR} - PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} -) - -if(SDL2_TTF_INCLUDE_DIR AND EXISTS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h") - file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h" SDL2_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_TTF_MAJOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h" SDL2_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_TTF_MINOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h" SDL2_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_TTF_PATCHLEVEL[ \t]+[0-9]+$") - string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MAJOR "${SDL2_TTF_VERSION_MAJOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MINOR "${SDL2_TTF_VERSION_MINOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_PATCH "${SDL2_TTF_VERSION_PATCH_LINE}") - set(SDL2_TTF_VERSION_STRING ${SDL2_TTF_VERSION_MAJOR}.${SDL2_TTF_VERSION_MINOR}.${SDL2_TTF_VERSION_PATCH}) - unset(SDL2_TTF_VERSION_MAJOR_LINE) - unset(SDL2_TTF_VERSION_MINOR_LINE) - unset(SDL2_TTF_VERSION_PATCH_LINE) - unset(SDL2_TTF_VERSION_MAJOR) - unset(SDL2_TTF_VERSION_MINOR) - unset(SDL2_TTF_VERSION_PATCH) -endif() - -set(SDL2_TTF_LIBRARIES ${SDL2_TTF_LIBRARY}) -set(SDL2_TTF_INCLUDE_DIRS ${SDL2_TTF_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_ttf - REQUIRED_VARS SDL2_TTF_LIBRARIES SDL2_TTF_INCLUDE_DIRS - VERSION_VAR SDL2_TTF_VERSION_STRING) - -# for backward compatibility -set(SDL2TTF_LIBRARY ${SDL2_TTF_LIBRARIES}) -set(SDL2TTF_INCLUDE_DIR ${SDL2_TTF_INCLUDE_DIRS}) -set(SDL2TTF_FOUND ${SDL2_TTF_FOUND}) - -mark_as_advanced(SDL2_TTF_LIBRARY SDL2_TTF_INCLUDE_DIR) - -if (SDL2_TTF_FOUND) - if(NOT TARGET SDL2::TTF) - add_library(SDL2::TTF UNKNOWN IMPORTED) - set_target_properties(SDL2::TTF PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SDL2_TTF_INCLUDE_DIRS}") - set_target_properties(SDL2::TTF PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_TTF_LIBRARIES}") - set_target_properties(SDL2::TTF PROPERTIES IMPORTED_LOCATION "${SDL2_TTF_LIBRARY}") - endif() -endif() diff --git a/cmake/FindSFML.cmake b/cmake/FindSFML.cmake deleted file mode 100644 index 8fb807580e..0000000000 --- a/cmake/FindSFML.cmake +++ /dev/null @@ -1,409 +0,0 @@ -# This script locates the SFML library -# ------------------------------------ -# -# Usage -# ----- -# -# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main). -# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing. -# example: -# find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules -# -# You can enforce a specific version, either MAJOR.MINOR or only MAJOR. -# If nothing is specified, the version won't be checked (i.e. any version will be accepted). -# example: -# find_package(SFML COMPONENTS ...) // no specific version required -# find_package(SFML 2 COMPONENTS ...) // any 2.x version -# find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater -# -# By default, the dynamic libraries of SFML will be found. To find the static ones instead, -# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...). -# Since you have to link yourself all the SFML dependencies when you link it statically, the following -# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed -# description below). -# In case of static linking, the SFML_STATIC macro will also be defined by this script. -# example: -# set(SFML_STATIC_LIBRARIES TRUE) -# find_package(SFML 2 COMPONENTS network system) -# -# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless -# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details. -# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which -# are available for both release and debug modes. -# -# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable -# to tell CMake where SFML is. -# -# Output -# ------ -# -# This script defines the following variables: -# - For each specified module XXX (system, window, graphics, network, audio, main): -# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found) -# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found) -# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary) -# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found -# - SFML_XXX_DEPENDENCIES: the list of libraries the module depends on, in case of static linking -# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules -# - SFML_FOUND: true if all the required modules are found -# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file) -# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking -# -# example: -# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED) -# include_directories(${SFML_INCLUDE_DIR}) -# add_executable(myapp ...) -# target_link_libraries(myapp ${SFML_LIBRARIES}) - -# define the SFML_STATIC macro if static build was chosen -if(SFML_STATIC_LIBRARIES) - add_definitions(-DSFML_STATIC) -endif() - -# define the list of search paths for headers and libraries -set(FIND_SFML_PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt) - -# find the SFML include directory (first using custom paths, then standards) -find_path(SFML_INCLUDE_DIR SFML/Config.hpp - PATH_SUFFIXES include - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - -# check the version number -set(SFML_VERSION_OK TRUE) -if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) - # extract the major and minor version numbers from SFML/Config.hpp - # we have to handle framework a little bit differently: - if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework") - set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp") - else() - set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp") - endif() - FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS) - STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}") - if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$") - set(SFML_VERSION_PATCH 0) - endif() - math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}") - - # if we could extract them, compare with the requested version number - if (SFML_VERSION_MAJOR) - # transform version numbers to an integer - math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}") - - # compare them - if(SFML_VERSION LESS SFML_REQUESTED_VERSION) - set(SFML_VERSION_OK FALSE) - endif() - else() - # SFML version is < 2.0 - if (SFML_REQUESTED_VERSION GREATER 10900) - set(SFML_VERSION_OK FALSE) - set(SFML_VERSION_MAJOR 1) - set(SFML_VERSION_MINOR x) - set(SFML_VERSION_PATCH x) - endif() - endif() -endif() - -# find the requested modules -set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found -foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS}) - string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER) - string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER) - set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}) - - # no suffix for sfml-main, it is always a static library - if(FIND_SFML_COMPONENT_LOWER STREQUAL "main") - # release library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE - NAMES ${FIND_SFML_COMPONENT_NAME} - PATH_SUFFIXES lib64 lib - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - - # debug library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG - NAMES ${FIND_SFML_COMPONENT_NAME}-d - PATH_SUFFIXES lib64 lib - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - else() - # static release library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE - NAMES ${FIND_SFML_COMPONENT_NAME}-s - PATH_SUFFIXES lib64 lib - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - - # static debug library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG - NAMES ${FIND_SFML_COMPONENT_NAME}-s-d - PATH_SUFFIXES lib64 lib - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - - # dynamic release library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE - NAMES ${FIND_SFML_COMPONENT_NAME} - PATH_SUFFIXES lib64 lib - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - - # dynamic debug library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG - NAMES ${FIND_SFML_COMPONENT_NAME}-d - PATH_SUFFIXES lib64 lib - HINTS ${SFML_ROOT} $ENV{SFML_ROOT} - PATHS ${FIND_SFML_PATHS}) - - # choose the entries that fit the requested link type - if(SFML_STATIC_LIBRARIES) - if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE}) - endif() - if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG}) - endif() - else() - if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE}) - endif() - if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG}) - endif() - endif() - endif() - - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) - # library found - set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE) - - # if both are found, set SFML_XXX_LIBRARY to contain both - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG} - optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) - endif() - - # if only one debug/release variant is found, set the other to be equal to the found one - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) - # debug and not release - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) - endif() - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) - # release and not debug - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) - endif() - else() - # library not found - set(SFML_FOUND FALSE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "") - set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY") - endif() - - # mark as advanced - MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG) - - # add to the global list of libraries - set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}") -endforeach() - -# in case of static linking, we must also define the list of all the dependencies of SFML libraries -if(SFML_STATIC_LIBRARIES) - - # detect the OS - if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(FIND_SFML_OS_WINDOWS 1) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(FIND_SFML_OS_LINUX 1) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set(FIND_SFML_OS_FREEBSD 1) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(FIND_SFML_OS_MACOSX 1) - endif() - - # start with an empty list - set(SFML_DEPENDENCIES) - set(FIND_SFML_DEPENDENCIES_NOTFOUND) - - # macro that searches for a 3rd-party library - macro(find_sfml_dependency output friendlyname) - # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions - find_library(${output} NAMES ${ARGN} HINTS ${SFML_ROOT} $ENV{SFML_ROOT} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH) - if(${${output}} STREQUAL "${output}-NOTFOUND") - unset(output) - set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}") - endif() - endmacro() - - # sfml-system - list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT) - if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1) - - # update the list -- these are only system libraries, no need to find them - if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX) - set(SFML_SYSTEM_DEPENDENCIES "pthread") - endif() - if(FIND_SFML_OS_LINUX) - set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt") - endif() - if(FIND_SFML_OS_WINDOWS) - set(SFML_SYSTEM_DEPENDENCIES "winmm") - endif() - set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES}) - endif() - - # sfml-network - list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT) - if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1) - - # update the list -- these are only system libraries, no need to find them - if(FIND_SFML_OS_WINDOWS) - set(SFML_NETWORK_DEPENDENCIES "ws2_32") - endif() - set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES}) - endif() - - # sfml-window - list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT) - if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1) - - # find libraries - if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD) - find_sfml_dependency(X11_LIBRARY "X11" X11) - find_sfml_dependency(LIBXCB_LIBRARIES "XCB" xcb libxcb) - find_sfml_dependency(X11_XCB_LIBRARY "X11-xcb" X11-xcb libX11-xcb) - find_sfml_dependency(XCB_RANDR_LIBRARY "xcb-randr" xcb-randr libxcb-randr) - find_sfml_dependency(XCB_IMAGE_LIBRARY "xcb-image" xcb-image libxcb-image) - endif() - - if(FIND_SFML_OS_LINUX) - find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev) - endif() - - # update the list - if(FIND_SFML_OS_WINDOWS) - set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32") - elseif(FIND_SFML_OS_LINUX) - set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${LIBXCB_LIBRARIES} ${X11_XCB_LIBRARY} ${XCB_RANDR_LIBRARY} ${XCB_IMAGE_LIBRARY} ${UDEV_LIBRARIES}) - elseif(FIND_SFML_OS_FREEBSD) - set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${LIBXCB_LIBRARIES} ${X11_XCB_LIBRARY} ${XCB_RANDR_LIBRARY} ${XCB_IMAGE_LIBRARY} "usbhid") - elseif(FIND_SFML_OS_MACOSX) - set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon") - endif() - set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES}) - endif() - - # sfml-graphics - list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT) - if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1) - - # find libraries - find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype) - find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg) - - # update the list - set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY}) - set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES}) - endif() - - # sfml-audio - list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT) - if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1) - - # find libraries - find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32) - find_sfml_dependency(OGG_LIBRARY "Ogg" ogg) - find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis) - find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile) - find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc) - find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC) - - # update the list - set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) - set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES}) - endif() - -endif() - -# handle errors -if(NOT SFML_VERSION_OK) - # SFML version not ok - set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})") - set(SFML_FOUND FALSE) -elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND) - set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})") - set(SFML_FOUND FALSE) -elseif(NOT SFML_FOUND) - # include directory or library not found - set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})") -endif() -if (NOT SFML_FOUND) - if(SFML_FIND_REQUIRED) - # fatal error - message(FATAL_ERROR ${FIND_SFML_ERROR}) - elseif(NOT SFML_FIND_QUIETLY) - # error but continue - message("${FIND_SFML_ERROR}") - endif() -endif() - -# handle success -if(SFML_FOUND AND NOT SFML_FIND_QUIETLY) - message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}") - - if(NOT TARGET sfml::system) - add_library(sfml::system UNKNOWN IMPORTED) - set_target_properties(sfml::system PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}") - set_target_properties(sfml::system PROPERTIES INTERFACE_LINK_LIBRARIES "${SFML_SYSTEM_DEPENDENCIES}") - set_target_properties(sfml::system PROPERTIES IMPORTED_LOCATION "${SFML_SYSTEM_LIBRARY}") - endif() - if(NOT TARGET sfml::network) - add_library(sfml::network UNKNOWN IMPORTED) - set_target_properties(sfml::network PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}") - set_target_properties(sfml::network PROPERTIES INTERFACE_LINK_LIBRARIES "${SFML_NETWORK_DEPENDENCIES}") - set_target_properties(sfml::network PROPERTIES IMPORTED_LOCATION "${SFML_NETWORK_LIBRARY}") - target_link_libraries(sfml::network INTERFACE sfml::system) - endif() - if(NOT TARGET sfml::window) - add_library(sfml::window UNKNOWN IMPORTED) - set_target_properties(sfml::window PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}") - set_target_properties(sfml::window PROPERTIES INTERFACE_LINK_LIBRARIES "${SFML_WINDOW_DEPENDENCIES}") - set_target_properties(sfml::window PROPERTIES IMPORTED_LOCATION "${SFML_WINDOW_LIBRARY}") - target_link_libraries(sfml::window INTERFACE sfml::system) - endif() - if(NOT TARGET sfml::audio) - add_library(sfml::audio UNKNOWN IMPORTED) - set_target_properties(sfml::audio PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}") - set_target_properties(sfml::audio PROPERTIES INTERFACE_LINK_LIBRARIES "${SFML_AUDIO_DEPENDENCIES}") - set_target_properties(sfml::audio PROPERTIES IMPORTED_LOCATION "${SFML_AUDIO_LIBRARY}") - target_link_libraries(sfml::audio INTERFACE sfml::system) - endif() - if(NOT TARGET sfml::graphics) - add_library(sfml::graphics UNKNOWN IMPORTED) - set_target_properties(sfml::graphics PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}") - set_target_properties(sfml::graphics PROPERTIES INTERFACE_LINK_LIBRARIES "${SFML_GRAPHICS_DEPENDENCIES}") - set_target_properties(sfml::graphics PROPERTIES IMPORTED_LOCATION "${SFML_GRAPHICS_LIBRARY}") - target_link_libraries(sfml::graphics INTERFACE sfml::window) - target_link_libraries(sfml::graphics INTERFACE sfml::system) - endif() -endif() diff --git a/cmake/Findlxgui.cmake b/cmake/Findlxgui.cmake deleted file mode 100644 index 13ae56416f..0000000000 --- a/cmake/Findlxgui.cmake +++ /dev/null @@ -1,430 +0,0 @@ -# Locate the lxgui library -# -# Use LXGUI_ROOT to specify a manual path. -# -# This module defines the following variables: -# LXGUI_LIBRARIES, the list of all libraries required to compile against lxgui. -# LXGUI_INCLUDE_DIRS, the list of all include directories, including dependencies. -# LXGUI_FOUND, true if both the LXGUI_LIBRARY and LXGUI_INCLUDE_DIR have been found. -# LXGUI_VERSION_STRING, the version of the library that has been found. -# LXGUI_IMPL_INCLUDE_DIR, where to find implementation include files. -# LXGUI_GUI_GL_LIBRARIES, the list of all libraries required to use the OpenGL implementation library. -# LXGUI_GUI_GL_INCLUDE_DIRS, the list of all include directories required to use the OpenGL implementation library. -# LXGUI_GUI_GL_FOUND, true if both LXGUI_FOUND and LXGUI_GUI_GL_LIBRARY have been found. -# LXGUI_OPENGL3, True if the OpenGL implementation was built for OpenGL3, or False for legacy OpenGL. -# LXGUI_GUI_SFML_LIBRARIES, the list of all libraries required to use the SFML input implementation library. -# LXGUI_GUI_SFML_INCLUDE_DIRS, the list of all include directories required to use the SFML input implementation library. -# LXGUI_GUI_SFML_FOUND, true if both LXGUI_FOUND and LXGUI_INPUT_SFML_LIBRARY have been found. -# LXGUI_INPUT_SFML_LIBRARIES, the list of all libraries required to use the SFML input implementation library. -# LXGUI_INPUT_SFML_INCLUDE_DIRS, the list of all include directories required to use the SFML input implementation library. -# LXGUI_INPUT_SFML_FOUND, true if both LXGUI_FOUND and LXGUI_INPUT_SFML_LIBRARY have been found. -# LXGUI_GUI_SDL_LIBRARIES, the list of all libraries required to use the SDL input implementation library. -# LXGUI_GUI_SDL_INCLUDE_DIRS, the list of all include directories required to use the SDL input implementation library. -# LXGUI_GUI_SDL_FOUND, true if both LXGUI_FOUND and LXGUI_INPUT_SDL_LIBRARY have been found. -# LXGUI_INPUT_SDL_LIBRARIES, the list of all libraries required to use the SDL input implementation library. -# LXGUI_INPUT_SDL_INCLUDE_DIRS, the list of all include directories required to use the SDL input implementation library. -# LXGUI_INPUT_SDL_FOUND, true if both LXGUI_FOUND and LXGUI_INPUT_SDL_LIBRARY have been found. -# -# Finally, the module exports the following targets: -# lxgui::lxgui, the core library -# lxgui::gui::gl, the OpenGL implementation library -# lxgui::gui::sdl, the SDL implementation library -# lxgui::gui::sfml, the SFML implementation library -# lxgui::input::sdl, the SDL input implementation library -# lxgui::input::sfml, the SFML input implementation library - -if(TARGET lxgui::lxgui) - return() -endif() - -find_path(LXGUI_INCLUDE_DIR - NAMES lxgui/lxgui.hpp DOC "Path to lxgui include directory." - PATH_SUFFIXES include - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -find_library(LXGUI_LIBRARY - NAMES lxgui lxgui.lib DOC "Absolute path to lxgui library." - PATH_SUFFIXES lib - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -set(LXGUI_LIBRARIES ${LXGUI_LIBRARY}) - -find_path(LXGUI_IMPL_INCLUDE_DIR - NAMES lxgui/impl/gui_gl_renderer.hpp DOC "Path to lxgui implementation include directory." - PATH_SUFFIXES include - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -find_library(LXGUI_GUI_GL_LIBRARY - NAMES lxgui-gl lxgui-gl.lib - PATH_SUFFIXES lib - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -find_library(LXGUI_GUI_SFML_LIBRARY - NAMES lxgui-sfml lxgui-sfml.lib - PATH_SUFFIXES lib - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -find_library(LXGUI_INPUT_SFML_LIBRARY - NAMES lxgui-input-sfml lxgui-input-sfml.lib - PATH_SUFFIXES lib - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -find_library(LXGUI_GUI_SDL_LIBRARY - NAMES lxgui-sdl lxgui-sdl.lib - PATH_SUFFIXES lib - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -find_library(LXGUI_INPUT_SDL_LIBRARY - NAMES lxgui-input-sdl lxgui-input-sdl.lib - PATH_SUFFIXES lib - HINTS ${LXGUI_ROOT} $ENV{LXGUI_ROOT} - PATHS /usr /usr/local -) - -mark_as_advanced(LXGUI_INCLUDE_DIR LXGUI_LIBRARY) -mark_as_advanced(LXGUI_IMPL_INCLUDE_DIR LXGUI_GUI_GL_LIBRARY LXGUI_GUI_SFML_LIBRARY LXGUI_INPUT_SFML_LIBRARY LXGUI_GUI_SDL_LIBRARY LXGUI_INPUT_SDL_LIBRARY) - -if(LXGUI_INCLUDE_DIR AND EXISTS "${LXGUI_INCLUDE_DIR}/lxgui/lxgui.hpp") - file(STRINGS "${LXGUI_INCLUDE_DIR}/lxgui/lxgui.hpp" lxgui_version_str - REGEX "^#[\t ]*define[\t ]+LXGUI_VERSION_(MAJOR|MINOR)[\t ]+[0-9]+$") - - unset(LXGUI_VERSION_STRING) - foreach(VPART MAJOR MINOR) - foreach(VLINE ${lxgui_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+LXGUI_VERSION_${VPART}") - string(REGEX REPLACE "^#[\t ]*define[\t ]+LXGUI_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1" - LXGUI_VERSION_PART "${VLINE}") - if(LXGUI_VERSION_STRING) - set(LXGUI_VERSION_STRING "${LXGUI_VERSION_STRING}.${LXGUI_VERSION_PART}") - else(LXGUI_VERSION_STRING) - set(LXGUI_VERSION_STRING "${LXGUI_VERSION_PART}") - endif() - unset(LXGUI_VERSION_PART) - endif() - endforeach() - endforeach() - - unset(lxgui_version_str) - - file(STRINGS "${LXGUI_INCLUDE_DIR}/lxgui/lxgui.hpp" lxgui_opengl - REGEX "^#[\t ]*define[\t ]+LXGUI_OPENGL3[\t ]*$") - - if(lxgui_opengl) - set(LXGUI_OPENGL3 TRUE) - else() - set(LXGUI_OPENGL3 FALSE) - endif() - - unset(lxgui_opengl) - - file(STRINGS "${LXGUI_INCLUDE_DIR}/lxgui/lxgui.hpp" lxgui_xml - REGEX "^#[\t ]*define[\t ]+LXGUI_ENABLE_XML_PARSER[\t ]*$") - if(lxgui_xml) - message(STATUS "lxgui found with XML parser") - set(LXGUI_ENABLE_XML_PARSER TRUE) - else() - set(LXGUI_ENABLE_XML_PARSER FALSE) - endif() - - unset(lxgui_xml) - - file(STRINGS "${LXGUI_INCLUDE_DIR}/lxgui/lxgui.hpp" lxgui_yaml - REGEX "^#[\t ]*define[\t ]+LXGUI_ENABLE_YAML_PARSER[\t ]*$") - - if(lxgui_yaml) - message(STATUS "lxgui found with YAML parser") - set(LXGUI_ENABLE_YAML_PARSER TRUE) - else() - set(LXGUI_ENABLE_YAML_PARSER FALSE) - endif() - - unset(lxgui_yaml) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(lxgui - REQUIRED_VARS LXGUI_LIBRARY LXGUI_INCLUDE_DIR - VERSION_VAR LXGUI_VERSION_STRING) - -find_package(Lua REQUIRED) -find_package(fmt REQUIRED) -find_package(oup REQUIRED) -find_package(sol2 REQUIRED) - -if(LXGUI_ENABLE_XML_PARSER) - find_package(pugixml REQUIRED) -endif() -if(LXGUI_ENABLE_YAML_PARSER) - find_package(ryml REQUIRED) -endif() - -set(LXGUI_GUI_GL_FOUND FALSE) -set(LXGUI_GUI_SFML_FOUND FALSE) -set(LXGUI_INPUT_SFML_FOUND FALSE) -set(LXGUI_GUI_SDL_FOUND FALSE) -set(LXGUI_INPUT_SDL_FOUND FALSE) - -set(LXGUI_INCLUDE_DIRS ${LXGUI_INCLUDE_DIR}) -set(LXGUI_LIBRARIES ${LXGUI_LIBRARY}) - -if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") - set(LXGUI_EMSCRIPTEN TRUE) -else() - set(LXGUI_EMSCRIPTEN FALSE) -endif() - -if(UNIX AND NOT (APPLE OR LXGUI_EMSCRIPTEN)) - set(LXGUI_LIBRARIES ${LXGUI_LIBRARIES} stdc++fs) -endif() - -if(LXGUI_FOUND) - if(NOT TARGET lxgui::lxgui) - add_library(lxgui::lxgui UNKNOWN IMPORTED) - set_target_properties(lxgui::lxgui PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LXGUI_INCLUDE_DIRS}") - set_target_properties(lxgui::lxgui PROPERTIES INTERFACE_LINK_LIBRARIES "${LXGUI_LIBRARIES}") - set_target_properties(lxgui::lxgui PROPERTIES IMPORTED_LOCATION "${LXGUI_LIBRARY}") - target_link_libraries(lxgui::lxgui INTERFACE Lua::Lua) - target_link_libraries(lxgui::lxgui INTERFACE sol2::sol2) - target_link_libraries(lxgui::lxgui INTERFACE fmt::fmt) - target_link_libraries(lxgui::lxgui INTERFACE oup::oup) - if(LXGUI_ENABLE_XML_PARSER) - target_link_libraries(lxgui::lxgui INTERFACE pugixml::pugixml) - endif() - if(LXGUI_ENABLE_YAML_PARSER) - target_link_libraries(lxgui::lxgui INTERFACE ryml::ryml) - endif() - if(LXGUI_EMSCRIPTEN) - target_compile_options(lxgui::lxgui INTERFACE "SHELL:-s DISABLE_EXCEPTION_CATCHING=0") - target_link_options(lxgui::lxgui INTERFACE "SHELL:-s DISABLE_EXCEPTION_CATCHING=0") - target_link_options(lxgui::lxgui INTERFACE "SHELL:-s MAX_WEBGL_VERSION=3") - endif() - endif() - - if(LXGUI_GUI_GL_LIBRARY) - if(NOT LXGUI_EMSCRIPTEN) - cmake_policy(SET CMP0072 "NEW") - find_package(Freetype) - find_package(PNG) - find_package(ZLIB) - find_package(GLEW) - find_package(OpenGL) - - if(OPENGL_FOUND AND GLEW_FOUND AND FREETYPE_FOUND AND PNG_FOUND AND ZLIB_FOUND) - message(STATUS "Found lxgui-gl") - set(LXGUI_GUI_GL_FOUND TRUE) - - set(LXGUI_GUI_GL_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_GUI_GL_LIBRARIES ${LXGUI_GUI_GL_LIBRARY}) - - mark_as_advanced(LXGUI_GUI_GL_FOUND) - else() - message(ERROR ": the OpenGL implementation of the GUI requires OpenGL, GLEW, freetype, libpng and zlib") - endif() - else() - find_package(Freetype) - - if(FREETYPE_FOUND) - message(STATUS "Found lxgui-gl") - set(LXGUI_GUI_GL_FOUND TRUE) - - set(LXGUI_GUI_GL_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_GUI_GL_LIBRARIES ${LXGUI_GUI_GL_LIBRARY}) - - mark_as_advanced(LXGUI_GUI_GL_FOUND) - else() - message(ERROR ": the OpenGL implementation of the GUI requires freetype") - endif() - - endif() - - if(LXGUI_GUI_GL_FOUND AND NOT TARGET lxgui::gui::gl) - add_library(lxgui::gui::gl UNKNOWN IMPORTED) - set_target_properties(lxgui::gui::gl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LXGUI_GUI_GL_INCLUDE_DIRS}") - set_target_properties(lxgui::gui::gl PROPERTIES INTERFACE_LINK_LIBRARIES "${LXGUI_GUI_GL_LIBRARIES}") - set_target_properties(lxgui::gui::gl PROPERTIES IMPORTED_LOCATION "${LXGUI_GUI_GL_LIBRARY}") - target_link_libraries(lxgui::gui::gl INTERFACE lxgui::lxgui) - target_link_libraries(lxgui::gui::gl INTERFACE Freetype::Freetype) - if(NOT LXGUI_EMSCRIPTEN) - target_link_libraries(lxgui::gui::gl INTERFACE OpenGL::GL) - target_link_libraries(lxgui::gui::gl INTERFACE PNG::PNG) - target_link_libraries(lxgui::gui::gl INTERFACE GLEW::GLEW) - else() - target_compile_options(lxgui::gui::gl INTERFACE "SHELL:-s USE_LIBPNG=1") - target_link_options(lxgui::gui::gl INTERFACE "SHELL:-s USE_LIBPNG=1") - target_link_options(lxgui::gui::gl INTERFACE "SHELL:-s MIN_WEBGL_VERSION=2") - endif() - endif() - endif() - - if(NOT LXGUI_EMSCRIPTEN) - find_package(SFML 2 COMPONENTS graphics system window) - endif() - - if(LXGUI_GUI_SFML_LIBRARY) - if(NOT LXGUI_EMSCRIPTEN) - if(SFML_FOUND) - set(LXGUI_GUI_SFML_FOUND TRUE) - message(STATUS "Found lxgui-sfml") - - set(LXGUI_GUI_SFML_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_GUI_SFML_LIBRARIES ${LXGUI_GUI_SFML_LIBRARY}) - - mark_as_advanced(LXGUI_GUI_SFML_FOUND) - else() - message(ERROR ": the SFML implementation of the GUI requires the SFML library") - endif() - else() - unset(LXGUI_GUI_SFML_LIBRARY) - endif() - - if(LXGUI_GUI_SFML_FOUND AND NOT TARGET lxgui::gui::sfml) - add_library(lxgui::gui::sfml UNKNOWN IMPORTED) - set_target_properties(lxgui::gui::sfml PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LXGUI_GUI_SFML_INCLUDE_DIRS}") - set_target_properties(lxgui::gui::sfml PROPERTIES INTERFACE_LINK_LIBRARIES "${LXGUI_GUI_SFML_LIBRARIES}") - set_target_properties(lxgui::gui::sfml PROPERTIES IMPORTED_LOCATION "${LXGUI_GUI_SFML_LIBRARY}") - target_link_libraries(lxgui::gui::sfml INTERFACE lxgui::lxgui) - target_link_libraries(lxgui::gui::sfml INTERFACE sfml::graphics) - endif() - endif() - - if(LXGUI_INPUT_SFML_LIBRARY) - if(NOT LXGUI_EMSCRIPTEN) - if(SFML_FOUND) - set(LXGUI_INPUT_SFML_FOUND TRUE) - message(STATUS "Found lxgui-input-sfml") - - set(LXGUI_INPUT_SFML_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_INPUT_SFML_LIBRARIES ${LXGUI_INPUT_SFML_LIBRARY}) - - mark_as_advanced(LXGUI_INPUT_SFML_FOUND) - else() - message(ERROR ": the SFML implementation of the input requires the SFML library") - endif() - else() - unset(LXGUI_INPUT_SFML_LIBRARY) - endif() - - if(LXGUI_INPUT_SFML_FOUND AND NOT TARGET lxgui::input::sfml) - add_library(lxgui::input::sfml UNKNOWN IMPORTED) - set_target_properties(lxgui::input::sfml PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LXGUI_INPUT_SFML_INCLUDE_DIRS}") - set_target_properties(lxgui::input::sfml PROPERTIES INTERFACE_LINK_LIBRARIES "${LXGUI_INPUT_SFML_LIBRARIES}") - set_target_properties(lxgui::input::sfml PROPERTIES IMPORTED_LOCATION "${LXGUI_INPUT_SFML_LIBRARY}") - target_link_libraries(lxgui::input::sfml INTERFACE lxgui::lxgui) - target_link_libraries(lxgui::input::sfml INTERFACE sfml::graphics) - endif() - endif() - - if(NOT LXGUI_EMSCRIPTEN) - if((LXGUI_GUI_SDL_LIBRARY OR LXGUI_INPUT_SDL_LIBRARY)) - find_package(SDL2) - endif() - endif() - - if(LXGUI_GUI_SDL_LIBRARY) - if(NOT LXGUI_EMSCRIPTEN) - find_package(SDL2_image) - find_package(SDL2_ttf) - - if(SDL2_FOUND AND SDL2_TTF_FOUND AND SDL2_IMAGE_FOUND) - set(LXGUI_GUI_SDL_FOUND TRUE) - message(STATUS "Found lxgui-sdl") - - set(LXGUI_GUI_SDL_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_GUI_SDL_LIBRARIES ${LXGUI_GUI_SDL_LIBRARY}) - - mark_as_advanced(LXGUI_GUI_SDL_FOUND) - else() - message(ERROR ": the SDL implementation of the GUI requires the SDL, SDL_ttf, and SDL_image libraries") - endif() - else() - set(LXGUI_GUI_SDL_FOUND TRUE) - message(STATUS "Found lxgui-sdl") - - set(LXGUI_GUI_SDL_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_GUI_SDL_LIBRARIES ${LXGUI_GUI_SDL_LIBRARY}) - endif() - - if(LXGUI_GUI_SDL_FOUND AND NOT TARGET lxgui::gui::sdl) - add_library(lxgui::gui::sdl UNKNOWN IMPORTED) - set_target_properties(lxgui::gui::sdl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LXGUI_GUI_SDL_INCLUDE_DIRS}") - set_target_properties(lxgui::gui::sdl PROPERTIES INTERFACE_LINK_LIBRARIES "${LXGUI_GUI_SDL_LIBRARIES}") - set_target_properties(lxgui::gui::sdl PROPERTIES IMPORTED_LOCATION "${LXGUI_GUI_SDL_LIBRARY}") - target_link_libraries(lxgui::gui::sdl INTERFACE lxgui::lxgui) - if(NOT LXGUI_EMSCRIPTEN) - target_link_libraries(lxgui::gui::sdl INTERFACE SDL2::SDL2) - target_link_libraries(lxgui::gui::sdl INTERFACE SDL2::image) - target_link_libraries(lxgui::gui::sdl INTERFACE SDL2::TTF) - else() - target_compile_options(lxgui::gui::sdl INTERFACE "SHELL:-s USE_SDL=2") - target_compile_options(lxgui::gui::sdl INTERFACE "SHELL:-s USE_SDL_IMAGE=2") - target_compile_options(lxgui::gui::sdl INTERFACE "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_compile_options(lxgui::gui::sdl INTERFACE "SHELL:-s USE_SDL_TTF=2") - target_link_options(lxgui::gui::sdl INTERFACE "SHELL:-s USE_SDL=2") - target_link_options(lxgui::gui::sdl INTERFACE "SHELL:-s USE_SDL_IMAGE=2") - target_link_options(lxgui::gui::sdl INTERFACE "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_link_options(lxgui::gui::sdl INTERFACE "SHELL:-s USE_SDL_TTF=2") - target_link_options(lxgui::gui::sdl INTERFACE "SHELL:-s MIN_WEBGL_VERSION=1") - endif() - endif() - endif() - - if(LXGUI_INPUT_SDL_LIBRARY) - if(NOT LXGUI_EMSCRIPTEN) - if(SDL2_FOUND) - set(LXGUI_INPUT_SDL_FOUND TRUE) - message(STATUS "Found lxgui-input-sdl") - - set(LXGUI_INPUT_SDL_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_INPUT_SDL_LIBRARIES ${LXGUI_INPUT_SDL_LIBRARY}) - - mark_as_advanced(LXGUI_INPUT_SDL_FOUND) - else() - message(ERROR ": the SDL implementation of the input requires the SDL library") - endif() - else() - set(LXGUI_INPUT_SDL_FOUND TRUE) - message(STATUS "Found lxgui-input-sdl") - - set(LXGUI_INPUT_SDL_INCLUDE_DIRS ${LXGUI_IMPL_INCLUDE_DIR}) - set(LXGUI_INPUT_SDL_LIBRARIES ${LXGUI_INPUT_SDL_LIBRARY}) - endif() - - if(LXGUI_INPUT_SDL_FOUND AND NOT TARGET lxgui::input::sdl) - add_library(lxgui::input::sdl UNKNOWN IMPORTED) - set_target_properties(lxgui::input::sdl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LXGUI_INPUT_SDL_INCLUDE_DIRS}") - set_target_properties(lxgui::input::sdl PROPERTIES INTERFACE_LINK_LIBRARIES "${LXGUI_INPUT_SDL_LIBRARIES}") - set_target_properties(lxgui::input::sdl PROPERTIES IMPORTED_LOCATION "${LXGUI_INPUT_SDL_LIBRARY}") - target_link_libraries(lxgui::input::sdl INTERFACE lxgui::lxgui) - if(NOT LXGUI_EMSCRIPTEN) - target_link_libraries(lxgui::input::sdl INTERFACE SDL2::SDL2) - target_link_libraries(lxgui::input::sdl INTERFACE SDL2::image) - else() - target_compile_options(lxgui::input::sdl INTERFACE "SHELL:-s USE_SDL=2") - target_compile_options(lxgui::input::sdl INTERFACE "SHELL:-s USE_SDL_IMAGE=2") - target_compile_options(lxgui::input::sdl INTERFACE "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_link_options(lxgui::input::sdl INTERFACE "SHELL:-s USE_SDL=2") - target_link_options(lxgui::input::sdl INTERFACE "SHELL:-s USE_SDL_IMAGE=2") - target_link_options(lxgui::input::sdl INTERFACE "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - endif() - endif() - endif() -endif() - -mark_as_advanced(LXGUI_OPENGL3 LXGUI_ENABLE_XML_PARSER LXGUI_ENABLE_YAML_PARSER - LXGUI_GUI_GL_FOUND LXGUI_GUI_SFML_FOUND LXGUI_INPUT_SFML_FOUND LXGUI_GUI_SDL_FOUND LXGUI_INPUT_SDL_FOUND) - -unset(LXGUI_EMSCRIPTEN) diff --git a/cmake/Findoup.cmake b/cmake/Findoup.cmake deleted file mode 100644 index 75cae38ca0..0000000000 --- a/cmake/Findoup.cmake +++ /dev/null @@ -1,19 +0,0 @@ -find_path(OUP_INCLUDE_DIR observable_unique_ptr.hpp - HINTS ${OUP_DIR} - PATH_SUFFIXES oup include/oup -) - -set(OUP_INCLUDE_DIRS ${OUP_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(oup REQUIRED_VARS OUP_INCLUDE_DIRS) - -mark_as_advanced(OUP_INCLUDE_DIR) - -if (OUP_FOUND) - if(NOT TARGET oup::oup) - add_library(oup::oup IMPORTED INTERFACE) - target_include_directories(oup::oup INTERFACE "${OUP_INCLUDE_DIRS}") - endif() -endif() diff --git a/cmake/lxgui-config.cmake.in b/cmake/lxgui-config.cmake.in index ec776bc48c..feef8f1c09 100644 --- a/cmake/lxgui-config.cmake.in +++ b/cmake/lxgui-config.cmake.in @@ -11,6 +11,7 @@ find_dependency(fmt) find_dependency(oup) find_dependency(sol2) find_dependency(utf8cpp) +find_dependency(magic_enum) if (@LXGUI_ENABLE_XML_PARSER@) find_dependency(pugixml) @@ -22,7 +23,7 @@ endif () if (@LXGUI_BUILD_GUI_GL_IMPL@) find_dependency(Freetype) - if (NOT @LXGUI_COMPILER_EMSCRIPTEN@) + if (NOT "@LXGUI_COMPILER_EMSCRIPTEN@") find_dependency(PNG) find_dependency(ZLIB) find_dependency(GLEW) @@ -48,7 +49,7 @@ if (@LXGUI_BUILD_GUI_SFML_IMPL@ OR @LXGUI_BUILD_INPUT_SFML_IMPL@) endif () if (@LXGUI_BUILD_GUI_SDL_IMPL@ OR @LXGUI_BUILD_INPUT_SDL_IMPL@) - if (NOT @LXGUI_COMPILER_EMSCRIPTEN@) + if (NOT "@LXGUI_COMPILER_EMSCRIPTEN@") find_dependency(SDL2) if (NOT TARGET SDL2::SDL2) if (TARGET SDL2) @@ -66,7 +67,7 @@ if (@LXGUI_BUILD_GUI_SDL_IMPL@ OR @LXGUI_BUILD_INPUT_SDL_IMPL@) endif () if (@LXGUI_BUILD_GUI_SDL_IMPL@) - if (NOT @LXGUI_COMPILER_EMSCRIPTEN@) + if (NOT "@LXGUI_COMPILER_EMSCRIPTEN@") find_dependency(SDL2_ttf) endif () endif () @@ -76,8 +77,3 @@ endif () #################################################################################### include("${CMAKE_CURRENT_LIST_DIR}/lxgui-targets.cmake") - -if (NOT TARGET lxgui) - add_library(lxgui INTERFACE IMPORTED) - set_target_properties(lxgui PROPERTIES INTERFACE_LINK_LIBRARIES lxgui::lxgui) -endif () diff --git a/conan/observable_unique_ptr/conanfile.py b/conan/observable_unique_ptr/conanfile.py new file mode 100644 index 0000000000..bb9361c0b2 --- /dev/null +++ b/conan/observable_unique_ptr/conanfile.py @@ -0,0 +1,50 @@ +import os +import shutil + +from conan import ConanFile +from conan.tools.files import copy, download, unzip +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd + +required_conan_version = ">=2.1" + + +class OupConan(ConanFile): + name = "observable_unique_ptr" + description = "Unique-ownership smart pointers with observable lifetime." + license = "MIT" + url = "https://github.com/cschreib/observable_unique_ptr" + homepage = "https://github.com/cschreib/observable_unique_ptr" + topics = ("format", "iostream", "printf") + package_type = "header-library" + exports_sources = "include/*" + + def set_version(self): + if not self.version: + self.version = '0.7.2' + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 17) + + def source(self): + url = f'https://github.com/cschreib/observable_unique_ptr/archive/refs/tags/v{self.version}.zip' + base_name = f'observable_unique_ptr-{self.version}' + zip_name = f'{base_name}.zip' + download(self, url, zip_name) + unzip(self, zip_name) + shutil.move(os.path.join(base_name, "include"), "include") + shutil.move(os.path.join(base_name, "LICENSE"), "LICENSE") + os.unlink(zip_name) + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "oup") + self.cpp_info.set_property("cmake_target_name", "oup::oup") + self.cpp_info.set_property("pkg_config_name", "oup") diff --git a/conan/profiles/macos-latest-64-clang++ b/conan/profiles/macos-latest-64-clang++ new file mode 100644 index 0000000000..21ae04c7aa --- /dev/null +++ b/conan/profiles/macos-latest-64-clang++ @@ -0,0 +1,7 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=apple-clang +compiler.cppstd=17 +compiler.libcxx=libc++ +os=Macos diff --git a/conan/profiles/ubuntu-latest-32-em++ b/conan/profiles/ubuntu-latest-32-em++ new file mode 100644 index 0000000000..d6017c4314 --- /dev/null +++ b/conan/profiles/ubuntu-latest-32-em++ @@ -0,0 +1,11 @@ +[settings] +arch=wasm +build_type=Release +compiler=clang +compiler.cppstd=17 +compiler.libcxx=libc++ +compiler.version=19 +os=Emscripten + +[tool_requires] +emsdk/3.1.73 diff --git a/conan/profiles/ubuntu-latest-64-clang++ b/conan/profiles/ubuntu-latest-64-clang++ new file mode 100644 index 0000000000..55c46bda38 --- /dev/null +++ b/conan/profiles/ubuntu-latest-64-clang++ @@ -0,0 +1,10 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=clang +compiler.cppstd=17 +compiler.libcxx=libstdc++11 +os=Linux + +[options] +sdl/*:pulse=False diff --git a/conan/profiles/ubuntu-latest-64-g++ b/conan/profiles/ubuntu-latest-64-g++ new file mode 100644 index 0000000000..51b73a9a0f --- /dev/null +++ b/conan/profiles/ubuntu-latest-64-g++ @@ -0,0 +1,7 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=gcc +compiler.cppstd=17 +compiler.libcxx=libstdc++11 +os=Linux diff --git a/conan/profiles/windows-latest-64-msvc b/conan/profiles/windows-latest-64-msvc new file mode 100644 index 0000000000..a6007225bd --- /dev/null +++ b/conan/profiles/windows-latest-64-msvc @@ -0,0 +1,6 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=msvc +compiler.cppstd=17 +os=Windows diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000..ca52f75357 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,58 @@ +from conan import ConanFile + + +class LxguiRecipe(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + options = { + "shared": [True, False], + "with_sfml": [True, False], + "with_sdl": [True, False], + "with_opengl": [True, False], + "with_xml": [True, False], + "with_yaml": [True, False], + } + default_options = { + "shared": True, + "with_sfml": True, + "with_sdl": True, + "with_opengl": True, + "with_xml": True, + "with_yaml": True + } + + def config_options(self): + if self.settings.os == "Emscripten": + del self.options.with_sfml + + def requirements(self): + self.requires("sol2/3.5.0") # may need to pull custom version + self.requires("fmt/[>=11.0]") + self.requires("observable_unique_ptr/0.7.2") + self.requires("magic_enum/[>=0.9]") + self.requires("utfcpp/[>=3.1]", transitive_headers=False) + + if self.options.with_xml: + self.requires("pugixml/[>=1.10]", transitive_headers=False) + if self.options.with_yaml: + self.requires("rapidyaml/[~0.8]", transitive_headers=False) + if self.settings.os != "Emscripten" and self.options.with_sfml: + self.requires("sfml/[>=2.5 <3]") # Could be transitive_headers=False with little effort + if self.options.with_opengl: + if self.settings.os != "Emscripten": + self.requires("opengl/system", transitive_headers=False) + self.requires("glew/[>=2.2]", transitive_headers=False) + self.requires("libpng/[>=1.6]", transitive_headers=False) + self.requires("zlib/[>=1.2]", transitive_headers=False) + self.requires("freetype/[>=2.10]") # Could be transitive_headers=False with little effort + if self.options.with_sdl: + if self.settings.os != "Emscripten": + self.requires("sdl/[>=2 <3]", force=True, transitive_headers=False) + self.requires("sdl_ttf/[>=2 <3]", transitive_headers=False) + self.requires("sdl_image/[>=2 <3]", transitive_headers=False) + + self.requires("flac/1.4.3", override=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.31]") diff --git a/dependencies/LuaCMakeLists.txt b/dependencies/LuaCMakeLists.txt deleted file mode 100644 index c23b496f89..0000000000 --- a/dependencies/LuaCMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -project ( lua C ) -cmake_minimum_required ( VERSION 2.8 ) - -include_directories ( src ${CMAKE_CURRENT_BINARY_DIR} ) -set ( SRC_CORE src/lapi.c src/lcode.c src/lctype.c src/ldebug.c src/ldo.c src/ldump.c src/lfunc.c src/lgc.c src/llex.c - src/lmem.c src/lobject.c src/lopcodes.c src/lparser.c src/lstate.c src/lstring.c src/ltable.c - src/ltm.c src/lundump.c src/lvm.c src/lzio.c ) -set ( SRC_LIB src/lauxlib.c src/lbaselib.c src/lbitlib.c src/lcorolib.c src/ldblib.c src/liolib.c - src/lmathlib.c src/loslib.c src/lstrlib.c src/ltablib.c src/lutf8lib.c src/loadlib.c src/linit.c ) - -add_library ( libluadll SHARED ${SRC_CORE} ${SRC_LIB} ) -target_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL ) -set_target_properties ( libluadll PROPERTIES OUTPUT_NAME lua53 ) diff --git a/dependencies/LuaWASMCMakeLists.txt b/dependencies/LuaWASMCMakeLists.txt deleted file mode 100644 index 6771e9e716..0000000000 --- a/dependencies/LuaWASMCMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -project ( lua C ) -cmake_minimum_required ( VERSION 2.8 ) - -include_directories ( src ${CMAKE_CURRENT_BINARY_DIR} ) - -add_library ( liblua lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c - lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c - ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c - lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c ) -set_target_properties ( liblua PROPERTIES OUTPUT_NAME lua ) diff --git a/dependencies/README.md b/dependencies/README.md deleted file mode 100644 index 6cb817b22c..0000000000 --- a/dependencies/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Windows dependencies - -See `get-windows-dependencies.sh`. This is not a fully automated script, and more of an outline. All the dependencies which must be compiled should be done manually (cmake ..; then open Visual Studio solution, select Release configuration, and build). - - -# WebAssembly - -Clone the lua repository, checkout version 5.3.x, copy the `LuaWASMCMakeLists.txt` in the lua repository, rename it to `CMakeLists.txt`. Then - -``` -mkdir build -cd build -emcmake cmake .. -emmake make -``` diff --git a/dependencies/WindowsBuild15.bat b/dependencies/WindowsBuild15.bat deleted file mode 100644 index e3bc34e7c5..0000000000 --- a/dependencies/WindowsBuild15.bat +++ /dev/null @@ -1,4 +0,0 @@ -echo off -call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" - -nmake diff --git a/dependencies/WindowsSetup15.bat b/dependencies/WindowsSetup15.bat deleted file mode 100644 index d4fe8df515..0000000000 --- a/dependencies/WindowsSetup15.bat +++ /dev/null @@ -1,4 +0,0 @@ -echo off -call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" - -cmake -G"NMake Makefiles" .. diff --git a/dependencies/get-windows-dependencies.sh b/dependencies/get-windows-dependencies.sh deleted file mode 100755 index 39e5521191..0000000000 --- a/dependencies/get-windows-dependencies.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash - -set -e - -# Define which Visual Studio version and which CPU architecture -VS_VERSION=15 # 2017 -ARCH=32 - -# Automatic setup of architecture variables -if [ ${ARCH} == "64" ]; then XARCH=x64; else XARCH=Win32; fi -if [ ${ARCH} == "64" ]; then XARCH2=x64; else XARCH2=x86; fi - -# Setup folders -mkdir -p include -mkdir -p lib -mkdir -p bin - -SCRIPT_ROOT_DIR=`pwd` - -# libpng (need to build from source) -PNG_VERSION=1.6.37 -PNG_VERSION_SHORT=${PNG_VERSION//./} -PNG_WEBSITE=https://download.sourceforge.net/libpng/ -PNG_DL_FILE=lpng${PNG_VERSION_SHORT}.zip -wget ${PNG_WEBSITE}${PNG_DL_FILE} -unzip ${PNG_DL_FILE} -PNG_DIR=lpng${PNG_VERSION_SHORT} -mkdir -p ${PNG_DIR}/build -cp WindowsSetup${VS_VERSION}.bat ${PNG_DIR}/build/Setup.bat -cp WindowsBuild${VS_VERSION}.bat ${PNG_DIR}/build/Build.bat -cd ${PNG_DIR}/build -cmd.exe /C "Setup.bat" -cmd.exe /C "Build.bat" -cd ../../ -mv ${PNG_DIR}/*.h include/ -mv ${PNG_DIR}/build/Release/libpng*.lib lib/ -mv ${PNG_DIR}/build/Release/libpng*.dll bin/ -rm -rf ${PNG_DIR} - -# zlib (need to build from source) -ZLIB_VERSION=1.2.11 -ZLIB_VERSION_SHORT=${ZLIB_VERSION//./} -ZLIB_WEBSITE=https://www.zlib.net/ -ZLIB_DL_FILE=zlib${ZLIB_VERSION_SHORT}.zip -wget ${ZLIB_WEBSITE}${ZLIB_DL_FILE} -unzip ${ZLIB_DL_FILE} -ZLIB_DIR=zlib-${ZLIB_VERSION} -mkdir -p ${ZLIB_DIR}/build -cp WindowsSetup${VS_VERSION}.bat ${ZLIB_DIR}/build/Setup.bat -cp WindowsBuild${VS_VERSION}.bat ${ZLIB_DIR}/build/Build.bat -cd ${ZLIB_DIR}/build -cmd.exe /C "Setup.bat" -cmd.exe /C "Build.bat" -cd ../../ -mv ${ZLIB_DIR}/*.h include/ -mv ${ZLIB_DIR}/build/*.h include/ # for zconf.h -mv ${ZLIB_DIR}/build/Release/zlib.lib lib/ -mv ${ZLIB_DIR}/build/Release/zlib.dll bin/ -rm -rf ${ZLIB_DIR} - -# SFML -SFML_VERSION=2.5.1 -SFML_WEBISTE=https://www.sfml-dev.org/files/ -SFML_DL_FILE=SFML-${SFML_VERSION}-windows-vc${VS_VERSION}-${ARCH}-bit.zip -wget "${SFML_WEBISTE}${SFML_DL_FILE}" -unzip -o ${SFML_DL_FILE} -SFML_DIR="SFML-${SFML_VERSION}" -mv ${SFML_DIR}/include/* include/ -mv ${SFML_DIR}/lib/* lib/ -mv ${SFML_DIR}/bin/* bin/ -rm ${SFML_DL_FILE} -rm -rf ${SFML_DIR} - -# Freetype -git clone https://github.com/ubawurinna/freetype-windows-binaries.git -mv freetype-windows-binaries/include/* include/ -mv "freetype-windows-binaries/release dll/win${ARCH}"/*.lib lib/ -mv "freetype-windows-binaries/release dll/win${ARCH}"/*.dll bin/ -rm -rf freetype-windows-binaries - -# GLEW -GLEW_VERSION=2.1.0 -GLEW_WEBSITE=https://github.com/nigels-com/glew/releases/download/ -GLEW_DL_FILE=glew-${GLEW_VERSION}-win32.zip -wget "${GLEW_WEBSITE}glew-${GLEW_VERSION}/${GLEW_DL_FILE}" -unzip ${GLEW_DL_FILE} -GLEW_DIR=glew-${GLEW_VERSION} -mv ${GLEW_DIR}/include/* include/ -mv ${GLEW_DIR}/lib/Release/${XARCH}/* lib/ -mv ${GLEW_DIR}/bin/Release/${XARCH}/*.dll bin/ -rm -rf ${GLEW_DIR} - -# Lua (need to build from source) -LUA_VERSION=5.3.0 -LUA_WEBSITE=http://www.lua.org/ftp/ -LUA_DL_FILE=lua-${LUA_VERSION}.tar.gz -wget ${LUA_WEBSITE}${LUA_DL_FILE} -tar -xvzf ${LUA_DL_FILE} -LUA_DIR=lua-${LUA_VERSION} -mkdir -p ${LUA_DIR}/build -cp LuaCMakeLists.txt ${LUA_DIR}/CMakeLists.txt -cp WindowsSetup${VS_VERSION}.bat ${LUA_DIR}/build/Setup.bat -cp WindowsBuild${VS_VERSION}.bat ${LUA_DIR}/build/Build.bat -cd ${LUA_DIR}/build -cmd.exe /C "Setup.bat" -cmd.exe /C "Build.bat" -cd ../../ -mv ${LUA_DIR}/src/*.h ${LUA_DIR}/src/*.hpp include/ -mv ${LUA_DIR}/build/*.lib lib/ -mv ${LUA_DIR}/build/*.dll bin/ -rm -rf ${LUA_DIR} diff --git a/dependencies/wasm.zip b/dependencies/wasm.zip deleted file mode 100644 index 87e1471698..0000000000 Binary files a/dependencies/wasm.zip and /dev/null differ diff --git a/dependencies/windows-dependencies-vs2019-32.zip b/dependencies/windows-dependencies-vs2019-32.zip deleted file mode 100644 index a82c0119c6..0000000000 Binary files a/dependencies/windows-dependencies-vs2019-32.zip and /dev/null differ diff --git a/dependencies/windows-dependencies-vs2019-64.zip b/dependencies/windows-dependencies-vs2019-64.zip deleted file mode 100644 index e817666662..0000000000 Binary files a/dependencies/windows-dependencies-vs2019-64.zip and /dev/null differ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4d78636da3..76d576eb96 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) project(lxgui-examples LANGUAGES CXX VERSION 2.0) diff --git a/examples/opengl-sdl-emscripten/CMakeLists.txt b/examples/opengl-sdl-emscripten/CMakeLists.txt index 519d655c81..31ce1a7246 100644 --- a/examples/opengl-sdl-emscripten/CMakeLists.txt +++ b/examples/opengl-sdl-emscripten/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) # Start new project project(lxgui-test-opengl-sdl-emscripten LANGUAGES CXX VERSION 2.0) -# Add the directory containing Findlxgui.cmake to the model path -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake" ${CMAKE_MODULE_PATH}) - -# Find lxgui and dependencies -find_package(lxgui 2) +if(NOT TARGET lxgui::lxgui) + # Find lxgui and dependencies + find_package(lxgui 2) +endif() # Set output directory to ../bin set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin) diff --git a/examples/opengl-sdl/CMakeLists.txt b/examples/opengl-sdl/CMakeLists.txt index dc756bf3e2..14eb8eb019 100644 --- a/examples/opengl-sdl/CMakeLists.txt +++ b/examples/opengl-sdl/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) # Start new project project(lxgui-test-opengl-sdl LANGUAGES CXX VERSION 2.0) -# Add the directory containing Findlxgui.cmake to the model path -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake" ${CMAKE_MODULE_PATH}) - -# Find lxgui and dependencies -find_package(lxgui 2) +if(NOT TARGET lxgui::lxgui) + # Find lxgui and dependencies + find_package(lxgui 2) +endif() # Set output directory to ../bin set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin) diff --git a/examples/opengl-sfml/CMakeLists.txt b/examples/opengl-sfml/CMakeLists.txt index 3296e57b52..5fb6193870 100644 --- a/examples/opengl-sfml/CMakeLists.txt +++ b/examples/opengl-sfml/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) # Start new project project(lxgui-test-opengl-sfml LANGUAGES CXX VERSION 2.0) -# Add the directory containing Findlxgui.cmake to the model path -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake" ${CMAKE_MODULE_PATH}) - -# Find lxgui and dependencies -find_package(lxgui 2) +if(NOT TARGET lxgui::lxgui) + # Find lxgui and dependencies + find_package(lxgui 2) +endif() # Set output directory to ../bin set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin) diff --git a/examples/sdl-emscripten/CMakeLists.txt b/examples/sdl-emscripten/CMakeLists.txt index ab8ee4d10f..7210e860b4 100644 --- a/examples/sdl-emscripten/CMakeLists.txt +++ b/examples/sdl-emscripten/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) # Start new project project(lxgui-test-sdl-emscripten LANGUAGES CXX VERSION 2.0) -# Add the directory containing Findlxgui.cmake to the model path -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake" ${CMAKE_MODULE_PATH}) - -# Find lxgui and dependencies -find_package(lxgui 2) +if(NOT TARGET lxgui::lxgui) + # Find lxgui and dependencies + find_package(lxgui 2) +endif() # Set output directory to ../bin set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin) diff --git a/examples/sdl/CMakeLists.txt b/examples/sdl/CMakeLists.txt index 6e93e1bc3b..076372175d 100644 --- a/examples/sdl/CMakeLists.txt +++ b/examples/sdl/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) # Start new project project(lxgui-test-sdl LANGUAGES CXX VERSION 2.0) -# Add the directory containing Findlxgui.cmake to the model path -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake" ${CMAKE_MODULE_PATH}) - -# Find lxgui and dependencies -find_package(lxgui 2) +if(NOT TARGET lxgui::lxgui) + # Find lxgui and dependencies + find_package(lxgui 2) +endif() # Set output directory to ../bin set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin) diff --git a/examples/sfml/CMakeLists.txt b/examples/sfml/CMakeLists.txt index 88345f337a..ed0353391d 100644 --- a/examples/sfml/CMakeLists.txt +++ b/examples/sfml/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14..3.31) # Start new project project(lxgui-test-sfml LANGUAGES CXX VERSION 2.0) -# Add the directory containing Findlxgui.cmake to the model path -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake" ${CMAKE_MODULE_PATH}) - -# Find lxgui and dependencies -find_package(lxgui 2) +if(NOT TARGET lxgui::lxgui) + # Find lxgui and dependencies + find_package(lxgui 2) +endif() # Set output directory to ../bin set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin) diff --git a/extern/fmt b/extern/fmt deleted file mode 160000 index d141cdbeb0..0000000000 --- a/extern/fmt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d141cdbeb0fb422a3fb7173b285fd38e0d1772dc diff --git a/extern/magic_enum b/extern/magic_enum deleted file mode 160000 index c9388f1c99..0000000000 --- a/extern/magic_enum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c9388f1c99f1867bb9b1d6c813156d599ee00438 diff --git a/extern/observable_unique_ptr b/extern/observable_unique_ptr deleted file mode 160000 index c82b3cd5e5..0000000000 --- a/extern/observable_unique_ptr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c82b3cd5e5dd88905fc1e91b2d4afc0114e71f1b diff --git a/extern/pugixml b/extern/pugixml deleted file mode 160000 index dd50fa5b45..0000000000 --- a/extern/pugixml +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dd50fa5b45ab8d58d6c27566c2eaf04a8b7e5841 diff --git a/extern/rapidyaml b/extern/rapidyaml deleted file mode 160000 index efc8b0e420..0000000000 --- a/extern/rapidyaml +++ /dev/null @@ -1 +0,0 @@ -Subproject commit efc8b0e420cc0d198df8bea191db279fec2dfb41 diff --git a/extern/sol2 b/extern/sol2 deleted file mode 160000 index dab66ab6aa..0000000000 --- a/extern/sol2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dab66ab6aa3fca289e2e372e7150bccdabe826a2 diff --git a/extern/utfcpp b/extern/utfcpp deleted file mode 160000 index d8b92208fd..0000000000 --- a/extern/utfcpp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d8b92208fddde08d628004563a1a3614a32cf8c8 diff --git a/impl/gui/gl/CMakeLists.txt b/impl/gui/gl/CMakeLists.txt index 516da36d33..7709c3e003 100644 --- a/impl/gui/gl/CMakeLists.txt +++ b/impl/gui/gl/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_DIR ${PROJECT_SOURCE_DIR}/impl/gui/gl) set(SRCROOT ${TARGET_DIR}/src) -add_library(lxgui-gl +add_library(lxgui-gui-gl ${SRCROOT}/gui_gl_atlas.cpp ${SRCROOT}/gui_gl_font.cpp ${SRCROOT}/gui_gl_renderer.cpp @@ -12,30 +12,34 @@ add_library(lxgui-gl ${SRCROOT}/gui_gl_vertex_cache.cpp ) -add_library(lxgui::gui::gl ALIAS lxgui-gl) +add_library(lxgui::gui::gl ALIAS lxgui-gui-gl) +set_target_properties(lxgui-gui-gl PROPERTIES EXPORT_NAME gui::gl) # need C++17 -target_compile_features(lxgui-gl PRIVATE cxx_std_17) -lxgui_set_warning_level(lxgui-gl) -target_include_directories(lxgui-gl PUBLIC +target_compile_features(lxgui-gui-gl PRIVATE cxx_std_17) +lxgui_set_warning_level(lxgui-gui-gl) +target_include_directories(lxgui-gui-gl PUBLIC $ $) # needed dependencies -target_link_libraries(lxgui-gl PUBLIC lxgui::lxgui) -target_link_libraries(lxgui-gl PRIVATE Freetype::Freetype) +target_link_libraries(lxgui-gui-gl PUBLIC lxgui::lxgui) if (NOT LXGUI_COMPILER_EMSCRIPTEN) - target_link_libraries(lxgui-gl PUBLIC OpenGL::GL) - target_link_libraries(lxgui-gl PRIVATE PNG::PNG) - target_link_libraries(lxgui-gl PRIVATE GLEW::GLEW) + target_link_libraries(lxgui-gui-gl PUBLIC OpenGL::GL) + target_link_libraries(lxgui-gui-gl PRIVATE Freetype::Freetype) + target_link_libraries(lxgui-gui-gl PRIVATE PNG::PNG) + target_link_libraries(lxgui-gui-gl PRIVATE GLEW::GLEW) else() - target_compile_options(lxgui-gl PUBLIC "SHELL:-s USE_LIBPNG=1") - target_link_options(lxgui-gl PUBLIC "SHELL:-s USE_LIBPNG=1") - target_link_options(lxgui-gl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=2") + target_compile_options(lxgui-gui-gl PUBLIC "SHELL:-s USE_LIBPNG=1") + target_compile_options(lxgui-gui-gl PUBLIC "SHELL:-s USE_FREETYPE=1") + target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s USE_LIBPNG=1") + target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s USE_FREETYPE=1") + target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=2") + target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s MAX_WEBGL_VERSION=2") endif() file(GLOB files ${PROJECT_SOURCE_DIR}/include/lxgui/impl/gui_gl*.hpp) install(FILES ${files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lxgui/impl) -list(APPEND LXGUI_INSTALL_TARGETS lxgui-gl) +list(APPEND LXGUI_INSTALL_TARGETS lxgui-gui-gl) set(LXGUI_INSTALL_TARGETS ${LXGUI_INSTALL_TARGETS} PARENT_SCOPE) diff --git a/impl/gui/gl/src/gui_gl_renderer.cpp b/impl/gui/gl/src/gui_gl_renderer.cpp index 1efa48a4f5..91bd25a3ba 100644 --- a/impl/gui/gl/src/gui_gl_renderer.cpp +++ b/impl/gui/gl/src/gui_gl_renderer.cpp @@ -53,7 +53,12 @@ renderer::renderer(const vector2ui& window_dimensions, bool init_glew [[maybe_un } std::string renderer::get_name() const { - std::string full_version = reinterpret_cast(glGetString(GL_VERSION)); + const char* gl_version = reinterpret_cast(glGetString(GL_VERSION)); + if (gl_version == nullptr) { + throw gui::exception("Cannot get OpenGL version; check that an OpenGL context exists"); + } + + std::string full_version = gl_version; #if defined(LXGUI_OPENGL3) # if defined(LXGUI_COMPILER_EMSCRIPTEN) return "WebGL (" + full_version + ")"; @@ -332,15 +337,15 @@ GLuint create_shader(GLenum type, const char* shader_source) { glCompileShader(shader); // Check sucess - GLint compiled = 0; + GLint compiled = GL_FALSE; glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); - if (compiled == 0) { + if (compiled == GL_FALSE) { GLint info_length = 0; - glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &info_length); + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_length); std::vector error_message(std::max(1, info_length), '\0'); if (info_length > 1) { - glGetProgramInfoLog(shader, info_length, NULL, error_message.data()); + glGetShaderInfoLog(shader, info_length, NULL, error_message.data()); } glDeleteShader(shader); diff --git a/impl/gui/gl/src/gui_gl_renderer_png.cpp b/impl/gui/gl/src/gui_gl_renderer_png.cpp index 1295cf4c88..4df40b6edf 100644 --- a/impl/gui/gl/src/gui_gl_renderer_png.cpp +++ b/impl/gui/gl/src/gui_gl_renderer_png.cpp @@ -34,7 +34,7 @@ renderer::create_material_png_(const std::string& file_name, material::filter fi if (!file.good() || png_sig_cmp(signature, 0, pngsigsize) != 0) { throw gui::exception( "gui::gl::manager", file_name + "' is not a valid PNG image: '" + - std::string(signature, signature + pngsigsize) + "'."); + std::string(std::begin(signature), std::end(signature)) + "'."); } png_structp read_struct = nullptr; @@ -81,7 +81,7 @@ renderer::create_material_png_(const std::string& file_name, material::filter fi std::vector rows(height); for (std::size_t i = 0; i < height; ++i) - rows[i] = reinterpret_cast(data.data() + i * width); + rows[i] = reinterpret_cast(&data[i * width]); png_read_image(read_struct, rows.data()); diff --git a/impl/gui/sdl/CMakeLists.txt b/impl/gui/sdl/CMakeLists.txt index 2493ab0782..0f145a5832 100644 --- a/impl/gui/sdl/CMakeLists.txt +++ b/impl/gui/sdl/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_DIR ${PROJECT_SOURCE_DIR}/impl/gui/sdl) set(SRCROOT ${TARGET_DIR}/src) -add_library(lxgui-sdl +add_library(lxgui-gui-sdl ${SRCROOT}/gui_sdl.cpp ${SRCROOT}/gui_sdl_atlas.cpp ${SRCROOT}/gui_sdl_font.cpp @@ -10,35 +10,37 @@ add_library(lxgui-sdl ${SRCROOT}/gui_sdl_render_target.cpp ) -add_library(lxgui::gui::sdl ALIAS lxgui-sdl) +add_library(lxgui::gui::sdl ALIAS lxgui-gui-sdl) +set_target_properties(lxgui-gui-sdl PROPERTIES EXPORT_NAME gui::sdl) # need C++17 -target_compile_features(lxgui-sdl PRIVATE cxx_std_17) -lxgui_set_warning_level(lxgui-sdl) -target_include_directories(lxgui-sdl PUBLIC +target_compile_features(lxgui-gui-sdl PRIVATE cxx_std_17) +lxgui_set_warning_level(lxgui-gui-sdl) +target_include_directories(lxgui-gui-sdl PUBLIC $ $) # needed dependencies -target_link_libraries(lxgui-sdl PUBLIC lxgui::lxgui) +target_link_libraries(lxgui-gui-sdl PUBLIC lxgui::lxgui) if (NOT LXGUI_COMPILER_EMSCRIPTEN) - target_link_libraries(lxgui-sdl PUBLIC SDL2::SDL2) - target_link_libraries(lxgui-sdl PRIVATE SDL2::image) - target_link_libraries(lxgui-sdl PRIVATE SDL2::TTF) + target_link_libraries(lxgui-gui-sdl PUBLIC SDL2::SDL2) + target_link_libraries(lxgui-gui-sdl PRIVATE SDL2_image::SDL2_image) + target_link_libraries(lxgui-gui-sdl PRIVATE SDL2_ttf::SDL2_ttf-static) else() - target_compile_options(lxgui-sdl PUBLIC "SHELL:-s USE_SDL=2") - target_compile_options(lxgui-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2") - target_compile_options(lxgui-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_compile_options(lxgui-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2") - target_link_options(lxgui-sdl PUBLIC "SHELL:-s USE_SDL=2") - target_link_options(lxgui-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2") - target_link_options(lxgui-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_link_options(lxgui-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2") - target_link_options(lxgui-sdl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=1") + target_compile_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL=2") + target_compile_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2") + target_compile_options(lxgui-gui-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") + target_compile_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2") + target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL=2") + target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2") + target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") + target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2") + target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=1") + target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s MAX_WEBGL_VERSION=2") endif() file(GLOB files ${PROJECT_SOURCE_DIR}/include/lxgui/impl/gui_sdl*.hpp) install(FILES ${files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lxgui/impl) -list(APPEND LXGUI_INSTALL_TARGETS lxgui-sdl) +list(APPEND LXGUI_INSTALL_TARGETS lxgui-gui-sdl) set(LXGUI_INSTALL_TARGETS ${LXGUI_INSTALL_TARGETS} PARENT_SCOPE) diff --git a/impl/gui/sdl/src/gui_sdl_font.cpp b/impl/gui/sdl/src/gui_sdl_font.cpp index 4b7f5d40ba..9016c28f85 100644 --- a/impl/gui/sdl/src/gui_sdl_font.cpp +++ b/impl/gui/sdl/src/gui_sdl_font.cpp @@ -190,10 +190,13 @@ font::font( if (pre_multiplied_alpha_supported) { const std::size_t area = canvas_dimensions.x * canvas_dimensions.y; for (std::size_t i = 0; i < area; ++i) { - float a = texture_pixels[i].a / 255.0f; - texture_pixels[i].r *= a; - texture_pixels[i].g *= a; - texture_pixels[i].b *= a; + float a = static_cast(texture_pixels[i].a) / 255.0f; + texture_pixels[i].r = + static_cast(static_cast(texture_pixels[i].r) * a); + texture_pixels[i].g = + static_cast(static_cast(texture_pixels[i].g) * a); + texture_pixels[i].b = + static_cast(static_cast(texture_pixels[i].b) * a); } } diff --git a/impl/gui/sdl/src/gui_sdl_material.cpp b/impl/gui/sdl/src/gui_sdl_material.cpp index f86d8dff15..5c0e2302b8 100644 --- a/impl/gui/sdl/src/gui_sdl_material.cpp +++ b/impl/gui/sdl/src/gui_sdl_material.cpp @@ -189,10 +189,10 @@ void material::premultiply_alpha(SDL_Surface* surface) { const std::size_t area = surface->w * surface->h; for (std::size_t i = 0; i < area; ++i) { - float a = pixel_data[i].a / 255.0f; - pixel_data[i].r *= a; - pixel_data[i].g *= a; - pixel_data[i].b *= a; + float a = static_cast(pixel_data[i].a) / 255.0f; + pixel_data[i].r = static_cast(static_cast(pixel_data[i].r) * a); + pixel_data[i].g = static_cast(static_cast(pixel_data[i].g) * a); + pixel_data[i].b = static_cast(static_cast(pixel_data[i].b) * a); } } diff --git a/impl/gui/sdl/src/gui_sdl_render_target.cpp b/impl/gui/sdl/src/gui_sdl_render_target.cpp index 332a3f79fe..c487a2a5c1 100644 --- a/impl/gui/sdl/src/gui_sdl_render_target.cpp +++ b/impl/gui/sdl/src/gui_sdl_render_target.cpp @@ -5,6 +5,7 @@ #include #include +#include #include namespace lxgui::gui::sdl { @@ -58,11 +59,14 @@ void render_target::save_to_file(std::string filename) const { const std::size_t area = surface->w * surface->h; for (std::size_t i = 0; i < area; ++i) { - float a = pixel_data[i].a / 255.0f; + float a = static_cast(pixel_data[i].a) / 255.0f; if (a > 0.0f) { - pixel_data[i].r /= a; - pixel_data[i].g /= a; - pixel_data[i].b /= a; + pixel_data[i].r = static_cast( + std::clamp(static_cast(pixel_data[i].r) / a, 0.0f, 255.0f)); + pixel_data[i].g = static_cast( + std::clamp(static_cast(pixel_data[i].g) / a, 0.0f, 255.0f)); + pixel_data[i].b = static_cast( + std::clamp(static_cast(pixel_data[i].b) / a, 0.0f, 255.0f)); } } diff --git a/impl/gui/sfml/CMakeLists.txt b/impl/gui/sfml/CMakeLists.txt index 595fd2b621..b66d2ca79a 100644 --- a/impl/gui/sfml/CMakeLists.txt +++ b/impl/gui/sfml/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_DIR ${PROJECT_SOURCE_DIR}/impl/gui/sfml) set(SRCROOT ${TARGET_DIR}/src) -add_library(lxgui-sfml +add_library(lxgui-gui-sfml ${SRCROOT}/gui_sfml.cpp ${SRCROOT}/gui_sfml_atlas.cpp ${SRCROOT}/gui_sfml_font.cpp @@ -11,22 +11,23 @@ add_library(lxgui-sfml ${SRCROOT}/gui_sfml_vertex_cache.cpp ) -add_library(lxgui::gui::sfml ALIAS lxgui-sfml) +add_library(lxgui::gui::sfml ALIAS lxgui-gui-sfml) +set_target_properties(lxgui-gui-sfml PROPERTIES EXPORT_NAME gui::sfml) # need C++17 -target_compile_features(lxgui-sfml PRIVATE cxx_std_17) -lxgui_set_warning_level(lxgui-sfml) -target_include_directories(lxgui-sfml PUBLIC +target_compile_features(lxgui-gui-sfml PRIVATE cxx_std_17) +lxgui_set_warning_level(lxgui-gui-sfml) +target_include_directories(lxgui-gui-sfml PUBLIC $ $) # needed dependencies -target_link_libraries(lxgui-sfml PUBLIC lxgui::lxgui) -target_link_libraries(lxgui-sfml PUBLIC sfml::graphics) +target_link_libraries(lxgui-gui-sfml PUBLIC lxgui::lxgui) +target_link_libraries(lxgui-gui-sfml PUBLIC sfml-graphics) file(GLOB files ${PROJECT_SOURCE_DIR}/include/lxgui/impl/gui_sfml*.hpp) install(FILES ${files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lxgui/impl) -list(APPEND LXGUI_INSTALL_TARGETS lxgui-sfml) +list(APPEND LXGUI_INSTALL_TARGETS lxgui-gui-sfml) set(LXGUI_INSTALL_TARGETS ${LXGUI_INSTALL_TARGETS} PARENT_SCOPE) diff --git a/impl/input/sdl/CMakeLists.txt b/impl/input/sdl/CMakeLists.txt index 0628f043de..569c129c10 100644 --- a/impl/input/sdl/CMakeLists.txt +++ b/impl/input/sdl/CMakeLists.txt @@ -6,6 +6,7 @@ add_library(lxgui-input-sdl ) add_library(lxgui::input::sdl ALIAS lxgui-input-sdl) +set_target_properties(lxgui-input-sdl PROPERTIES EXPORT_NAME input::sdl) # need C++17 target_compile_features(lxgui-input-sdl PRIVATE cxx_std_17) @@ -18,17 +19,14 @@ target_include_directories(lxgui-input-sdl PUBLIC target_link_libraries(lxgui-input-sdl PUBLIC lxgui::lxgui) if (NOT LXGUI_COMPILER_EMSCRIPTEN) target_link_libraries(lxgui-input-sdl PUBLIC SDL2::SDL2) - target_link_libraries(lxgui-input-sdl PRIVATE SDL2::image) + target_link_libraries(lxgui-input-sdl PRIVATE SDL2_image::SDL2_image) else() target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL=2") target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2") target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2") target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL=2") target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2") target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'") - target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2") - target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=1") endif() install(FILES ${PROJECT_SOURCE_DIR}/include/lxgui/impl/input_sdl_source.hpp diff --git a/impl/input/sdl/src/input_sdl_source.cpp b/impl/input/sdl/src/input_sdl_source.cpp index 97dec45a7e..56b26d023e 100644 --- a/impl/input/sdl/src/input_sdl_source.cpp +++ b/impl/input/sdl/src/input_sdl_source.cpp @@ -320,6 +320,7 @@ void source::on_sdl_event(const SDL_Event& event) { } break; } + default: break; } } diff --git a/impl/input/sfml/CMakeLists.txt b/impl/input/sfml/CMakeLists.txt index 1bb8357be0..ecf2d25f4d 100644 --- a/impl/input/sfml/CMakeLists.txt +++ b/impl/input/sfml/CMakeLists.txt @@ -6,6 +6,7 @@ add_library(lxgui-input-sfml ) add_library(lxgui::input::sfml ALIAS lxgui-input-sfml) +set_target_properties(lxgui-input-sfml PROPERTIES EXPORT_NAME input::sfml) # need C++17 target_compile_features(lxgui-input-sfml PRIVATE cxx_std_17) @@ -16,7 +17,7 @@ target_include_directories(lxgui-input-sfml PUBLIC # needed dependencies target_link_libraries(lxgui-input-sfml PUBLIC lxgui::lxgui) -target_link_libraries(lxgui-input-sfml PUBLIC sfml::graphics) +target_link_libraries(lxgui-input-sfml PUBLIC sfml-graphics) install(FILES ${PROJECT_SOURCE_DIR}/include/lxgui/impl/input_sfml_source.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lxgui/impl) diff --git a/include/lxgui/gui_color.hpp b/include/lxgui/gui_color.hpp index e2802f4dd0..1de57218b4 100644 --- a/include/lxgui/gui_color.hpp +++ b/include/lxgui/gui_color.hpp @@ -3,6 +3,7 @@ #include "lxgui/lxgui.hpp" +#include #include #include diff --git a/include/lxgui/gui_frame.hpp b/include/lxgui/gui_frame.hpp index 55931512c7..2ec20ba1ac 100644 --- a/include/lxgui/gui_frame.hpp +++ b/include/lxgui/gui_frame.hpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/lxgui/gui_frame_renderer.hpp b/include/lxgui/gui_frame_renderer.hpp index b2c8ea43dd..4a20219203 100644 --- a/include/lxgui/gui_frame_renderer.hpp +++ b/include/lxgui/gui_frame_renderer.hpp @@ -8,7 +8,7 @@ #include "lxgui/utils_sorted_vector.hpp" #include -#include +#include namespace lxgui::gui { @@ -26,10 +26,10 @@ class frame_renderer { virtual ~frame_renderer() = default; // Non-copiable, non-movable - frame_renderer(const frame_renderer&) = delete; - frame_renderer(frame_renderer&&) = delete; + frame_renderer(const frame_renderer&) = delete; + frame_renderer(frame_renderer&&) = delete; frame_renderer& operator=(const frame_renderer&) = delete; - frame_renderer& operator=(frame_renderer&&) = delete; + frame_renderer& operator=(frame_renderer&&) = delete; /// Tells this renderer that one of its region requires redraw. virtual void notify_strata_needs_redraw(strata strata_id); diff --git a/include/lxgui/gui_region.hpp b/include/lxgui/gui_region.hpp index 34e169c197..214e5ba793 100644 --- a/include/lxgui/gui_region.hpp +++ b/include/lxgui/gui_region.hpp @@ -857,7 +857,7 @@ const ObjectType* down_cast(const region* self) { template const ObjectType& down_cast(const region& self) { const ObjectType* object = dynamic_cast(self); - if (self && !object) { + if (!object) { if (self.is_region_type(ObjectType::class_name)) { throw gui::exception( self.get_region_type(), "cannot use down_cast() to " + diff --git a/include/lxgui/gui_region_tpl.hpp b/include/lxgui/gui_region_tpl.hpp index 43441d7ef1..26a663741e 100644 --- a/include/lxgui/gui_region_tpl.hpp +++ b/include/lxgui/gui_region_tpl.hpp @@ -151,8 +151,8 @@ const std::vector& region::get_type_list_impl_() { return type; } else { static const std::vector type = []() { - using base = typename T::base; - auto list = get_type_list_impl_(); + using child_base = typename T::base; + auto list = get_type_list_impl_(); list.push_back(T::class_name); return list; }(); diff --git a/include/lxgui/gui_vector2.hpp b/include/lxgui/gui_vector2.hpp index d61b48b841..eec23e286c 100644 --- a/include/lxgui/gui_vector2.hpp +++ b/include/lxgui/gui_vector2.hpp @@ -66,7 +66,8 @@ struct vector2 { vector2 get_scaled(const vector2& v) const noexcept { vector2 vec = *this; - vec.scale(v); + vec.x *= v.x; + vec.y *= v.y; return vec; } diff --git a/include/lxgui/impl/gui_gl_atlas.hpp b/include/lxgui/impl/gui_gl_atlas.hpp index aaf0db7b34..90822d723d 100644 --- a/include/lxgui/impl/gui_gl_atlas.hpp +++ b/include/lxgui/impl/gui_gl_atlas.hpp @@ -5,6 +5,7 @@ #include "lxgui/gui_material.hpp" #include "lxgui/utils.hpp" +#include #include #include @@ -71,10 +72,10 @@ class atlas final : public gui::atlas { */ explicit atlas(renderer& rdr, material::filter filt); - atlas(const atlas& tex) = delete; - atlas(atlas&& tex) = delete; + atlas(const atlas& tex) = delete; + atlas(atlas&& tex) = delete; atlas& operator=(const atlas& tex) = delete; - atlas& operator=(atlas&& tex) = delete; + atlas& operator=(atlas&& tex) = delete; protected: /** diff --git a/include/lxgui/impl/gui_gl_material.hpp b/include/lxgui/impl/gui_gl_material.hpp index 0b5460956a..37567cc59e 100644 --- a/include/lxgui/impl/gui_gl_material.hpp +++ b/include/lxgui/impl/gui_gl_material.hpp @@ -6,6 +6,7 @@ #include "lxgui/gui_material.hpp" #include "lxgui/utils.hpp" +#include #include #include @@ -40,10 +41,10 @@ class material final : public gui::material { const bounds2f rect, filter filt = filter::none); - material(const material& tex) = delete; - material(material&& tex) = delete; + material(const material& tex) = delete; + material(material&& tex) = delete; material& operator=(const material& tex) = delete; - material& operator=(material&& tex) = delete; + material& operator=(material&& tex) = delete; /// Destructor. ~material() override; diff --git a/include/lxgui/impl/gui_gl_render_target.hpp b/include/lxgui/impl/gui_gl_render_target.hpp index e1637b815a..19e7712a11 100644 --- a/include/lxgui/impl/gui_gl_render_target.hpp +++ b/include/lxgui/impl/gui_gl_render_target.hpp @@ -6,6 +6,7 @@ #include "lxgui/impl/gui_gl_material.hpp" #include "lxgui/utils.hpp" +#include #include namespace lxgui::gui::gl { diff --git a/include/lxgui/impl/gui_gl_renderer.hpp b/include/lxgui/impl/gui_gl_renderer.hpp index 4da945e82e..5bac50246b 100644 --- a/include/lxgui/impl/gui_gl_renderer.hpp +++ b/include/lxgui/impl/gui_gl_renderer.hpp @@ -11,6 +11,7 @@ #include "lxgui/utils.hpp" #include +#include #include #include diff --git a/include/lxgui/impl/gui_gl_vertex_cache.hpp b/include/lxgui/impl/gui_gl_vertex_cache.hpp index e5890d7c1a..240f263558 100644 --- a/include/lxgui/impl/gui_gl_vertex_cache.hpp +++ b/include/lxgui/impl/gui_gl_vertex_cache.hpp @@ -4,6 +4,7 @@ #include "lxgui/gui_vertex_cache.hpp" #include "lxgui/utils.hpp" +#include #include #include diff --git a/include/lxgui/utils_string.hpp b/include/lxgui/utils_string.hpp index 14c42c604b..3a2eaf4928 100644 --- a/include/lxgui/utils_string.hpp +++ b/include/lxgui/utils_string.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/lxgui/utils_variant.hpp b/include/lxgui/utils_variant.hpp index 12ab006d48..7812838bc2 100644 --- a/include/lxgui/utils_variant.hpp +++ b/include/lxgui/utils_variant.hpp @@ -4,6 +4,7 @@ #include "lxgui/lxgui.hpp" #include "lxgui/utils.hpp" +#include #include #include #include diff --git a/lxgui.sublime-project b/lxgui.sublime-project index 14db281321..279b3d57b2 100644 --- a/lxgui.sublime-project +++ b/lxgui.sublime-project @@ -1,1104 +1,315 @@ { - "build_systems": - [ - { - "file_regex": "(.+[^:]):(\\d+):(\\d+): (?:fatal )?((?:error|warning): .+)$", - "name": "lxgui (Linux)", - "shell_cmd": "make -j12", - "syntax": "Packages/CMakeBuilder/Syntax/Make.sublime-syntax", - "variants": - [ - { - "name": "clean", - "shell_cmd": "make -j12 clean", - }, - { - "name": "install", - "shell_cmd": "make -j12 install", - }, - { - "name": "install/local", - "shell_cmd": "make -j12 install/local", - }, - { - "name": "install/strip", - "shell_cmd": "make -j12 install/strip", - }, - { - "name": "list_install_components", - "shell_cmd": "make -j12 list_install_components", - }, - { - "name": "rebuild_cache", - "shell_cmd": "make -j12 rebuild_cache", - }, - { - "name": "Continuous", - "shell_cmd": "make -j12 Continuous", - }, - { - "name": "ContinuousBuild", - "shell_cmd": "make -j12 ContinuousBuild", - }, - { - "name": "ContinuousConfigure", - "shell_cmd": "make -j12 ContinuousConfigure", - }, - { - "name": "ContinuousCoverage", - "shell_cmd": "make -j12 ContinuousCoverage", - }, - { - "name": "ContinuousMemCheck", - "shell_cmd": "make -j12 ContinuousMemCheck", - }, - { - "name": "ContinuousStart", - "shell_cmd": "make -j12 ContinuousStart", - }, - { - "name": "ContinuousSubmit", - "shell_cmd": "make -j12 ContinuousSubmit", - }, - { - "name": "ContinuousTest", - "shell_cmd": "make -j12 ContinuousTest", - }, - { - "name": "ContinuousUpdate", - "shell_cmd": "make -j12 ContinuousUpdate", - }, - { - "name": "Experimental", - "shell_cmd": "make -j12 Experimental", - }, - { - "name": "ExperimentalBuild", - "shell_cmd": "make -j12 ExperimentalBuild", - }, - { - "name": "ExperimentalConfigure", - "shell_cmd": "make -j12 ExperimentalConfigure", - }, - { - "name": "ExperimentalCoverage", - "shell_cmd": "make -j12 ExperimentalCoverage", - }, - { - "name": "ExperimentalMemCheck", - "shell_cmd": "make -j12 ExperimentalMemCheck", - }, - { - "name": "ExperimentalStart", - "shell_cmd": "make -j12 ExperimentalStart", - }, - { - "name": "ExperimentalSubmit", - "shell_cmd": "make -j12 ExperimentalSubmit", - }, - { - "name": "ExperimentalTest", - "shell_cmd": "make -j12 ExperimentalTest", - }, - { - "name": "ExperimentalUpdate", - "shell_cmd": "make -j12 ExperimentalUpdate", - }, - { - "name": "Nightly", - "shell_cmd": "make -j12 Nightly", - }, - { - "name": "NightlyBuild", - "shell_cmd": "make -j12 NightlyBuild", - }, - { - "name": "NightlyConfigure", - "shell_cmd": "make -j12 NightlyConfigure", - }, - { - "name": "NightlyCoverage", - "shell_cmd": "make -j12 NightlyCoverage", - }, - { - "name": "NightlyMemCheck", - "shell_cmd": "make -j12 NightlyMemCheck", - }, - { - "name": "NightlyMemoryCheck", - "shell_cmd": "make -j12 NightlyMemoryCheck", - }, - { - "name": "NightlyStart", - "shell_cmd": "make -j12 NightlyStart", - }, - { - "name": "NightlySubmit", - "shell_cmd": "make -j12 NightlySubmit", - }, - { - "name": "NightlyTest", - "shell_cmd": "make -j12 NightlyTest", - }, - { - "name": "NightlyUpdate", - "shell_cmd": "make -j12 NightlyUpdate", - }, - { - "name": "c4core-amalgamate", - "shell_cmd": "make -j12 c4core-amalgamate", - }, - { - "name": "ryml-uninstall", - "shell_cmd": "make -j12 ryml-uninstall", - }, - { - "name": "c4core", - "shell_cmd": "make -j12 c4core", - }, - { - "name": "fmt", - "shell_cmd": "make -j12 fmt", - }, - { - "name": "lxgui", - "shell_cmd": "make -j12 lxgui", - }, - { - "name": "lxgui-gl", - "shell_cmd": "make -j12 lxgui-gl", - }, - { - "name": "lxgui-input-sdl", - "shell_cmd": "make -j12 lxgui-input-sdl", - }, - { - "name": "lxgui-input-sfml", - "shell_cmd": "make -j12 lxgui-input-sfml", - }, - { - "name": "lxgui-sdl", - "shell_cmd": "make -j12 lxgui-sdl", - }, - { - "name": "lxgui-sfml", - "shell_cmd": "make -j12 lxgui-sfml", - }, - { - "name": "lxgui-test", - "shell_cmd": "make -j12 lxgui-test", - }, - { - "name": "lxgui-test-opengl-sdl", - "shell_cmd": "make -j12 lxgui-test-opengl-sdl", - }, - { - "name": "lxgui-test-opengl-sfml", - "shell_cmd": "make -j12 lxgui-test-opengl-sfml", - }, - { - "name": "lxgui-test-sdl", - "shell_cmd": "make -j12 lxgui-test-sdl", - }, - { - "name": "lxgui-test-sfml", - "shell_cmd": "make -j12 lxgui-test-sfml", - }, - { - "name": "pugixml-static", - "shell_cmd": "make -j12 pugixml-static", - }, - { - "name": "ryml", - "shell_cmd": "make -j12 ryml", - }, - { - "name": "src/gui_addon_registry.o", - "shell_cmd": "make -j12 src/gui_addon_registry.o", - }, - { - "name": "src/gui_addon_registry.i", - "shell_cmd": "make -j12 src/gui_addon_registry.i", - }, - { - "name": "src/gui_addon_registry.s", - "shell_cmd": "make -j12 src/gui_addon_registry.s", - }, - { - "name": "src/gui_addon_registry_parser.o", - "shell_cmd": "make -j12 src/gui_addon_registry_parser.o", - }, - { - "name": "src/gui_addon_registry_parser.i", - "shell_cmd": "make -j12 src/gui_addon_registry_parser.i", - }, - { - "name": "src/gui_addon_registry_parser.s", - "shell_cmd": "make -j12 src/gui_addon_registry_parser.s", - }, - { - "name": "src/gui_anchor.o", - "shell_cmd": "make -j12 src/gui_anchor.o", - }, - { - "name": "src/gui_anchor.i", - "shell_cmd": "make -j12 src/gui_anchor.i", - }, - { - "name": "src/gui_anchor.s", - "shell_cmd": "make -j12 src/gui_anchor.s", - }, - { - "name": "src/gui_atlas.o", - "shell_cmd": "make -j12 src/gui_atlas.o", - }, - { - "name": "src/gui_atlas.i", - "shell_cmd": "make -j12 src/gui_atlas.i", - }, - { - "name": "src/gui_atlas.s", - "shell_cmd": "make -j12 src/gui_atlas.s", - }, - { - "name": "src/gui_backdrop.o", - "shell_cmd": "make -j12 src/gui_backdrop.o", - }, - { - "name": "src/gui_backdrop.i", - "shell_cmd": "make -j12 src/gui_backdrop.i", - }, - { - "name": "src/gui_backdrop.s", - "shell_cmd": "make -j12 src/gui_backdrop.s", - }, - { - "name": "src/gui_button.o", - "shell_cmd": "make -j12 src/gui_button.o", - }, - { - "name": "src/gui_button.i", - "shell_cmd": "make -j12 src/gui_button.i", - }, - { - "name": "src/gui_button.s", - "shell_cmd": "make -j12 src/gui_button.s", - }, - { - "name": "src/gui_button_glues.o", - "shell_cmd": "make -j12 src/gui_button_glues.o", - }, - { - "name": "src/gui_button_glues.i", - "shell_cmd": "make -j12 src/gui_button_glues.i", - }, - { - "name": "src/gui_button_glues.s", - "shell_cmd": "make -j12 src/gui_button_glues.s", - }, - { - "name": "src/gui_button_parser.o", - "shell_cmd": "make -j12 src/gui_button_parser.o", - }, - { - "name": "src/gui_button_parser.i", - "shell_cmd": "make -j12 src/gui_button_parser.i", - }, - { - "name": "src/gui_button_parser.s", - "shell_cmd": "make -j12 src/gui_button_parser.s", - }, - { - "name": "src/gui_check_button.o", - "shell_cmd": "make -j12 src/gui_check_button.o", - }, - { - "name": "src/gui_check_button.i", - "shell_cmd": "make -j12 src/gui_check_button.i", - }, - { - "name": "src/gui_check_button.s", - "shell_cmd": "make -j12 src/gui_check_button.s", - }, - { - "name": "src/gui_check_button_glues.o", - "shell_cmd": "make -j12 src/gui_check_button_glues.o", - }, - { - "name": "src/gui_check_button_glues.i", - "shell_cmd": "make -j12 src/gui_check_button_glues.i", - }, - { - "name": "src/gui_check_button_glues.s", - "shell_cmd": "make -j12 src/gui_check_button_glues.s", - }, - { - "name": "src/gui_check_button_parser.o", - "shell_cmd": "make -j12 src/gui_check_button_parser.o", - }, - { - "name": "src/gui_check_button_parser.i", - "shell_cmd": "make -j12 src/gui_check_button_parser.i", - }, - { - "name": "src/gui_check_button_parser.s", - "shell_cmd": "make -j12 src/gui_check_button_parser.s", - }, - { - "name": "src/gui_color.o", - "shell_cmd": "make -j12 src/gui_color.o", - }, - { - "name": "src/gui_color.i", - "shell_cmd": "make -j12 src/gui_color.i", - }, - { - "name": "src/gui_color.s", - "shell_cmd": "make -j12 src/gui_color.s", - }, - { - "name": "src/gui_edit_box.o", - "shell_cmd": "make -j12 src/gui_edit_box.o", - }, - { - "name": "src/gui_edit_box.i", - "shell_cmd": "make -j12 src/gui_edit_box.i", - }, - { - "name": "src/gui_edit_box.s", - "shell_cmd": "make -j12 src/gui_edit_box.s", - }, - { - "name": "src/gui_edit_box_glues.o", - "shell_cmd": "make -j12 src/gui_edit_box_glues.o", - }, - { - "name": "src/gui_edit_box_glues.i", - "shell_cmd": "make -j12 src/gui_edit_box_glues.i", - }, - { - "name": "src/gui_edit_box_glues.s", - "shell_cmd": "make -j12 src/gui_edit_box_glues.s", - }, - { - "name": "src/gui_edit_box_parser.o", - "shell_cmd": "make -j12 src/gui_edit_box_parser.o", - }, - { - "name": "src/gui_edit_box_parser.i", - "shell_cmd": "make -j12 src/gui_edit_box_parser.i", - }, - { - "name": "src/gui_edit_box_parser.s", - "shell_cmd": "make -j12 src/gui_edit_box_parser.s", - }, - { - "name": "src/gui_event_data.o", - "shell_cmd": "make -j12 src/gui_event_data.o", - }, - { - "name": "src/gui_event_data.i", - "shell_cmd": "make -j12 src/gui_event_data.i", - }, - { - "name": "src/gui_event_data.s", - "shell_cmd": "make -j12 src/gui_event_data.s", - }, - { - "name": "src/gui_event_emitter.o", - "shell_cmd": "make -j12 src/gui_event_emitter.o", - }, - { - "name": "src/gui_event_emitter.i", - "shell_cmd": "make -j12 src/gui_event_emitter.i", - }, - { - "name": "src/gui_event_emitter.s", - "shell_cmd": "make -j12 src/gui_event_emitter.s", - }, - { - "name": "src/gui_event_receiver.o", - "shell_cmd": "make -j12 src/gui_event_receiver.o", - }, - { - "name": "src/gui_event_receiver.i", - "shell_cmd": "make -j12 src/gui_event_receiver.i", - }, - { - "name": "src/gui_event_receiver.s", - "shell_cmd": "make -j12 src/gui_event_receiver.s", - }, - { - "name": "src/gui_factory.o", - "shell_cmd": "make -j12 src/gui_factory.o", - }, - { - "name": "src/gui_factory.i", - "shell_cmd": "make -j12 src/gui_factory.i", - }, - { - "name": "src/gui_factory.s", - "shell_cmd": "make -j12 src/gui_factory.s", - }, - { - "name": "src/gui_font_string.o", - "shell_cmd": "make -j12 src/gui_font_string.o", - }, - { - "name": "src/gui_font_string.i", - "shell_cmd": "make -j12 src/gui_font_string.i", - }, - { - "name": "src/gui_font_string.s", - "shell_cmd": "make -j12 src/gui_font_string.s", - }, - { - "name": "src/gui_font_string_glues.o", - "shell_cmd": "make -j12 src/gui_font_string_glues.o", - }, - { - "name": "src/gui_font_string_glues.i", - "shell_cmd": "make -j12 src/gui_font_string_glues.i", - }, - { - "name": "src/gui_font_string_glues.s", - "shell_cmd": "make -j12 src/gui_font_string_glues.s", - }, - { - "name": "src/gui_font_string_parser.o", - "shell_cmd": "make -j12 src/gui_font_string_parser.o", - }, - { - "name": "src/gui_font_string_parser.i", - "shell_cmd": "make -j12 src/gui_font_string_parser.i", - }, - { - "name": "src/gui_font_string_parser.s", - "shell_cmd": "make -j12 src/gui_font_string_parser.s", - }, - { - "name": "src/gui_frame.o", - "shell_cmd": "make -j12 src/gui_frame.o", - }, - { - "name": "src/gui_frame.i", - "shell_cmd": "make -j12 src/gui_frame.i", - }, - { - "name": "src/gui_frame.s", - "shell_cmd": "make -j12 src/gui_frame.s", - }, - { - "name": "src/gui_frame_container.o", - "shell_cmd": "make -j12 src/gui_frame_container.o", - }, - { - "name": "src/gui_frame_container.i", - "shell_cmd": "make -j12 src/gui_frame_container.i", - }, - { - "name": "src/gui_frame_container.s", - "shell_cmd": "make -j12 src/gui_frame_container.s", - }, - { - "name": "src/gui_frame_glues.o", - "shell_cmd": "make -j12 src/gui_frame_glues.o", - }, - { - "name": "src/gui_frame_glues.i", - "shell_cmd": "make -j12 src/gui_frame_glues.i", - }, - { - "name": "src/gui_frame_glues.s", - "shell_cmd": "make -j12 src/gui_frame_glues.s", - }, - { - "name": "src/gui_frame_parser.o", - "shell_cmd": "make -j12 src/gui_frame_parser.o", - }, - { - "name": "src/gui_frame_parser.i", - "shell_cmd": "make -j12 src/gui_frame_parser.i", - }, - { - "name": "src/gui_frame_parser.s", - "shell_cmd": "make -j12 src/gui_frame_parser.s", - }, - { - "name": "src/gui_frame_renderer.o", - "shell_cmd": "make -j12 src/gui_frame_renderer.o", - }, - { - "name": "src/gui_frame_renderer.i", - "shell_cmd": "make -j12 src/gui_frame_renderer.i", - }, - { - "name": "src/gui_frame_renderer.s", - "shell_cmd": "make -j12 src/gui_frame_renderer.s", - }, - { - "name": "src/gui_key_binder.o", - "shell_cmd": "make -j12 src/gui_key_binder.o", - }, - { - "name": "src/gui_key_binder.i", - "shell_cmd": "make -j12 src/gui_key_binder.i", - }, - { - "name": "src/gui_key_binder.s", - "shell_cmd": "make -j12 src/gui_key_binder.s", - }, - { - "name": "src/gui_layered_region.o", - "shell_cmd": "make -j12 src/gui_layered_region.o", - }, - { - "name": "src/gui_layered_region.i", - "shell_cmd": "make -j12 src/gui_layered_region.i", - }, - { - "name": "src/gui_layered_region.s", - "shell_cmd": "make -j12 src/gui_layered_region.s", - }, - { - "name": "src/gui_layered_region_glues.o", - "shell_cmd": "make -j12 src/gui_layered_region_glues.o", - }, - { - "name": "src/gui_layered_region_glues.i", - "shell_cmd": "make -j12 src/gui_layered_region_glues.i", - }, - { - "name": "src/gui_layered_region_glues.s", - "shell_cmd": "make -j12 src/gui_layered_region_glues.s", - }, - { - "name": "src/gui_layered_region_parser.o", - "shell_cmd": "make -j12 src/gui_layered_region_parser.o", - }, - { - "name": "src/gui_layered_region_parser.i", - "shell_cmd": "make -j12 src/gui_layered_region_parser.i", - }, - { - "name": "src/gui_layered_region_parser.s", - "shell_cmd": "make -j12 src/gui_layered_region_parser.s", - }, - { - "name": "src/gui_localizer.o", - "shell_cmd": "make -j12 src/gui_localizer.o", - }, - { - "name": "src/gui_localizer.i", - "shell_cmd": "make -j12 src/gui_localizer.i", - }, - { - "name": "src/gui_localizer.s", - "shell_cmd": "make -j12 src/gui_localizer.s", - }, - { - "name": "src/gui_localizer_glues.o", - "shell_cmd": "make -j12 src/gui_localizer_glues.o", - }, - { - "name": "src/gui_localizer_glues.i", - "shell_cmd": "make -j12 src/gui_localizer_glues.i", - }, - { - "name": "src/gui_localizer_glues.s", - "shell_cmd": "make -j12 src/gui_localizer_glues.s", - }, - { - "name": "src/gui_manager.o", - "shell_cmd": "make -j12 src/gui_manager.o", - }, - { - "name": "src/gui_manager.i", - "shell_cmd": "make -j12 src/gui_manager.i", - }, - { - "name": "src/gui_manager.s", - "shell_cmd": "make -j12 src/gui_manager.s", - }, - { - "name": "src/gui_manager_glues.o", - "shell_cmd": "make -j12 src/gui_manager_glues.o", - }, - { - "name": "src/gui_manager_glues.i", - "shell_cmd": "make -j12 src/gui_manager_glues.i", - }, - { - "name": "src/gui_manager_glues.s", - "shell_cmd": "make -j12 src/gui_manager_glues.s", - }, - { - "name": "src/gui_material.o", - "shell_cmd": "make -j12 src/gui_material.o", - }, - { - "name": "src/gui_material.i", - "shell_cmd": "make -j12 src/gui_material.i", - }, - { - "name": "src/gui_material.s", - "shell_cmd": "make -j12 src/gui_material.s", - }, - { - "name": "src/gui_matrix4.o", - "shell_cmd": "make -j12 src/gui_matrix4.o", - }, - { - "name": "src/gui_matrix4.i", - "shell_cmd": "make -j12 src/gui_matrix4.i", - }, - { - "name": "src/gui_matrix4.s", - "shell_cmd": "make -j12 src/gui_matrix4.s", - }, - { - "name": "src/gui_out.o", - "shell_cmd": "make -j12 src/gui_out.o", - }, - { - "name": "src/gui_out.i", - "shell_cmd": "make -j12 src/gui_out.i", - }, - { - "name": "src/gui_out.s", - "shell_cmd": "make -j12 src/gui_out.s", - }, - { - "name": "src/gui_parser_common.o", - "shell_cmd": "make -j12 src/gui_parser_common.o", - }, - { - "name": "src/gui_parser_common.i", - "shell_cmd": "make -j12 src/gui_parser_common.i", - }, - { - "name": "src/gui_parser_common.s", - "shell_cmd": "make -j12 src/gui_parser_common.s", - }, - { - "name": "src/gui_region.o", - "shell_cmd": "make -j12 src/gui_region.o", - }, - { - "name": "src/gui_region.i", - "shell_cmd": "make -j12 src/gui_region.i", - }, - { - "name": "src/gui_region.s", - "shell_cmd": "make -j12 src/gui_region.s", - }, - { - "name": "src/gui_region_glues.o", - "shell_cmd": "make -j12 src/gui_region_glues.o", - }, - { - "name": "src/gui_region_glues.i", - "shell_cmd": "make -j12 src/gui_region_glues.i", - }, - { - "name": "src/gui_region_glues.s", - "shell_cmd": "make -j12 src/gui_region_glues.s", - }, - { - "name": "src/gui_region_parser.o", - "shell_cmd": "make -j12 src/gui_region_parser.o", - }, - { - "name": "src/gui_region_parser.i", - "shell_cmd": "make -j12 src/gui_region_parser.i", - }, - { - "name": "src/gui_region_parser.s", - "shell_cmd": "make -j12 src/gui_region_parser.s", - }, - { - "name": "src/gui_registry.o", - "shell_cmd": "make -j12 src/gui_registry.o", - }, - { - "name": "src/gui_registry.i", - "shell_cmd": "make -j12 src/gui_registry.i", - }, - { - "name": "src/gui_registry.s", - "shell_cmd": "make -j12 src/gui_registry.s", - }, - { - "name": "src/gui_renderer.o", - "shell_cmd": "make -j12 src/gui_renderer.o", - }, - { - "name": "src/gui_renderer.i", - "shell_cmd": "make -j12 src/gui_renderer.i", - }, - { - "name": "src/gui_renderer.s", - "shell_cmd": "make -j12 src/gui_renderer.s", - }, - { - "name": "src/gui_root.o", - "shell_cmd": "make -j12 src/gui_root.o", - }, - { - "name": "src/gui_root.i", - "shell_cmd": "make -j12 src/gui_root.i", - }, - { - "name": "src/gui_root.s", - "shell_cmd": "make -j12 src/gui_root.s", - }, - { - "name": "src/gui_scroll_frame.o", - "shell_cmd": "make -j12 src/gui_scroll_frame.o", - }, - { - "name": "src/gui_scroll_frame.i", - "shell_cmd": "make -j12 src/gui_scroll_frame.i", - }, - { - "name": "src/gui_scroll_frame.s", - "shell_cmd": "make -j12 src/gui_scroll_frame.s", - }, - { - "name": "src/gui_scroll_frame_glues.o", - "shell_cmd": "make -j12 src/gui_scroll_frame_glues.o", - }, - { - "name": "src/gui_scroll_frame_glues.i", - "shell_cmd": "make -j12 src/gui_scroll_frame_glues.i", - }, - { - "name": "src/gui_scroll_frame_glues.s", - "shell_cmd": "make -j12 src/gui_scroll_frame_glues.s", - }, - { - "name": "src/gui_scroll_frame_parser.o", - "shell_cmd": "make -j12 src/gui_scroll_frame_parser.o", - }, - { - "name": "src/gui_scroll_frame_parser.i", - "shell_cmd": "make -j12 src/gui_scroll_frame_parser.i", - }, - { - "name": "src/gui_scroll_frame_parser.s", - "shell_cmd": "make -j12 src/gui_scroll_frame_parser.s", - }, - { - "name": "src/gui_slider.o", - "shell_cmd": "make -j12 src/gui_slider.o", - }, - { - "name": "src/gui_slider.i", - "shell_cmd": "make -j12 src/gui_slider.i", - }, - { - "name": "src/gui_slider.s", - "shell_cmd": "make -j12 src/gui_slider.s", - }, - { - "name": "src/gui_slider_glues.o", - "shell_cmd": "make -j12 src/gui_slider_glues.o", - }, - { - "name": "src/gui_slider_glues.i", - "shell_cmd": "make -j12 src/gui_slider_glues.i", - }, - { - "name": "src/gui_slider_glues.s", - "shell_cmd": "make -j12 src/gui_slider_glues.s", - }, - { - "name": "src/gui_slider_parser.o", - "shell_cmd": "make -j12 src/gui_slider_parser.o", - }, - { - "name": "src/gui_slider_parser.i", - "shell_cmd": "make -j12 src/gui_slider_parser.i", - }, - { - "name": "src/gui_slider_parser.s", - "shell_cmd": "make -j12 src/gui_slider_parser.s", - }, - { - "name": "src/gui_status_bar.o", - "shell_cmd": "make -j12 src/gui_status_bar.o", - }, - { - "name": "src/gui_status_bar.i", - "shell_cmd": "make -j12 src/gui_status_bar.i", - }, - { - "name": "src/gui_status_bar.s", - "shell_cmd": "make -j12 src/gui_status_bar.s", - }, - { - "name": "src/gui_status_bar_glues.o", - "shell_cmd": "make -j12 src/gui_status_bar_glues.o", - }, - { - "name": "src/gui_status_bar_glues.i", - "shell_cmd": "make -j12 src/gui_status_bar_glues.i", - }, - { - "name": "src/gui_status_bar_glues.s", - "shell_cmd": "make -j12 src/gui_status_bar_glues.s", - }, - { - "name": "src/gui_status_bar_parser.o", - "shell_cmd": "make -j12 src/gui_status_bar_parser.o", - }, - { - "name": "src/gui_status_bar_parser.i", - "shell_cmd": "make -j12 src/gui_status_bar_parser.i", - }, - { - "name": "src/gui_status_bar_parser.s", - "shell_cmd": "make -j12 src/gui_status_bar_parser.s", - }, - { - "name": "src/gui_text.o", - "shell_cmd": "make -j12 src/gui_text.o", - }, - { - "name": "src/gui_text.i", - "shell_cmd": "make -j12 src/gui_text.i", - }, - { - "name": "src/gui_text.s", - "shell_cmd": "make -j12 src/gui_text.s", - }, - { - "name": "src/gui_texture.o", - "shell_cmd": "make -j12 src/gui_texture.o", - }, - { - "name": "src/gui_texture.i", - "shell_cmd": "make -j12 src/gui_texture.i", - }, - { - "name": "src/gui_texture.s", - "shell_cmd": "make -j12 src/gui_texture.s", - }, - { - "name": "src/gui_texture_glues.o", - "shell_cmd": "make -j12 src/gui_texture_glues.o", - }, - { - "name": "src/gui_texture_glues.i", - "shell_cmd": "make -j12 src/gui_texture_glues.i", - }, - { - "name": "src/gui_texture_glues.s", - "shell_cmd": "make -j12 src/gui_texture_glues.s", - }, - { - "name": "src/gui_texture_parser.o", - "shell_cmd": "make -j12 src/gui_texture_parser.o", - }, - { - "name": "src/gui_texture_parser.i", - "shell_cmd": "make -j12 src/gui_texture_parser.i", - }, - { - "name": "src/gui_texture_parser.s", - "shell_cmd": "make -j12 src/gui_texture_parser.s", - }, - { - "name": "src/gui_vertex_cache.o", - "shell_cmd": "make -j12 src/gui_vertex_cache.o", - }, - { - "name": "src/gui_vertex_cache.i", - "shell_cmd": "make -j12 src/gui_vertex_cache.i", - }, - { - "name": "src/gui_vertex_cache.s", - "shell_cmd": "make -j12 src/gui_vertex_cache.s", - }, - { - "name": "src/gui_virtual_registry.o", - "shell_cmd": "make -j12 src/gui_virtual_registry.o", - }, - { - "name": "src/gui_virtual_registry.i", - "shell_cmd": "make -j12 src/gui_virtual_registry.i", - }, - { - "name": "src/gui_virtual_registry.s", - "shell_cmd": "make -j12 src/gui_virtual_registry.s", - }, - { - "name": "src/gui_virtual_root.o", - "shell_cmd": "make -j12 src/gui_virtual_root.o", - }, - { - "name": "src/gui_virtual_root.i", - "shell_cmd": "make -j12 src/gui_virtual_root.i", - }, - { - "name": "src/gui_virtual_root.s", - "shell_cmd": "make -j12 src/gui_virtual_root.s", - }, - { - "name": "src/input_dispatcher.o", - "shell_cmd": "make -j12 src/input_dispatcher.o", - }, - { - "name": "src/input_dispatcher.i", - "shell_cmd": "make -j12 src/input_dispatcher.i", - }, - { - "name": "src/input_dispatcher.s", - "shell_cmd": "make -j12 src/input_dispatcher.s", - }, - { - "name": "src/input_keys.o", - "shell_cmd": "make -j12 src/input_keys.o", - }, - { - "name": "src/input_keys.i", - "shell_cmd": "make -j12 src/input_keys.i", - }, - { - "name": "src/input_keys.s", - "shell_cmd": "make -j12 src/input_keys.s", - }, - { - "name": "src/input_source.o", - "shell_cmd": "make -j12 src/input_source.o", - }, - { - "name": "src/input_source.i", - "shell_cmd": "make -j12 src/input_source.i", - }, - { - "name": "src/input_source.s", - "shell_cmd": "make -j12 src/input_source.s", - }, - { - "name": "src/input_window.o", - "shell_cmd": "make -j12 src/input_window.o", - }, - { - "name": "src/input_window.i", - "shell_cmd": "make -j12 src/input_window.i", - }, - { - "name": "src/input_window.s", - "shell_cmd": "make -j12 src/input_window.s", - }, - { - "name": "src/utils_exception.o", - "shell_cmd": "make -j12 src/utils_exception.o", - }, - { - "name": "src/utils_exception.i", - "shell_cmd": "make -j12 src/utils_exception.i", - }, - { - "name": "src/utils_exception.s", - "shell_cmd": "make -j12 src/utils_exception.s", - }, - { - "name": "src/utils_file_system.o", - "shell_cmd": "make -j12 src/utils_file_system.o", - }, - { - "name": "src/utils_file_system.i", - "shell_cmd": "make -j12 src/utils_file_system.i", - }, - { - "name": "src/utils_file_system.s", - "shell_cmd": "make -j12 src/utils_file_system.s", - }, - { - "name": "src/utils_maths.o", - "shell_cmd": "make -j12 src/utils_maths.o", - }, - { - "name": "src/utils_maths.i", - "shell_cmd": "make -j12 src/utils_maths.i", - }, - { - "name": "src/utils_maths.s", - "shell_cmd": "make -j12 src/utils_maths.s", - }, - { - "name": "src/utils_periodic_timer.o", - "shell_cmd": "make -j12 src/utils_periodic_timer.o", - }, - { - "name": "src/utils_periodic_timer.i", - "shell_cmd": "make -j12 src/utils_periodic_timer.i", - }, - { - "name": "src/utils_periodic_timer.s", - "shell_cmd": "make -j12 src/utils_periodic_timer.s" - }, - { - "name": "src/utils_string.o", - "shell_cmd": "make -j12 src/utils_string.o" - }, - { - "name": "src/utils_string.i", - "shell_cmd": "make -j12 src/utils_string.i" - }, - { - "name": "src/utils_string.s", - "shell_cmd": "make -j12 src/utils_string.s" - }, - ], - "working_dir": "$folder/build", - } - ], - "folders": - [ - { - "file_exclude_patterns": - [ - "*.html", - "*.json", - ".gitignore", - ".gitmodules", - ".travis.yml", - "travis_key*", - "lxgui-test*" - ], - "folder_exclude_patterns": - [ - "build", - "doc/html", - "doc/lua", - ".git", - ".ci" - ], - "index_exclude_patterns": - [ - "build/*", - "dependencies/*", - ".ci/*", - "doc/html/*", - "doc/lua/*", - "test/lxgui-test*", - "*.html" - ], - "path": ".", - } - ], - "settings": - { - "cmake": - { - "build_folder": "$folder/build", - }, - "ClangFormat": - { - "format_on_save": true, - }, - }, + "build_systems": + [ + { + "config": "Release", + "env": + { + "CMAKE_BUILD_PARALLEL_LEVEL": "12" + }, + "generator": "Unix Makefiles", + "name": "Release", + "target": "cmake_build", + "variants": + [ + { + "build_target": "Continuous", + "name": "Continuous" + }, + { + "build_target": "ContinuousBuild", + "name": "ContinuousBuild" + }, + { + "build_target": "ContinuousConfigure", + "name": "ContinuousConfigure" + }, + { + "build_target": "ContinuousCoverage", + "name": "ContinuousCoverage" + }, + { + "build_target": "ContinuousMemCheck", + "name": "ContinuousMemCheck" + }, + { + "build_target": "ContinuousStart", + "name": "ContinuousStart" + }, + { + "build_target": "ContinuousSubmit", + "name": "ContinuousSubmit" + }, + { + "build_target": "ContinuousTest", + "name": "ContinuousTest" + }, + { + "build_target": "ContinuousUpdate", + "name": "ContinuousUpdate" + }, + { + "build_target": "Experimental", + "name": "Experimental" + }, + { + "build_target": "ExperimentalBuild", + "name": "ExperimentalBuild" + }, + { + "build_target": "ExperimentalConfigure", + "name": "ExperimentalConfigure" + }, + { + "build_target": "ExperimentalCoverage", + "name": "ExperimentalCoverage" + }, + { + "build_target": "ExperimentalMemCheck", + "name": "ExperimentalMemCheck" + }, + { + "build_target": "ExperimentalStart", + "name": "ExperimentalStart" + }, + { + "build_target": "ExperimentalSubmit", + "name": "ExperimentalSubmit" + }, + { + "build_target": "ExperimentalTest", + "name": "ExperimentalTest" + }, + { + "build_target": "ExperimentalUpdate", + "name": "ExperimentalUpdate" + }, + { + "build_target": "Nightly", + "name": "Nightly" + }, + { + "build_target": "NightlyBuild", + "name": "NightlyBuild" + }, + { + "build_target": "NightlyConfigure", + "name": "NightlyConfigure" + }, + { + "build_target": "NightlyCoverage", + "name": "NightlyCoverage" + }, + { + "build_target": "NightlyMemCheck", + "name": "NightlyMemCheck" + }, + { + "build_target": "NightlyMemoryCheck", + "name": "NightlyMemoryCheck" + }, + { + "build_target": "NightlyStart", + "name": "NightlyStart" + }, + { + "build_target": "NightlySubmit", + "name": "NightlySubmit" + }, + { + "build_target": "NightlyTest", + "name": "NightlyTest" + }, + { + "build_target": "NightlyUpdate", + "name": "NightlyUpdate" + }, + { + "build_target": "c4core", + "name": "c4core" + }, + { + "build_target": "c4core-amalgamate", + "name": "c4core-amalgamate" + }, + { + "build_target": "fmt", + "name": "fmt" + }, + { + "build_target": "lxgui", + "name": "lxgui" + }, + { + "build_target": "lxgui-gl", + "name": "lxgui-gl" + }, + { + "build_target": "lxgui-input-sdl", + "name": "lxgui-input-sdl" + }, + { + "build_target": "lxgui-input-sfml", + "name": "lxgui-input-sfml" + }, + { + "build_target": "lxgui-sdl", + "name": "lxgui-sdl" + }, + { + "build_target": "lxgui-sfml", + "name": "lxgui-sfml" + }, + { + "build_target": "lxgui-test", + "name": "lxgui-test" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test", + "build_target": "lxgui-test", + "name": "Run: lxgui-test", + "target": "cmake_run" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test", + "build_target": "lxgui-test", + "debug": true, + "name": "Run under GDB: lxgui-test", + "target": "cmake_run" + }, + { + "build_target": "lxgui-test-opengl-sdl", + "name": "lxgui-test-opengl-sdl" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-opengl-sdl", + "build_target": "lxgui-test-opengl-sdl", + "name": "Run: lxgui-test-opengl-sdl", + "target": "cmake_run" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-opengl-sdl", + "build_target": "lxgui-test-opengl-sdl", + "debug": true, + "name": "Run under GDB: lxgui-test-opengl-sdl", + "target": "cmake_run" + }, + { + "build_target": "lxgui-test-opengl-sfml", + "name": "lxgui-test-opengl-sfml" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-opengl-sfml", + "build_target": "lxgui-test-opengl-sfml", + "name": "Run: lxgui-test-opengl-sfml", + "target": "cmake_run" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-opengl-sfml", + "build_target": "lxgui-test-opengl-sfml", + "debug": true, + "name": "Run under GDB: lxgui-test-opengl-sfml", + "target": "cmake_run" + }, + { + "build_target": "lxgui-test-sdl", + "name": "lxgui-test-sdl" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-sdl", + "build_target": "lxgui-test-sdl", + "name": "Run: lxgui-test-sdl", + "target": "cmake_run" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-sdl", + "build_target": "lxgui-test-sdl", + "debug": true, + "name": "Run under GDB: lxgui-test-sdl", + "target": "cmake_run" + }, + { + "build_target": "lxgui-test-sfml", + "name": "lxgui-test-sfml" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-sfml", + "build_target": "lxgui-test-sfml", + "name": "Run: lxgui-test-sfml", + "target": "cmake_run" + }, + { + "artifact": "/home/cschreib/programming/lxgui/bin/lxgui-test-sfml", + "build_target": "lxgui-test-sfml", + "debug": true, + "name": "Run under GDB: lxgui-test-sfml", + "target": "cmake_run" + }, + { + "build_target": "pugixml-static", + "name": "pugixml-static" + }, + { + "build_target": "ryml", + "name": "ryml" + }, + { + "build_target": "ryml-uninstall", + "name": "ryml-uninstall" + }, + { + "name": "ctest", + "target": "ctest_run" + } + ], + "working_dir": "$folder/build" + }, + ], + "folders": + [ + { + "file_exclude_patterns": + [ + "*.html", + "*.json", + ".travis.yml", + "travis_key*", + "lxgui-test*" + ], + "folder_exclude_patterns": + [ + ".git", + ".ci" + ], + "index_exclude_patterns": + [ + "build/*", + "dependencies/*", + ".ci/*", + "doc/html/*", + "doc/lua/*", + "test/lxgui-test*", + "*.html" + ], + "path": ".", + } + ], + "settings": + { + "cmake": + { + "build_folder": "$folder/build", + }, + "ClangFormat": + { + "format_on_save": true, + }, + "LSP": { + "clangd": { + "initializationOptions": { + "clangd.compile-commands-dir": "build_clang" + } + } + } + }, } diff --git a/src/gui_addon_registry_parser.cpp b/src/gui_addon_registry_parser.cpp index 4ab4ecc9f3..4248c75f76 100644 --- a/src/gui_addon_registry_parser.cpp +++ b/src/gui_addon_registry_parser.cpp @@ -138,7 +138,7 @@ void set_node( const file_line_mappings& file, const ryml::Tree& tree, layout_node& node, - const ryml::NodeRef& yaml_node) { + const ryml::ConstNodeRef& yaml_node) { std::string location; if (yaml_node.has_key()) location = file.get_location(yaml_node.key().data() - tree.arena().data()); @@ -225,7 +225,8 @@ void addon_registry::parse_layout_file_(const std::string& file_name, const addo #if defined(LXGUI_ENABLE_YAML_PARSER) if (extension == ".yml" || extension == ".yaml") { - ryml::Tree tree = ryml::parse(ryml::to_csubstr(file.get_content())); + ryml::Tree tree; + ryml::parse_in_arena(ryml::to_csubstr(file.get_content()), &tree); set_node(file, tree, root, tree.rootref().first_child()); parsed = true; } diff --git a/src/gui_backdrop.cpp b/src/gui_backdrop.cpp index 6f01f76c87..e464ff5e50 100644 --- a/src/gui_backdrop.cpp +++ b/src/gui_backdrop.cpp @@ -57,6 +57,9 @@ void backdrop::set_background(const std::string& background_file) { auto& renderer = parent_.get_manager().get_renderer(); background_texture_ = renderer.create_atlas_material("GUI", background_file); + if (!background_texture_) { + return; + } tile_size_ = original_tile_size_ = static_cast(background_texture_->get_rect().width()); background_file_ = background_file; @@ -157,6 +160,9 @@ void backdrop::set_edge(const std::string& edge_file) { auto& renderer = parent_.get_manager().get_renderer(); edge_texture_ = renderer.create_atlas_material("GUI", edge_file); + if (!edge_texture_) { + return; + } if (edge_texture_->get_rect().width() / edge_texture_->get_rect().height() != 8.0f) { edge_texture_ = nullptr; diff --git a/src/input_keys.cpp b/src/input_keys.cpp index 3307add8bc..887bf65417 100644 --- a/src/input_keys.cpp +++ b/src/input_keys.cpp @@ -56,14 +56,14 @@ get_mouse_button_and_event_codename(mouse_button button_id, mouse_button_event b case mouse_button_event::down: return "RightButton:Down"; case mouse_button_event::double_click: return "RightButton:DoubleClick"; default: return ""; - }; + } case mouse_button::middle: switch (button_event) { case mouse_button_event::up: return "MiddleButton:Up"; case mouse_button_event::down: return "MiddleButton:Down"; case mouse_button_event::double_click: return "MiddleButton:DoubleClick"; default: return ""; - }; + } default: return ""; } } diff --git a/src/utils_string.cpp b/src/utils_string.cpp index bdf962fe11..5122ed834e 100644 --- a/src/utils_string.cpp +++ b/src/utils_string.cpp @@ -1,8 +1,7 @@ #include "lxgui/utils_string.hpp" -#include "utf8.h" - #include +#include /** \cond NOT_REMOVE_FROM_DOC */