mirror of
https://github.com/CPunch/Laika.git
synced 2024-11-21 20:40:05 +00:00
Minor cmake refactoring
This commit is contained in:
parent
1d7efeba24
commit
9432aaf594
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "cmake-modules/libsodium"]
|
[submodule "cmake-modules/libsodium"]
|
||||||
path = cmake-modules/libsodium
|
path = lib/libsodium
|
||||||
url = https://github.com/robinlinden/libsodium-cmake.git
|
url = https://github.com/robinlinden/libsodium-cmake.git
|
||||||
|
@ -36,7 +36,6 @@ endif ()
|
|||||||
set(SODIUM_DISABLE_TESTS ON)
|
set(SODIUM_DISABLE_TESTS ON)
|
||||||
set(SODIUM_MINIMAL ON)
|
set(SODIUM_MINIMAL ON)
|
||||||
set(SODIUM_STATIC ON)
|
set(SODIUM_STATIC ON)
|
||||||
add_subdirectory(cmake-modules/libsodium)
|
|
||||||
|
|
||||||
# compile laikalib, tools, cnc & bot
|
# compile laikalib, tools, cnc & bot
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
@ -9,7 +9,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|||||||
|
|
||||||
# compile LaikaBot
|
# compile LaikaBot
|
||||||
file(GLOB_RECURSE BOTSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
file(GLOB_RECURSE BOTSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
||||||
add_executable(LaikaBot ${BOTSOURCE})
|
file(GLOB_RECURSE BOTHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
||||||
|
add_executable(LaikaBot ${BOTSOURCE} ${BOTHEADERS})
|
||||||
target_link_libraries(LaikaBot PUBLIC LaikaLib)
|
target_link_libraries(LaikaBot PUBLIC LaikaLib)
|
||||||
|
|
||||||
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
|
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
|
||||||
|
@ -9,7 +9,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|||||||
|
|
||||||
# compile LaikaCNC
|
# compile LaikaCNC
|
||||||
file(GLOB_RECURSE CNCSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
file(GLOB_RECURSE CNCSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
||||||
add_executable(LaikaCNC ${CNCSOURCE})
|
file(GLOB_RECURSE CNCHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
||||||
|
add_executable(LaikaCNC ${CNCSOURCE} ${CNCHEADERS})
|
||||||
target_link_libraries(LaikaCNC PUBLIC LaikaLib)
|
target_link_libraries(LaikaCNC PUBLIC LaikaLib)
|
||||||
|
|
||||||
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
|
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
|
||||||
|
@ -24,16 +24,20 @@ configure_file(${LIB_INCLUDEDIR}/lconfig.h.in ${LIB_INCLUDEDIR}/lconfig.h)
|
|||||||
# Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder
|
# Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
# include libsodium
|
||||||
|
add_subdirectory(libsodium)
|
||||||
|
|
||||||
# compile LaikaLib library
|
# compile LaikaLib library
|
||||||
file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c ${CMAKE_CURRENT_SOURCE_DIR}/vendor/**.c)
|
file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c ${CMAKE_CURRENT_SOURCE_DIR}/vendor/**.c)
|
||||||
add_library(LaikaLib STATIC ${LIBSOURCE})
|
file(GLOB_RECURSE LIBHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
||||||
|
add_library(LaikaLib STATIC ${LIBSOURCE} ${LIBHEADERS})
|
||||||
target_link_libraries(LaikaLib PRIVATE sodium)
|
target_link_libraries(LaikaLib PRIVATE sodium)
|
||||||
|
|
||||||
# add the version definitions and the 'DEBUG' preprocessor definition if we're compiling as Debug
|
# add the version definitions and the 'DEBUG' preprocessor definition if we're compiling as Debug
|
||||||
target_compile_definitions(LaikaLib PUBLIC "$<$<CONFIG:Debug>:DEBUG>")
|
target_compile_definitions(LaikaLib PUBLIC "$<$<CONFIG:Debug>:DEBUG>")
|
||||||
|
|
||||||
# add include directory
|
# add include directory
|
||||||
target_include_directories(LaikaLib PUBLIC ${LIB_INCLUDEDIR} ${sodium_INCLUDE_DIR})
|
target_include_directories(LaikaLib PUBLIC ${LIB_INCLUDEDIR} ${CMAKE_CURRENT_SOURCE_DIR}/libsodium/libsodium/src/libsodium/include)
|
||||||
|
|
||||||
# set library name
|
# set library name
|
||||||
set_target_properties(LaikaLib PROPERTIES OUTPUT_NAME laika-${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|
set_target_properties(LaikaLib PROPERTIES OUTPUT_NAME laika-${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|
||||||
|
@ -9,7 +9,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|||||||
|
|
||||||
# compile LaikaShell
|
# compile LaikaShell
|
||||||
file(GLOB_RECURSE SHELLSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
file(GLOB_RECURSE SHELLSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
|
||||||
add_executable(LaikaShell ${SHELLSOURCE})
|
file(GLOB_RECURSE SHELLHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
|
||||||
|
add_executable(LaikaShell ${SHELLSOURCE} ${SHELLHEADERS})
|
||||||
target_link_libraries(LaikaShell PUBLIC LaikaLib)
|
target_link_libraries(LaikaShell PUBLIC LaikaLib)
|
||||||
|
|
||||||
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
|
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
|
||||||
|
Loading…
Reference in New Issue
Block a user