Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CMake. #39

Merged
merged 42 commits into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1f2998a
[0.0.1] Pre-release
Jun 10, 2012
d3f2339
Bug on processing nested functions fixed
Jun 10, 2012
bd1cc78
Exclude compiled executable file from git tree
Jun 11, 2012
aac3628
Add the argument of FILE* to formula_print
Jun 12, 2012
1bef5c4
Support negative value and function
Jun 12, 2012
6e66fe6
Bug on operation priority and line-head minus sign fixed
Sep 7, 2012
a26da8f
Cleaned link settings and dependencies
at-wat Jun 14, 2014
2150b21
Disable maintainer mode in configure script
at-wat Jun 17, 2014
33b7c96
Fix operator priority
at-wat Feb 17, 2016
92752f4
Add boolean operators
at-wat Feb 17, 2016
0615af7
Add const attribute to the string input
at-wat Feb 17, 2016
aa50051
Add extern C for C++
at-wat Feb 17, 2016
8425866
Use cmake. (#1)
at-wat Jul 28, 2017
ae6caeb
Add const attribute.
at-wat Jul 28, 2017
82bbe8e
Fix abs().
at-wat Jul 28, 2017
b122f7c
Add test and CI settings. (#3)
at-wat Jul 28, 2017
6a7ea8d
Use cmake.
at-wat Jul 28, 2017
cd05a92
Revert local changes on formula-calc.
at-wat Jul 28, 2017
4522e8f
Subtree merge formula-calc library.
at-wat Jul 28, 2017
39f62b9
Add support for windows.
at-wat Jul 28, 2017
30b3b15
Install g++ on travis build.
at-wat Jul 28, 2017
5d90539
Link utils with static lib.
at-wat Jul 28, 2017
f944d4d
Enable static link for deployed binary.
at-wat Jul 29, 2017
ae15b80
Update cmake config.
at-wat Jul 29, 2017
a5c17f1
Add configure script wrapping cmake.
at-wat Jul 29, 2017
cc3ed12
Fix memory leak and add leak test. (#5)
at-wat Jul 29, 2017
362011a
Build shared library. (#4)
at-wat Jul 29, 2017
969efaf
Fix header install.
at-wat Jul 29, 2017
e78ab4a
Subtree merge formula-calc.
at-wat Jul 29, 2017
af4094d
Add revision hash to version string.
at-wat Jul 29, 2017
103e505
Build samples.
at-wat Jul 29, 2017
049e986
Deploy samples.
at-wat Jul 29, 2017
0b38cc9
Fix install without ssm.
at-wat Jul 29, 2017
57b9f3a
Fix ssm include switch.
at-wat Jul 29, 2017
c982161
Fix include.
at-wat Jul 29, 2017
3522b62
Export cmake config.
at-wat Jul 29, 2017
803198a
Fix static link.
at-wat Jul 29, 2017
9b82f71
Fix dll install on windows. (#6)
at-wat Jul 29, 2017
2d928da
Subtree merge formula-calc.
at-wat Jul 29, 2017
bf6821e
Fix static link.
at-wat Jul 30, 2017
500b01c
Fix run-test deploy.
at-wat Jul 30, 2017
906922a
Change sample filename.
at-wat Jul 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 3 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
*.log
*~
*.o
*.a
*.bak
a.out
Makefile
.deps
config.status
config.h
stamp-h1
libtool
.libs
*.la
*.lo
samples/MOI-estimate
samples/cartesian2d-test
samples/run-test
src/ypspur-coordinator
src/ypspur-free
src/ypspur-interpreter
*.coff
*.mot
*.elf
autom4te.cache/
*.bz2
*.gz
*.zip
*.def
*.dll
*.lib
*.exe
*.patch
.spurip_history
*.swp
.lvimrc
build*
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ compiler: gcc

before_install:
- sudo apt-get update -y
- sudo apt-get install -y gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
- sudo apt-get install -y gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-x86-64 g++-mingw-w64-i686
script:
- mkdir build && cd build && ../configure && make
- mkdir build && cd build && cmake ../ && make
- cd ../
- mkdir build-win64 && mkdir build-win64/install && cd build-win64 && ../configure CC='x86_64-w64-mingw32-gcc -m64 -static-libgcc' --enable-all-static --enable-shared --host=x86_64-w64-mingw32 --prefix=`pwd`/install && make && make install
- mkdir build-win64 && mkdir build-win64/install && cd build-win64 && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw-x86_64.cmake -DCMAKE_INSTALL_PREFIX=`pwd`/install -DENABLE_ALL_STATIC=ON .. && make && make install
- cd ../
- mkdir build-win32 && mkdir build-win32/install && cd build-win32 && ../configure CC='i686-w64-mingw32-gcc -m32 -static-libgcc' --enable-all-static --enable-shared --host=i686-w64-mingw32 --prefix=`pwd`/install && make && make install
- mkdir build-win32 && mkdir build-win32/install && cd build-win32 && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw-i686.cmake -DCMAKE_INSTALL_PREFIX=`pwd`/install -DENABLE_ALL_STATIC=ON .. && make && make install
- cd ../
before_deploy:
- sudo apt-get install -y npm
Expand All @@ -29,6 +29,10 @@ before_deploy:
- cd ../../
- cd build-win32/install/ && zip -q ../../packages/yp-spur.win32.$GIT_TAG.zip -r $(ls)
- cd ../../
- cd build-win64/ && zip -q ../packages/yp-spur-samples.win64.$GIT_TAG.zip -r samples/run-test.exe
- cd ../
- cd build-win32/ && zip -q ../packages/yp-spur-samples.win32.$GIT_TAG.zip -r samples/run-test.exe
- cd ../

deploy:
provider: releases
Expand All @@ -38,6 +42,8 @@ deploy:
file:
- packages/yp-spur.win64.$GIT_TAG.zip
- packages/yp-spur.win32.$GIT_TAG.zip
- packages/yp-spur-samples.win64.$GIT_TAG.zip
- packages/yp-spur-samples.win32.$GIT_TAG.zip
on:
tags: true

260 changes: 260 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
cmake_minimum_required(VERSION 3.0.2)
project(yp-spur
VERSION 1.14.0
)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)

set(YP_VENDOR_NAME "OpenSpur.org")
set(YP_PRODUCT_NAME "Yamabico Project - Spur")
set(YP_PROTOCOL_NAME "YPP:09:03")
set(YP_PARAMS_DIR "robot-params")

option(USE_SSM "Compile with SSM if available." ON)

include(GetGitRevision)
get_git_revision()
set(PROJECT_VERSION_REV "${PROJECT_VERSION} (${GIT_REVISION_SHORT})")


# Find dependencies

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

find_package(PkgConfig)
if(PKGCONFIG_FOUND)
set(HAVE_PKG_CONFIG 1)
endif(PKGCONFIG_FOUND)

if(USE_SSM)
find_package(SSM)
endif(USE_SSM)

configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
)
add_definitions(-DHAVE_CONFIG_H=1)


# Set include dirs

include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_SOURCE_DIR}/auxlib
${CMAKE_SOURCE_DIR}/auxlib/formula-calc/include
)
if(SSM_FOUND)
include_directories(
${SSM_INCLUDE_DIRS}
)
endif(SSM_FOUND)


# Static link options

option(ENABLE_ALL_STATIC "Static link libgcc and libstdc++." OFF)
set(TARGET_STATIC_POSTFIX "")
if(ENABLE_ALL_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc")
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc")
set(TARGET_STATIC_POSTFIX "-static")
endif(ENABLE_ALL_STATIC)


# Add subdirectories

add_subdirectory(auxlib)
add_subdirectory(samples)


# Build coordinator and utilities

add_executable(ypspur-coordinator
src/adinput.c
src/command_ad.c
src/command.c
src/command_get.c
src/command_joint.c
src/command_param.c
src/command_run.c
src/command_set.c
src/communication.c
src/control_motion.c
src/control_vehicle.c
src/ipcommunication.c
src/msq.win32.c
src/odometry.c
src/param.c
src/serial.c
src/ssm_spur_handler.c
src/utility.c
src/ypprotocol.c
src/yprintf.c
src/ypspur-coordinator.c
)
target_link_libraries(ypspur-coordinator
carte2d${TARGET_STATIC_POSTFIX} formula-calc${TARGET_STATIC_POSTFIX} m Threads::Threads
)
if(SSM_FOUND)
target_link_libraries(ypspur-coordinator
odomssm${TARGET_STATIC_POSTFIX}
${SSM_LIBRARIES}
)
endif(SSM_FOUND)
if(WIN32)
target_link_libraries(ypspur-coordinator wsock32 ws2_32)
endif(WIN32)

add_executable(ypspur-free
src/ypspur-free.c
)
target_link_libraries(ypspur-free
ypspur${TARGET_STATIC_POSTFIX}
)

add_executable(ypspur-interpreter
src/ypspur-interpreter.c
)

target_link_libraries(ypspur-interpreter
ypspur${TARGET_STATIC_POSTFIX}
)


# Build libraries

set(YPSPUR_LIBRARY_VERSION 14.2.0)
set(YPSPUR_LIBRARY_SOVERSION 14)
set(YPSPUR_PUBLIC_HEADERS
include/ypspur.h
include/ypparam.h
)
set(YPSPUR_MD_PUBLIC_HEADERS
include/ypspur-md.h
include/ypparam.h
)
add_library(ypspur SHARED
src/libypspur.c
src/libypspur-md.c
src/ipcommunication.c
src/msq.win32.c
src/yprintf.c
src/utility.c
)
if(WIN32)
target_link_libraries(ypspur wsock32 ws2_32)
endif(WIN32)
set_target_properties(ypspur PROPERTIES
IMPORT_SUFFIX "_import.lib"
VERSION ${YPSPUR_LIBRARY_VERSION}
SOVERSION ${YPSPUR_LIBRARY_SOVERSION}
PUBLIC_HEADER "${YPSPUR_PUBLIC_HEADERS}"
)

add_library(ypspur-static STATIC
src/libypspur.c
src/libypspur-md.c
src/ipcommunication.c
src/msq.win32.c
src/yprintf.c
src/utility.c
)
if(WIN32)
target_link_libraries(ypspur-static wsock32 ws2_32)
endif(WIN32)
set_target_properties(ypspur-static PROPERTIES
OUTPUT_NAME "ypspur"
PUBLIC_HEADER "${YPSPUR_PUBLIC_HEADERS}"
)

add_library(ypspur-md SHARED
src/libypspur-md.c
src/ipcommunication.c
src/msq.win32.c
src/yprintf.c
src/utility.c
)
if(WIN32)
target_link_libraries(ypspur-md wsock32 ws2_32)
endif(WIN32)
set_target_properties(ypspur-md PROPERTIES
IMPORT_SUFFIX "_import.lib"
VERSION ${YPSPUR_LIBRARY_VERSION}
SOVERSION ${YPSPUR_LIBRARY_SOVERSION}
PUBLIC_HEADER "${YPSPUR_MD_PUBLIC_HEADERS}"
)

add_library(ypspur-md-static STATIC
src/libypspur-md.c
src/ipcommunication.c
src/msq.win32.c
src/yprintf.c
src/utility.c
)
if(WIN32)
target_link_libraries(ypspur-md-static wsock32 ws2_32)
endif(WIN32)
set_target_properties(ypspur-md-static PROPERTIES
OUTPUT_NAME "ypspur-md"
PUBLIC_HEADER "${YPSPUR_MD_PUBLIC_HEADERS}"
)


# Install

install(TARGETS
ypspur-coordinator
ypspur
ypspur-static
ypspur-md
ypspur-md-static
ypspur-free
ypspur-interpreter
EXPORT YPSpurExport
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include
)
install(FILES include/yp-spur.h
DESTINATION include
)
if(SSM_FOUND)
install(DIRECTORY
include/ssmtype
DESTINATION include
)
endif(SSM_FOUND)


# Generate package config and install


install(EXPORT YPSpurExport
DESTINATION share/ypspur/cmake/
FILE YPSpurTargets.cmake
)

set(YPSPUR_CMAKE_DIR share/ypspur/cmake)

include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/YPSpurConfig.cmake.in
${PROJECT_BINARY_DIR}/cmake/ypspur/YPSpurConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/ypspur
PATH_VARS YPSPUR_CMAKE_DIR
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/cmake/ypspur/YPSpurConfig-version.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY SameMajorVersion
)

install(
FILES
${PROJECT_BINARY_DIR}/cmake/ypspur/YPSpurConfig.cmake
${PROJECT_BINARY_DIR}/cmake/ypspur/YPSpurConfig-version.cmake
DESTINATION share/ypspur/
)

11 changes: 0 additions & 11 deletions INSTALL

This file was deleted.

12 changes: 0 additions & 12 deletions Makefile.am

This file was deleted.

Loading