Created
August 5, 2015 16:05
-
-
Save carlmartus/6ec5d69542778eddd947 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.6) | |
# If you want a bin and lib output directory | |
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) | |
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) | |
add_definitions("-Wall -O2 -std=gnu11") | |
# Version | |
# ======= | |
set(MAJOR 0) | |
set(MINOR 2) | |
set(PATCH 1) | |
set(VERSION ${MAJOR}.${MINOR}.${PATCH}) | |
# Library naming | |
# ============== | |
set(ORGANIC organic${MAJOR}) | |
set(ORGANICAUX organicaux${MAJOR}) | |
# Library | |
# ======= | |
file(GLOB LIB_SOURCE src/organic/*.c) | |
add_library(${ORGANIC} SHARED ${LIB_SOURCE}) | |
target_link_libraries (${ORGANIC} m) | |
set_target_properties( | |
${ORGANIC} PROPERTIES VERSION ${VERSION} SOVERSION ${MAJOR}) | |
# 3D auxiliary library | |
# ==================== | |
file(GLOB LIBGLEW_SOURCE src/organicaux/*.c) | |
add_library(${ORGANICAUX} SHARED ${LIBGLEW_SOURCE}) | |
target_link_libraries (${ORGANICAUX} m ${ORGANIC}) | |
set_target_properties( | |
${ORGANICAUX} PROPERTIES VERSION ${VERSION} SOVERSION ${MAJOR}) | |
# Install | |
# ======= | |
install(TARGETS ${ORGANIC} ${ORGANICAUX} | |
LIBRARY DESTINATION "lib" | |
ARCHIVE DESTINATION "lib" | |
RUNTIME DESTINATION "bin" | |
COMPONENT library) | |
# Install a header to system include directory | |
install(FILES | |
src/organic/organic.h | |
src/organicaux/organicaux.h | |
DESTINATION include) | |
# Unit tests | |
# ========== | |
set(UNITS | |
mesh | |
texture | |
) | |
foreach(file ${UNITS}) | |
add_executable(unit_${file} "units/${file}.c" units/CuTest.c units/runner.c) | |
target_link_libraries(unit_${file} ${ORGANIC}) | |
include_directories(unit_${file} src/organic) | |
endforeach(file) | |
# Samples | |
# ======= | |
add_executable(sample_ppm "samples/ppm.c") | |
target_link_libraries(sample_ppm ${ORGANIC}) | |
add_executable(sample_mesh samples/mesh.c) | |
target_link_libraries(sample_mesh ${ORGANIC} ${ORGANICAUX} SDL GL GLEW) | |
include_directories(sample_mesh src/organic src/organicaux) | |
add_executable(sample_texture samples/texture.c) | |
target_link_libraries(sample_texture ${ORGANIC} ${ORGANICAUX} SDL GL GLEW) | |
include_directories(sample_texture src/organic src/organicaux) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment