Permalink
Browse files

Shared lib stuff

  • Loading branch information...
JarrettBillingsley committed Nov 22, 2015
1 parent ec96372 commit 5a94c9c035b0165c9e538333c2940fa1ef01bdb2
Showing with 25 additions and 11 deletions.
  1. +6 −0 CMakeLists.txt
  2. +14 −1 src/CMakeLists.txt
  3. +0 −5 src/croc/apiex.h
  4. +0 −5 src/croc/apifuncs.h
  5. +5 −0 src/croc/apitypes.h
View
@@ -26,6 +26,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic-errors -Wall -Wextra -Werror -fno-exceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=2 -m${CROC_BUILD_BITS}")
if(CROC_BUILD_SHARED AND WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCROCAPI=__declspec(dllimport)")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCROCAPI=extern")
endif()
if(CROC_BUILD_BITS EQUAL 32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xlinker \"-melf_i386\" -Xlinker \"--oformat=elf32-i386\"")
endif()
View
@@ -9,6 +9,8 @@ set(CROC_PCRE_ADDON "${CROC_ALL_ADDONS}" CACHE BOOL "Compiles in the libPCRE a
set(CROC_OPENAL_ADDON "${CROC_ALL_ADDONS}" CACHE BOOL "Compiles in the OpenAL addon.")
set(CROC_IMGUI_ADDON "${CROC_ALL_ADDONS}" CACHE BOOL "Compiles in the ImGui addon.")
set(CROC_BUILD_SHARED "false" CACHE BOOL "If enabled, builds Croc as a shared library; otherwise builds it as a static library.")
if(NOT DEFINED CROC_BUILD_BITS)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CROC_BUILD_BITS 64)
@@ -256,6 +258,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=2 -m${CROC_BUILD_BITS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCROC_BUILTIN_DOCS=1 -DCROC_BUILD_BITS=${CROC_BUILD_BITS}")
if(CROC_BUILD_SHARED AND WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCROCAPI=__declspec(dllexport)")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCROCAPI=extern")
endif()
if(CROC_BUILD_BITS EQUAL 32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xlinker \"-melf_i386\" -Xlinker \"--oformat=elf32-i386\"")
endif()
@@ -295,7 +303,12 @@ else()
message(FATAL_ERROR "Dunno what compiler you have but I don't support it")
endif()
add_library(croc ${croc_ALLSRC})
if(CROC_BUILD_SHARED)
add_library(croc SHARED ${croc_ALLSRC})
else()
add_library(croc STATIC ${croc_ALLSRC})
endif()
add_dependencies(croc ConvertCrocFiles)
if(CROC_IMGUI_ADDON)
View
@@ -8,9 +8,6 @@
#include "croc/apitypes.h"
#define CROCAPI
#define CROCPRINT(a, b) __attribute__((format(printf, a, b)))
#ifdef __cplusplus
extern "C" {
#endif
@@ -292,6 +289,4 @@ CROCAPI void croc_ex_docFields (CrocDoc* d, const char** docStrings);
} /* extern "C" */
#endif
#undef CROCAPI
#endif
View
@@ -7,9 +7,6 @@
#include "croc/apitypes.h"
#define CROCAPI
#define CROCPRINT(a, b) __attribute__((format(printf, a, b)))
#ifdef __cplusplus
extern "C" {
#endif
@@ -465,6 +462,4 @@ CROCAPI word_t croc_compiler_parseDocCommentText (CrocThread* t);
} /* extern "C" */
#endif
#undef CROCAPI
#endif
View
@@ -10,6 +10,11 @@ extern "C" {
#include <stddef.h>
#include <stdint.h>
#ifndef CROCAPI
#define CROCAPI extern
#endif
#define CROCPRINT(a, b) __attribute__((format(printf, a, b)))
/** @addtogroup APITypes */
/**@{*/

0 comments on commit 5a94c9c

Please sign in to comment.