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-30 07:15:51 +00:00
|
|
|
# DO NOT USE THESE KEYS, TESTING ONLY
|
|
|
|
if(NOT LAIKA_PUBKEY)
|
2022-02-03 22:25:49 +00:00
|
|
|
set(LAIKA_PUBKEY "40d5534aca77d1f5ec2bbe79dd9d0f52a78148918f95814404cefe97c34c5c27")
|
2022-01-30 07:15:51 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if(NOT LAIKA_PRIVKEY)
|
2022-02-18 21:26:29 +00:00
|
|
|
set(LAIKA_PRIVKEY "90305aa77023d1c1e03265c3b6af046eb58d6ec8ba650b0dffed01379feab8cc")
|
2022-01-30 07:15:51 +00:00
|
|
|
endif ()
|
|
|
|
|
2022-03-15 18:05:11 +00:00
|
|
|
if(NOT LAIKA_CNC_IP)
|
|
|
|
set(LAIKA_CNC_IP "127.0.0.1")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if(NOT LAIKA_CNC_PORT)
|
|
|
|
set(LAIKA_CNC_PORT "13337")
|
|
|
|
endif ()
|
|
|
|
|
2022-01-24 03:28:16 +00:00
|
|
|
# version details
|
2022-01-25 17:58:36 +00:00
|
|
|
set(LAIKA_VERSION_MAJOR 0)
|
2022-05-11 01:28:54 +00:00
|
|
|
set(LAIKA_VERSION_MINOR 2)
|
2022-03-14 02:48:09 +00:00
|
|
|
set(SODIUM_DISABLE_TESTS ON)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
2022-05-11 19:50:42 +00:00
|
|
|
# vmbox config location
|
|
|
|
set(LAIKA_VMBOXCONFIG ${LIB_INCLUDEDIR}/lboxconfig.h PARENT_SCOPE)
|
|
|
|
|
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
|
|
|
|
2022-02-18 21:26:29 +00:00
|
|
|
message(STATUS "Building config file...")
|
2022-01-30 07:15:51 +00:00
|
|
|
configure_file(${LIB_INCLUDEDIR}/lconfig.h.in ${LIB_INCLUDEDIR}/lconfig.h)
|
|
|
|
|
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)
|
|
|
|
|
2022-03-14 05:51:11 +00:00
|
|
|
# include libsodium
|
|
|
|
add_subdirectory(libsodium)
|
|
|
|
|
2022-01-24 03:28:16 +00:00
|
|
|
# compile LaikaLib library
|
2022-02-17 23:38:34 +00:00
|
|
|
file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c ${CMAKE_CURRENT_SOURCE_DIR}/vendor/**.c)
|
2022-03-14 05:51:11 +00:00
|
|
|
file(GLOB_RECURSE LIBHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
|
|
|
add_library(LaikaLib STATIC ${LIBSOURCE} ${LIBHEADERS})
|
2022-03-14 17:21:29 +00:00
|
|
|
target_link_libraries(LaikaLib PUBLIC sodium)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
# add the version definitions and the 'DEBUG' preprocessor definition if we're compiling as Debug
|
2022-01-30 07:15:51 +00:00
|
|
|
target_compile_definitions(LaikaLib PUBLIC "$<$<CONFIG:Debug>:DEBUG>")
|
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})
|