diff options
author | Trumeet <yuuta@yuuta.moe> | 2022-07-29 11:56:55 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2022-07-29 11:56:55 -0700 |
commit | ff769a117046448dec8f09d86dfc661cda0bbc3b (patch) | |
tree | 850712959b05d988994cb1d40d85511e10651fd7 | |
parent | 41d27344c3b489466632bd2f1314fd69ff0a363c (diff) | |
download | acron-ff769a117046448dec8f09d86dfc661cda0bbc3b.tar acron-ff769a117046448dec8f09d86dfc661cda0bbc3b.tar.gz acron-ff769a117046448dec8f09d86dfc661cda0bbc3b.tar.bz2 acron-ff769a117046448dec8f09d86dfc661cda0bbc3b.zip |
build(helloworld): switch to Meson
-rw-r--r-- | client/helloworld/CMakeLists.txt | 50 | ||||
-rw-r--r-- | client/helloworld/main.c | 2 | ||||
-rw-r--r-- | client/helloworld/meson.build | 26 | ||||
-rw-r--r-- | client/helloworld/subprojects/json-c.wrap | 2 | ||||
l--------- | client/helloworld/subprojects/libacron | 1 |
5 files changed, 30 insertions, 51 deletions
diff --git a/client/helloworld/CMakeLists.txt b/client/helloworld/CMakeLists.txt deleted file mode 100644 index f36e020..0000000 --- a/client/helloworld/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -cmake_minimum_required(VERSION 3.22) -project(libac C) - -set(CMAKE_C_STANDARD 11) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) -endif() - -add_definitions(-D_POSIX_C_SOURCE=200809L) -IF(CMAKE_BUILD_TYPE MATCHES Debug) - add_definitions(-DDEBUG) -ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) - -if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_C_FLAGS_DEBUG - "${CMAKE_C_FLAGS_DEBUG} -g3 -O0 -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG - "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address") - set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -fvisibility=hidden") -elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") - # TODO: MSVC ASAN - set(CMAKE_C_FLAGS_DEBUG - "${CMAKE_C_FLAGS_DEBUG} /DEBUG /Z7 /Od") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG - "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") -endif() - -add_subdirectory(../libacron ${CMAKE_BINARY_DIR}/libac) - -# helloworld -if(WIN32) - set(APPS_DEPS ws2_32) -endif() -set(APPS_DEPS ${APPS_DEPS} ac) -add_executable(helloworld - main.c - net.c - net.h - ) -target_link_libraries(helloworld ${APPS_DEPS}) - -install(TARGETS helloworld - EXPORT ${PROJECT_NAME}-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/libac -) diff --git a/client/helloworld/main.c b/client/helloworld/main.c index cba7e30..6c46ed0 100644 --- a/client/helloworld/main.c +++ b/client/helloworld/main.c @@ -2,7 +2,7 @@ * Created by yuuta on 7/20/22. */ -#include "libac.h" +#include <libac.h> #include "net.h" #include <stdio.h> diff --git a/client/helloworld/meson.build b/client/helloworld/meson.build new file mode 100644 index 0000000..73832e2 --- /dev/null +++ b/client/helloworld/meson.build @@ -0,0 +1,26 @@ +project('helloworld', 'c', + version : '1.0', + license : 'GPL-2.0-only') + +xtra_link_args = [] +xtra_c_args = [ '-D_POSIX_C_SOURCE=200809L' ] +if get_option('debug') == true + xtra_c_args += '-DDEBUG' +endif + +libac_dep = dependency('ac', + fallback : ['libacron', 'libac_dep'], + default_options: [ 'default_library=static' ] +) + +sources = [ + 'net.c', + 'main.c' +] + +executable('helloworld', sources, + dependencies : [ libac_dep ], + link_args : xtra_link_args, + c_args : xtra_c_args, + install : true +) diff --git a/client/helloworld/subprojects/json-c.wrap b/client/helloworld/subprojects/json-c.wrap new file mode 100644 index 0000000..3b53361 --- /dev/null +++ b/client/helloworld/subprojects/json-c.wrap @@ -0,0 +1,2 @@ +[wrap-redirect] +filename = libacron/subprojects/json-c.wrap diff --git a/client/helloworld/subprojects/libacron b/client/helloworld/subprojects/libacron new file mode 120000 index 0000000..7af75e9 --- /dev/null +++ b/client/helloworld/subprojects/libacron @@ -0,0 +1 @@ +../../libacron
\ No newline at end of file |