Skip to content

Instantly share code, notes, and snippets.

@roxlu roxlu/CMakeLists.txt
Created May 13, 2016

Embed
What would you like to do?
CMakeLists for microprofile; for now it compiles the demo_ui. Tested on Mac and Win.
cmake_minimum_required(VERSION 2.8)
project(microprofile)
include(ExternalProject)
set(bd ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# SDL
ExternalProject_Add(
sdl
URL https://www.libsdl.org/release/SDL2-2.0.4.tar.gz
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)
include_directories(
${bd}
${CMAKE_INSTALL_PREFIX}/include/SDL2
${bd}/demo/glew/
)
if (APPLE)
find_library(fr_corefoundation CoreFoundation)
find_library(fr_cocoa Cocoa)
find_library(fr_carbon Carbon)
find_library(fr_iokit IOKit)
find_library(fr_avfoundation AVFoundation)
find_library(fr_corevideo CoreVideo)
find_library(fr_coreaudio CoreAudio)
find_library(fr_audiounit AudioUnit)
find_library(fr_opengl OpenGL)
find_library(fr_ff ForceFeedback)
list(APPEND libs
${CMAKE_INSTALL_PREFIX}/lib/libSDL2.a
${fr_carbon}
${fr_corefoundation}
${fr_cocoa}
${fr_iokit}
${fr_opengl}
${fr_avfoundation}
${fr_corevideo}
${fr_coreaudio}
${fr_audiounit}
${fr_ff}
pthread
ldap
z
iconv
)
elseif(WIN32)
list(APPEND libs
${CMAKE_INSTALL_PREFIX}/lib/SDL2.lib
ws2_32.lib
Opengl32.lib
Imm32.lib
Winmm.lib
Mincore.lib
Version.lib
)
endif()
add_executable(demo_ui
${bd}/demo/ui/demo.cpp
${bd}/demo/ui/fakework.cpp
${bd}/demo/ui/microprofile.cpp
${bd}/demo/glew/glew.c
)
add_dependencies(demo_ui sdl)
target_link_libraries(demo_ui ${libs})
#!/bin/sh
d=${PWD}
set -x
if [ ! -d build ] ; then
mkdir build
fi
cd build
cmake -DCMAKE_INSTALL_PREFIX=${d}/installed \
..
if [ $? -ne 0 ] ; then
echo "Configure error."
exit
fi
echo "build"
cmake --build .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.