support building tomato as a lib/shared object

This commit is contained in:
Green Sky 2024-05-29 10:38:57 +02:00
parent ba7188cf66
commit ef79aa8b80
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -18,6 +18,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
option(TOMATO_MAIN_SO "Build tomato as a shared object (for eg android apps)" ANDROID)
option(TOMATO_ASAN "Build tomato with asan (gcc/clang/msvc)" OFF)
if (TOMATO_ASAN)

View File

@ -1,8 +1,15 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.9...3.24 FATAL_ERROR)
########################################
add_executable(tomato
if (TOMATO_MAIN_SO)
add_library(tomato MODULE)
target_compile_definitions(tomato PUBLIC TOMATO_MAIN_SO)
else()
add_executable(tomato)
endif()
target_sources(tomato PUBLIC
./main.cpp
./icon.rc