1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-23 06:50:26 +00:00

Update CMakeLists.txt for tests.

This commit is contained in:
bakpakin 2018-06-08 16:54:08 -04:00
parent 1690fee446
commit eba6242978
3 changed files with 15 additions and 4 deletions

View File

@ -26,6 +26,11 @@ set(TARGET_NAME ${PROJECT_NAME})
set (CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
# Set configurations
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
include_directories(src/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@ -112,10 +117,12 @@ src/include/dst/dsttypes.h
# Build the executable
add_executable(${TARGET_NAME} ${REPL_SOURCES})
if (UNIX AND NOT EMSCRIPTEN)
if (APPLE)
# macOS flags here
elseif (UNIX AND NOT EMSCRIPTEN)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
target_link_libraries(${TARGET_NAME} m dl)
endif (UNIX AND NOT EMSCRIPTEN)
endif (APPLE)
set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${DST_PUBLIC_HEADERS}")
# Generate header containing standard library
@ -152,8 +159,10 @@ endif (DEFINED EMSCRIPTEN)
# Add some test scripts
enable_testing()
add_test(suite0 ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite0.dst)
add_test(suite1 ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite1.dst)
add_test(NAME suite0 COMMAND ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite0.dst
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_test(NAME suite1 COMMAND ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite1.dst
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# Add convenience script to run repl
add_custom_target(run

View File

@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
(print "Current working directory is: " (os.cwd))
(import test.helper :prefix "" :exit true)
(start-suite 0)

View File

@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
(print "Current working directory is: " (os.cwd))
(import test.helper :prefix "" :exit true)
(start-suite 1)