Skip to content

Commit

Permalink
better shell for v1
Browse files Browse the repository at this point in the history
  • Loading branch information
saolsen committed Feb 16, 2025
1 parent b4e61a8 commit b85c7ea
Show file tree
Hide file tree
Showing 8 changed files with 753 additions and 53 deletions.
14 changes: 7 additions & 7 deletions build_tazar_web.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

pushd cmake
pushd cmake || exit
emcmake cmake -S . -B cmake-web -DCMAKE_BUILD_TYPE=Release
cmake --build cmake-web --target tazar
pushd cmake-web
mv tazar.html index.html
cmake --build cmake-web --target tazar-v1
pushd cmake-web || exit
mv tazar-v1.html index.html
mkdir tazar-web
cp tazar.js tazar-web/
cp tazar.wasm tazar-web/
cp tazar-v1.js tazar-web/
cp tazar-v1.wasm tazar-web/
cp index.html tazar-web/
zip -r tazar-web.zip tazar-web
popd
popd || exit
63 changes: 32 additions & 31 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,41 @@ if (NOT ((CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_C_COMPILER_ID MATCHES "
endif ()

# Raylib stuff is only working for a few platforms right now.
#if ((NOT ((CMAKE_SYSTEM_NAME STREQUAL "Darwin") AND (CMAKE_C_COMPILER_ID STREQUAL "GNU"))))
# include(FetchContent)
# set(FETCHCONTENT_QUIET FALSE)
# set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
# set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games
# set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
# set(CUSTOMIZE_BUILD OFF CACHE BOOL "" FORCE)
#
# FetchContent_Declare(
# raylib
# GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
# GIT_TAG "master"
# GIT_PROGRESS TRUE
# )
# FetchContent_MakeAvailable(raylib)
#
# #if (EMSCRIPTEN)
# # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s GL_ENABLE_GET_PROC_ADDRESS=1 -s ALLOW_MEMORY_GROWTH")
# # set(CMAKE_EXECUTABLE_SUFFIX ".html")
# #endif ()
#
# add_executable(tazar-v1 ../tazar-v1/tazar_game.c ../tazar-v1/tazar_ai.c ../tazar-v1/tazar_ui.c ../tazar-v1/tazar_main.c)
# target_link_libraries(tazar-v1 PRIVATE compile-options raylib)
#endif ()
if ((NOT ((CMAKE_SYSTEM_NAME STREQUAL "Darwin") AND (CMAKE_C_COMPILER_ID STREQUAL "GNU"))))
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(CUSTOMIZE_BUILD OFF CACHE BOOL "" FORCE)

FetchContent_Declare(
raylib
GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
GIT_TAG "master"
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(raylib)

if (EMSCRIPTEN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s GL_ENABLE_GET_PROC_ADDRESS=1 -s ALLOW_MEMORY_GROWTH --shell-file shell.html")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
configure_file(../tazar-v1/shell.html shell.html COPYONLY)
endif ()

add_executable(tazar-v1 ../tazar-v1/tazar_game.c ../tazar-v1/tazar_ai.c ../tazar-v1/tazar_ui.c ../tazar-v1/tazar_main.c)
target_link_libraries(tazar-v1 PRIVATE compile-options raylib)
endif ()

add_executable(tazar-test ../tazar/tazar_game.c ../tazar/tazar_ai.c ../tazar/tazar_test.c)
target_link_libraries(tazar-test PRIVATE compile-options)

if (EMSCRIPTEN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH -s EXPORTED_FUNCTIONS=\"['_tazar_ai']\" -s EXPORTED_RUNTIME_METHODS=ccall,cwrap")
add_executable(tazar-wasm ../tazar/tazar_game.c ../tazar/tazar_ai.c ../tazar/tazar_wasm.c)
target_link_libraries(tazar-wasm PRIVATE compile-options)
configure_file(../tazar/index.html index.html COPYONLY)
configure_file(../tazar/tazar.js tazar.js COPYONLY)
endif ()
#if (EMSCRIPTEN)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH -s EXPORTED_FUNCTIONS=\"['_tazar_ai']\" -s EXPORTED_RUNTIME_METHODS=ccall,cwrap")
# add_executable(tazar-wasm ../tazar/tazar_game.c ../tazar/tazar_ai.c ../tazar/tazar_wasm.c)
# target_link_libraries(tazar-wasm PRIVATE compile-options)
# configure_file(../tazar/index.html index.html COPYONLY)
# configure_file(../tazar/tazar.js tazar.js COPYONLY)
#endif ()

# new project
Loading

0 comments on commit b85c7ea

Please sign in to comment.