Skip to content

Commit

Permalink
clean cmake default options
Browse files Browse the repository at this point in the history
  • Loading branch information
nesbox committed Jun 1, 2024
1 parent 43a0317 commit 657e866
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 72 deletions.
52 changes: 26 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===
Expand All @@ -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
Expand All @@ -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 ===
Expand Down Expand Up @@ -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 ===
Expand All @@ -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
Expand All @@ -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 ===
Expand Down Expand Up @@ -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 ===
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 ===
Expand All @@ -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
Expand All @@ -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 ===
Expand Down Expand Up @@ -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
Expand Down
36 changes: 7 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions cmake/sokol.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

################################
Expand All @@ -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()
6 changes: 1 addition & 5 deletions tic80.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -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 .."
Expand Down

0 comments on commit 657e866

Please sign in to comment.