CMake stuff

FossilOrigin-Name: fe1c7dd140d5709f64904904144c835c1e8e2e2a494895b607ec54bdbab92a8c
This commit is contained in:
nekobit 2022-12-02 17:14:20 +00:00
parent bf586e1e92
commit 97eb61fd45
3 changed files with 54 additions and 1 deletions

View File

@ -13,4 +13,5 @@ test/tests
scripts/*.o
templates/*.ctt
test/unit/*.bin
compile_commands.json
compile_commands.json
build/

51
CMakeLists.txt Normal file
View File

@ -0,0 +1,51 @@
# Invocations
# cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# cmake -DCMAKE_BUILD_TYPE=Release ..
cmake_minimum_required(VERSION 3.14)
project(treebird
VERSION 0.7
DESCRIPTION "A very lightweight and beautiful Pleroma frontend"
LANGUAGES C)
include(cmake/helpers.cmake)
find_package(FCGI REQUIRED)
find_package(PERL REQUIRED)
# Useful for GNU Emacs or VS Code
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Setup compile options
add_compile_options(
-Wall -Wextra -std=c99
-Wshadow -Wcast-align -Wstrict-prototypes
$<$<CONFIG:DEBUG>:-Og>
$<$<CONFIG:DEBUG>:-g>
$<$<CONFIG:RELEASE>:-O2>
)
include_directories(include)
# Read CMakeLists.txt in test file
add_subdirectory(test)
set_and_def(SRC_FILES
)
# Compile with X11
if(X11_FOUND)
set(SRC_FILES ${SRC_FILES}
src/x11/treebird_x11_context.c
src/x11/treebird_x11_window.c
)
add_definitions(-DTREEBIRD_USE_X11_BACKEND)
endif(X11_FOUND)
add_executable(treebird SHARED ${SRC_FILES})
target_include_directories(treebird PUBLIC ${X11_xcb_INCLUDE_PATH})
# Build! Note the mastodont hack, this _should_ change soon.
target_link_libraries(treebird PUBLIC ${_LIB} mastodont-c/libmastodont.a)

1
cmake/helpers.cmake Normal file
View File

@ -0,0 +1 @@
message("hello world")