Cmake framework for cross-platform extensions and building.

This commit is contained in:
jaynus 2015-04-03 13:46:53 -07:00
parent 604e851423
commit caecf9b21b
9 changed files with 64 additions and 26 deletions

31
extensions/CMakeLists.txt Normal file
View File

@ -0,0 +1,31 @@
cmake_minimum_required (VERSION 3.0)
project (ACE)
if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "No build type selected, default to Debug")
set(CMAKE_BUILD_TYPE "Debug")
endif()
option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF)
option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON)
if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "-std=c++11 -march=i686 -m32 -O2 -s -fPIC -fpermissive")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++")
else()
set(CMAKE_CXX_FLAGS_DEBUG "/D _DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG")
endif()
file(GLOB_RECURSE ACE_COMMON_SOURCES common/*.h common/*.hpp common/*.c common/*.cpp)
add_library(ace_common STATIC ${ACE_COMMON_SOURCES})
include_directories(AFTER "common")
# Add extensions to build here
add_subdirectory(fcs)
message("Build Type: ${CMAKE_BUILD_TYPE}")

4
extensions/build/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
int test(int var) {
return var;
}

View File

@ -0,0 +1,4 @@
#pragma once
#include "targetver.h"

View File

@ -0,0 +1,8 @@
#pragma once
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#endif

View File

@ -0,0 +1,11 @@
set(ACE_EXTENSION_NAME "ace_fcs")
file(GLOB_RECURSE SOURCES *.h *.hpp *.c *.cpp)
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES})
add_dependencies(${ACE_EXTENSION_NAME} ace_common)
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
if(CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
endif()

View File

@ -11,8 +11,8 @@
* Correction to angle
*/
#include "stdafx.h"
#include "ace_common.h"
#define _USE_MATH_DEFINES
#include <math.h>

View File

@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// ace_fcs.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -1,16 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// TODO: reference additional headers your program requires here