2022-05-14 18:24:20 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
set(LIB_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
|
2022-01-25 17:58:36 +00:00
|
|
|
project(LaikaLib VERSION ${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
|
|
|
# compile LaikaLib library
|
2022-09-02 01:00:37 +00:00
|
|
|
file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
2022-03-14 05:51:11 +00:00
|
|
|
file(GLOB_RECURSE LIBHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
2022-07-16 21:09:33 +00:00
|
|
|
|
|
|
|
# include platform specific backends
|
|
|
|
if(WIN32)
|
|
|
|
file(GLOB_RECURSE LIBPLATFORMSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/win/**.c)
|
|
|
|
elseif(UNIX AND NOT APPLE)
|
|
|
|
file(GLOB_RECURSE LIBPLATFORMSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/lin/**.c)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
add_library(LaikaLib STATIC ${LIBSOURCE} ${LIBHEADERS} ${LIBPLATFORMSOURCE})
|
2022-03-14 17:21:29 +00:00
|
|
|
target_link_libraries(LaikaLib PUBLIC sodium)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
2022-05-19 17:32:39 +00:00
|
|
|
# make sure we're compiled *AFTER* lboxconfig.h has been generated
|
|
|
|
add_dependencies(LaikaLib VMBoxGen)
|
|
|
|
|
2022-10-06 01:36:49 +00:00
|
|
|
# add the version definitions
|
|
|
|
target_compile_definitions(LaikaLib PUBLIC)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# add include directory
|
2022-03-14 05:51:11 +00:00
|
|
|
target_include_directories(LaikaLib PUBLIC ${LIB_INCLUDEDIR} ${CMAKE_CURRENT_SOURCE_DIR}/libsodium/libsodium/src/libsodium/include)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# set library name
|
2022-01-25 17:58:36 +00:00
|
|
|
set_target_properties(LaikaLib PROPERTIES OUTPUT_NAME laika-${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|