From 657e8661fc2b38f753b293c6d7821fc2dd66082f Mon Sep 17 00:00:00 2001 From: nesbox Date: Sat, 1 Jun 2024 11:34:39 +0200 Subject: [PATCH] clean cmake default options --- .github/workflows/build.yml | 52 +++++++++++++++++----------------- CMakeLists.txt | 36 +++++------------------ build/android/app/build.gradle | 2 +- cmake/sokol.cmake | 22 +++++++------- tic80.sublime-project | 6 +--- 5 files changed, 46 insertions(+), 72 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0436951cd..d95ab6d2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: run: | COPY /Y build\janet\janetconf.h vendor\janet\src\conf\janetconf.h cd build - cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_PRO=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel # === Windows === @@ -59,7 +59,7 @@ jobs: shell: cmd run: | cd build - cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. + cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel - name: Deploy @@ -74,7 +74,7 @@ jobs: shell: cmd run: | cd build - cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_PRO=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel # === Windows MinGW-64 === @@ -108,7 +108,7 @@ jobs: shell: bash run: | cd build - cmake -G "MSYS Makefiles" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. + cmake -G "MSYS Makefiles" -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. cmake --build . --config MinSizeRel --parallel # === Ubuntu === @@ -133,7 +133,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel - name: Deploy @@ -147,7 +147,7 @@ jobs: - name: Build Pro run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=ON -DBUILD_PRO=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel # === Raspberry PI === @@ -183,7 +183,7 @@ jobs: - name: Build Pro run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_PRO=On -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_PRO=ON -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake .. cmake --build . --config MinSizeRel --parallel # === Raspberry PI 1-4 Bare Metal === @@ -222,7 +222,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON -DBUILD_STATIC=ON -DBUILD_SDL=OFF .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -282,7 +282,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON -DBUILD_STATIC=ON -DBUILD_SDL=OFF .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -328,7 +328,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DBUILD_STATIC=ON -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_SDL=OFF .. make -j$(nproc) - name: Deploy @@ -353,7 +353,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel - name: Deploy @@ -367,7 +367,7 @@ jobs: - name: Build Pro run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=ON -DBUILD_PRO=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel # === MacOS 14 / arm64 === @@ -386,7 +386,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel - name: Deploy @@ -400,7 +400,7 @@ jobs: - name: Build Pro run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=ON -DBUILD_PRO=ON -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel # === Android === @@ -462,73 +462,73 @@ jobs: - name: Build lua run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=ON -DTIC80_TARGET=tic80lua .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=ON -DTIC80_TARGET=tic80lua .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build ruby run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_RUBY=ON -DTIC80_TARGET=tic80ruby .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_RUBY=ON -DTIC80_TARGET=tic80ruby .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build js run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JS=ON -DTIC80_TARGET=tic80js .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JS=ON -DTIC80_TARGET=tic80js .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build moon run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_MOON=ON -DTIC80_TARGET=tic80moon .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_MOON=ON -DTIC80_TARGET=tic80moon .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build fennel run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_FENNEL=ON -DTIC80_TARGET=tic80fennel .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_FENNEL=ON -DTIC80_TARGET=tic80fennel .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build scheme run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SCHEME=ON -DTIC80_TARGET=tic80scheme .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SCHEME=ON -DTIC80_TARGET=tic80scheme .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build squirrel run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SQUIRREL=ON -DTIC80_TARGET=tic80squirrel .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SQUIRREL=ON -DTIC80_TARGET=tic80squirrel .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build wren run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WREN=ON -DTIC80_TARGET=tic80wren .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WREN=ON -DTIC80_TARGET=tic80wren .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build wasm run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WASM=ON -DTIC80_TARGET=tic80wasm .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WASM=ON -DTIC80_TARGET=tic80wasm .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build janet run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JANET=ON -DTIC80_TARGET=tic80janet .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JANET=ON -DTIC80_TARGET=tic80janet .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build python run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_PYTHON=ON -DTIC80_TARGET=tic80python .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_PYTHON=ON -DTIC80_TARGET=tic80python .. --fresh cmake --build . --config MinSizeRel --parallel - name: Build all run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. --fresh + emcmake cmake -DBUILD_STATIC=ON -DBUILD_SDLGPU=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. --fresh cmake --build . --config MinSizeRel --parallel cp html/index.html bin/index.html diff --git a/CMakeLists.txt b/CMakeLists.txt index a812dd23c..1ffbb83fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,28 +14,17 @@ message("VERSION_HASH: ${VERSION_HASH}") configure_file("${PROJECT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") -if(ANDROID OR EMSCRIPTEN OR N3DS OR BAREMETALPI) - set(BUILD_STATIC_DEFAULT ON) -else() - set(BUILD_STATIC_DEFAULT OFF) -endif() - -set(BUILD_PLAYER_DEFAULT OFF) -set(BUILD_LIBRETRO_DEFAULT OFF) -set(BUILD_TOUCH_INPUT_DEFAULT ${ANDROID}) -set(BUILD_WITH_ALL_DEFAULT OFF) - -option(BUILD_STATIC "Static runtime" ${BUILD_STATIC_DEFAULT}) -option(BUILD_WITH_ALL "Build all supported scripts" ${BUILD_WITH_ALL_DEFAULT}) +option(BUILD_STATIC "Static runtime" OFF) +option(BUILD_WITH_ALL "Build all supported scripts" OFF) option(BUILD_SDL "SDL Enabled" ON) option(BUILD_SDLGPU "SDL GPU Enabled" OFF) option(BUILD_SOKOL "Sokol Enabled" OFF) -option(BUILD_LIBRETRO "libretro Enabled" ${BUILD_LIBRETRO_DEFAULT}) +option(BUILD_LIBRETRO "libretro Enabled" OFF) option(BUILD_TOOLS "bin2txt prj2cart" OFF) option(BUILD_EDITORS "Build cart editors" ON) option(BUILD_PRO "Build PRO version" FALSE) -option(BUILD_PLAYER "Build standalone players" ${BUILD_PLAYER_DEFAULT}) -option(BUILD_TOUCH_INPUT "Build with touch input support" ${BUILD_TOUCH_INPUT_DEFAULT}) +option(BUILD_PLAYER "Build standalone players" OFF) +option(BUILD_TOUCH_INPUT "Build with touch input support" OFF) option(BUILD_NO_OPTIMIZATION "Build without optimizations for debugging" OFF) option(BUILD_ASAN_DEBUG "Build with AddressSanitizer" OFF) option(BUILD_WITH_ZLIB "Build with zlib linked" ON) @@ -55,10 +44,6 @@ if (BUILD_ASAN_DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") endif() -if(NOT BUILD_SDL) - set(BUILD_SDLGPU OFF) -endif() - add_library(runtime INTERFACE) if(BUILD_STATIC) @@ -71,18 +56,12 @@ endif() target_compile_definitions(runtime INTERFACE BUILD_DEPRECATED) message("BUILD_STATIC: ${BUILD_STATIC}") +message("BUILD_SDL: ${BUILD_SDL}") +message("BUILD_SOKOL: ${BUILD_SOKOL}") message("BUILD_SDLGPU: ${BUILD_SDLGPU}") message("BUILD_TOUCH_INPUT: ${BUILD_TOUCH_INPUT}") message("BUILD_WITH_ALL: ${BUILD_WITH_ALL}") -if (N3DS) - set(BUILD_SDL OFF) -endif() - -if (BAREMETALPI) - set(BUILD_SDL OFF) -endif() - if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID AND NOT N3DS) set(LINUX TRUE) @@ -130,7 +109,6 @@ if(RPI) endif() set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/vendor) -set(DEMO_CARTS_IN ${CMAKE_SOURCE_DIR}/demos) include(cmake/gif.cmake) include(cmake/blipbuf.cmake) diff --git a/build/android/app/build.gradle b/build/android/app/build.gradle index d936c98b3..728799aa0 100644 --- a/build/android/app/build.gradle +++ b/build/android/app/build.gradle @@ -25,7 +25,7 @@ android { arguments "APP_PLATFORM=android-31" } cmake { - arguments "-DBUILD_WITH_RUBY=OFF", "-DBUILD_PRO=Off", "-DCMAKE_BUILD_TYPE=MinSizeRel", "-DBUILD_WITH_ALL=ON" + arguments "-DBUILD_STATIC=ON", "-BUILD_TOUCH_INPUT=ON", "-DBUILD_WITH_RUBY=OFF", "-DBUILD_PRO=Off", "-DCMAKE_BUILD_TYPE=MinSizeRel", "-DBUILD_WITH_ALL=ON" } } } diff --git a/cmake/sokol.cmake b/cmake/sokol.cmake index d3a7c8f6f..da7eb7ab1 100644 --- a/cmake/sokol.cmake +++ b/cmake/sokol.cmake @@ -52,19 +52,19 @@ endif() if(BUILD_PLAYER AND BUILD_SOKOL) - add_executable(player-sokol WIN32 ${CMAKE_SOURCE_DIR}/src/system/sokol/player.c) + add_executable(player WIN32 ${CMAKE_SOURCE_DIR}/src/system/sokol/player.c) if(MINGW) - target_link_libraries(player-sokol mingw32) - target_link_options(player-sokol PRIVATE -static) + target_link_libraries(player mingw32) + target_link_options(player PRIVATE -static) endif() - target_include_directories(player-sokol PRIVATE + target_include_directories(player PRIVATE ${CMAKE_SOURCE_DIR}/include ${THIRDPARTY_DIR}/sokol ${CMAKE_SOURCE_DIR}/src) - target_link_libraries(player-sokol tic80core sokol) + target_link_libraries(player tic80core sokol) endif() ################################ @@ -80,21 +80,21 @@ if(BUILD_SOKOL) configure_file("${PROJECT_SOURCE_DIR}/build/windows/tic80.rc.in" "${PROJECT_SOURCE_DIR}/build/windows/tic80.rc") set(TIC80_SRC ${TIC80_SRC} "${PROJECT_SOURCE_DIR}/build/windows/tic80.rc") - add_executable(tic80-sokol WIN32 ${TIC80_SRC}) + add_executable(${TIC80_TARGET} WIN32 ${TIC80_SRC}) else() - add_executable(tic80-sokol ${TIC80_SRC}) + add_executable(${TIC80_TARGET} ${TIC80_SRC}) endif() - target_include_directories(tic80-sokol PRIVATE + target_include_directories(${TIC80_TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${THIRDPARTY_DIR}/sokol) if(MINGW) - target_link_libraries(tic80-sokol mingw32) - target_link_options(tic80-sokol PRIVATE -static -mconsole) + target_link_libraries(${TIC80_TARGET} mingw32) + target_link_options(${TIC80_TARGET} PRIVATE -static -mconsole) endif() - target_link_libraries(tic80-sokol tic80studio sokol) + target_link_libraries(${TIC80_TARGET} tic80studio sokol) endif() \ No newline at end of file diff --git a/tic80.sublime-project b/tic80.sublime-project index 64a890ebc..64d714fb8 100644 --- a/tic80.sublime-project +++ b/tic80.sublime-project @@ -3,15 +3,11 @@ [ { "name": "build", - "shell_cmd": "cd ${project_path}/build && cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel .. && ninja", + "shell_cmd": "cd ${project_path}/build && cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel .. --fresh && ninja", "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "variants": [ - { - "name": "fresh", - "shell_cmd": "cd ${project_path}/build && cmake -G Ninja .. --fresh" - }, { "name": "BUILD_STATIC=ON", "shell_cmd": "cd ${project_path}/build && cmake -DBUILD_STATIC=ON .."