diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 69659e0..05e1c44 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -8,6 +8,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: build-linux: runs-on: ${{ matrix.arch == 'x64' && 'ubuntu-22.04' || 'blaze/ubuntu-22.04' }} @@ -30,26 +31,12 @@ jobs: - name: Install Linux Dependencies run: | sudo apt-get update - sudo apt-get install -y ninja-build libsdl2-dev libgtk-3-dev lld llvm clang-15 - - # Install SDL2 - echo ::group::install SDL2 + sudo apt-get install -y ninja-build lld llvm clang-15 - # Enable ccache - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - - wget https://www.libsdl.org/release/SDL2-2.26.1.tar.gz - tar -xzf SDL2-2.26.1.tar.gz - cd SDL2-2.26.1 - ./configure - make -j 10 - sudo make install - sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ - echo ::endgroup:: - name: Generate CMake Project run: | # enable ccache - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build - name: Build ultramodern run: | @@ -61,6 +48,7 @@ jobs: # enable ccache export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" cmake --build cmake-build --config ${{ matrix.type }} --target librecomp -j $(nproc) + build-windows: runs-on: windows-latest strategy: diff --git a/README.md b/README.md index 7f2200d..d4f5777 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,15 @@ Librecomp is a library meant to be used to bridge the gap between code generated * Overlay handling * PI DMA (ROM reads) -* EEPROM, SRAM and Flashram saving (these may be partially moved to ultramodern in the future) \ No newline at end of file +* EEPROM, SRAM and Flashram saving (these may be partially moved to ultramodern in the future) + +## Building + +It is recommended to reference this project on your `CMakeLists.txt` file. Note that this project has been developed with `clang` 15, older versions may not work. + +For building locally this project (ie, developing new features for the libraries of this project), the following is recommneded: + +```bash +cmake -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Debug +cmake --build build -j $(nproc) --config Debug +``` diff --git a/librecomp/CMakeLists.txt b/librecomp/CMakeLists.txt index 1716ec6..92c9003 100644 --- a/librecomp/CMakeLists.txt +++ b/librecomp/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.20) + project(librecomp) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_CXX_EXTENSIONS OFF) # Define the library add_library(librecomp STATIC @@ -33,6 +37,10 @@ target_include_directories(librecomp PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/librecomp" ) -target_compile_options(librecomp PRIVATE -Wno-deprecated-declarations) +target_compile_options(librecomp PRIVATE +# -Wall +# -Wextra + -Wno-unused-parameter +) target_link_libraries(librecomp PRIVATE ultramodern) diff --git a/ultramodern/CMakeLists.txt b/ultramodern/CMakeLists.txt index 21cd31b..2cf9ed4 100644 --- a/ultramodern/CMakeLists.txt +++ b/ultramodern/CMakeLists.txt @@ -33,38 +33,8 @@ target_include_directories(ultramodern PUBLIC "${PROJECT_SOURCE_DIR}/../thirdparty/sse2neon" ) -if (WIN32) - include(FetchContent) - # Fetch SDL2 on windows - FetchContent_Declare( - sdl2 - URL https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip - URL_HASH MD5=d8173db078e54040c666f411c5a6afff - ) - FetchContent_MakeAvailable(sdl2) - target_include_directories(ultramodern PRIVATE - ${sdl2_SOURCE_DIR}/include - ) - target_link_directories(ultramodern PRIVATE - ${sdl2_SOURCE_DIR}/lib/x64 - ) - add_compile_definitions(NOMINMAX) -elseif (APPLE) - find_package(SDL2 REQUIRED) - target_include_directories(ultramodern PRIVATE ${SDL2_INCLUDE_DIRS}) -else() - find_package(SDL2 REQUIRED) - find_package(X11 REQUIRED) - - message(STATUS "SDL2_FOUND = ${SDL2_FOUND}") - message(STATUS "SDL2_INCLUDE_DIRS = ${SDL2_INCLUDE_DIRS}") - - target_include_directories(ultramodern PRIVATE ${SDL2_INCLUDE_DIRS}) - - message(STATUS "X11_FOUND = ${X11_FOUND}") - message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}") - message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}") - - target_include_directories(ultramodern PRIVATE ${X11_INCLUDE_DIR}) - target_link_libraries(ultramodern PRIVATE ${X11_LIBRARIES}) -endif() +target_compile_options(ultramodern PRIVATE +# -Wall +# -Wextra + -Wno-unused-parameter +)