-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
CMakeLists.txt
55 lines (42 loc) · 1.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 2.8.7)
project(Haxelib C)
include(GNUInstallDirs)
# put output in ${CMAKE_BINARY_DIR}
set(OUTPUT_DIR ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR})
# avoid the extra "Debug", "Release" directories
# http://stackoverflow.com/questions/7747857/in-cmake-how-do-i-work-around-the-debug-and-release-directories-visual-studio-2
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTPUT_DIR} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTPUT_DIR} )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTPUT_DIR} )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
# find Haxe and Neko
find_program(HAXE_COMPILER haxe)
find_path(NEKO_INCLUDE_DIRS neko.h)
find_library(NEKO_LIBRARIES neko)
find_program(NEKO neko)
find_program(NEKOTOOLS nekotools)
message(STATUS "HAXE_COMPILER: ${HAXE_COMPILER}")
message(STATUS "NEKO_INCLUDE_DIRS: ${NEKO_INCLUDE_DIRS}")
message(STATUS "NEKO_LIBRARIES: ${NEKO_LIBRARIES}")
message(STATUS "NEKOTOOLS: ${NEKOTOOLS}")
include_directories(${NEKO_INCLUDE_DIRS})
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/run.n
COMMAND ${HAXE_COMPILER} client.hxml
VERBATIM
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/run.c
COMMAND ${NEKOTOOLS} boot -c run.n
VERBATIM
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${CMAKE_SOURCE_DIR}/run.n
)
add_executable(haxelib
${CMAKE_SOURCE_DIR}/run.c
)
target_link_libraries(haxelib ${NEKO_LIBRARIES})