Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Sep 30, 2024
1 parent de54d9c commit 7675c83
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
51 changes: 24 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
cmake_minimum_required(VERSION 3.20)

project(carimbo)
project(carimbo LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(SDL2_MAIN SDL2::SDL2main)

find_package(CURL CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(Ogg CONFIG REQUIRED)
Expand All @@ -25,41 +23,38 @@ file(GLOB SOURCE_FILES "src/*.cpp")
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_precompile_headers(${PROJECT_NAME} PRIVATE ${HEADER_FILES})

option(SANDBOX "Use sandbox" OFF)

if(SANDBOX)
add_definitions(-DSANDBOX)
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
target_link_libraries(${PROJECT_NAME} PRIVATE "-s EVAL_CTORS=1")
target_link_libraries(${PROJECT_NAME} PRIVATE "-s WASM_BIGINT=1")
target_link_libraries(${PROJECT_NAME} PRIVATE "-s DISABLE_EXCEPTION_CATCHING=1")
target_link_libraries(${PROJECT_NAME} PRIVATE "-s ALLOW_MEMORY_GROWTH=1")
target_link_libraries(${PROJECT_NAME} PRIVATE "-s INITIAL_MEMORY=134217728")
target_link_libraries(${PROJECT_NAME} PRIVATE "-s EXPORTED_RUNTIME_METHODS=['callMain']")
# target_link_libraries(${PROJECT_NAME} PRIVATE "-s USE_PTHREADS=1" "-pthread")

# target_link_libraries(${PROJECT_NAME} PRIVATE "--profiling")
# target_link_libraries(${PROJECT_NAME} PRIVATE "-s RUNTIME_DEBUG")
# target_link_libraries(${PROJECT_NAME} PRIVATE "-s ASSERTIONS=1")
# target_link_libraries(${PROJECT_NAME} PRIVATE "-s NO_DISABLE_EXCEPTION_CATCHING")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -pedantic -O3 -flto)
elseif(CMAKE_BUILD_TYPE MATCHES "Debug")
if(CMAKE_BUILD_TYPE MATCHES "Debug")
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /Od /Zi)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -O0 -g)
endif()
elseif (CMAKE_BUILD_TYPE MATCHES "Release")
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /O3 /GL)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /O2 /GL)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -pedantic -O3 -flto)
endif()
endif()

configure_file(${CMAKE_SOURCE_DIR}/assets/index.html ${CMAKE_BINARY_DIR}/index.html COPYONLY)
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(EMSCRIPTEN_OPTIONS
"-s EVAL_CTORS=1"
"-s WASM_BIGINT=1"
"-s DISABLE_EXCEPTION_CATCHING=1"
"-s ALLOW_MEMORY_GROWTH=1"
"-s INITIAL_MEMORY=134217728"
"-s EXPORTED_RUNTIME_METHODS=['callMain']"
)

target_link_libraries(${PROJECT_NAME} PRIVATE ${EMSCRIPTEN_OPTIONS})
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -pedantic -O3 -flto)
endif()

option(SANDBOX "Use sandbox" OFF)
if(SANDBOX)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DSANDBOX)
endif()

target_link_libraries(${PROJECT_NAME} PRIVATE
CURL::libcurl
Expand All @@ -77,3 +72,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL::OpenAL)
endif()

configure_file(${CMAKE_SOURCE_DIR}/assets/index.html ${CMAKE_BINARY_DIR}/index.html COPYONLY)
2 changes: 1 addition & 1 deletion src/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
extern "C" {
#include <AL/al.h>

Check failure on line 10 in src/common.hpp

View workflow job for this annotation

GitHub Actions / lint

src/common.hpp:10:10 [clang-diagnostic-error]

'AL/al.h' file not found
#include <AL/alc.h>
// #include <AL/alext.h>
#include <AL/alext.h>
#include <SDL2/SDL.h>
#include <curl/curl.h>
#include <ogg/ogg.h>
Expand Down

0 comments on commit 7675c83

Please sign in to comment.