2021-02-01 14:06:37 -08:00
|
|
|
cmake_minimum_required(VERSION 3.17)
|
|
|
|
project(flint C)
|
2021-12-10 12:41:36 -08:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2021-02-01 14:06:37 -08:00
|
|
|
|
2024-07-09 21:03:23 +00:00
|
|
|
if ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
|
|
|
|
add_compile_definitions(flint __USE_XOPEN_EXTENDED)
|
|
|
|
endif()
|
|
|
|
|
2021-02-01 14:06:37 -08:00
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
|
|
include_directories(include)
|
|
|
|
|
|
|
|
set(SOURCES
|
2023-07-12 11:32:21 -07:00
|
|
|
src/linkedlist.c
|
|
|
|
src/set.c
|
|
|
|
src/stack.c
|
|
|
|
src/binarytree.c
|
|
|
|
src/input.c
|
|
|
|
src/math.c
|
2023-12-03 17:08:04 -08:00
|
|
|
src/string.c
|
2023-10-25 07:56:41 -07:00
|
|
|
src/vector.c
|
2023-11-29 14:01:41 -08:00
|
|
|
src/utility.c
|
2024-03-28 15:19:05 -07:00
|
|
|
src/crypto.c
|
2024-04-05 11:13:08 -07:00
|
|
|
src/parsing.c
|
2024-07-09 21:03:23 +00:00
|
|
|
src/network.c
|
2024-07-16 10:49:08 -07:00
|
|
|
src/memory.c
|
2021-02-01 14:06:37 -08:00
|
|
|
)
|
|
|
|
|
2023-12-28 12:31:14 -08:00
|
|
|
if ((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin"))
|
2024-07-09 21:03:23 +00:00
|
|
|
add_library(flint ${SOURCES} src/macos.c)
|
2023-12-28 12:31:14 -08:00
|
|
|
else()
|
|
|
|
add_library(flint ${SOURCES})
|
|
|
|
endif()
|
|
|
|
|
2022-12-02 08:04:51 -08:00
|
|
|
if ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
|
2024-07-09 21:03:23 +00:00
|
|
|
target_link_libraries(flint pthread bsd)
|
2022-03-30 16:36:00 -07:00
|
|
|
endif()
|
2021-02-01 14:06:37 -08:00
|
|
|
|
|
|
|
if(${CMAKE_PROJECT_NAME} STREQUAL flint)
|
|
|
|
add_executable(tests tests/tests.c)
|
|
|
|
target_include_directories(tests PRIVATE include)
|
|
|
|
|
2023-10-25 09:21:59 -07:00
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
2024-07-09 21:03:23 +00:00
|
|
|
target_link_libraries(tests flint pthread bsd)
|
|
|
|
else()
|
|
|
|
target_link_libraries(tests flint pthread)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(netmanual tests/netmanual.c)
|
|
|
|
target_include_directories(netmanual PRIVATE include)
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
target_link_libraries(netmanual flint pthread bsd)
|
2023-10-25 09:21:59 -07:00
|
|
|
else()
|
2024-07-09 21:03:23 +00:00
|
|
|
target_link_libraries(netmanual flint pthread)
|
2023-07-12 11:45:30 -07:00
|
|
|
endif()
|
|
|
|
endif()
|