2022-05-14 18:24:20 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2022-01-24 03:28:16 +00:00
|
|
|
|
|
|
|
set(BOT_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
|
2022-01-25 18:13:04 +00:00
|
|
|
project(LaikaBot VERSION 1.0)
|
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 LaikaBot
|
|
|
|
file(GLOB_RECURSE BOTSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
2022-03-14 05:51:11 +00:00
|
|
|
file(GLOB_RECURSE BOTHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
2022-03-17 23:22:26 +00:00
|
|
|
|
|
|
|
# include platform specific backends
|
|
|
|
if(WIN32)
|
|
|
|
file(GLOB_RECURSE BOTPLATFORMSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/win/**.c)
|
2022-06-05 20:51:18 +00:00
|
|
|
if (NOT LAIKA_DEBUG_BUILD)
|
2022-06-04 15:26:25 +00:00
|
|
|
set(BOTFLAGS WIN32)
|
|
|
|
endif ()
|
2022-03-17 23:22:26 +00:00
|
|
|
elseif(UNIX AND NOT APPLE)
|
|
|
|
file(GLOB_RECURSE BOTPLATFORMSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/lin/**.c)
|
|
|
|
set(BOTPLATFORMLIBS util)
|
|
|
|
endif ()
|
|
|
|
|
2022-05-15 23:14:29 +00:00
|
|
|
add_executable(LaikaBot ${BOTFLAGS} ${BOTSOURCE} ${BOTHEADERS} ${BOTPLATFORMSOURCE})
|
2022-03-17 23:22:26 +00:00
|
|
|
target_link_libraries(LaikaBot PUBLIC LaikaLib ${BOTPLATFORMLIBS})
|
2022-01-24 03:28:16 +00:00
|
|
|
|
2022-05-15 20:27:54 +00:00
|
|
|
# make sure lboxconfig.h is generated before building
|
|
|
|
if(LAIKA_OBFUSCATE)
|
|
|
|
add_dependencies(LaikaBot VMBoxGen)
|
|
|
|
endif ()
|
|
|
|
|
2022-01-24 03:28:16 +00:00
|
|
|
# add include directory
|
2022-05-01 19:21:44 +00:00
|
|
|
target_include_directories(LaikaBot PUBLIC ${BOT_INCLUDEDIR})
|
|
|
|
|
2022-05-11 02:03:23 +00:00
|
|
|
# strip symbols for UNIX binaries
|
2022-06-05 20:51:18 +00:00
|
|
|
if((UNIX AND NOT APPLE) AND NOT LAIKA_DEBUG_BUILD)
|
2022-05-01 19:21:44 +00:00
|
|
|
message(STATUS "Stripping LaikaBot symbols...")
|
|
|
|
target_link_options(LaikaBot PRIVATE -s)
|
|
|
|
endif ()
|