build: improve findllvm script

This commit is contained in:
Andrew Kelley 2015-11-25 11:23:25 -07:00
parent 4fe366dfa6
commit a1771c76c3
3 changed files with 25 additions and 8 deletions

View File

@ -13,7 +13,8 @@ set(ZIG_VERSION "${ZIG_VERSION_MAJOR}.${ZIG_VERSION_MINOR}.${ZIG_VERSION_PATCH}"
message("Configuring zig version ${ZIG_VERSION}")
find_package(llvm)
include_directories(${LLVM_INCLUDE_DIR})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBDIRS})
include_directories(
${CMAKE_SOURCE_DIR}

View File

@ -31,8 +31,8 @@ readable, safe, optimal, and concise code to solve any computing problem.
## Roadmap
* C style comments.
* Unit tests.
* C style comments.
* Simple .so library
* Multiple files
* figure out integers

View File

@ -3,19 +3,35 @@
# See http://opensource.org/licenses/MIT
# LLVM_FOUND
# LLVM_INCLUDE_DIR
# LLVM_INCLUDE_DIRS
# LLVM_LIBRARIES
# LLVM_LIBDIRS
find_path(LLVM_INCLUDE_DIR NAMES llvm-c/Core.h)
find_path(LLVM_C_INCLUDE_DIR NAMES llvm-c/Core.h PATHS /usr/include/llvm-c-3.7/)
find_path(LLVM_INCLUDE_DIR NAMES llvm/IR/IRBuilder.h PATHS /usr/include/llvm-3.7/)
find_program(LLVM_CONFIG_EXE llvm-config)
find_program(LLVM_CONFIG_EXE NAMES llvm-config llvm-config-3.7)
execute_process(
COMMAND ${LLVM_CONFIG_EXE} --libs
OUTPUT_VARIABLE LLVM_LIBRARIES
OUTPUT_STRIP_TRAILING_WHITESPACE)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LLVM DEFAULT_MSG LLVM_LIBRARIES LLVM_INCLUDE_DIR)
execute_process(
COMMAND ${LLVM_CONFIG_EXE} --system-libs
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
OUTPUT_STRIP_TRAILING_WHITESPACE)
mark_as_advanced(LLVM_INCLUDE_DIR LLVM_LIBRARIES)
execute_process(
COMMAND ${LLVM_CONFIG_EXE} --libdir
OUTPUT_VARIABLE LLVM_LIBDIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_INCLUDE_DIRS "${LLVM_C_INCLUDE_DIR} ${LLVM_INCLUDE_DIR}")
set(LLVM_LIBRARIES "${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LLVM DEFAULT_MSG LLVM_LIBRARIES LLVM_INCLUDE_DIRS)
mark_as_advanced(LLVM_INCLUDE_DIRS LLVM_LIBRARIES LLVM_LIBDIRS)