mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-30 19:54:26 +01:00
* Updated rakefile to work on Unix-based systems
git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@8 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
@@ -2,19 +2,30 @@
|
|||||||
module RakefileConstants
|
module RakefileConstants
|
||||||
|
|
||||||
C_EXTENSION = '.c'
|
C_EXTENSION = '.c'
|
||||||
OBJ_EXTENSION = '.obj'
|
|
||||||
BIN_EXTENSION = '.exe'
|
def Kernel.is_windows?
|
||||||
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
||||||
|
platform == 'mswin32'
|
||||||
|
end
|
||||||
|
|
||||||
|
if Kernel.is_windows?
|
||||||
|
OBJ_EXTENSION = '.obj'
|
||||||
|
BIN_EXTENSION = '.exe'
|
||||||
|
else
|
||||||
|
OBJ_EXTENSION = '.o'
|
||||||
|
BIN_EXTENSION = '.out'
|
||||||
|
end
|
||||||
|
|
||||||
UNIT_TEST_PATH = 'test'
|
UNIT_TEST_PATH = 'test'
|
||||||
UNITY_PATH = '../src'
|
UNITY_PATH = '../src'
|
||||||
SOURCE_PATH = 'src'
|
SOURCE_PATH = 'src'
|
||||||
BUILD_PATH = 'build'
|
BUILD_PATH = 'build'
|
||||||
|
|
||||||
UNITY_SRC = UNITY_PATH + '\unity.c'
|
UNITY_SRC = UNITY_PATH + '/unity.c'
|
||||||
UNITY_HDR = UNITY_PATH + '\unity.h'
|
UNITY_HDR = UNITY_PATH + '/unity.h'
|
||||||
|
|
||||||
COMPILER = 'gcc.exe'
|
COMPILER = 'gcc'
|
||||||
LINKER = 'gcc.exe'
|
LINKER = 'gcc'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32,11 +43,11 @@ module RakefileHelpers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile src, obj
|
def compile src, obj
|
||||||
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o#{obj}"
|
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o #{obj}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def link prerequisites, executable
|
def link prerequisites, executable
|
||||||
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o#{executable}"
|
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o #{executable}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_test executable
|
def run_test executable
|
||||||
|
|||||||
@@ -2,27 +2,38 @@
|
|||||||
module RakefileConstants
|
module RakefileConstants
|
||||||
|
|
||||||
C_EXTENSION = '.c'
|
C_EXTENSION = '.c'
|
||||||
OBJ_EXTENSION = '.obj'
|
|
||||||
BIN_EXTENSION = '.exe'
|
def Kernel.is_windows?
|
||||||
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
||||||
|
platform == 'mswin32'
|
||||||
|
end
|
||||||
|
|
||||||
|
if Kernel.is_windows?
|
||||||
|
OBJ_EXTENSION = '.obj'
|
||||||
|
BIN_EXTENSION = '.exe'
|
||||||
|
else
|
||||||
|
OBJ_EXTENSION = '.o'
|
||||||
|
BIN_EXTENSION = '.out'
|
||||||
|
end
|
||||||
|
|
||||||
UNIT_TEST_PATH = 'test'
|
UNIT_TEST_PATH = 'test'
|
||||||
UNITY_PATH = 'src'
|
UNITY_PATH = 'src'
|
||||||
SOURCE_PATH = 'src'
|
SOURCE_PATH = 'src'
|
||||||
BUILD_PATH = 'build'
|
BUILD_PATH = 'build'
|
||||||
|
|
||||||
UNITY_SRC = UNITY_PATH + '\unity.c'
|
UNITY_SRC = UNITY_PATH + '/unity.c'
|
||||||
UNITY_HDR = UNITY_PATH + '\unity.h'
|
UNITY_HDR = UNITY_PATH + '/unity.h'
|
||||||
BIN_PATH = 'build'
|
BIN_PATH = 'build'
|
||||||
UNITY_TEST_SRC = UNIT_TEST_PATH + '\testunity.c'
|
UNITY_TEST_SRC = UNIT_TEST_PATH + '/testunity.c'
|
||||||
UNITY_TEST_RUNNER_SRC = UNIT_TEST_PATH + '\testunity_Runner.c'
|
UNITY_TEST_RUNNER_SRC = UNIT_TEST_PATH + '/testunity_Runner.c'
|
||||||
UNITY_OBJ = BIN_PATH + '\unity' + OBJ_EXTENSION
|
UNITY_OBJ = BIN_PATH + '/unity' + OBJ_EXTENSION
|
||||||
UNITY_TEST_OBJ = BIN_PATH + '\testunity' + OBJ_EXTENSION
|
UNITY_TEST_OBJ = BIN_PATH + '/testunity' + OBJ_EXTENSION
|
||||||
UNITY_TEST_RUNNER_OBJ = BIN_PATH + '\testunity_Runner' + OBJ_EXTENSION
|
UNITY_TEST_RUNNER_OBJ = BIN_PATH + '/testunity_Runner' + OBJ_EXTENSION
|
||||||
UNITY_TEST_EXEC = UNITY_TEST_OBJ.ext BIN_EXTENSION
|
UNITY_TEST_EXEC = UNITY_TEST_OBJ.ext BIN_EXTENSION
|
||||||
TEST_RESULTS = UNITY_TEST_OBJ.ext '.testpass'
|
TEST_RESULTS = UNITY_TEST_OBJ.ext '.testpass'
|
||||||
|
|
||||||
COMPILER = 'gcc.exe'
|
COMPILER = 'gcc'
|
||||||
LINKER = 'gcc.exe'
|
LINKER = 'gcc'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -40,11 +51,11 @@ module RakefileHelpers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile src, obj
|
def compile src, obj
|
||||||
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o#{obj}"
|
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o #{obj}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def link prerequisites, executable
|
def link prerequisites, executable
|
||||||
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o#{executable}"
|
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o #{executable}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_test executable
|
def run_test executable
|
||||||
|
|||||||
Reference in New Issue
Block a user