Skip to content

Commit

Permalink
add basic build environment using CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Puschmann committed Jan 30, 2012
1 parent 4e00869 commit 02abf09
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
########################################################################
# Prevent in-tree builds
########################################################################
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
MESSAGE(FATAL_ERROR "Prevented in-tree built. This is bad practice.")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

########################################################################
# Project setup
#######################################################################
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (NEON_MATH)
ENABLE_TESTING()
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")

ADD_SUBDIRECTORY (src)

# Make sure the compiler can find include files
include_directories (${NEON_MATH_SOURCE_DIR}/src)

# Make sure the linker can find the library once it is built.
link_directories (${NEON_MATH_BINARY_DIR}/src)

52 changes: 52 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
########################################################################
# Build the library from source files
########################################################################
SET(math_neon_sources
math_acosf.c
math_asinf.c
math_atan2f.c
math_atanf.c
math_ceilf.c
math_cosf.c
math_coshf.c
math_expf.c
math_fabsf.c
math_floorf.c
math_fmodf.c
math_frexpf.c
math_invsqrtf.c
math_ldexpf.c
math_log10f.c
math_logf.c
math_mat2.c
math_mat3.c
math_mat4.c
math_modf.c
math_powf.c
math_runfast.c
math_sincosf.c
math_sinf.c
math_sinfv.c
math_sinhf.c
math_sqrtf.c
math_sqrtfv.c
math_tanf.c
math_tanhf.c
math_vec2.c
math_vec3.c
math_vec4.c
)

set(CMAKE_CXX_COMPILER g++)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_FLAGS "-std=gnu99 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp")
set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) #same flags for C sources

# Static library (test code can link against this)
ADD_LIBRARY(math_neon SHARED ${math_neon_sources})

########################################################################
# Add executables and link to libraries
########################################################################
ADD_EXECUTABLE (math_debug math_debug.c)
TARGET_LINK_LIBRARIES (math_debug math_neon m)

0 comments on commit 02abf09

Please sign in to comment.