Skip to content

Some fixes for C++ and tests #13

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

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ec43535
* Made c_order_d_ip_ocp_hard_tv() and hpmpc_d_ip_ocp_hard_tv_work_spa…
Jun 22, 2016
4c3b435
Merge branch 'cleaning' of https://github.com/giaf/hpmpc into cleaning
Jun 22, 2016
bc030e6
* Merge branch 'cleaning' of github.com:giaf/hpmpc into cleaning
Jun 28, 2016
d472a19
Added CMake scripts and tests.
Jul 1, 2016
63b7b5e
Added test for https://github.com/giaf/hpmpc/issues/10
Jul 1, 2016
181521e
Merge branch 'cleaning' of github.com:giaf/hpmpc into cleaning
Jul 1, 2016
9884bb0
Merge branch 'cleaning' of github.com:giaf/hpmpc into cleaning
Jul 1, 2016
dc9e5e1
Fixed (again) const-correctness in hpmpc_d_ip_ocp_hard_tv_work_space_…
Jul 1, 2016
798e0ea
Added hpmpc to quadprog problem conversion.
Jul 1, 2016
79121b9
Added MATLAB function for KKT matrix calculation from a quadprog prob…
Jul 3, 2016
dfde372
Added tests for https://github.com/giaf/hpmpc/issues/12
Jul 5, 2016
4f90c6f
Added tests for https://github.com/giaf/hpmpc/issues/12
Jul 5, 2016
e4c9187
Test for https://github.com/giaf/hpmpc/issues/12 with relaxed termina…
Jul 6, 2016
9f1fb76
GTest added as a git submodule.
Jul 9, 2016
cf5c3f4
Fixed const-correctness compiler warnings.
Jul 9, 2016
5ce14de
Fixed const-correctness.
mkatliar Jul 9, 2016
626e60c
Revert "finishin removing cmake"
mkatliar Jul 20, 2016
ed9012d
Recovered CMake
mkatliar Jul 20, 2016
e0d8d10
Fixed CMake configuration errors
mkatliar Jul 20, 2016
8a5fe86
Fixed CMake configuration errors
mkatliar Jul 20, 2016
06ffbb3
Merge branch 'master' of github.com:mkotlyar/hpmpc
mkatliar Jul 20, 2016
75e13fa
* Added the HPMPC_BUILD_TESTS option
mkatliar Jul 20, 2016
3023cb4
Compiling hpmpc_test with C++14 support enabled
mkatliar Sep 23, 2016
a4dadf1
A cleaner way of managing dumped QPs in test_qp.cpp
mkatliar Oct 4, 2016
4d1a625
A nicer way of dealing with test QPs
mkatliar Oct 4, 2016
85ba4ed
Added test case for https://github.com/giaf/hpmpc/issues/15
mkatliar Oct 5, 2016
18b555f
Removed C-build related files from .gitignore. Build must be off-source.
mkatliar Oct 5, 2016
92e0e57
target.h is spit to the build dir, not the source.
mkatliar Oct 6, 2016
d32f4cf
Installing generated target.h
mkatliar Oct 6, 2016
c2b5bb4
* Installing target.h
mkatliar Nov 2, 2016
5141d52
Merge branch 'master' of github.com:mkotlyar/hpmpc
mkatliar Nov 2, 2016
bdfd3b4
Fixed CMake build errors for SSE3 target
Nov 8, 2016
1f94cbc
Fixed CMake build for AVX2 target
Nov 8, 2016
4ec32df
Adding target-specific compiler options for all build configurations,
mkatliar Feb 11, 2017
01d33d3
Removed unneeded debug output
May 17, 2017
d38129a
Merge branch 'master' of github.com:mkotlyar/hpmpc
May 17, 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
82 changes: 5 additions & 77 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
# Created by http://www.gitignore.io

### C ###
# Object files
*.o
*.ko
*.obj
*.elf

# Libraries
*.lib
*.a

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex


### C++ ###
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app


### Linux ###
*~

Expand All @@ -68,13 +18,6 @@ Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp


### OSX ###
.DS_Store
.AppleDouble
Expand All @@ -83,7 +26,6 @@ $RECYCLE.BIN/
# Icon must ends with two \r.
Icon


# Thumbnails
._*

Expand Down Expand Up @@ -159,25 +101,11 @@ Session.vim
.netrwhist
*~


### CMake ###
CMakeCache.txt
CMakeFiles
# Makefile
cmake_install.cmake
install_manifest.txt

### Preconfigured target configuration file
include/target.h
# include/target.h <-- must be built off-source

# Octave
octave-workspace
*.mex
### VS Code ###
.vscode

# eps figures
*.eps

# tex
*.aux
*.log
*.toc
### CMake ###
build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test/googletest"]
path = test/googletest
url = https://github.com/google/googletest.git
222 changes: 222 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
################################################################################
#
# Project settings
#
################################################################################

#
# Minimum required version of cmake
#
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

#
# Project name and programming languages used
#
PROJECT( HPMPC )
set(CMAKE_C_STANDARD 99)

#
# Folder path for generated executables
#
SET( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )

#
# Folder path for generated libraries
#
SET( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib )

################################################################################
#
# User configuration
#
################################################################################

IF( NOT CMAKE_VERBOSE_MAKEFILE )
SET( CMAKE_VERBOSE_MAKEFILE OFF )
ENDIF( NOT CMAKE_VERBOSE_MAKEFILE )

#
# Build type
#
IF( NOT CMAKE_BUILD_TYPE )
SET(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
ENDIF( NOT CMAKE_BUILD_TYPE )

#
# Target type
#
IF ( NOT HPMPC_TARGET )
SET( HPMPC_TARGET X64_AVX CACHE STRING
"Choose build target: X64_AVX2, X64_AVX, X64_SSE3, CORTEX_A57, CORTEX_A15, CORTEX_A9, CORTEX_A7, C99_4X4"
)
ENDIF( )

#
# Build options
#
option(HPMPC_BUILD_TESTS "Build tests" ON)

################################################################################
#
# Compiler settings
#
################################################################################

SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )

IF ( ${HPMPC_TARGET} STREQUAL "X64_AVX2" )
ADD_DEFINITIONS( -DTARGET_X64_AVX2 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mavx2 -mfma")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "X64_AVX" )
ADD_DEFINITIONS( -DTARGET_X64_AVX )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mavx")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "X64_SSE3" )
ADD_DEFINITIONS( -DTARGET_X64_SSE3 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -msse3")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A57" )
ADD_DEFINITIONS( -DTARGET_CORTEX_A57 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+fp+simd -mcpu=cortex-a57")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A15" )
ADD_DEFINITIONS( -DTARGET_CORTEX_A15 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a15")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A9" )
ADD_DEFINITIONS( -DTARGET_CORTEX_A9 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -mfloat-abi=hard -mfpu=neon -mcpu=cortex-a9")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A7" )
ADD_DEFINITIONS( -DTARGET_CORTEX_A7 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a7")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "C99_4X4" )
ADD_DEFINITIONS( -DTARGET_C99_4X4 )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")

ELSEIF ( ${HPMPC_TARGET} STREQUAL "C99_4X4_PREFETCH" )
ADD_DEFINITIONS( -DTARGET_C99_4X4_PREFETCH )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")

ELSE( )
MESSAGE( ERROR "You chose unsupported target ${HPMPC_TARGET}")
ENDIF( )

# Link math library against all targets
LINK_LIBRARIES( m )

# This will add the "make test" target
ENABLE_TESTING()

################################################################################
#
# Configure the target header file
#
################################################################################

STRING(TOUPPER ${HPMPC_TARGET} TARGET_DEF)
SET( TARGET_DEF TARGET_${TARGET_DEF})

CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/include/target.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/target.h" # Spit target.h in the build dir, don't pollute the source folder.
@ONLY
)

################################################################################
#
# Include directories
#
################################################################################

INCLUDE_DIRECTORIES( include )
INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_BINARY_DIR}/include" ) # Make target.h accessible

################################################################################
#
# Build the library
#
################################################################################

MESSAGE( STATUS "Compiling the library for ${HPMPC_TARGET} target")

#
# Macro for adding source files
#
MACRO( HPMPC_ADD_SOURCE_FILES )
# MESSAGE( STATUS "${ARGV}" )
UNSET( _SRC )
FOREACH( SRC ${ARGV} )
GET_FILENAME_COMPONENT(ABS_SRC ${SRC} REALPATH)
SET( _SRC ${_SRC} ${ABS_SRC} )
ENDFOREACH()
SET ( SOURCES ${SOURCES} ${_SRC} PARENT_SCOPE )
ENDMACRO( HPMPC_ADD_SOURCE_FILES )

#
# Add source folders
#
UNSET( SOURCES )
ADD_SUBDIRECTORY( kernel )
ADD_SUBDIRECTORY( blas )
ADD_SUBDIRECTORY( auxiliary )
ADD_SUBDIRECTORY( lqcp_solvers )
ADD_SUBDIRECTORY( mpc_solvers )
ADD_SUBDIRECTORY( interfaces )
ADD_SUBDIRECTORY( reference_code )
#ADD_SUBDIRECTORY( codegen )

#
# Add library
#
ADD_LIBRARY( hpmpc STATIC ${SOURCES} )

################################################################################
#
# Installation rules
#
################################################################################

INSTALL(
DIRECTORY
include/
DESTINATION
include/hpmpc
PATTERN "*.h.in*" EXCLUDE
)

INSTALL(
TARGETS
hpmpc
DESTINATION
lib
)

INSTALL(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/include/target.h"
DESTINATION
"include/hpmpc"
)

################################################################################
#
# Build examples
#
################################################################################

ADD_SUBDIRECTORY( test_problems )

################################################################################
#
# Build tests
#
################################################################################
if(HPMPC_BUILD_TESTS)
add_subdirectory(test)
endif()
25 changes: 25 additions & 0 deletions auxiliary/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

IF ( ${HPMPC_TARGET} STREQUAL "X64_AVX2" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib8.c d_aux_extern_depend_lib4.c i_aux.c)

ELSEIF ( ${HPMPC_TARGET} STREQUAL "X64_AVX" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib8.c d_aux_extern_depend_lib4.c i_aux.c )

ELSEIF ( ${HPMPC_TARGET} STREQUAL "X64_SSE3" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib4.c d_aux_extern_depend_lib4.c i_aux.c )

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A15" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib4.c d_aux_extern_depend_lib4.c i_aux.c )

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A9" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib4.c d_aux_extern_depend_lib4.c i_aux.c )

ELSEIF ( ${HPMPC_TARGET} STREQUAL "CORTEX_A7" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib4.c d_aux_extern_depend_lib4.c i_aux.c )

ELSEIF ( ${HPMPC_TARGET} STREQUAL "C99_4X4" )
HPMPC_ADD_SOURCE_FILES( d_aux_lib4.c s_aux_lib4.c d_aux_extern_depend_lib4.c i_aux.c )

ELSE( )
MESSAGE( ERROR "Impossible happened!" )
ENDIF( )
Loading