Add cmake support

This commit is contained in:
Bjoern Kerler
2020-04-16 10:57:53 +02:00
committed by Philippe Teuwen
parent edb96e75cf
commit 6b1a8b8390
11 changed files with 908 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
include(tinycbor.cmake)
include(jansson.cmake)
include(lua.cmake)
include(mbedtls.cmake)
include(amiibo.cmake)
include(reveng.cmake)
include(zlib.cmake)
include(hardnested.cmake)

28
client/deps/amiibo.cmake Normal file
View File

@@ -0,0 +1,28 @@
# just for testing amiitool before complete migration into a lib:
#amiitool:
#gcc $(CFLAGS) \
#amiitool.c $(MYSRCS) ../../../../common/../../commonutil.c ../ui.c -lreadline -lm ../../../../common/mbedtls/libmbedtls.a \
#-o amiitool
set_property(SOURCE PROPERTY C_STANDARD 99)
add_definitions(-D_ISOC99_SOURCE)
include_directories(jansson)
include_directories(../../common)
include_directories(../../common/include)
include_directories(amiitool)
add_library(amiibo
jansson/dump.c
jansson/error.c
jansson/hashtable.c
jansson/hashtable_seed.c
jansson/load.c
jansson/memory.c
jansson/pack_unpack.c
jansson/strbuffer.c
jansson/strconv.c
jansson/utf.c
jansson/path.c
jansson/value.c
)

View File

@@ -0,0 +1,115 @@
set_property(SOURCE PROPERTY C_STANDARD 99)
add_definitions(-DHAVE_STDINT_H)
include_directories(hardnested)
## CPU-specific code
## These are mostly for x86-based architectures, which is not useful for many Android devices.
add_library(hardnested_nosimd OBJECT
hardnested/hardnested_bf_core.c
hardnested/hardnested_bitarray_core.c)
target_include_directories(hardnested_nosimd PRIVATE
../../common
../../include
hardnested)
set(X86_CPUS x86 x86_64 i686)
message(STATUS "CMAKE_SYSTEM_PROCESSOR := ${CMAKE_SYSTEM_PROCESSOR}")
if ("${CMAKE_SYSTEM_PROCESSOR}" IN_LIST X86_CPUS)
message(STATUS "Building optimised x86/x86_64 binaries")
target_compile_options(hardnested_nosimd BEFORE PRIVATE
-mno-mmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f)
set_property(TARGET hardnested_nosimd PROPERTY POSITION_INDEPENDENT_CODE ON)
## x86 / MMX
add_library(hardnested_mmx OBJECT
hardnested/hardnested_bf_core.c
hardnested/hardnested_bitarray_core.c)
target_compile_options(hardnested_mmx BEFORE PRIVATE
-mmmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f)
target_include_directories(hardnested_mmx PRIVATE
../../common
../../include
hardnested)
set_property(TARGET hardnested_mmx PROPERTY POSITION_INDEPENDENT_CODE ON)
## x86 / SSE2
add_library(hardnested_sse2 OBJECT
hardnested/hardnested_bf_core.c
hardnested/hardnested_bitarray_core.c)
target_compile_options(hardnested_sse2 BEFORE PRIVATE
-mmmx -msse2 -mno-avx -mno-avx2 -mno-avx512f)
target_include_directories(hardnested_sse2 PRIVATE
../../common
../../include
hardnested)
set_property(TARGET hardnested_sse2 PROPERTY POSITION_INDEPENDENT_CODE ON)
## x86 / AVX
add_library(hardnested_avx OBJECT
hardnested/hardnested_bf_core.c
hardnested/hardnested_bitarray_core.c)
target_compile_options(hardnested_avx BEFORE PRIVATE
-mmmx -msse2 -mavx -mno-avx2 -mno-avx512f)
target_include_directories(hardnested_avx PRIVATE
../../common
../../include
hardnested)
set_property(TARGET hardnested_avx PROPERTY POSITION_INDEPENDENT_CODE ON)
## x86 / AVX2
add_library(hardnested_avx2 OBJECT
hardnested/hardnested_bf_core.c
hardnested/hardnested_bitarray_core.c)
target_compile_options(hardnested_avx2 BEFORE PRIVATE
-mmmx -msse2 -mavx -mavx2 -mno-avx512f)
target_include_directories(hardnested_avx2 PRIVATE
../../common
../../include
hardnested)
set_property(TARGET hardnested_avx2 PROPERTY POSITION_INDEPENDENT_CODE ON)
## x86 / AVX512
add_library(hardnested_avx512 OBJECT
hardnested/hardnested_bf_core.c
hardnested/hardnested_bitarray_core.c)
target_compile_options(hardnested_avx512 BEFORE PRIVATE
-mmmx -msse2 -mavx -mavx2 -mavx512f)
target_include_directories(hardnested_avx512 PRIVATE
../../common
../../include
hardnested)
set_property(TARGET hardnested_avx512 PROPERTY POSITION_INDEPENDENT_CODE ON)
set(SIMD_TARGETS
$<TARGET_OBJECTS:hardnested_mmx>
$<TARGET_OBJECTS:hardnested_sse2>
$<TARGET_OBJECTS:hardnested_avx>
$<TARGET_OBJECTS:hardnested_avx2>
$<TARGET_OBJECTS:hardnested_avx512>)
else ()
message(STATUS "Not building optimised targets")
set(SIMD_TARGETS)
endif ()
add_library(hardnested STATIC
$<TARGET_OBJECTS:hardnested_nosimd>
${SIMD_TARGETS})

18
client/deps/jansson.cmake Normal file
View File

@@ -0,0 +1,18 @@
set_property(SOURCE PROPERTY C_STANDARD 99)
add_definitions(-DHAVE_STDINT_H)
include_directories(jansson)
add_library(jansson
jansson/dump.c
jansson/error.c
jansson/hashtable.c
jansson/hashtable_seed.c
jansson/load.c
jansson/memory.c
jansson/pack_unpack.c
jansson/strbuffer.c
jansson/strconv.c
jansson/utf.c
jansson/path.c
jansson/value.c
)

58
client/deps/lua.cmake Normal file
View File

@@ -0,0 +1,58 @@
add_definitions(-DLUA_COMPAT_ALL $(SYSCFLAGS))
include_directories(liblua)
set(SYSCFLAGS "-DLUA_COMPAT_ALL")
if (UNIX)
set(SYSCFLAGS "-DLUA_USE_LINUX")
endif (UNIX)
if (WIN32)
set(SYSCFLAGS "-DLUA_USE_LINUX")
endif (WIN32)
if (MINGW)
set(SYSCFLAGS "-DLUA_COMPAT_ALL $(SYSCFLAGS)")
endif (MINGW)
if (APPLE)
set(SYSCFLAGS "-DLUA_USE_MACOSX")
endif (APPLE)
add_definitions($(SYSCFLAGS))
add_library(lua
liblua/lapi.c
liblua/lcode.c
liblua/lctype.c
liblua/ldebug.c
liblua/ldo.c
liblua/ldump.c
liblua/lfunc.c
liblua/lgc.c
liblua/llex.c
liblua/lmem.c
liblua/lobject.c
liblua/lopcodes.c
liblua/lparser.c
liblua/lstate.c
liblua/lstring.c
liblua/ltable.c
liblua/ltm.c
liblua/lundump.c
liblua/lvm.c
liblua/lzio.c
liblua/lauxlib.c
liblua/lbaselib.c
liblua/lbitlib.c
liblua/lcorolib.c
liblua/ldblib.c
liblua/liolib.c
liblua/lmathlib.c
liblua/loslib.c
liblua/lstrlib.c
liblua/ltablib.c
liblua/loadlib.c
liblua/linit.c
)

49
client/deps/mbedtls.cmake Normal file
View File

@@ -0,0 +1,49 @@
set_property(SOURCE PROPERTY C_STANDARD 99)
add_definitions(-DHAVE_STDINT_H)
include_directories(../../common)
add_library(mbedtls
../../common/mbedtls/aes.c
../../common/mbedtls/asn1parse.c
../../common/mbedtls/asn1write.c
../../common/mbedtls/base64.c
../../common/mbedtls/bignum.c
../../common/mbedtls/ctr_drbg.c
../../common/mbedtls/entropy_poll.c
../../common/mbedtls/entropy.c
../../common/mbedtls/error.c
../../common/mbedtls/timing.c
../../common/mbedtls/ecp.c
../../common/mbedtls/ecp_curves.c
../../common/mbedtls/certs.c
../../common/mbedtls/camellia.c
../../common/mbedtls/blowfish.c
../../common/mbedtls/cipher_wrap.c
../../common/mbedtls/cipher.c
../../common/mbedtls/cmac.c
../../common/mbedtls/des.c
../../common/mbedtls/ecdsa.c
../../common/mbedtls/md.c
../../common/mbedtls/md_wrap.c
../../common/mbedtls/md5.c
../../common/mbedtls/oid.c
../../common/mbedtls/pem.c
../../common/mbedtls/arc4.c
../../common/mbedtls/pk.c
../../common/mbedtls/pk_wrap.c
../../common/mbedtls/pkwrite.c
../../common/mbedtls/pkcs5.c
../../common/mbedtls/pkcs12.c
../../common/mbedtls/pkparse.c
../../common/mbedtls/platform.c
../../common/mbedtls/platform_util.c
../../common/mbedtls/rsa.c
../../common/mbedtls/rsa_internal.c
../../common/mbedtls/sha1.c
../../common/mbedtls/sha256.c
../../common/mbedtls/sha512.c
../../common/mbedtls/threading.c
../../common/mbedtls/x509.c
../../common/mbedtls/x509_crl.c
../../common/mbedtls/x509_crt.c
)

15
client/deps/reveng.cmake Normal file
View File

@@ -0,0 +1,15 @@
set_property(SOURCE PROPERTY C_STANDARD 99)
add_definitions(-DPRESETS)
include_directories(reveng)
include_directories(.)
add_library(reveng
reveng/bmpbit.c
reveng/cli.c
reveng/getopt.c
reveng/model.c
reveng/poly.c
reveng/preset.c
reveng/reveng.c
)

View File

@@ -0,0 +1,10 @@
add_library(tinycbor
tinycbor/cborencoder.c
tinycbor/cborencoder_close_container_checked.c
tinycbor/cborerrorstrings.c
tinycbor/cborparser.c
tinycbor/cborparser_dup_string.c
tinycbor/cborpretty.c
tinycbor/cbortojson.c
tinycbor/cborvalidation.c
)

15
client/deps/zlib.cmake Normal file
View File

@@ -0,0 +1,15 @@
set_property(SOURCE PROPERTY C_STANDARD 99)
add_definitions(-D_ISOC99_SOURCE -DZ_SOLO -DNO_GZIP -DZLIB_PM3_TUNED)
include_directories(../../common/zlib)
add_library(z
../../common/zlib/deflate.c
../../common/zlib/adler32.c
../../common/zlib/trees.c
../../common/zlib/zutil.c
../../common/zlib/inflate.c
../../common/zlib/inffast.c
../../common/zlib/inftrees.c
)