Merge pull request #45 from nurupo/master

Improved build system
This commit is contained in:
irungentoo 2013-07-17 15:46:59 -07:00
commit e02620c7be
13 changed files with 117 additions and 26 deletions

6
.gitignore vendored
View File

@ -3,3 +3,9 @@
//nacl build //nacl build
nacl/build/ nacl/build/
build build
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt

View File

@ -1,6 +1,7 @@
language: c language: c
compiler: compiler:
- gcc - gcc
- clang
before_script: before_script:
- git clone git://github.com/jedisct1/libsodium.git - git clone git://github.com/jedisct1/libsodium.git
@ -14,7 +15,9 @@ before_script:
script: script:
- cmake CMakeLists.txt - cmake CMakeLists.txt
- make -j3 - make DHT_bootstrap -j3
- make Messenger_test -j3
- make nTox -j3
notifications: notifications:
email: false email: false

View File

@ -1,7 +1,15 @@
cmake_minimum_required(VERSION 2.6.0) cmake_minimum_required(VERSION 2.6.0)
project(TOX C)
set(exe_name toxMessengerTest) if(NOT WIN32)
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
endif()
endif()
if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
endif()
set(core_sources set(core_sources
core/DHT.c core/DHT.c
@ -9,29 +17,21 @@ set(core_sources
core/Lossless_UDP.c core/Lossless_UDP.c
core/net_crypto.c core/net_crypto.c
core/Messenger.c) core/Messenger.c)
if(WIN32)
set(test_sources
testing/Messenger_test.c)
else()
set(test_sources
testing/nTox.c)
#testing/Messenger_test.c)
endif()
add_executable(${exe_name} add_library(core ${core_sources})
${core_sources}
${test_sources})
if(WIN32) macro(linkCoreLibraries exe_name)
include_directories(${TOX_SOURCE_DIR}/sodium/include/) if(WIN32)
target_link_libraries(${exe_name} ws2_32 target_link_libraries(${exe_name} core
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a) ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
else() ws2_32)
target_link_libraries(${exe_name} sodium) else()
target_link_libraries(${exe_name} ncurses) target_link_libraries(${exe_name} core
endif() sodium)
endif()
endmacro()
if(CMAKE_COMPILER_IS_GNUCC) cmake_policy(SET CMP0011 NEW)
message(STATUS "==== GCC detected - Adding compiler flags ====")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") ADD_SUBDIRECTORY(testing)
endif() ADD_SUBDIRECTORY(other)

1
other/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_bootstrap.cmake)

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(DHT_bootstrap C)
set(exe_name DHT_bootstrap)
add_executable(${exe_name}
DHT_bootstrap.c)
linkCoreLibraries(${exe_name})

7
testing/CMakeLists.txt Normal file
View File

@ -0,0 +1,7 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_cryptosendfiletest.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_sendfiletest.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_test.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testclient.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox.cmake)

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(DHT_cryptosendfiletest C)
set(exe_name DHT_cryptosendfiletest)
add_executable(${exe_name}
DHT_cryptosendfiletest.c)
linkCoreLibraries(${exe_name})

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(DHT_sendfiletest C)
set(exe_name DHT_sendfiletest)
add_executable(${exe_name}
DHT_sendfiletest.c)
linkCoreLibraries(${exe_name})

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(DHT_test C)
set(exe_name DHT_test)
add_executable(${exe_name}
DHT_test.c)
linkCoreLibraries(${exe_name})

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(Lossless_UDP_testclient C)
set(exe_name Lossless_UDP_testclient)
add_executable(${exe_name}
Lossless_UDP_testclient.c)
linkCoreLibraries(${exe_name})

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(Lossless_UDP_testserver C)
set(exe_name Lossless_UDP_testserver)
add_executable(${exe_name}
Lossless_UDP_testserver.c)
linkCoreLibraries(${exe_name})

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6.0)
project(Messenger_test C)
set(exe_name Messenger_test)
add_executable(${exe_name}
Messenger_test.c)
linkCoreLibraries(${exe_name})

11
testing/cmake/nTox.cmake Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 2.6.0)
project(nTox C)
set(exe_name nTox)
add_executable(${exe_name}
nTox.c)
target_link_libraries(${exe_name} ncurses)
linkCoreLibraries(${exe_name})